Inheritance Graph
graph BT
Mesh
Mesh --> ReferenceCounter
click Mesh "classRendering_1_1Mesh"
click ReferenceCounter "classUtil_1_1ReferenceCounter"
Description
Class for polygonal meshes. A mesh consisting of four components:
-
MeshVertexData : The vertices of the mesh stored in local and/or graphics memory
-
MeshIndexData : The indices of the used vertices stored in local and/or graphics memory
-
DataStrategy: A strategy that determines where the data is stored and how the mesh is rendered (e.g. as VBO or VertexArray)
-
Filename: (optional) The filename from which the mesh was loaded.
Create a new mesh:
Mesh * mesh = new Mesh; // create a mesh
MeshIndexData & id = mesh->openMeshIndexData(); // get access to index data
id.allocate(numberOfIndices); // allocate memory for indices (using triangles)
for(uint32_t i = 0; i < numberOfIndices; ++i) {
id[i] = someIndex(...); // access the indices
}
id.updateIndexRange(); // recalculate index range
MeshVertexData & vd = mesh->openMeshVertexData(); // get access to vertex data
VertexDescription desc; // create a vertexDescription
vd.allocate(numberOfVertices); // allocate memory for vertices
uint8_t * binaryMeshVertexData = vd.data(); // access the vertices
createMeshVertexData(...);
vd.updateBoundingBox(); // recalculate bounding box
Note: After an existing mesh has been changed, vd.markAsChanged() and id.markAsChanged() have to be called so that the VBO can be updated. After allocate(…) this is not necessary.
Main
MeshIndexData
Filename
MeshVertexData
DataStrategy
DrawMode
Documentation
function
Rendering::Mesh::Mesh
Defined in Rendering/Mesh/Mesh.h:75
function
Rendering::Mesh::Mesh
Defined in Rendering/Mesh/Mesh.h:76
function
Rendering::Mesh::Mesh
Defined in Rendering/Mesh/Mesh.h:77
function
Rendering::Mesh::Mesh
Defined in Rendering/Mesh/Mesh.h:78
function
Rendering::Mesh::Mesh
Defined in Rendering/Mesh/Mesh.h:79
function
Rendering::Mesh::clone
Defined in Rendering/Mesh/Mesh.h:81
function
Rendering::Mesh::swap
Defined in Rendering/Mesh/Mesh.h:83
function
Rendering::Mesh::getMainMemoryUsage
Return the amount of main memory currently occupied by this mesh.
Note: If the mesh data is currently not present in main memory, only a small number is returned (probablysizeof(Mesh)
).
Returns
Amount of memory in bytes
Defined in Rendering/Mesh/Mesh.h:91
function
Rendering::Mesh::getGraphicsMemoryUsage
Return the amount of graphics memory currently occupied by this mesh.
Note: If the mesh data is currently not uploaded to the graphics card, zero is returned.
Returns
Amount of memory in bytes
Defined in Rendering/Mesh/Mesh.h:99
function
Rendering::Mesh::empty
Returns true if no data is set.
Defined in Rendering/Mesh/Mesh.h:102
function
Rendering::Mesh::_display
Display the mesh as VBO or VertexArray (determined by current data strategy).
-
If the mesh uses indices ( isUsingIndexData() ==true),firstElement
andelementCount
are the first index and the number of indices to be drawn.
-
If the mesh does not us indices ( isUsingIndexData() ==false),firstElement
andelementCount
are the first vertex and the number of vertices to be drawn. Calls:> dataStrategy->displayMesh(…)> dataStrategy::doDisplayMesh(…)> vertexData.bind() & indexData.drawElements(…) OR (if no indexData is present) vertexData.drawArray(…)
Note: AttentionThe function has to be called from within the GL-thread!
Note: Except if you know what you are doing, use renderingContext.displayMesh(mesh) instead.
Defined in Rendering/Mesh/Mesh.h:115
function
Rendering::Mesh::getPrimitiveCount
Return the number of primitives stored in this mesh. The number depends on the number of indices, the number of vertices, and the draw mode. To retrieve the type of primitives, call getDrawMode() .
Parameters
- numElements
- If zero, the number of indices or the number of vertices will be used. If non-zero, use the number of elements to do the calculation.
Defined in Rendering/Mesh/Mesh.h:126
function
Rendering::Mesh::_getIndexData
Returns a reference to the indexData member.
Note: In most cases: openIndexData() is what you want (that why the _ is in the name…)
Defined in Rendering/Mesh/Mesh.h:138
function
Rendering::Mesh::_getIndexData
Defined in Rendering/Mesh/Mesh.h:139
function
Rendering::Mesh::openIndexData
Returns a reference to the indexData member and assures that if the mesh contains index data, this data can be accessed via MeshIndexData.data()
Defined in Rendering/Mesh/Mesh.h:143
function
Rendering::Mesh::getIndexCount
Defined in Rendering/Mesh/Mesh.h:145
function
Rendering::Mesh::isUsingIndexData
If useIndexData is false, the mesh’s indexData.
Defined in Rendering/Mesh/Mesh.h:150
function
Rendering::Mesh::setUseIndexData
Defined in Rendering/Mesh/Mesh.h:151
function
Rendering::Mesh::getFileName
Defined in Rendering/Mesh/Mesh.h:160
function
Rendering::Mesh::setFileName
Defined in Rendering/Mesh/Mesh.h:161
function
Rendering::Mesh::_getVertexData
Returns a reference to the vertexData member.
Note: In most cases: openVertexData() is what you want (that why the _ is in the name…)
Defined in Rendering/Mesh/Mesh.h:172
function
Rendering::Mesh::_getVertexData
Defined in Rendering/Mesh/Mesh.h:173
function
Rendering::Mesh::openVertexData
Returns a reference to the vertexData member and assures that if the mesh contains vertex data, this data can be accessed via MeshVertexData.data()
Defined in Rendering/Mesh/Mesh.h:177
function
Rendering::Mesh::getVertexCount
Defined in Rendering/Mesh/Mesh.h:179
function
Rendering::Mesh::getVertexDescription
Defined in Rendering/Mesh/Mesh.h:180
function
Rendering::Mesh::getBoundingBox
Defined in Rendering/Mesh/Mesh.h:181
function
Rendering::Mesh::getDataStrategy
Return the current data strategy.
Defined in Rendering/Mesh/Mesh.h:191
function
Rendering::Mesh::setDataStrategy
Set a new data strategy.
Defined in Rendering/Mesh/Mesh.h:196
enum
Rendering::Mesh::draw_mode_t
Enumerator |
|
Description |
Enumerator |
|
Description |
DRAW_POINTS |
|
Corresponds toGL_POINTS . |
DRAW_LINE_STRIP |
|
Corresponds toGL_LINE_STRIP . |
DRAW_LINE_LOOP |
|
Corresponds toGL_LINE_LOOP . |
DRAW_LINES |
|
Corresponds toGL_LINES . |
DRAW_TRIANGLES |
|
Corresponds toGL_TRIANGLES . |
Enumeration of draw modes
See also: parametermode
of functionglDrawElements
Defined in Rendering/Mesh/Mesh.h:212
function
Rendering::Mesh::getDrawMode
Defined in Rendering/Mesh/Mesh.h:227
function
Rendering::Mesh::setDrawMode
Defined in Rendering/Mesh/Mesh.h:230
function
Rendering::Mesh::getGLDrawMode
Convert the draw mode to an OpenGL constant.
Parameters
:
Defined in Rendering/Mesh/Mesh.h:243
function
Rendering::Mesh::setGLDrawMode
Convert an OpenGL constant to the draw mode. SetdrawModeto
-
DRAW_POINTS
ifglDrawMode
isGL_POINTS
-
DRAW_LINE_STRIP
ifglDrawMode
isGL_LINE_STRIP
-
DRAW_LINE_LOOP
ifglDrawMode
isGL_LINE_LOOP
-
DRAW_LINES
ifglDrawMode
isGL_LINES
-
DRAW_TRIANGLES
otherwise
Defined in Rendering/Mesh/Mesh.h:253