Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
|
Class for holding a mesh with a single material. More...
#include <nirtcpp/core/engine/IMeshBuffer.hpp>
Public Types | |
enum | ECloneFlags { ECF_VERTICES = 1 , ECF_INDICES = 2 } |
Bitflags with options for cloning. More... | |
Public Member Functions | |
virtual video::SMaterial & | getMaterial ()=0 |
Get the material of this meshbuffer. | |
virtual const video::SMaterial & | getMaterial () const =0 |
Get the material of this meshbuffer. | |
virtual video::E_VERTEX_TYPE | getVertexType () const =0 |
Get type of vertex data which is stored in this meshbuffer. | |
virtual const void * | getVertices () const =0 |
Get access to vertex data. The data is an array of vertices. | |
virtual void * | getVertices ()=0 |
Get access to vertex data. The data is an array of vertices. | |
virtual u32 | getVertexCount () const =0 |
Get amount of vertices in meshbuffer. | |
virtual video::E_INDEX_TYPE | getIndexType () const =0 |
Get type of index data which is stored in this meshbuffer. | |
virtual const u16 * | getIndices () const =0 |
Get access to indices. | |
virtual u16 * | getIndices ()=0 |
Get access to indices. | |
virtual u32 | getIndexCount () const =0 |
Get amount of indices in this meshbuffer. | |
virtual const core::aabbox3df & | getBoundingBox () const =0 |
Get the axis aligned bounding box of this meshbuffer. | |
virtual void | setBoundingBox (const core::aabbox3df &box)=0 |
Set axis aligned bounding box. | |
virtual void | recalculateBoundingBox ()=0 |
Recalculates the bounding box. Should be called if the mesh changed. | |
virtual const core::vector3df & | getPosition (u32 i) const =0 |
returns position of vertex i | |
virtual core::vector3df & | getPosition (u32 i)=0 |
returns position of vertex i | |
virtual const core::vector3df & | getNormal (u32 i) const =0 |
returns normal of vertex i | |
virtual core::vector3df & | getNormal (u32 i)=0 |
returns normal of vertex i | |
virtual const core::vector2df & | getTCoords (u32 i) const =0 |
returns texture coord of vertex i | |
virtual core::vector2df & | getTCoords (u32 i)=0 |
returns texture coord of vertex i | |
virtual video::SColor & | getColor (u32 i)=0 |
returns color of vertex i | |
virtual const video::SColor & | getColor (u32 i) const =0 |
returns color of vertex i | |
virtual void | append (const void *const vertices, u32 numVertices, const u16 *const indices, u32 numIndices)=0 |
Append the vertices and indices to the current buffer. | |
virtual void | append (const IMeshBuffer *const other)=0 |
virtual E_HARDWARE_MAPPING | getHardwareMappingHint_Vertex () const =0 |
get the current hardware mapping hint | |
virtual E_HARDWARE_MAPPING | getHardwareMappingHint_Index () const =0 |
get the current hardware mapping hint | |
virtual void | setHardwareMappingHint (E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)=0 |
set the hardware mapping hint, for driver | |
virtual void | setDirty (E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)=0 |
flags the meshbuffer as changed, reloads hardware buffers | |
virtual u32 | getChangedID_Vertex () const =0 |
Get the currently used ID for identification of changes. | |
virtual u32 | getChangedID_Index () const =0 |
Get the currently used ID for identification of changes. | |
virtual void | setPrimitiveType (E_PRIMITIVE_TYPE type)=0 |
Describe what kind of primitive geometry is used by the meshbuffer. | |
virtual E_PRIMITIVE_TYPE | getPrimitiveType () const =0 |
Get the kind of primitive geometry which is used by the meshbuffer. | |
virtual u32 | getPrimitiveCount () const |
Calculate how many geometric primitives are used by this meshbuffer. | |
virtual EMESH_BUFFER_TYPE | getType () const |
Returns type of the class implementing the IMeshBuffer. | |
virtual IMeshBuffer * | createClone (int cloneFlags=ECF_VERTICES|ECF_INDICES) const =0 |
Create a new object with a copy of the meshbuffer. | |
Public Member Functions inherited from nirt::IReferenceCounted | |
IReferenceCounted () | |
Constructor. | |
virtual | ~IReferenceCounted () |
Destructor. | |
void | grab () const |
Grabs the object. Increments the reference counter by one. | |
bool | drop () const |
Drops the object. Decrements the reference counter by one. | |
s32 | getReferenceCount () const |
Get the reference count. | |
const c8 * | getDebugName () const |
Returns the debug name of the object. | |
Additional Inherited Members | |
Protected Member Functions inherited from nirt::IReferenceCounted | |
void | setDebugName (const c8 *newName) |
Sets the debug name of the object. | |
Class for holding a mesh with a single material.
A part of an IMesh which has the same material on each face of that group. Logical groups of an IMesh need not be put into separate mesh buffers, but can be. Separately animated parts of the mesh must be put into separate mesh buffers. Some mesh buffer implementations have limitations on the number of vertices the buffer can hold. In that case, logical grouping can help. Moreover, the number of vertices should be optimized for the GPU upload, which often depends on the type of gfx card. Typical figures are 1000-10000 vertices per buffer. SMeshBuffer is a simple implementation of a MeshBuffer, which supports up to 65535 vertices.
Since meshbuffers are used for drawing, and hence will be exposed to the driver, chances are high that they are grab()'ed from somewhere. It's therefore required to dynamically allocate meshbuffers which are passed to a video driver and only drop the buffer once it's not used in the current code block anymore.
Bitflags with options for cloning.
Enumerator | |
---|---|
ECF_INDICES | clone the vertices (or copy pointer for SSharedMeshBuffer) |
|
pure virtual |
Not supported right now by any meshbuffer In theory: Append the meshbuffer to the current buffer Only works for compatible vertex types
other | Buffer to append to this one. |
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Append the vertices and indices to the current buffer.
Only works for compatible vertex types and not implemented for most buffers for now.
vertices | Pointer to a vertex array. |
numVertices | Number of vertices in the array. |
indices | Pointer to index array. |
numIndices | Number of indices in array. |
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Create a new object with a copy of the meshbuffer.
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get the axis aligned bounding box of this meshbuffer.
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get the currently used ID for identification of changes.
This shouldn't be used for anything outside the VideoDriver.
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get the currently used ID for identification of changes.
This shouldn't be used for anything outside the VideoDriver.
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
returns color of vertex i
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
returns color of vertex i
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
get the current hardware mapping hint
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
get the current hardware mapping hint
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get amount of indices in this meshbuffer.
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get type of index data which is stored in this meshbuffer.
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get access to indices.
Note: For historical reasons data pointer is of type u16*, but for an index type of EIT_32BIT the index data is using an u32 array and therefore needs a cast to u32*.
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get access to indices.
Note: For historical reasons data pointer is of type u16*, but for an index type of EIT_32BIT the index data is using an u32 array and therefore needs a cast to u32*.
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get the material of this meshbuffer.
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get the material of this meshbuffer.
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
returns normal of vertex i
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
returns normal of vertex i
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
returns position of vertex i
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
returns position of vertex i
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get the kind of primitive geometry which is used by the meshbuffer.
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
returns texture coord of vertex i
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
returns texture coord of vertex i
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
inlinevirtual |
Returns type of the class implementing the IMeshBuffer.
Reimplemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get amount of vertices in meshbuffer.
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get type of vertex data which is stored in this meshbuffer.
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get access to vertex data. The data is an array of vertices.
Which vertex type is used can be determined by getVertexType().
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Get access to vertex data. The data is an array of vertices.
Which vertex type is used can be determined by getVertexType().
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Recalculates the bounding box. Should be called if the mesh changed.
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Set axis aligned bounding box.
box | User defined axis aligned bounding box to use for this buffer. |
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
flags the meshbuffer as changed, reloads hardware buffers
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
set the hardware mapping hint, for driver
Implemented in nirt::scene::CMeshBuffer< T >, nirt::scene::IDynamicMeshBuffer, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.
|
pure virtual |
Describe what kind of primitive geometry is used by the meshbuffer.
Note: Default is EPT_TRIANGLES. Using other types is fine for rendering. But meshbuffer manipulation functions might expect type EPT_TRIANGLES to work correctly. Also mesh writers will generally fail (badly!) with other types than EPT_TRIANGLES.
Implemented in nirt::scene::CDynamicMeshBuffer, nirt::scene::CMeshBuffer< T >, nirt::scene::SSharedMeshBuffer, and nirt::scene::SSkinMeshBuffer.