chai3d::cGenericObject Class Reference

This class implements a base class for all 2D or 3D objects in CHAI3D. More...

#include <CGenericObject.h>

Inheritance diagram for chai3d::cGenericObject:

Public Member Functions

 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 cGenericObjectcopy (const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=true)
 This method creates a copy of itself. 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 setTransparencyLevel (const float a_level, const bool a_applyToVertices=false, const bool a_applyToTextures=false, const bool a_affectChildren=false)
 This method sets the transparency level of the object. 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 markForUpdate (const bool a_affectChildren=false)
 This method invalidates any existing display lists, optionally propagating the operation to its children. 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

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...
 

Static Public Attributes

static cColorf s_boundaryBoxColor
 Color of the boundary box. More...
 

Protected Member Functions

virtual void render (cRenderOptions &a_options)
 This method renders this object graphically using OpenGL. More...
 
virtual void updateGlobalPositions (const bool a_frameOnly)
 This method update the global position information about this object. More...
 
virtual void updateBoundaryBox ()
 This method updates the boundary box of this object. More...
 
virtual void scaleObject (const double &a_scaleFactor)
 This method scales the size of this object with given scale factor. More...
 
virtual void computeLocalInteraction (const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN)
 This method updates the geometric relationship between the tool and the current object. More...
 
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...
 
virtual bool computeOtherCollisionDetection (cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
 This method computes any additional collisions other than the ones computed by the default collision detector. 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

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...
 

Static Protected Attributes

static cMaterialPtr s_defaultMaterial = nullptr
 Default material property. More...
 

Friends

class cMultiMesh
 

Detailed Description

This class is the root of basically every render-able object in CHAI3D. It defines a reference frame (position and rotation) and virtual methods for rendering, which are overloaded by useful subclasses.
This class also defines basic methods for maintaining a scene graph, and propagating rendering passes and reference frame changes through a hierarchy of cGenericObjects.
The most important methods to look at here are probably the virtual methods, which are listed last in CGenericObject.h. These methods will be called on each cGenericObject as operations propagate through the scene graph.

Constructor & Destructor Documentation

chai3d::cGenericObject::cGenericObject ( )

Constructor of cGenericObject.

chai3d::cGenericObject::~cGenericObject ( )
virtual

Destructor of cGenericObject.
Deletes all children starting from this point in the scene graph, so if you have objects that shouldn't be deleted, be sure to remove them from the scene graph before deleting their parents.

Member Function Documentation

void chai3d::cGenericObject::setEnabled ( bool  a_enabled,
const bool  a_affectChildren = false 
)
virtual

This method enables or disables this object.
When an object is disabled, haptic and graphic rendering are no longer performed through the scenegraph and the object is simply ignored. Other operations however will still be active.
Enabling or disabling an object will not affect child objects, unless explicitly specified.

Parameters
a_enabledIf true then object is enabled, false otherwise.
a_affectChildrenIf true, then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getEnabled ( ) const
inline
virtual cGenericObject* chai3d::cGenericObject::copy ( const bool  a_duplicateMaterialData = false,
const bool  a_duplicateTextureData = false,
const bool  a_duplicateMeshData = false,
const bool  a_buildCollisionDetector = true 
)
inlinevirtual
virtual void chai3d::cGenericObject::setLocalPos ( const cVector3d a_localPos)
inlinevirtual
void chai3d::cGenericObject::setLocalPos ( const double  a_x = 0.0,
const double  a_y = 0.0,
const double  a_z = 0.0 
)
inline
cVector3d chai3d::cGenericObject::getLocalPos ( ) const
inline
cVector3d chai3d::cGenericObject::getGlobalPos ( ) const
inline
virtual void chai3d::cGenericObject::setLocalRot ( const cMatrix3d a_localRot)
inlinevirtual
cMatrix3d chai3d::cGenericObject::getLocalRot ( ) const
inline
cMatrix3d chai3d::cGenericObject::getGlobalRot ( ) const
inline
void chai3d::cGenericObject::setLocalTransform ( const cTransform a_transform)
inline
cTransform chai3d::cGenericObject::getLocalTransform ( )
inline
cTransform chai3d::cGenericObject::getGlobalTransform ( )
inline
void chai3d::cGenericObject::translate ( const cVector3d a_translation)

This method translate this object by a specified offset passed as argument.

Parameters
a_translationTranslation offset.
void chai3d::cGenericObject::translate ( const double  a_x,
const double  a_y,
const double  a_z = 0.0 
)

This method translates an object by a specified offset passed as argument.

Parameters
a_xTranslation component X.
a_yTranslation component Y.
a_zTranslation component Z.
void chai3d::cGenericObject::rotateAboutLocalAxisRad ( const cVector3d a_axis,
const double  a_angleRad 
)

This method rotates this object around a specified rotation axis and angle. The axis is expressed in local coordinates.

Parameters
a_axisRotation axis. This vector must be normalized!
a_angleRadRotation angle in defined in radians.
void chai3d::cGenericObject::rotateAboutLocalAxisDeg ( const cVector3d a_axis,
const double  a_angleDeg 
)
inline
void chai3d::cGenericObject::rotateAboutLocalAxisRad ( const double  a_axisX,
const double  a_axisY,
const double  a_axisZ,
const double  a_angleRad 
)
inline
void chai3d::cGenericObject::rotateAboutLocalAxisDeg ( const double  a_axisX,
const double  a_axisY,
const double  a_axisZ,
const double  a_angleDeg 
)
inline
void chai3d::cGenericObject::rotateAboutGlobalAxisRad ( const cVector3d a_axis,
const double  a_angleRad 
)

This method rotates this object around a specified rotation axis and angle. The axis is expressed in global coordinates.

Parameters
a_axisRotation axis. This vector must be normalized!
a_angleRadRotation angle in defined in radians.
void chai3d::cGenericObject::rotateAboutGlobalAxisDeg ( const cVector3d a_axis,
const double  a_angleDeg 
)
inline
void chai3d::cGenericObject::rotateAboutGlobalAxisRad ( const double  a_axisX,
const double  a_axisY,
const double  a_axisZ,
const double  a_angleRad 
)
inline
void chai3d::cGenericObject::rotateAboutGlobalAxisDeg ( const double  a_axisX,
const double  a_axisY,
const double  a_axisZ,
const double  a_angleDeg 
)
inline
void chai3d::cGenericObject::rotateExtrinsicEulerAnglesRad ( const double &  a_angleRad1,
const double &  a_angleRad2,
const double &  a_angleRad3,
const cEulerOrder  a_eulerOrder 
)

This method builds a rotation matrix from a set of Euler angles and fixed axes of rotations.

Parameters
a_angleRad1Angle in radians of the first rotation in the sequence.
a_angleRad2Angle in radians of the second rotation in the sequence.
a_angleRad3Angle in radians of the third rotation in the sequence.
a_eulerOrderThe order of the axes about which the rotations are to be applied
void chai3d::cGenericObject::rotateExtrinsicEulerAnglesDeg ( const double &  a_angleDeg1,
const double &  a_angleDeg2,
const double &  a_angleDeg3,
const cEulerOrder  a_eulerOrder 
)
inline
void chai3d::cGenericObject::rotateIntrinsicEulerAnglesRad ( const double &  a_angleRad1,
const double &  a_angleRad2,
const double &  a_angleRad3,
const cEulerOrder  a_eulerOrder 
)

This method builds a rotation matrix from a set of Euler angles and co-moving axes of rotations.

Parameters
a_angleRad1Angle in radians of the first rotation in the sequence.
a_angleRad2Angle in radians of the second rotation in the sequence.
a_angleRad3Angle in radians of the third rotation in the sequence.
a_eulerOrderThe order of the axes about which the rotations are to be applied.
void chai3d::cGenericObject::rotateIntrinsicEulerAnglesDeg ( const double &  a_angleDeg1,
const double &  a_angleDeg2,
const double &  a_angleDeg3,
const cEulerOrder  a_eulerOrder 
)
inline
void chai3d::cGenericObject::computeGlobalPositions ( const bool  a_frameOnly = true,
const cVector3d a_globalPos = cVector3d(0.0, 0.0, 0.0),
const cMatrix3d a_globalRot = cIdentity3d() 
)
virtual

This method computes the global position and global rotation matrix given the local position and location rotation of this object, and the global configuration of its parent.
If a_frameOnly is set to false, additional global positions such as vertex positions are computed too (which may be time-consuming!).

Parameters
a_frameOnlyIf true then only the global frame is computed
a_globalPosGlobal position of parent object.
a_globalRotGlobal rotation matrix of parent object.
void chai3d::cGenericObject::computeGlobalPositionsFromRoot ( const bool  a_frameOnly = true)

This method computes the global position and global rotation for this object only, by recursively climbing up the scene graph tree until the root is reached.

If argument a_frameOnly is set to false, additional global positions such as vertex positions are computed.

Parameters
a_frameOnlyIf true then only the global frame is computed.
bool chai3d::cGenericObject::addEffect ( cGenericEffect a_effect)

This method adds a haptic effect to this object.

Parameters
a_effectHaptic effect to be added to the list.
bool chai3d::cGenericObject::removeEffect ( cGenericEffect a_effect)

This method removes a haptic effect from this object.

Parameters
a_effectHaptic effect to be removed from the list of effects.
void chai3d::cGenericObject::deleteAllEffects ( )

This method deletes all haptic effects and removes them from the list.

bool chai3d::cGenericObject::createEffectMagnetic ( )

This method creates a magnetic haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::deleteEffectMagnetic ( )

This method deletes the magnetic haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::createEffectStickSlip ( )

This method creates a stick-and-slip haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::deleteEffectStickSlip ( )

This method deletes the stick-and-slip haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::createEffectSurface ( )

This method creates a surface haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::deleteEffectSurface ( )

This method deletes the surface haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::createEffectVibration ( )

This method creates a vibration haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::deleteEffectVibration ( )

This method deletes the current vibration haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::createEffectViscosity ( )

This method creates a viscous haptic effect.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cGenericObject::deleteEffectViscosity ( )

This method deletes the current viscous haptic effect.

Returns
true if the operation succeeds, false otherwise.
void chai3d::cGenericObject::setHapticEnabled ( const bool  a_hapticEnabled,
const bool  a_affectChildren = true 
)
virtual

This method enables or disables the object to be felt haptically.
If argument a_affectChildren is set to true then all children are updated with the new value.

Parameters
a_hapticEnabledIf true then the object can be touched when visible.
a_affectChildrenIf true then all children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getHapticEnabled ( ) const
inline
void chai3d::cGenericObject::setStiffness ( const double  a_stiffness,
const bool  a_affectChildren = true 
)
virtual

This method sets the haptic stiffness for this object, optionally recursively affecting children.

Parameters
a_stiffnessThe stiffness to apply to this object.
a_affectChildrenIf true, then children are updated too.

Reimplemented in chai3d::cMultiMesh.

void chai3d::cGenericObject::setFriction ( double  a_staticFriction,
double  a_dynamicFriction,
const bool  a_affectChildren = true 
)
virtual

This method sets the static and dynamic friction properties for this object, optionally recursively affecting children.

Parameters
a_staticFrictionThe static friction to apply to this object.
a_dynamicFrictionThe dynamic friction to apply to this object.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

void chai3d::cGenericObject::setShowEnabled ( const bool  a_show,
const bool  a_affectChildren = true 
)
virtual

This method graphically shows or hides this object, optionally recursively affecting children.

Parameters
a_showIf true then object is visible.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getShowEnabled ( ) const
inline
void chai3d::cGenericObject::setWireMode ( const bool  a_showWireMode,
const bool  a_affectChildren = false 
)
virtual

This method enables or disables wireframe rendering, optionally propagating the operation to children.

Parameters
a_showWireModeIf true then wireframe mode is used.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getWireMode ( ) const
inline
void chai3d::cGenericObject::setUseCulling ( const bool  a_useCulling,
const bool  a_affectChildren = false 
)
virtual

This method enables or disables back face culling.
Rendering in OpenGL is much faster with culling enabled.

Parameters
a_useCullingIf true then back faces are culled.
a_affectChildrenIf true then then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getUseCulling ( ) const
inline
void chai3d::cGenericObject::setUseTransparency ( const bool  a_useTransparency,
const bool  a_affectChildren = false 
)
virtual

This method specifies whether transparency is enabled. If transparency is enabled then make sure that multi-pass rendering is enabled too. For more information, see class cCamera.

Parameters
a_useTransparencyIf true then transparency is enabled.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getUseTransparency ( ) const
inline
void chai3d::cGenericObject::setTransparencyLevel ( const float  a_level,
const bool  a_applyToVertices = false,
const bool  a_applyToTextures = false,
const bool  a_affectChildren = false 
)
virtual

This method sets the alpha value to all components of the object, optionally propagating the operation to children.
Using the 'apply to textures' option causes the actual texture alpha values to be over-written in my texture, if it exists.

Parameters
a_levelLevel of transparency ranging from 0.0 to 1.0.
a_applyToTexturesIf true, then apply changes to texture pixels.
a_applyToVerticesIf true, then apply changes to vertex colors.
a_affectChildrenIf true, then children are updated too.

Reimplemented in chai3d::cPanel, chai3d::cMultiSegment, chai3d::cMultiPoint, chai3d::cMultiMesh, and chai3d::cMesh.

void chai3d::cGenericObject::setUseDisplayList ( const bool  a_useDisplayList,
const bool  a_affectChildren = false 
)
virtual

This method enables the use of display lists for mesh rendering. Display lists significantly speed up rendering for large meshes, but it means that any changes that are made on the object (e.g changing vertex positions) will not take effect until you invalidate the existing display list by calling markForUpdate().

Parameters
a_useDisplayListIf true then a display list is created (cMesh).
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getUseDisplayList ( ) const
inline
void chai3d::cGenericObject::markForUpdate ( const bool  a_affectChildren = false)
virtual

This method invalidates any existing display lists. You should call this on if you're using display lists and you modify mesh options, vertex positions, etc.

Parameters
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiSegment, chai3d::cMultiPoint, chai3d::cMultiMesh, and chai3d::cMesh.

void chai3d::cGenericObject::setUseVertexColors ( const bool  a_useColors,
const bool  a_affectChildren = false 
)
virtual

This method enables or disables the use of per-vertex color information of when rendering the mesh.

Parameters
a_useColorsIf true then then vertex color information is applied.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getUseVertexColors ( ) const
inline
void chai3d::cGenericObject::setUseMaterial ( const bool  a_useMaterial,
const bool  a_affectChildren = false 
)
virtual

This method enables or disables the use of material properties.

Parameters
a_useMaterialIf true then material properties are used for rendering.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getUseMaterial ( ) const
inline
void chai3d::cGenericObject::setMaterial ( cMaterialPtr  a_material,
const bool  a_affectChildren = false 
)
virtual

This method copies all material properties defined in a_material to the material structure of this object.
Note that this does not affect whether material rendering is enabled; it sets the material that will be rendered if material rendering is enabled. Call method setUseMaterial() to enable or disable material rendering.

Parameters
a_materialThe material to apply to this object.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

void chai3d::cGenericObject::setMaterial ( cMaterial a_material,
const bool  a_affectChildren = false 
)
virtual

This method copies all material properties defined in a_material to the material structure of this object.
Note that this does not affect whether material rendering is enabled; it sets the material that will be rendered if material rendering is enabled. Call method setUseMaterial() to enable or disable material rendering.

Parameters
a_materialThe material to apply to this object
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

void chai3d::cGenericObject::backupMaterialColors ( const bool  a_affectChildren = false)
virtual

This method creates a backup of the material color properties of this object, optionally recursively affecting children.

Parameters
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

void chai3d::cGenericObject::restoreMaterialColors ( const bool  a_affectChildren = false)
virtual

This method restores material color properties for this object, optionally recursively affecting children.

Parameters
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

void chai3d::cGenericObject::setUseTexture ( const bool  a_useTexture,
const bool  a_affectChildren = false 
)
virtual

This method enables or disables texture-mapping, optionally recursively affecting children.

Parameters
a_useTextureIf true then texture mapping is used.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getUseTexture ( ) const
inline
void chai3d::cGenericObject::setTexture ( cTexture1dPtr  a_texture,
const bool  a_affectChildren = false 
)
virtual

This method sets the current texture for this mesh, optionally recursively affecting children.
Note that this does not affect whether texturing is enabled; it sets the texture that will be rendered if texturing is enabled. Call method setUseTexture() to enable or disable texturing.

Parameters
a_textureThe texture to apply to this object.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

void chai3d::cGenericObject::setShaderProgram ( cShaderProgramPtr  a_shaderProgram,
const bool  a_affectChildren = false 
)
virtual

This method assigns a shader program to this object.
If a_affectChildren is set to true then all children are assigned with the shader program.

Parameters
a_shaderProgramShader program to be assigned to object.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cGenericTool, and chai3d::cMultiMesh.

virtual cShaderProgramPtr chai3d::cGenericObject::getShaderProgram ( )
inlinevirtual
void chai3d::cGenericObject::setShowBoundaryBox ( const bool  a_showBoundaryBox,
const bool  a_affectChildren = false 
)
virtual

This method enables or disables the graphic representation of the boundary box of this object.
If a_affectChildren is set to true then all children are updated with the new value.

Parameters
a_showBoundaryBoxIf true boundary box is displayed.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getShowBoundaryBox ( ) const
inline
cVector3d chai3d::cGenericObject::getBoundaryMin ( ) const
inline
cVector3d chai3d::cGenericObject::getBoundaryMax ( ) const
inline
cVector3d chai3d::cGenericObject::getBoundaryCenter ( ) const
inline
bool chai3d::cGenericObject::getBoundaryBoxEmpty ( )
inline
void chai3d::cGenericObject::computeBoundaryBox ( const bool  a_includeChildren = true)
virtual

This method computes the boundary box of this object and all of its children.

If argument a_includeChildren is set to true then each object's bounding box covers its own volume and the volume of its children. If it is set to false, then the object's bounding volume shall only cover its own geometrical elements.

Parameters
a_includeChildrenIf true, then children are included in the boundary volume of the parent.
void chai3d::cGenericObject::setShowFrame ( const bool  a_showFrame,
const bool  a_affectChildren = false 
)
virtual

This method enables of disables the display of the reference frame. The reference frame is a set of arrows that represent this object's position and orientation.

If argument a_affectChildren is set to true then all children are updated with the new value.

Parameters
a_showFrameIf true then frame is displayed.
a_affectChildrenIf true then children are updated too.
bool chai3d::cGenericObject::getShowFrame ( void  ) const
inline
void chai3d::cGenericObject::setFrameSize ( const double  a_size = 1.0,
const bool  a_affectChildren = false 
)
virtual

This method sets the display size of the arrows representing my reference frame. The size corresponds to the length of each displayed axis (X-Y-Z).
If argument a_affectChildren is set to true then all children are updated with the new value.

Parameters
a_sizeLength of graphical representation of frame.
a_affectChildrenIf true then children are updated too.
double chai3d::cGenericObject::getFrameSize ( ) const
inline
void chai3d::cGenericObject::setCollisionDetector ( cGenericCollision a_collisionDetector)
inline
cGenericCollision* chai3d::cGenericObject::getCollisionDetector ( ) const
inline
void chai3d::cGenericObject::deleteCollisionDetector ( const bool  a_affectChildren = false)
virtual

This method deletes any existing collision detector and sets the current collision detector to null.
It's fine for an object to have a null collision detector (that's the default for a new object, in fact), it just means that no collisions will be found.

Parameters
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::computeCollisionDetection ( const cVector3d a_segmentPointA,
const cVector3d a_segmentPointB,
cCollisionRecorder a_recorder,
cCollisionSettings a_settings 
)
virtual

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 in chai3d::cMultiMesh, and chai3d::cWorld.

void chai3d::cGenericObject::setShowCollisionDetector ( const bool  a_showCollisionDetector,
const bool  a_affectChildren = false 
)
virtual

This method enables or disables graphic representation of the collision detector at this node.
If argument a_affectChildren is set to true then all children are updated with the new value.

Parameters
a_showCollisionDetectorIf true then display collision detector graphically.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

bool chai3d::cGenericObject::getShowCollisionDetector ( )
inline
void chai3d::cGenericObject::setCollisionDetectorProperties ( unsigned int  a_displayDepth,
cColorf a_color,
const bool  a_affectChildren = false 
)
virtual

This method sets the rendering properties of the the graphic representation of the collision detector.
If argument a_affectChildren is set to true then all children are updated with the new values.

Parameters
a_colorColor used to render collision detector.
a_displayDepthIndicated which depth of collision tree needs to be displayed (see cGenericCollision).
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

void chai3d::cGenericObject::setParent ( cGenericObject a_parent)
inline
cGenericObject* chai3d::cGenericObject::getParent ( ) const
inline
void chai3d::cGenericObject::setOwner ( cGenericObject a_owner)
inline
cGenericObject* chai3d::cGenericObject::getOwner ( )
inline
cGenericObject* chai3d::cGenericObject::getChild ( const unsigned int  a_index) const
inline
bool chai3d::cGenericObject::addChild ( cGenericObject a_object)

This method adds an object to the scene graph below this object.
Note that an object can only be a child of one single object, unless )ghosting_ is enabled.

Parameters
a_objectObject to be added to child list.
Returns
true if operation succeeded.
bool chai3d::cGenericObject::removeChild ( cGenericObject a_object)

This method removes an object from the list of children, without deleting the child object from memory.
This method assigns the child object's parent point to null, so if you're moving an object around in your scene graph, make sure you call this function before you add the child to another node in the scene graph.

Parameters
a_objectObject to be removed from my list of children.
Returns
true if the specified object was found on my list of children, false otherwise.
bool chai3d::cGenericObject::removeFromGraph ( )

This method removes this object from its parent's list of children.

Returns
true if operation succeeds, false otherwise.
bool chai3d::cGenericObject::deleteChild ( cGenericObject a_object)

This method removes an object from its list of children, and deletes the child object from memory.

Parameters
a_objectObject to be removed from my list of children and deleted.
Returns
true if the specified object was found in the child list.
void chai3d::cGenericObject::clearAllChildren ( )

This method clears all objects from my list of children, without deleting them.

void chai3d::cGenericObject::deleteAllChildren ( )

This method deletes and clear all objects the list of children.

unsigned int chai3d::cGenericObject::getNumChildren ( )
inline
unsigned int chai3d::cGenericObject::getNumDescendants ( bool  a_includeCurrentObject = false)
inline

This method returns the total number of descendants, optionally including this object.

Parameters
a_includeCurrentObjectIf true then this object is included in the count.
Returns
Number of descendants found.
void chai3d::cGenericObject::setGhostEnabled ( bool  a_ghostEnabled)
inline
bool chai3d::cGenericObject::getGhostEnabled ( )
inline
void chai3d::cGenericObject::scale ( const double &  a_scaleFactor,
const bool  a_affectChildren = true 
)
virtual

This method performs a uniform scale on the object, optionally including children.

Parameters
a_scaleFactorScale factor.
a_affectChildrenIf true then children are updated too.

Reimplemented in chai3d::cMultiMesh.

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

This method render this object. Subclasses will generally override this method. This is called from renderSceneGraph, which subclasses generally do not need to override.

A word on OpenGL conventions:
CHAI3D does not re-initialize the OpenGL state at every rendering pass. The only OpenGL state variables that CHAI3D sets explicitly in a typical rendering pass are:

lighting is enabled (cWorld)
depth-testing is enabled (cWorld)
glColorMaterial is enabled and set to GL_AMBIENT_AND_DIFFUSE/GL_FRONT_AND_BACK (cWorld)
a perspective projection matrix is set up (cCamera)

This adherence to the defaults is nice because it lets an application change an important piece of state globally and not worry about it getting changed by CHAI3D objects.

It is expected that objects will "clean up after themselves" if they change any rendering state besides:

color (glColor)
material properties (glMaterial)
normals (glNormal)

For example, if my object changes the rendering color, I don't need to set it back before returning, but if my object turns on vertex buffering, I should turn it off before returning. Consequently if I care about the current color, I should set it up in my own render() function, because I shouldn't count on it being meaningful when my render() function is called.

Necessary exceptions to these conventions include:

cLight will change the lighting state for his assigned GL_LIGHT
cCamera sets up relevant transformation matrices

Parameters
a_optionsRendering options.

Reimplemented in chai3d::cGenericTool, chai3d::cMultiMesh, chai3d::cMesh, chai3d::cMultiPoint, chai3d::cMultiSegment, chai3d::cVoxelObject, chai3d::cSpotLight, chai3d::cWorld, chai3d::cScope, chai3d::cLabel, chai3d::cPositionalLight, chai3d::cShapeLine, chai3d::cGenericLight, chai3d::cShapeEllipsoid, chai3d::cShapeCylinder, chai3d::cBackground, chai3d::cShapeBox, chai3d::cShapeSphere, chai3d::cShapeTorus, chai3d::cDirectionalLight, chai3d::cToolGripper, and chai3d::cToolCursor.

virtual void chai3d::cGenericObject::updateGlobalPositions ( const bool  a_frameOnly)
inlineprotectedvirtual
virtual void chai3d::cGenericObject::scaleObject ( const double &  a_scaleFactor)
inlineprotectedvirtual
void chai3d::cGenericObject::computeLocalInteraction ( const cVector3d a_toolPos,
const cVector3d a_toolVel,
const unsigned int  a_IDN 
)
protectedvirtual

This method uses the position of the tool and searches for the nearest point located at the surface of the current object and identifies if the point is located inside or outside of the object.

Parameters
a_toolPosPosition of the tool.
a_toolVelVelocity of the tool.
a_IDNIdentification number of the force algorithm.

Reimplemented in chai3d::cMesh, chai3d::cShapeLine, chai3d::cShapeEllipsoid, chai3d::cWorld, chai3d::cShapeCylinder, chai3d::cShapeBox, chai3d::cShapeSphere, and chai3d::cShapeTorus.

virtual cVector3d chai3d::cGenericObject::computeOtherInteractions ( const cVector3d a_toolPos,
const cVector3d a_toolVel,
const unsigned int  a_IDN,
cInteractionRecorder a_interactions 
)
inlineprotectedvirtual
virtual bool chai3d::cGenericObject::computeOtherCollisionDetection ( cVector3d a_segmentPointA,
cVector3d a_segmentPointB,
cCollisionRecorder a_recorder,
cCollisionSettings a_settings 
)
inlineprotectedvirtual
void chai3d::cGenericObject::copyGenericObjectProperties ( cGenericObject a_obj,
const bool  a_duplicateMaterialData,
const bool  a_duplicateTextureData,
const bool  a_duplicateMeshData,
const bool  a_buildCollisionDetector 
)
protected

This method copies all material and texture properties from current generic object to another. This function is typically called by copy() method which duplicates an instance of a subclass of cGenericObject.

Parameters
a_objObject to which properties are copied to
a_duplicateMaterialDataIf true, material (if available) is duplicated, otherwise it is shared.
a_duplicateTextureDataIf true, texture data (if available) is duplicated, otherwise it is shared.
a_duplicateMeshDataIf true, mesh data (if available) is duplicated, otherwise it is shared.
a_buildCollisionDetectorIf true, collision detector (if available) is duplicated, otherwise it is shared.
void chai3d::cGenericObject::renderSceneGraph ( cRenderOptions a_options)
virtual

This method renders the scene graph starting at this object. This method is called for each object and optionally render the object itself, its reference frame and the collision and/or scenegraph trees.
The object itself is rendered by calling render(), which should be defined for each subclass that has a graphical representation. renderSceneGraph does not generally need to be over-ridden in subclasses.
The a_options parameter is used to allow multiple rendering passes. See CRenderOptionh.h for more information.

Parameters
a_optionsRendering options.
void chai3d::cGenericObject::adjustCollisionSegment ( cVector3d a_segmentPointA,
cVector3d a_segmentPointAadjusted 
)
virtual

This method adjusts the collision segment to take into consideration motion from an object. This feature is used by the finger-proxy algorithm to avoid "popping" through objects if their move toward the proxy while the proxy remains till.

Parameters
a_segmentPointAStart point of segment.
a_segmentPointAadjustedAdjusted start point of segment.
cVector3d chai3d::cGenericObject::computeInteractions ( const cVector3d a_toolPos,
const cVector3d a_toolVel,
const unsigned int  a_IDN,
cInteractionRecorder a_interactions 
)
virtual

This method descends through child objects to compute interactions for all cGenericEffect classes defined for each object.

Parameters
a_toolPosCurrent position of tool.
a_toolVelCurrent position of tool.
a_IDNIdentification number of the force algorithm.
a_interactionsList of recorded interactions.
Returns
Resulting interaction force.

Reimplemented in chai3d::cMultiMesh.

Friends And Related Function Documentation

friend class cMultiMesh
friend

Member Data Documentation

cColorf chai3d::cGenericObject::s_boundaryBoxColor
static
std::string chai3d::cGenericObject::m_name
cMaterialPtr chai3d::cGenericObject::m_material
cTexture1dPtr chai3d::cGenericObject::m_texture
cNormalMapPtr chai3d::cGenericObject::m_normalMap
int chai3d::cGenericObject::m_userTag
void* chai3d::cGenericObject::m_userData
std::string chai3d::cGenericObject::m_userName
cGenericObject* chai3d::cGenericObject::m_userExternalObject
cGenericObject* chai3d::cGenericObject::m_parent
protected
cGenericObject* chai3d::cGenericObject::m_owner
protected

For most objects this value is initialized to point to the object itself. In the case of cMultiMesh, all mesh objects contained in cMultimesh are owned by their parent (cMultiMesh).

std::vector<cGenericObject*> chai3d::cGenericObject::m_children
protected
cVector3d chai3d::cGenericObject::m_localPos
protected
cVector3d chai3d::cGenericObject::m_globalPos
protected
cMatrix3d chai3d::cGenericObject::m_localRot
protected
cMatrix3d chai3d::cGenericObject::m_globalRot
protected
cVector3d chai3d::cGenericObject::m_prevGlobalPos
protected
cMatrix3d chai3d::cGenericObject::m_prevGlobalRot
protected
cVector3d chai3d::cGenericObject::m_boundaryBoxMin
protected
cVector3d chai3d::cGenericObject::m_boundaryBoxMax
protected
bool chai3d::cGenericObject::m_boundaryBoxEmpty
protected
double chai3d::cGenericObject::m_frameSize
protected
double chai3d::cGenericObject::m_frameThicknessScale
protected
bool chai3d::cGenericObject::m_enabled
protected
bool chai3d::cGenericObject::m_showEnabled
protected
bool chai3d::cGenericObject::m_hapticEnabled
protected
bool chai3d::cGenericObject::m_ghostEnabled
protected
bool chai3d::cGenericObject::m_showFrame
protected
bool chai3d::cGenericObject::m_showBoundaryBox
protected
bool chai3d::cGenericObject::m_showCollisionDetector
protected
bool chai3d::cGenericObject::m_useTextureMapping
protected
bool chai3d::cGenericObject::m_useMaterialProperty
protected
bool chai3d::cGenericObject::m_useVertexColors
protected
bool chai3d::cGenericObject::m_useDisplayList
protected
cDisplayList chai3d::cGenericObject::m_displayList
protected
int chai3d::cGenericObject::m_triangleMode
protected
bool chai3d::cGenericObject::m_useTransparency
protected

If true, transparency is enabled... this turns alpha on when the mesh is rendered, and - if multipass transparency is enabled in the rendering camera - uses the camera's multiple rendering passes to approximate back-to-front sorting via culling.

bool chai3d::cGenericObject::m_cullingEnabled
protected

Should culling be used when rendering triangles?
Note that this option only applies when multipass transparency is disabled or during the non-transparent rendering pass when multipass transparency is enabled...
Also note that currently only back-faces are culled during non-transparent rendering; you can't cull front-faces.

cMaterialPtr chai3d::cGenericObject::s_defaultMaterial = nullptr
staticprotected
cShaderProgramPtr chai3d::cGenericObject::m_shaderProgram
protected
cTransform chai3d::cGenericObject::m_frameGL
protected
cGenericCollision* chai3d::cGenericObject::m_collisionDetector
protected
std::vector<cGenericEffect*> chai3d::cGenericObject::m_effects
protected
cVector3d chai3d::cGenericObject::m_interactionPoint
cVector3d chai3d::cGenericObject::m_interactionNormal
bool chai3d::cGenericObject::m_interactionInside

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