![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Mesh/Rendering/MeshGl.h>
Stores vertex and texture data of a Mesh on the GPU so that it can be rendered using OpenGL. More...
Inheritance diagram for MeshGl:Stores vertex and texture data of a Mesh on the GPU so that it can be rendered using OpenGL.
A MeshGl instance is always bound to a parent Mesh instance for which it provides OpenGL buffers and textures with the same data as its parent CPU counterpart. It uses signals to monitor the parent for changes so that the data on the GPU is updated when necessary.
Instances of this class serve as main input to the render() function of MeshRendererXyz classes. MeshGl provides a set of OpenGL VertexBuffers with individual attributes for the vertex positions, colors, texture coordinates, normals, as well as per-face and per-vertex indices and labels. They are split up into separate buffers and only computed lazily on-demand so that you can mix and match because different renderers require only an individual subset of these vertex attributes. All VertexBuffers share the same underlying primitive layout and are supposed to be rendered directly as GL::Primitive::Triangles without a GL::IndexBuffer.
Use a GL::VertexArrayObject to combine them into a single rendering call, e.g.:
Public Member Functions | |
| MeshGl (const Mesh &parentMesh) | |
| const Mesh & | mesh () const |
| Returns the underlying parent mesh. | |
| const std::vector< vec3f > & | customPerVertexColors () const |
| Returns an optional list of custom per-vertex colors to use in positionColorTexCoordBuffer() instead of the ones in the parent Mesh. | |
| void | setCustomPerVertexColors (const std::vector< vec3f > &colors) |
| Set an optional list of custom per-vertex colors to use in positionColorTexCoordBuffer() instead of the ones in the parent Mesh. | |
| const GL::VertexBuffer & | positionColorTexCoordBuffer () const |
| Returns a vertex buffer with the following data: | |
| const GL::VertexBuffer & | perVertexNormalsBuffer () const |
| Returns a vertex buffer with a single attribute containing the per-vertex normals. | |
| const GL::VertexBuffer & | perFaceNormalsBuffer () const |
| Returns a vertex buffer with a single attribute containing the per-face normals. | |
| const GL::VertexBuffer & | faceIndexLabelBuffer () const |
| Returns a vertex buffer with the following data: | |
| const GL::VertexBuffer & | vertexIndexLabelBuffer () const |
| Returns a vertex buffer with the following data: | |
| const GlImage * | colorTexture () const |
| Returns the optional color texture in case the mesh is textured. | |
| const GlImage * | faceLabelTexture () const |
| Returns the LUT for face labels. | |
| const GlImage * | vertexLabelTexture () const |
| Returns the LUT for vertex labels. | |
| bool | isDirty () const |
Public Member Functions inherited from SignalReceiver | |
| SignalReceiver ()=default | |
| Default constructor. | |
| SignalReceiver (const SignalReceiver &other) | |
| Copy constructor, does not copy any existing signal connections from other. | |
| SignalReceiver & | operator= (SignalReceiver rhs) |
| Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs. | |
| virtual | ~SignalReceiver () |
| Virtual destructor disconnects from all connected signals. | |
Additional Inherited Members | |
Protected Member Functions inherited from SignalReceiver | |
| void | disconnectAll () |
| Disconnects all existing connections. | |
| void setCustomPerVertexColors | ( | const std::vector< vec3f > & | colors | ) |
Set an optional list of custom per-vertex colors to use in positionColorTexCoordBuffer() instead of the ones in the parent Mesh.
The number of provided colors must match the number of vertices of the parent mesh.
| const GL::VertexBuffer & positionColorTexCoordBuffer | ( | ) | const |
Returns a vertex buffer with the following data:
| const GL::VertexBuffer & faceIndexLabelBuffer | ( | ) | const |
Returns a vertex buffer with the following data:
| const GL::VertexBuffer & vertexIndexLabelBuffer | ( | ) | const |
Returns a vertex buffer with the following data: