Voxelyze
|
Voxelyze mesh visualizer. More...
#include <VX_MeshRender.h>
Public Types | |
enum | viewColoring { MATERIAL, FAILURE, STATE_INFO } |
Defines various ways of coloring the voxels in the 3D mesh. More... | |
Public Member Functions | |
CVX_MeshRender (CVoxelyze *voxelyzeInstance) | |
Initializes this mesh visualization with the specified voxelyze instance. This voxelyze pointer must remain valid for the duration of this object. | |
void | generateMesh () |
Generates (or regenerates) this mesh from the linked voxelyze object. This must be called whenever voxels are added or removed in the simulation. | |
void | updateMesh (viewColoring colorScheme=MATERIAL, CVoxelyze::stateInfoType stateType=CVoxelyze::DISPLACEMENT) |
Updates the mesh according to the current state of the linked voxelyze object and the coloring scheme specified by the arguments. | |
void | saveObj (const char *filePath) |
Save the current deformed mesh as an obj file to the path specified. Coloring is not supported yet. | |
void | glDraw () |
Executes openGL drawing commands to draw this mesh in an Open GL window if USE_OPENGL is defined. |
Voxelyze mesh visualizer.
A simple way to generate a deformed mesh reflecting the current state of a voxelyze object. After constructing with a pointer to the desired voxelyze object the mesh is ready. If the state of the voxelyze object has changed or a different coloring is desired, simply call updateMesh(). If voxels are added or subtracted to the voxelyze object, generateMesh() must be called to regenerate the mesh before calling updateMesh or drawGl().
The mesh can be drawn in an initialized OpenGL window by defining USE_OPENGL in the preprocessor and calling glDraw from within the drawing loop. An obj mesh file can also be generated at any time.
Defines various ways of coloring the voxels in the 3D mesh.
MATERIAL |
Display the material color specified by its RGB values. |
FAILURE |
Display the current failure status (red=failed, yellow=yielded, white=ok) |
STATE_INFO |
Display a color coded "head map" of the specified CVoxelyze::stateInfoType (displacement, kinetic energy, etc.) |
CVX_MeshRender::CVX_MeshRender | ( | CVoxelyze * | voxelyzeInstance | ) |
Initializes this mesh visualization with the specified voxelyze instance. This voxelyze pointer must remain valid for the duration of this object.
[in] | voxelyzeInstance | The voxelyze instance to link this mesh object to. |
void CVX_MeshRender::saveObj | ( | const char * | filePath | ) |
Save the current deformed mesh as an obj file to the path specified. Coloring is not supported yet.
[in] | filePath | File path to save the obj file as. Creates or overwrites. |
void CVX_MeshRender::updateMesh | ( | viewColoring | colorScheme = MATERIAL , |
CVoxelyze::stateInfoType | stateType = CVoxelyze::DISPLACEMENT |
||
) |
Updates the mesh according to the current state of the linked voxelyze object and the coloring scheme specified by the arguments.
[in] | colorScheme | The coloring scheme. |
[in] | stateType | If colorScheme = STATE_INFO, this argument determines the state to color the object according to. Only kinetic energy, strain energy, displacement, and pressure are currently supported. |