Lysa  0.0
Lysa 3D Engine
MeshInstance Class Reference

Detailed Description

Instance that holds a Mesh.

+ Inheritance diagram for MeshInstance:

Public Member Functions

 MeshInstance (const MeshInstance &orig)
 
 MeshInstance (const Mesh &mesh, const std::string &name="")
 
 MeshInstance (const MeshInstance &mi, const std::string &name)
 
const MeshgetMesh () const
 
bool isVisible () const
 
void setVisible (bool visible)
 
bool isCastShadows () const
 
void setCastShadows (bool castShadows)
 
const AABBgetAABB () const
 
void setAABB (const AABB &aabb)
 
const float4x4 & getTransform () const
 
void setTransform (const float4x4 &transform)
 
unique_id getSurfaceMaterial (uint32 surfaceIndex) const
 
void setSurfaceOverrideMaterial (uint32 surfaceIndex, unique_id materialId)
 
void removeSurfaceOverrideMaterial (uint32 surfaceIndex)
 
unique_id getSurfaceOverrideMaterial (uint32 surfaceIndex) const
 
MeshInstanceData getData () const
 
bool isDirty () const
 
void resetDirty ()
 
void setNodeData (void *data)
 
void * getNodeData () const
 
 ~MeshInstance () override
 
- Public Member Functions inherited from UniqueResource
 UniqueResource () = default
 
 UniqueResource (UniqueResource &) = delete
 
UniqueResource & operator= (UniqueResource &) = delete
 
- Public Member Functions inherited from UnmanagedResource
 UnmanagedResource ()
 
 UnmanagedResource (const Resource &other)
 
- Public Member Functions inherited from Resource
bool operator== (const Resource &other) const
 
 Resource () = default
 
 Resource (const unique_id id)
 
virtual ~Resource () = default
 

Additional Inherited Members

- Public Attributes inherited from Resource
unique_id id {INVALID_ID}
 

Constructor & Destructor Documentation

MeshInstance ( const MeshInstance &  orig)

Copy constructor — creates an independent instance sharing the same mesh.

MeshInstance ( const Mesh mesh,
const std::string &  name = "" 
)

Constructor

Parameters
meshReference to the mesh
nameOptional name for the instance
MeshInstance ( const MeshInstance &  mi,
const std::string &  name 
)

Copy constructor with a new name override.

~MeshInstance ( )
override

Member Function Documentation

const AABB& getAABB ( ) const
inline

Returns the world-space AABB of the instance

MeshInstanceData getData ( ) const

Returns the mesh instance data for GPU consumption

const Mesh& getMesh ( ) const
inline

Returns the mesh associated with the instance

void* getNodeData ( ) const
inline
unique_id getSurfaceMaterial ( uint32  surfaceIndex) const

Returns the material ID used by a specific surface

unique_id getSurfaceOverrideMaterial ( uint32  surfaceIndex) const

Returns the override material ID for a specific surface

const float4x4& getTransform ( ) const
inline

Returns the world transformation matrix of the instance

bool isCastShadows ( ) const
inline

Returns true if the instance casts shadows

bool isDirty ( ) const
inline

Returns true if the instance data has changed and needs to be re-uploaded to the GPU.

bool isVisible ( ) const
inline

Returns true if the instance is visible

void removeSurfaceOverrideMaterial ( uint32  surfaceIndex)

Removes the override material ID for a specific surface

void resetDirty ( )
inline

Clears the dirty flag after the instance data has been re-uploaded.

void setAABB ( const AABB aabb)

Sets the world-space AABB of the instance

void setCastShadows ( bool  castShadows)

Sets whether the instance casts shadows

void setNodeData ( void *  data)
inline
void setSurfaceOverrideMaterial ( uint32  surfaceIndex,
unique_id  materialId 
)

Sets an override material ID for a specific surface

void setTransform ( const float4x4 &  transform)

Sets the world transformation matrix of the instance

void setVisible ( bool  visible)

Sets the visibility of the instance