NAP
Public Member Functions | Public Attributes | List of all members
Mesh Class Reference

#include <mesh.h>

Public Member Functions

 Mesh ()=default
 
 Mesh (Core &core)
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual MeshInstancegetMeshInstance () override
 
virtual const MeshInstancegetMeshInstance () const override
 
template<typename T >
const VertexAttribute< T > * FindAttribute (const std::string &id) const
 
template<typename T >
const VertexAttribute< T > & GetAttribute (const std::string &id) const
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

RTTIMeshProperties mProperties
 Property: 'Properties' RTTI mesh CPU data. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Serializable Mesh. This mesh can be used to either load from json or binary format. Notice that the rtti properties that are deserialized should remain constant, like any other resource. To alter mesh data dynamically, use the MeshInstance that is returned from this object.

The RTTI data in the Mesh can conveniently be used as a source to alter the MeshInstance's contents. For instance, it is possible to copy the original data from the Mesh into the MeshInstance while making some modifications.

Inheritance diagram for Mesh:
[legend]
Collaboration diagram for Mesh:
[legend]

Constructor & Destructor Documentation

◆ Mesh() [1/2]

Mesh ( )
default

Constructor used during serialization.

◆ Mesh() [2/2]

Mesh ( Core core)

Constructor used at runtime.

Member Function Documentation

◆ FindAttribute()

const VertexAttribute< T > * FindAttribute ( const std::string &  id) const

Finds vertex attribute.

Parameters
idThe name of the vertex attribute. For predefined vertex attributions like position, color etc, use the various MeshInstance::VertexAttributeIDs.
Returns
Type safe vertex attribute if found, nullptr if not found or if there was a type mismatch.

◆ GetAttribute()

const VertexAttribute< T > & GetAttribute ( const std::string &  id) const

Gets vertex attribute.

Parameters
idThe name of the vertex attribute. For predefined vertex attributions like position, color etc, use the various MeshInstance::VertexAttributeIDs.
Returns
Type safe vertex attribute. If not found or in case there is a type mismatch, the function asserts.

◆ getMeshInstance() [1/2]

virtual const MeshInstance& getMeshInstance ( ) const
overridevirtual
Returns
MeshInstance as created during init().

Implements IMesh.

◆ getMeshInstance() [2/2]

virtual MeshInstance& getMeshInstance ( )
overridevirtual
Returns
MeshInstance as created during init().

Implements IMesh.

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initialized the mesh instance.

Parameters
errorStateContains error information if an error occurred.
Returns
True if succeeded, false on error.

Reimplemented from Object.

Member Data Documentation

◆ mProperties

RTTIMeshProperties mProperties

Property: 'Properties' RTTI mesh CPU data.