Saga3D API Documentation
1.0-RC4
|
Struct for holding a mesh with a single material. More...
#include <IMeshBuffer.h>
Public Member Functions | |
virtual | ~IMeshBuffer () |
virtual bool | isGPUBuffer () const =0 |
virtual std::uint64_t | getID () const =0 |
Returns internal ID to identify mesh buffer. More... | |
virtual void | buildBuffer (video::IVideoDriver &driver, const video::PipelineHandle pipeline)=0 |
Generate GPU-compatible data. More... | |
virtual const void * | getData (const video::PipelineHandle pipeline) const =0 |
Get pointer to GPU staging buffer. More... | |
virtual std::size_t | getSize (const video::PipelineHandle pipeline) const =0 |
Get size of GPU staging buffer. More... | |
virtual void * | getVertices ()=0 |
Get access to vertex data. The data is an array of vertices. More... | |
virtual void | setVertexCount (const size_t count)=0 |
Set number of vertices. More... | |
virtual std::size_t | getVertexCount () const =0 |
Get amount of vertices in meshbuffer. More... | |
virtual const std::uint32_t * | getIndices () const =0 |
Get access to indices. More... | |
virtual std::uint32_t * | getIndices ()=0 |
Get access to indices. More... | |
virtual std::uint32_t | getIndexCount () const =0 |
Get amount of indices in this meshbuffer. More... | |
virtual void | setIndexCount (const std::uint32_t count)=0 |
Set number of indices. More... | |
virtual const core::aabbox3df & | getBoundingBox () const =0 |
Get the axis aligned bounding box of this meshbuffer. More... | |
virtual void | setBoundingBox (const core::aabbox3df &box)=0 |
Set axis aligned bounding box. More... | |
virtual void | recalculateBoundingBox ()=0 |
Recalculates the bounding box. Should be called if the mesh changed. More... | |
virtual const glm::vec3 & | getPosition (std::uint32_t i) const =0 |
returns position of vertex i More... | |
virtual const glm::vec3 & | getNormal (std::uint32_t i) const =0 |
returns normal of vertex i More... | |
virtual const glm::vec2 & | getTCoords (std::uint32_t i) const =0 |
returns texture coord of vertex i More... | |
virtual const glm::vec3 & | getTangent (std::uint32_t i) const =0 |
returns tangent of vertex i More... | |
virtual const glm::vec3 & | getBiTangent (std::uint32_t i) const =0 |
returns bi-tangent of vertex i More... | |
virtual std::uint32_t | getIndex (std::size_t offset) const =0 |
returns vertex index at this offset More... | |
virtual void | append (std::vector< S3DVertex > &&vertices, std::vector< uint32_t > &&indices)=0 |
Append the vertices and indices to the current buffer. More... | |
virtual void | append (const IMeshBuffer *const other)=0 |
Append the meshbuffer to the current buffer. More... | |
virtual void | appendAttribute (const char *buffer, const size_t size, const size_t stride)=0 |
Append the custom attribute buffer to the current mesh buffer. More... | |
void | setPrimitiveType (scene::E_PRIMITIVE_TYPE type) |
Describe what kind of primitive geometry is used by the meshbuffer. More... | |
scene::E_PRIMITIVE_TYPE | getPrimitiveType () const |
Get the kind of primitive geometry which is used by the meshbuffer. More... | |
E_INDEX_TYPE | getIndexType () const |
Get index type. More... | |
void | setIndexType (const E_INDEX_TYPE type) |
Set index type. More... | |
void | setInstanceCount (const size_t count) |
Set buffer binding location. More... | |
std::size_t | getInstanceCount () const |
Get buffer binding location. More... | |
void | setBindingLocation (const int binding) |
Set buffer binding location. More... | |
int | getBindingLocation () const |
Get buffer binding location. More... | |
void | isNull (const bool null) |
bool | isNull () const |
virtual std::uint32_t | getPrimitiveCount () const |
Calculate how many geometric primitives are used by this meshbuffer. More... | |
bool | useIndirectDraw () const |
auto | indirectDrawBuffer () const |
void | setIndirectDrawBuffer (const video::IndirectBufferHandle buffer) |
bool | useIndexedIndirectDraw () const |
auto | indexedIndirectDrawBuffer () const |
void | setIndexedIndirectDrawBuffer (const video::IndexedIndirectBufferHandle buffer) |
Protected Attributes | |
scene::E_PRIMITIVE_TYPE | PrimitiveType = E_PRIMITIVE_TYPE::TRIANGLES |
Primitive type used for rendering (triangles, lines, ...) More... | |
std::size_t | InstanceCount = 1 |
Instance count for rendering multiple objects with this buffer. More... | |
int | Binding = 0 |
Binding location. More... | |
bool | IsNull = false |
Is a null buffer? More... | |
video::IndirectBufferHandle | IndirectDrawBuffer = video::NULL_GPU_RESOURCE_HANDLE |
Indirect draw command buffer for this mesh buffer. More... | |
video::IndexedIndirectBufferHandle | IndexedIndirectDrawBuffer = video::NULL_GPU_RESOURCE_HANDLE |
Indexed indirect draw command buffer for this mesh buffer. More... | |
E_INDEX_TYPE | IndexType = E_INDEX_TYPE::UINT32 |
Static Protected Attributes | |
static MeshBufferID | RootID |
To set ID for mesh buffer when created. More... | |
Struct 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.
Definition at line 43 of file IMeshBuffer.h.
|
inlinevirtual |
Definition at line 46 of file IMeshBuffer.h.
|
pure virtual |
Append the meshbuffer to the current buffer.
Only works for compatible vertex types
other | Buffer to append to this one. |
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Append the vertices and indices to the current buffer.
Only works for compatible vertex types.
vertices | vertex vector. |
indices | index vector. |
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Append the custom attribute buffer to the current mesh buffer.
buffer | Pointer to the buffer containing data |
size | Total size of buffer (bytes) |
stride | The custom data size of each vertex (bytes) |
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Generate GPU-compatible data.
Depending on render pass's pipeline layout, this function generates vertex data for that pass
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inline |
Get buffer binding location.
Definition at line 188 of file IMeshBuffer.h.
|
pure virtual |
returns bi-tangent of vertex i
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Get the axis aligned bounding box of this meshbuffer.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Get pointer to GPU staging buffer.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Returns internal ID to identify mesh buffer.
Each mesh buffer will be assigned an unique ID in its creation
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
returns vertex index at this offset
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Get amount of indices in this meshbuffer.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inline |
Get index type.
Definition at line 158 of file IMeshBuffer.h.
|
pure virtual |
Get access to indices.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Get access to indices.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inline |
Get buffer binding location.
Definition at line 176 of file IMeshBuffer.h.
|
pure virtual |
returns normal of vertex i
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
returns position of vertex i
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inlinevirtual |
Calculate how many geometric primitives are used by this meshbuffer.
Definition at line 204 of file IMeshBuffer.h.
|
inline |
Get the kind of primitive geometry which is used by the meshbuffer.
Definition at line 152 of file IMeshBuffer.h.
|
pure virtual |
Get size of GPU staging buffer.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
returns tangent of vertex i
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
returns texture coord of vertex i
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Get amount of vertices in meshbuffer.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
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 saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inline |
Definition at line 244 of file IMeshBuffer.h.
|
inline |
Definition at line 229 of file IMeshBuffer.h.
|
pure virtual |
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inline |
Definition at line 198 of file IMeshBuffer.h.
|
inline |
Definition at line 193 of file IMeshBuffer.h.
|
pure virtual |
Recalculates the bounding box. Should be called if the mesh changed.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inline |
Set buffer binding location.
Definition at line 182 of file IMeshBuffer.h.
|
pure virtual |
Set axis aligned bounding box.
box | User defined axis aligned bounding box to use for this buffer. |
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
pure virtual |
Set number of indices.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inline |
Definition at line 249 of file IMeshBuffer.h.
|
inline |
Set index type.
Definition at line 164 of file IMeshBuffer.h.
|
inline |
Definition at line 234 of file IMeshBuffer.h.
|
inline |
Set buffer binding location.
Definition at line 170 of file IMeshBuffer.h.
|
inline |
Describe what kind of primitive geometry is used by the meshbuffer.
Note: Default is E_PRIMITIVE_TYPE::TRIANGLES. Using other types is fine for rendering. But meshbuffer manipulation functions might expect type E_PRIMITIVE_TYPE::TRIANGLES to work correctly. Also mesh writers will generally fail (badly!) with other types than E_PRIMITIVE_TYPE::TRIANGLES.
Definition at line 146 of file IMeshBuffer.h.
|
pure virtual |
Set number of vertices.
Implemented in saga::scene::CMeshBuffer, and saga::scene::CGPUMeshBuffer.
|
inline |
Definition at line 239 of file IMeshBuffer.h.
|
inline |
Definition at line 224 of file IMeshBuffer.h.
|
protected |
Binding location.
Definition at line 265 of file IMeshBuffer.h.
|
protected |
Indexed indirect draw command buffer for this mesh buffer.
Definition at line 274 of file IMeshBuffer.h.
|
protected |
Definition at line 276 of file IMeshBuffer.h.
|
protected |
Indirect draw command buffer for this mesh buffer.
Definition at line 271 of file IMeshBuffer.h.
|
protected |
Instance count for rendering multiple objects with this buffer.
Definition at line 262 of file IMeshBuffer.h.
|
protected |
Is a null buffer?
Definition at line 268 of file IMeshBuffer.h.
|
protected |
Primitive type used for rendering (triangles, lines, ...)
Definition at line 259 of file IMeshBuffer.h.
|
staticprotected |
To set ID for mesh buffer when created.
Definition at line 256 of file IMeshBuffer.h.