chai3d::cVoxelObject Class Reference

This class implements a 3D volumetric object composed of voxels. More...

#include <CVoxelObject.h>

Inheritance diagram for chai3d::cVoxelObject:

Public Member Functions

 cVoxelObject ()
 Constructor of cVoxelObject. More...
 
virtual ~cVoxelObject ()
 Destructor of cVoxelObject. More...
 
void setRenderingModeBasic ()
 This method sets the basic rendering mode without shader. More...
 
void setRenderingModeVoxelColors ()
 This method sets a basic voxel renderer with shader. More...
 
void setRenderingModeVoxelColorMap ()
 This method sets a basic voxel renderer with shader and colormap. More...
 
void setRenderingModeIsosurfaceMaterial ()
 This method sets an isosurface renderer using shader and material color. More...
 
void setRenderingModeIsosurfaceColors ()
 This method sets an isosurface renderer using shader and individual voxel colors. More...
 
void setRenderingModeIsosurfaceColorMap ()
 This method sets an isosurface renderer using shader and colormap. More...
 
void setRenderingModeDVRColorMap ()
 This method sets a direct volume renderer. More...
 
void setRenderingModeCustom ()
 This method sets a custom shader renderer. More...
 
void setQuality (const double a_quality)
 This method sets the quality level of the graphic rendering. This number ranges from 0.1 (poor) to 1.0 (high). More...
 
double getQuality ()
 This method returns the quality level of the graphic rendering. More...
 
void setIsosurfaceValue (const float a_isosurfaceValue)
 This method sets the isosurface value. Used when isometric rendering is enabled. More...
 
float getIsosurfaceValue ()
 This method returns the isosurface value. This setting is used when isometric rendering is enabled. More...
 
void setVoxelOpacity (const float a_voxelOpacity)
 This method sets the voxel opacity value. This setting is used with basic voxel rendering mode. More...
 
float getVoxelOpacity ()
 This method returns the voxel opacity value. More...
 
void setOpacityThreshold (const float a_opacityThreshold)
 This method sets the opacity threshold. This value is the opacity accumulated along the ray before the shader decides to stop casting. More...
 
float getOpacityThreshold ()
 This method returns the opacity threshold. More...
 
void setOpticalDensity (const float a_opticalDensity)
 This method sets the optical density factor. This setting is used when the direct volume rendering mode is enabled. More...
 
float getOpticalDensity ()
 This method returns the optical density factor. More...
 
void setUseLinearInterpolation (const bool a_useLinearInterpolation)
 This method enables or disables linear interpolation. More...
 
bool getUseLinearInterpolation ()
 This method returns true if linear interpolation is enabled, false otherwise. More...
 
void setUseColorMap (const bool a_useColorMap)
 This method enables or disables the use of the color look-up table. More...
 
bool getUseColorMap () const
 This method returns true if the color look-up table is enabled, false otherwise. More...
 
bool polygonize (cMesh *a_mesh, double a_gridSizeX=-1.0, double a_gridSizeY=-1.0, double a_gridSizeZ=-1.0)
 This method converts this voxel object into a triangle mesh. More...
 
bool polygonize (cMultiMesh *a_multiMesh, double a_gridSizeX=-1.0, double a_gridSizeY=-1.0, double a_gridSizeZ=-1.0)
 This method converts this voxel object into a triangle multi-mesh. More...
 
- Public Member Functions inherited from chai3d::cMesh
 cMesh (cMaterialPtr a_material=cMaterialPtr())
 Constructor of cMesh. More...
 
virtual ~cMesh ()
 Destructor of cMesh. More...
 
virtual cMeshcopy (const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=false)
 This method creates a copy of itself. More...
 
virtual void setTransparencyLevel (const float a_level, const bool a_applyToVertices=false, const bool a_applyToTextures=false, const bool a_affectChildren=false)
 This method sets the alpha value at each vertex and in all of my material colors. More...
 
virtual void markForUpdate (const bool a_affectChildren=false)
 This method invalidates any existing display lists and marks the mesh for update. More...
 
unsigned int newVertex (const double a_x=0.0, const double a_y=0.0, const double a_z=0.0, const double a_normalX=1.0, const double a_normalY=0.0, const double a_normalZ=0.0, const double a_textureCoordX=0.0, const double a_textureCoordY=0.0, const double a_textureCoordZ=0.0)
 This method creates a new vertex and adds it to the vertex list. More...
 
unsigned int newVertex (const cVector3d &a_pos, const cVector3d &a_normal=cVector3d(1, 0, 0), const cVector3d &a_textureCoord=cVector3d(0, 0, 0), const cColorf &a_color=cColorf(0, 0, 0, 1))
 This method creates a new vertex and adds it to the vertex list. More...
 
unsigned int getNumVertices () const
 This method returns the number of stored vertices. More...
 
void setVertexColor (const cColorf &a_color)
 This method sets the color of each vertex. More...
 
unsigned int newTriangle (const unsigned int a_indexVertex0, const unsigned int a_indexVertex1, const unsigned int a_indexVertex2)
 This method creates a new triangle by passing vertex indices. More...
 
unsigned int newTriangle (const cVector3d &a_vertex0=cVector3d(0, 0, 0), const cVector3d &a_vertex1=cVector3d(0, 0, 0), const cVector3d &a_vertex2=cVector3d(0, 0, 0), const cVector3d &a_normal0=cVector3d(1, 0, 0), const cVector3d &a_normal1=cVector3d(1, 0, 0), const cVector3d &a_normal2=cVector3d(1, 0, 0), const cVector3d &a_textureCoord0=cVector3d(0, 0, 0), const cVector3d &a_textureCoord1=cVector3d(0, 0, 0), const cVector3d &a_textureCoord2=cVector3d(0, 0, 0), const cColorf &a_colorVertex0=cColorf(0, 0, 0, 1), const cColorf &a_colorVertex1=cColorf(0, 0, 0, 1), const cColorf &a_colorVertex2=cColorf(0, 0, 0, 1))
 This method creates a new triangle and three new vertices by passing vertex positions, normals and texture coordinates. More...
 
bool removeTriangle (const unsigned int a_index)
 This method removes a triangle from the triangle array. More...
 
unsigned int getNumTriangles ()
 This method returns the number of stored triangles. More...
 
void clear ()
 This method clears all triangles and vertices of mesh. More...
 
void setShowTriangles (const bool a_showTriangles)
 This method enables or disables the rendering of triangles. More...
 
bool getShowTriangles () const
 This method returns whether rendering of triangles is enabled. More...
 
void computeAllEdges (double a_angleThresholdDeg=40.0)
 This method creates a list of edges by providing a threshold angle in degrees. More...
 
void clearAllEdges ()
 This method clears all edges. More...
 
void setShowEdges (const bool a_showEdges)
 This method enables or disables the rendering of edges. More...
 
bool getShowEdges () const
 This method returns whether rendering of edges is enabled. More...
 
void setEdgeProperties (const double a_width, const cColorf &a_color)
 This method sets the graphic properties for edge-rendering. More...
 
void setEdgeLineWidth (const double a_width)
 This method sets the line width of edges. More...
 
void setShowNormals (const bool a_showNormals)
 This method enables or disables the rendering of vertex normals. More...
 
bool getShowNormals () const
 This method returns whether rendering of normals is enabled. More...
 
void setNormalsProperties (const double a_length, const cColorf &a_color)
 This method sets the graphic properties for normal-rendering. More...
 
void setNormalsLength (const double a_length)
 This method set the length of normals for display purposes. More...
 
void computeAllNormals ()
 This method computes all triangle normals. More...
 
virtual void reverseAllNormals ()
 This method reverses all surface normals. More...
 
void computeBTN ()
 This method computes the normal matrix vectors for all triangles. More...
 
void setShowTangents (const bool a_showTangents)
 This method enables or disables the rendering of tangents and bi-tangents. More...
 
bool getShowTangents () const
 This method returns whether rendering of tangents and bi-tangents is enabled. More...
 
virtual void createBruteForceCollisionDetector ()
 This method builds a brute force collision detector for this mesh. More...
 
virtual void createAABBCollisionDetector (const double a_radius)
 This method builds an AABB collision detector for this mesh. More...
 
void scaleXYZ (const double a_scaleX, const double a_scaleY, const double a_scaleZ)
 This method scale this mesh by using different scale factors along X, Y and Z axes. More...
 
virtual void offsetVertices (const cVector3d &a_offset, const bool a_updateCollisionDetector=true)
 This method shifts all vertex positions by the specified amount. More...
 
virtual cVector3d getCenterOfMass ()
 This method computes the center of mass of this mesh, based on vertex positions. More...
 
- Public Member Functions inherited from chai3d::cGenericObject
 cGenericObject ()
 Constructor of cGenericObject. More...
 
virtual ~cGenericObject ()
 Destructor of cGenericObject. More...
 
virtual void setEnabled (bool a_enabled, const bool a_affectChildren=false)
 This method enables or disable this object. When an object is disabled, both haptic and graphic rendering no longer occur. More...
 
bool getEnabled () const
 This method returns true if the object is enabled, false otherwise. More...
 
virtual void setLocalPos (const cVector3d &a_localPos)
 This method sets the local position of this object. More...
 
void setLocalPos (const double a_x=0.0, const double a_y=0.0, const double a_z=0.0)
 This method sets the local position of this object. More...
 
cVector3d getLocalPos () const
 This method returns the local position of this object. More...
 
cVector3d getGlobalPos () const
 This method returns the global position of this object. More...
 
virtual void setLocalRot (const cMatrix3d &a_localRot)
 This method sets the local rotation matrix for this object. More...
 
cMatrix3d getLocalRot () const
 This method returns the local rotation matrix of this object. More...
 
cMatrix3d getGlobalRot () const
 This method returns the global rotation matrix of this object. More...
 
void setLocalTransform (const cTransform &a_transform)
 This method returns the local position and rotation matrix by passing a transformation matrix. More...
 
cTransform getLocalTransform ()
 This method returns the local position and rotation matrix in a transformation matrix. More...
 
cTransform getGlobalTransform ()
 This method returns the global position and rotation matrix in a transformation matrix. More...
 
void translate (const cVector3d &a_translation)
 This method translates this object by a specified offset. More...
 
void translate (const double a_x, const double a_y, const double a_z=0.0)
 This method translates this object by a specified offset. More...
 
void rotateAboutLocalAxisRad (const cVector3d &a_axis, const double a_angleRad)
 This method rotates this object around a local axis. Angle magnitude is defined in radians. More...
 
void rotateAboutLocalAxisDeg (const cVector3d &a_axis, const double a_angleDeg)
 This method rotates this object around a local axis. Angle magnitude is defined in degrees. More...
 
void rotateAboutLocalAxisRad (const double a_axisX, const double a_axisY, const double a_axisZ, const double a_angleRad)
 This method rotates this object around a local axis. Angle magnitude is defined in radians. More...
 
void rotateAboutLocalAxisDeg (const double a_axisX, const double a_axisY, const double a_axisZ, const double a_angleDeg)
 This method rotates this object around a local axis. Angle magnitude is defined in degrees. More...
 
void rotateAboutGlobalAxisRad (const cVector3d &a_axis, const double a_angleRad)
 This method rotates this object around a global axis. Angle magnitude is defined in radians. More...
 
void rotateAboutGlobalAxisDeg (const cVector3d &a_axis, const double a_angleDeg)
 This method rotates this object around a global axis. Angle magnitude is defined in degrees. More...
 
void rotateAboutGlobalAxisRad (const double a_axisX, const double a_axisY, const double a_axisZ, const double a_angleRad)
 This method rotate this object around a local axis. Angle magnitude is defined in radians. More...
 
void rotateAboutGlobalAxisDeg (const double a_axisX, const double a_axisY, const double a_axisZ, const double a_angleDeg)
 This method rotates this object around a local axis. Angle magnitude is defined in degrees. More...
 
void rotateExtrinsicEulerAnglesRad (const double &a_angleRad1, const double &a_angleRad2, const double &a_angleRad3, const cEulerOrder a_eulerOrder)
 This method rotates this object using fixed Euler representation. Angles are defined in radians. More...
 
void rotateExtrinsicEulerAnglesDeg (const double &a_angleDeg1, const double &a_angleDeg2, const double &a_angleDeg3, const cEulerOrder a_eulerOrder)
 This method rotates this object using fixed Euler representation. Angles are defined in radians. More...
 
void rotateIntrinsicEulerAnglesRad (const double &a_angleRad1, const double &a_angleRad2, const double &a_angleRad3, const cEulerOrder a_eulerOrder)
 This method rotates this object using co-moving Euler representation. Angles are defined in radians. More...
 
void rotateIntrinsicEulerAnglesDeg (const double &a_angleDeg1, const double &a_angleDeg2, const double &a_angleDeg3, const cEulerOrder a_eulerOrder)
 This method rotates this object using co-moving Euler representation. Angles are defined in radians. More...
 
virtual void computeGlobalPositions (const bool a_frameOnly=true, const cVector3d &a_globalPos=cVector3d(0.0, 0.0, 0.0), const cMatrix3d &a_globalRot=cIdentity3d())
 This method computes the global position and rotation of this object and its children. More...
 
void computeGlobalPositionsFromRoot (const bool a_frameOnly=true)
 This method computes the global position and rotation of current object only. More...
 
bool addEffect (cGenericEffect *a_effect)
 This method adds a haptic effect to this object. More...
 
bool removeEffect (cGenericEffect *a_effect)
 This method removes a haptic effect from this object. More...
 
void deleteAllEffects ()
 This method removes all haptic effects. More...
 
bool createEffectMagnetic ()
 This method creates a magnetic haptic effect. More...
 
bool deleteEffectMagnetic ()
 This method deletes any current magnetic haptic effect. More...
 
bool createEffectStickSlip ()
 This method creates a stick-and-slip haptic effect. More...
 
bool deleteEffectStickSlip ()
 This method delete any current stick-and-slip haptic effect. More...
 
bool createEffectSurface ()
 This method creates a surface haptic effect. More...
 
bool deleteEffectSurface ()
 This method deletes any current surface haptic effect. More...
 
bool createEffectVibration ()
 This method creates a vibration haptic effect. More...
 
bool deleteEffectVibration ()
 This method deletes any current vibration haptic effect. More...
 
bool createEffectViscosity ()
 This method creates a viscous haptic effect. More...
 
bool deleteEffectViscosity ()
 This method deletes any current viscous haptic effect. More...
 
virtual void setHapticEnabled (const bool a_hapticEnabled, const bool a_affectChildren=true)
 This method enables or disables haptic perception of this object, optionally propagating the change to children. More...
 
bool getHapticEnabled () const
 This method returns the haptic status of object (true means it can be felt when visible). More...
 
virtual void setStiffness (const double a_stiffness, const bool a_affectChildren=true)
 This method sets the haptic stiffness of the object, optionally recursively affecting children. More...
 
virtual void setFriction (double a_staticFriction, double a_dynamicFriction, const bool a_affectChildren=true)
 This method sets the static and dynamic friction properties (polygonal models only), optionally recursively affecting children. More...
 
virtual void setShowEnabled (const bool a_show, const bool a_affectChildren=true)
 This method enables or disables the graphic display of this object, optionally propagating the change to children. More...
 
bool getShowEnabled () const
 This method returns the display status of object (true means it's visible). More...
 
virtual void setWireMode (const bool a_showWireMode, const bool a_affectChildren=false)
 This method enables or disables wireframe rendering, optionally propagating the operation to my children. More...
 
bool getWireMode () const
 This method returns whether wireframe rendering is enabled. More...
 
virtual void setUseCulling (const bool a_useCulling, const bool a_affectChildren=false)
 This method enables or disables face-culling, optionally propagating the operation to my children. More...
 
bool getUseCulling () const
 This method returns true if face-culling is enabled, false otherwise. More...
 
virtual void setUseTransparency (const bool a_useTransparency, const bool a_affectChildren=false)
 This method enables or disables transparency. More...
 
bool getUseTransparency () const
 This method returns true if transparency is enabled, false otherwise. More...
 
virtual void setUseDisplayList (const bool a_useDisplayList, const bool a_affectChildren=false)
 This method enabled or disables the use of a display list for rendering, optionally propagating the operation to its children. More...
 
bool getUseDisplayList () const
 This method returns true if a display list is activated, false otherwise. More...
 
virtual void setUseVertexColors (const bool a_useColors, const bool a_affectChildren=false)
 This method enables or disables the use of per-vertex colors, optionally propagating the operation to its children. More...
 
bool getUseVertexColors () const
 This method returns true is per-vertex color properties are enabled, false otherwise. More...
 
virtual void setUseMaterial (const bool a_useMaterial, const bool a_affectChildren=false)
 This method enables or disables the use of material properties, optionally propagating the operation to its children. More...
 
bool getUseMaterial () const
 This method returns true is material properties are enabled, false otherwise. More...
 
virtual void setMaterial (cMaterialPtr a_material, const bool a_affectChildren=false)
 This method sets the material properties of this object, optionally propagating the operation to its children. More...
 
virtual void setMaterial (cMaterial &a_material, const bool a_affectChildren=false)
 This method setd the material properties of this object, optionally propagating the operation to its children. More...
 
virtual void backupMaterialColors (const bool a_affectChildren=false)
 This method creates a backup of the material colors of this object, optionally propagating the operation to its children. More...
 
virtual void restoreMaterialColors (const bool a_affectChildren=false)
 This method restores the material color properties of this object from a previous backup, optionally propagating the operation to its children. More...
 
virtual void setUseTexture (const bool a_useTexture, const bool a_affectChildren=false)
 This method enables or disables the use of texture-mapping, optionally propagating the operation to its children. More...
 
bool getUseTexture () const
 This method returns true if texture-mapping is enabled, false otherwise. More...
 
virtual void setTexture (cTexture1dPtr a_texture, const bool a_affectChildren=false)
 This method sets a texture to this object, optionally propagating the operation to its children. More...
 
virtual void setShaderProgram (cShaderProgramPtr a_shaderProgram, const bool a_affectChildren=false)
 This method assigns a shader program to this object, optionally propagating the operation to its children.. More...
 
virtual cShaderProgramPtr getShaderProgram ()
 This method returns a pointer to the current shader program. More...
 
virtual void setShowBoundaryBox (const bool a_showBoundaryBox, const bool a_affectChildren=false)
 This method enables or disabled the graphic display of the boundary box for this object, optionally propagating the change to its children. More...
 
bool getShowBoundaryBox () const
 This method returns true if the boundary box is being displayed, false otherwise. More...
 
cVector3d getBoundaryMin () const
 This method returns the minimum point of this object's boundary box. More...
 
cVector3d getBoundaryMax () const
 This method returns the maximum point of this object's boundary box. More...
 
cVector3d getBoundaryCenter () const
 This method computes and returns the center of this object's boundary box. More...
 
bool getBoundaryBoxEmpty ()
 This method returns true, if the boundary box is empty, otherwise false. More...
 
virtual void computeBoundaryBox (const bool a_includeChildren=true)
 This method computes this object's boundary box, optionally forcing it to bound child objects. More...
 
virtual void setShowFrame (const bool a_showFrame, const bool a_affectChildren=false)
 This method enables or disables the graphic display of the reference frame arrows for this object, optionally propagating the change to its children. More...
 
bool getShowFrame (void) const
 This method returns true if the display of the reference frame is enabled, false otherwise. More...
 
virtual void setFrameSize (const double a_size=1.0, const bool a_affectChildren=false)
 This method sets the size of the rendered reference frame, optionally propagating the change to its children. More...
 
double getFrameSize () const
 This method returns the size of the graphical reference frame. More...
 
void setCollisionDetector (cGenericCollision *a_collisionDetector)
 This method sets a collision detector to this current object. More...
 
cGenericCollisiongetCollisionDetector () const
 This method returns a pointer to this object's current collision detector. More...
 
virtual void deleteCollisionDetector (const bool a_affectChildren=false)
 This method deletes any existing collision detector. More...
 
virtual bool computeCollisionDetection (const cVector3d &a_segmentPointA, const cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
 This method computes any collision between a segment and this object. More...
 
virtual void setShowCollisionDetector (const bool a_showCollisionDetector, const bool a_affectChildren=false)
 This method enables or disables the display of the collision detector, optionally propagating the change to its children. More...
 
bool getShowCollisionDetector ()
 This method returns true if the collision detector is being displayed graphically, false otherwise. More...
 
virtual void setCollisionDetectorProperties (unsigned int a_displayDepth, cColorf &a_color, const bool a_affectChildren=false)
 This method sets the collision detector graphic display properties. More...
 
void setParent (cGenericObject *a_parent)
 This method sets the parent of this object. More...
 
cGenericObjectgetParent () const
 This method returns the parent of this object. More...
 
void setOwner (cGenericObject *a_owner)
 This method sets a link to an object that owns this object. This could be a super parent for instance. More...
 
cGenericObjectgetOwner ()
 This method returns the owner of this object. More...
 
cGenericObjectgetChild (const unsigned int a_index) const
 This method returns a selected child from the list of children. More...
 
bool addChild (cGenericObject *a_object)
 This method add an object to the list of children. More...
 
bool removeChild (cGenericObject *a_object)
 This method removes an object from the list of children, without deleting it. More...
 
bool removeFromGraph ()
 This method removes this object from its parent's list of children. More...
 
bool deleteChild (cGenericObject *a_object)
 This method removes an object from its list of children and deletes it. More...
 
void clearAllChildren ()
 This method clears all objects from its list of children, without deleting them. More...
 
void deleteAllChildren ()
 This method clears and delete all objects from its list of children. More...
 
unsigned int getNumChildren ()
 This method returns the number of children from its list of children. More...
 
unsigned int getNumDescendants (bool a_includeCurrentObject=false)
 This method returns the total number of descendants, optionally including this object. More...
 
void setGhostEnabled (bool a_ghostEnabled)
 This method enables or disables this object to be a ghost node. More...
 
bool getGhostEnabled ()
 This method returns truee if this object is a ghost node. More...
 
virtual void scale (const double &a_scaleFactor, const bool a_affectChildren=true)
 This method scales the size of this object. More...
 
virtual void renderSceneGraph (cRenderOptions &a_options)
 This method renders the entire scene graph, starting from this object. More...
 
virtual void adjustCollisionSegment (cVector3d &a_segmentPointA, cVector3d &a_segmentPointAadjusted)
 This method adjusts the collision segment to handle objects in motion. More...
 
virtual cVector3d computeInteractions (const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN, cInteractionRecorder &a_interactions)
 This method computes all haptic interaction between a tool and this object using the haptic effects. More...
 
- Public Member Functions inherited from chai3d::cGenericType
 cGenericType ()
 Constructor of cGenericType. More...
 
virtual ~cGenericType ()
 Destructor of cGenericType. More...
 

Public Attributes

cVector3d m_minCorner
 Corner with minimum position coordinate. More...
 
cVector3d m_maxCorner
 Corner with maximum position coordinate. More...
 
cVector3d m_minTextureCoord
 Texture coordinate at point v000 (minimum corner). More...
 
cVector3d m_maxTextureCoord
 Texture coordinate at point v111 (maximum corner). More...
 
cTexture1dPtr m_colorMap
 Color Map. (Lookup table) More...
 
- Public Attributes inherited from chai3d::cMesh
cColorf m_normalsColor
 Color used to render lines representing normals. More...
 
cColorf m_edgeLineColor
 Color used to render lines representing edges. More...
 
cVertexArrayPtr m_vertices
 Array of vertices. More...
 
cTriangleArrayPtr m_triangles
 Array of triangles. More...
 
std::vector< cEdge > m_edges
 Array of Edges. More...
 
- Public Attributes inherited from chai3d::cGenericObject
std::string m_name
 Name of current object (filename). More...
 
cMaterialPtr m_material
 Material property. More...
 
cTexture1dPtr m_texture
 Texture property. More...
 
cNormalMapPtr m_normalMap
 Normal map property. More...
 
int m_userTag
 An arbitrary tag, not used by CHAI3D. More...
 
void * m_userData
 An arbitrary data pointer, not used by CHAI3D. More...
 
std::string m_userName
 Name of current object, not used by CHAI3D. More...
 
cGenericObjectm_userExternalObject
 A link to an external cGenericObject object, not used by CHAI3D. More...
 
cVector3d m_interactionPoint
 Projection of the most recent haptic point (tool) onto the surface of the virtual object. More...
 
cVector3d m_interactionNormal
 Surface normal at the current interaction point. More...
 
bool m_interactionInside
 Was the last tool (haptic point) located inside the object? More...
 

Protected Member Functions

void loadRenderingShaders ()
 This method loads all rendering shaders. More...
 
void update (cRenderOptions &a_options)
 This method updates the mesh model. More...
 
virtual void render (cRenderOptions &a_options)
 This method renders the object graphically using OpenGL. More...
 
virtual bool computeOtherCollisionDetection (cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
 This method computes any collision between a segment and this object. More...
 
- Protected Member Functions inherited from chai3d::cMesh
virtual void renderNormals (cRenderOptions &a_options)
 This method draws a small line for each vertex normal. More...
 
virtual void renderTangents (cRenderOptions &a_options)
 This method draws a small line for each tangent and bi-tangent. More...
 
virtual void renderEdges (cRenderOptions &a_options)
 This method draws all edges of the mesh. More...
 
virtual void renderMesh (cRenderOptions &a_options)
 This method renders all triangles, material and texture properties. More...
 
virtual void updateGlobalPositions (const bool a_frameOnly)
 This method updates the global position of each vertex. More...
 
virtual void updateBoundaryBox ()
 This method updates the boundary box dimensions based on the vertices. More...
 
void copyMeshProperties (cMesh *a_obj, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
 This method copies all properties of this mesh to another. More...
 
virtual void scaleObject (const double &a_scaleFactor)
 This method scales this object by a scale factor. More...
 
void computeLocalInteraction (const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN)
 This method updates the relationship between the tool and the current object. More...
 
- Protected Member Functions inherited from chai3d::cGenericObject
virtual cVector3d computeOtherInteractions (const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN, cInteractionRecorder &a_interactions)
 This method computes any additional interactions between the object and the tools. More...
 
void copyGenericObjectProperties (cGenericObject *a_objDest, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
 This method copies all properties of the current generic object to another. More...
 

Protected Attributes

cVector3d m_edges [12][2]
 List of edges. More...
 
double m_quality
 Quality of the displayed graphical model. More...
 
float m_isosurfaceValue
 Isosurface value. More...
 
float m_voxelOpacity
 Voxel opacity value. More...
 
float m_opacityThreshold
 Opacity threshold. This value is the opacity accumulated along the ray before the shader decides to stop casting. More...
 
float m_opticalDensity
 Optical density factor. More...
 
int m_renderingMode
 Rendering mode. More...
 
bool m_useLinearInterpolation
 If true use linear interpolation, otherwise used nearest voxel. More...
 
bool m_useColorMap
 If true use color mapping. More...
 
std::vector< cVoxelCoordList > m_voxelCoordList
 List of points. More...
 
bool m_flagShadersInitialized
 Flag that indicates if shaders have been initialized. More...
 
cShaderPtr m_vertexShaders [C_NUM_VOXEL_RENDERING_MODES]
 Vertex shaders. More...
 
cShaderPtr m_fragmentShaders [C_NUM_VOXEL_RENDERING_MODES]
 Fragment shaders. More...
 
cShaderProgramPtr m_programShaders [C_NUM_VOXEL_RENDERING_MODES]
 Program shaders. More...
 
- Protected Attributes inherited from chai3d::cMesh
bool m_showTriangles
 If true, then triangles are displayed. More...
 
bool m_showNormals
 If true, then normals are displayed. More...
 
bool m_showTangents
 If true, then tangents and bitangents are displayed. More...
 
double m_normalsLength
 Length of each normal (for graphic rendering of normals). More...
 
bool m_showEdges
 If true, then show edges. More...
 
double m_edgeLineWidth
 Width of edge lines. More...
 
cDisplayList m_displayListEdges
 Display list for edges. More...
 
- Protected Attributes inherited from chai3d::cGenericObject
cGenericObjectm_parent
 Parent object. More...
 
cGenericObjectm_owner
 
std::vector< cGenericObject * > m_children
 List of children. More...
 
cVector3d m_localPos
 The position of this object in my parent's reference frame. More...
 
cVector3d m_globalPos
 The position of this object in the world's reference frame. More...
 
cMatrix3d m_localRot
 The rotation matrix that rotates my reference frame into my parent's reference frame. More...
 
cMatrix3d m_globalRot
 The rotation matrix that rotates my reference frame into the world's reference frame. More...
 
cVector3d m_prevGlobalPos
 Previous position since last haptic computation. More...
 
cMatrix3d m_prevGlobalRot
 Previous rotation since last haptic computation. More...
 
cVector3d m_boundaryBoxMin
 Minimum position of boundary box. More...
 
cVector3d m_boundaryBoxMax
 Maximum position of boundary box. More...
 
bool m_boundaryBoxEmpty
 If true, then the boundary box does not include any object. More...
 
double m_frameSize
 Size of graphical representation of frame (X-Y-Z). More...
 
double m_frameThicknessScale
 Pen thickness of graphical representation of frame (X-Y-Z). More...
 
bool m_enabled
 If true, the object may be rendered graphically and haptically. More...
 
bool m_showEnabled
 If true, this object is rendered. More...
 
bool m_hapticEnabled
 If true, this object can be felt. More...
 
bool m_ghostEnabled
 If true, object is enabled as ghost. More...
 
bool m_showFrame
 If true, this object's reference frame is rendered as a set of arrows. More...
 
bool m_showBoundaryBox
 If true, this object's boundary box is displayed as a set of lines. More...
 
bool m_showCollisionDetector
 If true, the collision detector is displayed (if available) at this node. More...
 
bool m_useTextureMapping
 Should texture mapping be used? More...
 
bool m_useMaterialProperty
 Should material properties be used? More...
 
bool m_useVertexColors
 Should per-vertex colors be used? More...
 
bool m_useDisplayList
 Should we use a display list to render this mesh? More...
 
cDisplayList m_displayList
 Basic display list for current object. More...
 
int m_triangleMode
 The polygon rendering mode (GL_FILL or GL_LINE). More...
 
bool m_useTransparency
 
bool m_cullingEnabled
 
cShaderProgramPtr m_shaderProgram
 Shader program. More...
 
cTransform m_frameGL
 OpenGL matrix describing my position and orientation transformation. More...
 
cGenericCollisionm_collisionDetector
 The collision detector used to test for contact with this object. More...
 
std::vector< cGenericEffect * > m_effects
 List of haptic effects programmed for this object. More...
 

Additional Inherited Members

- Static Public Attributes inherited from chai3d::cGenericObject
static cColorf s_boundaryBoxColor
 Color of the boundary box. More...
 
- Static Protected Attributes inherited from chai3d::cGenericObject
static cMaterialPtr s_defaultMaterial = nullptr
 Default material property. More...
 

Detailed Description

This class implements a 3D volumetric object composed of voxels.

Constructor & Destructor Documentation

chai3d::cVoxelObject::cVoxelObject ( )

Constructor of cVoxelObject.

chai3d::cVoxelObject::~cVoxelObject ( )
virtual

Destructor of cVoxelObject.

Member Function Documentation

void chai3d::cVoxelObject::setRenderingModeBasic ( )

This method sets the basic rendering mode without shader.

void chai3d::cVoxelObject::setRenderingModeVoxelColors ( )

This method sets a basic voxel renderer with shader.

void chai3d::cVoxelObject::setRenderingModeVoxelColorMap ( )

This method sets a basic voxel renderer with shader and colormap.

void chai3d::cVoxelObject::setRenderingModeIsosurfaceMaterial ( )

This method sets an isosurface renderer using shader and material color.

void chai3d::cVoxelObject::setRenderingModeIsosurfaceColors ( )

This method sets an isosurface renderer using a shader and individual voxel colors.

void chai3d::cVoxelObject::setRenderingModeIsosurfaceColorMap ( )

This method sets an isosurface renderer using a shader and colormap.

void chai3d::cVoxelObject::setRenderingModeDVRColorMap ( )

This method sets a direct volume renderer with color map.

void chai3d::cVoxelObject::setRenderingModeCustom ( )

This method sets a custom shader renderer.

void chai3d::cVoxelObject::setQuality ( const double  a_quality)
inline
double chai3d::cVoxelObject::getQuality ( )
inline
void chai3d::cVoxelObject::setIsosurfaceValue ( const float  a_isosurfaceValue)
inline
float chai3d::cVoxelObject::getIsosurfaceValue ( )
inline
void chai3d::cVoxelObject::setVoxelOpacity ( const float  a_voxelOpacity)
inline
float chai3d::cVoxelObject::getVoxelOpacity ( )
inline
void chai3d::cVoxelObject::setOpacityThreshold ( const float  a_opacityThreshold)
inline
float chai3d::cVoxelObject::getOpacityThreshold ( )
inline
void chai3d::cVoxelObject::setOpticalDensity ( const float  a_opticalDensity)
inline
float chai3d::cVoxelObject::getOpticalDensity ( )
inline
void chai3d::cVoxelObject::setUseLinearInterpolation ( const bool  a_useLinearInterpolation)
inline
bool chai3d::cVoxelObject::getUseLinearInterpolation ( )
inline
void chai3d::cVoxelObject::setUseColorMap ( const bool  a_useColorMap)
inline
bool chai3d::cVoxelObject::getUseColorMap ( ) const
inline
bool chai3d::cVoxelObject::polygonize ( cMesh a_mesh,
double  a_gridSizeX = -1.0,
double  a_gridSizeY = -1.0,
double  a_gridSizeZ = -1.0 
)

This method converts this voxel object into a triangle mesh.

Parameters
a_meshMesh object.
a_gridSizeXSampling grid size along x-axis
a_gridSizeYSampling grid size along y-axis
a_gridSizeZSampling grid size along z-axis
Returns
true of the operation succeeds, __false__otherwise.
bool chai3d::cVoxelObject::polygonize ( cMultiMesh a_multiMesh,
double  a_gridSizeX = -1.0,
double  a_gridSizeY = -1.0,
double  a_gridSizeZ = -1.0 
)

This method converts this voxel object into a triangle multi-mesh.

Parameters
a_multiMeshMulti-mesh.
a_gridSizeXSampling grid size along x-axis
a_gridSizeYSampling grid size along y-axis
a_gridSizeZSampling grid size along z-axis
Returns
true of the operation succeeds, __false__otherwise.
void chai3d::cVoxelObject::loadRenderingShaders ( )
protected

This method initializes all shader programs that are used to render the voxel object. Each mode has its own shader, except for mode 0, which uses classic OpenGL rendering.

void chai3d::cVoxelObject::update ( cRenderOptions a_options)
protected

This method updates the mesh model.

void chai3d::cVoxelObject::render ( cRenderOptions a_options)
protectedvirtual

This method renders the object using OpenGL

Parameters
a_optionsRender options.

Reimplemented from chai3d::cMesh.

bool chai3d::cVoxelObject::computeOtherCollisionDetection ( cVector3d a_segmentPointA,
cVector3d a_segmentPointB,
cCollisionRecorder a_recorder,
cCollisionSettings a_settings 
)
protectedvirtual

This method determines whether a given segment intersects this object or any of its descendants.
The segment is described by a start point a_segmentPointA and end point a_segmentPointB.
All detected collisions are reported in the collision recorder passed by argument a_recorder.
Specifications about the type of collisions reported are specified by argument a_settings.

Parameters
a_segmentPointAStart point of segment.
a_segmentPointBEnd point of segment.
a_recorderRecorder which stores all collision events.
a_settingsCollision settings information.
Returns
true if one or more collisions have occurred, false otherwise.

Reimplemented from chai3d::cGenericObject.

Member Data Documentation

cVector3d chai3d::cVoxelObject::m_minCorner
cVector3d chai3d::cVoxelObject::m_maxCorner
cVector3d chai3d::cVoxelObject::m_minTextureCoord
cVector3d chai3d::cVoxelObject::m_maxTextureCoord
cTexture1dPtr chai3d::cVoxelObject::m_colorMap
cVector3d chai3d::cVoxelObject::m_edges[12][2]
protected
double chai3d::cVoxelObject::m_quality
protected
float chai3d::cVoxelObject::m_isosurfaceValue
protected
float chai3d::cVoxelObject::m_voxelOpacity
protected
float chai3d::cVoxelObject::m_opacityThreshold
protected
float chai3d::cVoxelObject::m_opticalDensity
protected
int chai3d::cVoxelObject::m_renderingMode
protected
bool chai3d::cVoxelObject::m_useLinearInterpolation
protected
bool chai3d::cVoxelObject::m_useColorMap
protected
std::vector<cVoxelCoordList> chai3d::cVoxelObject::m_voxelCoordList
protected
bool chai3d::cVoxelObject::m_flagShadersInitialized
protected
cShaderPtr chai3d::cVoxelObject::m_vertexShaders[C_NUM_VOXEL_RENDERING_MODES]
protected
cShaderPtr chai3d::cVoxelObject::m_fragmentShaders[C_NUM_VOXEL_RENDERING_MODES]
protected
cShaderProgramPtr chai3d::cVoxelObject::m_programShaders[C_NUM_VOXEL_RENDERING_MODES]
protected

The documentation for this class was generated from the following files: