chai3d::cCamera Class Reference

This class implements a virtual camera. More...

#include <CCamera.h>

Inheritance diagram for chai3d::cCamera:

Public Member Functions

 cCamera (cWorld *a_parentWorld)
 Constructor of cCamera. More...
 
virtual ~cCamera ()
 Destructor of cCamera. More...
 
cWorldgetParentWorld ()
 This method returns a pointer to the parent world. More...
 
virtual bool selectWorld (const int a_windowPosX, const int a_windowPosY, const int a_windowWidth, const int a_windowHeight, cCollisionRecorder &a_collisionRecorder, cCollisionSettings &a_collisionSettings)
 This method queries whether the specified position is 'pointing at' any objects in the world. More...
 
virtual bool selectFrontLayer (const int a_windowPosX, const int a_windowPosY, const int a_windowWidth, const int a_windowHeight, cCollisionRecorder &a_collisionRecorder, cCollisionSettings &a_collisionSettings)
 This method queries whether the specified position is 'pointing at' any widget on the front layer. More...
 
virtual bool selectBackLayer (const int a_windowPosX, const int a_windowPosY, const int a_windowWidth, const int a_windowHeight, cCollisionRecorder &a_collisionRecorder, cCollisionSettings &a_collisionSettings)
 This method queries whether the specified position is 'pointing at' any widget on the back layer. More...
 
virtual bool selectLayers (const int a_windowPosX, const int a_windowPosY, const int a_windowWidth, const int a_windowHeight, cCollisionRecorder &a_collisionRecorder, cCollisionSettings &a_collisionSettings, bool a_checkFrontLayer=true, bool a_checkBackLayer=true)
 This method queries whether the specified position is 'pointing at' any widget on selected layers. More...
 
virtual bool set (const cVector3d &a_localPosition, const cVector3d &a_localLookAt, const cVector3d &a_localUp)
 This method set the position and orientation of the camera. More...
 
cVector3d getLookVector () const
 This method returns the camera "look at" position vector for this camera. More...
 
cVector3d getUpVector () const
 This method returns the "up" vector for this camera. More...
 
cVector3d getRightVector () const
 This method returns the "right direction" vector for this camera. More...
 
void setSphericalRad (const double &a_radius, const double &a_polarRad, const double &a_azimuthRad)
 This method sets the position and orientation of the camera in spherical coordinates in radians. More...
 
void setSphericalDeg (const double &a_radius, const double &a_polarDeg, const double &a_azimuthDeg)
 This method sets the position and orientation of the camera in spherical coordinates in degrees. More...
 
void setSphericalReferences (const cVector3d &a_originReference, const cVector3d &a_zenithReference, const cVector3d &a_azimuthReference)
 This method sets the reference vectors that define the basis of the spherical coordinate system. More...
 
void setSphericalRadius (const double &a_radius)
 This method sets the radius position of the camera (spherical coordinates). More...
 
double getSphericalRadius ()
 This method returns the radius position of the camera (spherical coordinates). More...
 
void setSphericalPolarRad (const double &a_polarRad)
 This method sets the polar position of the camera in radians (spherical coordinates). More...
 
double getSphericalPolarRad ()
 This method returns the polar position of the camera in radians (spherical coordinates). More...
 
void setSphericalPolarDeg (const double &a_polarDeg)
 This method sets the polar position of the camera in degrees (spherical coordinates). More...
 
double getSphericalPolarDeg ()
 This method returns the polar position of the camera in degrees (spherical coordinates). More...
 
void setSphericalAzimuthRad (const double &a_azimuthRad)
 This method sets the azimuth position of the camera in radians (spherical coordinates). More...
 
double getSphericalAzimuthRad ()
 This method returns the azimuth position of the camera in radians (spherical coordinates). More...
 
void setSphericalAzimuthDeg (const double &a_azimuthDeg)
 This method sets the azimuth position of the camera in degrees (spherical coordinates). More...
 
double getSphericalAzimuthDeg ()
 This method returns the azimuth position of the camera in degrees (spherical coordinates). More...
 
void setSphericalZenithReference (const cVector3d &a_zenithReference)
 This method sets the zenith reference direction vector of the camera (spherical coordinates). More...
 
cVector3d getSphericalZenithReference ()
 This method returns the zenith reference direction vector of the camera (spherical coordinates). More...
 
void setSphericalAzimuthReference (const cVector3d &a_azimuthReference)
 This method sets the azimuth reference direction vector of the camera (spherical coordinates). More...
 
cVector3d getSphericalAzimuthReference ()
 This method returns the azimuth reference direction vector of the camera (spherical coordinates). More...
 
void setSphericalOriginReference (const cVector3d &a_originReference)
 This method sets the origin target point of the camera (spherical coordinates). More...
 
cVector3d getSphericalOriginReference ()
 This method returns the origin target point of the camera (spherical coordinates). More...
 
void setClippingPlanes (const double a_distanceNear, const double a_distanceFar)
 This method sets the near and far clipping plane distances. More...
 
double getNearClippingPlane ()
 This method returns the near clipping plane distance. More...
 
double getFarClippingPlane ()
 This method returns the far clipping plane distance. More...
 
void adjustClippingPlanes ()
 This method automatically adjust back and front clipping planes. More...
 
void setOrthographicView (double a_viewWidth)
 This method sets the camera in orthographic mode. More...
 
void setFieldViewAngleDeg (double a_fieldViewAngleDeg)
 This method sets the field of view angle (in degrees). More...
 
double getFieldViewAngleDeg ()
 This method returns the field of view angle (in degrees). More...
 
void setFieldViewAngleRad (double a_fieldViewAngleRad)
 This method set the field of view angle (in radians). More...
 
double getFieldViewAngleRad ()
 This method returns the field of view angle (in radians). More...
 
double getAspectRatio ()
 This method returns the aspect ratio. More...
 
void setStereoFocalLength (double a_stereoFocalLength)
 This method sets the stereo focal length. More...
 
double getStereoFocalLength ()
 This method returns the stereo focal length. More...
 
void setStereoEyeSeparation (double a_stereoEyeSeparation)
 This method sets the stereo eye separation. More...
 
double getStereoEyeSeparation ()
 This method returns the stereo eye separation. More...
 
virtual void renderView (const int a_windowWidth, const int a_windowHeight, const cEyeMode a_eyeMode=C_STEREO_LEFT_EYE, const bool a_defaultBuffer=true)
 This method renders the the camera view in OpenGL. More...
 
void copyImageBuffer (cImagePtr a_image)
 This method copies the output image data to an image structure. More...
 
virtual void setUseMultipassTransparency (bool a_enabled)
 This method enables or disables additional rendering passes for transparency. More...
 
bool getUseMultipassTransparency ()
 This method returns true if multipass rendering is enabled, false otherwise. More...
 
int getDisplayWidth ()
 This method returns the width of the current window display in pixels. More...
 
int getDisplayHeight ()
 This method returns the height of the current window display in pixels. More...
 
void updateGPU ()
 This method resets textures and display lists for the world associated with this camera. More...
 
virtual void setStereoMode (cStereoMode a_stereoMode)
 This method sets the desired stereo mode. More...
 
cStereoMode getStereoMode ()
 This method returns the current stereo mode being used. More...
 
void setMirrorHorizontal (bool a_enabled)
 This method enables or disables output image mirroring horizontally. More...
 
void setMirrorVertical (bool a_enabled)
 This method enables or disables output image mirroring vertically. More...
 
bool getMirrorHorizontal ()
 This method returns true then output image is mirrored horizontally, false otherwise. More...
 
bool getMirrorVertical ()
 This method returns true then output image is mirrored vertically, false otherwise. More...
 
void attachAudioDevice (cAudioDevice *a_audioDevice)
 This method attaches an audio device to the camera. More...
 
void detachAudioDevice ()
 This method detaches the current audio device from the camera. 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 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

cTransform m_projectionMatrix
 Projection matrix of camera. More...
 
cTransform m_modelViewMatrix
 Modelview matrix of camera. More...
 
bool m_useCustomProjectionMatrix
 If true, then use projection matrix specified in m_projectionMatrix. More...
 
bool m_useCustomModelViewMatrix
 If true, then use projection matrix specified in m_projectionMatrix. More...
 
cWorldm_frontLayer
 Front plane scene graph which can be used to attach widgets. More...
 
cWorldm_backLayer
 Black plane scene graph which can be used to attach widgets. More...
 
cDirectionalLightm_lightFrontLayer
 Directional light for front plane. More...
 
cDirectionalLightm_lightBackLayer
 Directional light for back plane. 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 renderLayer (cGenericObject *a_graph, int a_width, int a_height)
 Renders a 2D layer within this camera's view. More...
 
- Protected Member Functions inherited from chai3d::cGenericObject
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

cWorldm_parentWorld
 Parent world. More...
 
double m_distanceNear
 Distance to near clipping plane. More...
 
double m_distanceFar
 Distance to far clipping plane. More...
 
double m_fieldViewAngleDeg
 Field of view angle expressed in degrees. More...
 
double m_orthographicWidth
 Width of orthographic view. More...
 
bool m_perspectiveMode
 If true, then camera operates in perspective mode. If false, then camera is in orthographic mode. More...
 
bool m_useMultipassTransparency
 If true, then three rendering passes are performed to approximate back-front sorting (see comment). More...
 
bool m_useShadowCasting
 If true, then shadow casting is used. More...
 
double m_stereoFocalLength
 Stereo focal length. More...
 
double m_stereoEyeSeparation
 Stereo eye separation. More...
 
cStereoMode m_stereoMode
 Stereo rendering mode. More...
 
unsigned int m_lastDisplayWidth
 Last width size of the window. More...
 
unsigned int m_lastDisplayHeight
 Last height size of the window. More...
 
bool m_markForUpdate
 If true then a display reset has been requested. More...
 
bool m_mirrorHorizontal
 If true then the output image is mirrored horizontally. More...
 
bool m_mirrorVertical
 If true then the output image is mirrored vertically. More...
 
bool m_mirrorStatus
 If true then only one of the axes is mirrored. More...
 
double m_scaleH
 Scale factor used for horizontal mirroring. (-1.0 or 1.0) More...
 
double m_scaleV
 Scale factor used for vertical mirroring. (-1.0 or 1.0) More...
 
double m_posPolarRad
 Camera polar position in radians (spherical coordinates). More...
 
double m_posAzimuthRad
 Camera azimuth position in radians (spherical coordinates). More...
 
double m_posRadius
 Camera radius position (spherical coordinates). More...
 
cVector3d m_zenithReference
 Camera zenith reference vector (spherical coordinates). More...
 
cVector3d m_azimuthReference
 Camera azimuth reference vector (spherical coordinates). More...
 
cVector3d m_originReference
 Camera origin (spherical coordinates). More...
 
cAudioDevicem_audioDevice
 Optionally attached audio device. 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

cCamera implements a virtual camera located inside the world. Its job is to set up the OpenGL projection matrix for the current OpenGL rendering context. The default camera looks down the negative x-axis.

cCamera also includes front and back layers for rendering 2D widgets. The back layer is rendered first, followed by the main scenegraph (world) containing all 3d objects. Finally the front layer is rendered at the very end. Layers are rendered through an orthographic projection matrix, so the positive z axis faces the camera. Depth is currently not used. Lighting is disabled during rendering.

Constructor & Destructor Documentation

chai3d::cCamera::cCamera ( cWorld a_parentWorld)

Constructor of cCamera.

Parameters
a_parentWorldParent world.
chai3d::cCamera::~cCamera ( )
virtual

Destructor of cCamera.
Deletes all widgets, 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

cWorld* chai3d::cCamera::getParentWorld ( )
inline
bool chai3d::cCamera::selectWorld ( const int  a_windowPosX,
const int  a_windowPosY,
const int  a_windowWidth,
const int  a_windowHeight,
cCollisionRecorder a_collisionRecorder,
cCollisionSettings a_collisionSettings 
)
virtual

This method checks for collision detection between an x-y position (typically a mouse click) and an object in the scene.

Parameters
a_windowPosXX coordinate position of mouse click.
a_windowPosYY coordinate position of mouse click.
a_windowWidthWidth of window display (pixels)
a_windowHeightHeight of window display (pixels)
a_collisionRecorderRecorder used to store all collisions between mouse and objects
a_collisionSettingsSettings related to collision detection
Returns
true if an object has been hit, false otherwise.
bool chai3d::cCamera::selectFrontLayer ( const int  a_windowPosX,
const int  a_windowPosY,
const int  a_windowWidth,
const int  a_windowHeight,
cCollisionRecorder a_collisionRecorder,
cCollisionSettings a_collisionSettings 
)
virtual

This method checks for collision detection between an x-y position (typically a mouse click) and a widget on the front layer. The (0,0) coordinate is located at the bottom left pixel on the screen.

Parameters
a_windowPosXX coordinate position of mouse click.
a_windowPosYY coordinate position of mouse click.
a_windowWidthWidth of window display (pixels)
a_windowHeightHeight of window display (pixels)
a_collisionRecorderRecorder used to store all collisions between mouse and objects
a_collisionSettingsSettings related to collision detection
Returns
true if an object has been hit, otherwise false.
bool chai3d::cCamera::selectBackLayer ( const int  a_windowPosX,
const int  a_windowPosY,
const int  a_windowWidth,
const int  a_windowHeight,
cCollisionRecorder a_collisionRecorder,
cCollisionSettings a_collisionSettings 
)
virtual

This method checks for collision detection between an x-y position (typically a mouse click) and a widget on the back layer. The (0,0) coordinate is located at the bottom left pixel on the screen.

Parameters
a_windowPosXX coordinate position of mouse click.
a_windowPosYY coordinate position of mouse click.
a_windowWidthWidth of window display (pixels)
a_windowHeightHeight of window display (pixels)
a_collisionRecorderRecorder used to store all collisions between mouse and objects
a_collisionSettingsSettings related to collision detection
Returns
true if an object has been hit, otherwise false.
bool chai3d::cCamera::selectLayers ( const int  a_windowPosX,
const int  a_windowPosY,
const int  a_windowWidth,
const int  a_windowHeight,
cCollisionRecorder a_collisionRecorder,
cCollisionSettings a_collisionSettings,
bool  a_checkFrontLayer = true,
bool  a_checkBackLayer = true 
)
virtual

This method checks for collision detection between an x-y position (typically a mouse click) and a widget on the front layer. The (0,0) coordinate is located at the bottom left pixel on the screen.

Parameters
a_windowPosXX coordinate position of mouse click.
a_windowPosYY coordinate position of mouse click.
a_windowWidthWidth of window display (pixels)
a_windowHeightHeight of window display (pixels)
a_collisionRecorderRecorder used to store all collisions between mouse and objects
a_collisionSettingsSettings related to collision detection
a_checkFrontLayerIf true, select front layer.
a_checkBackLayerIf true, select back layer.
Returns
true if an object has been hit, otherwise false.
bool chai3d::cCamera::set ( const cVector3d a_localPosition,
const cVector3d a_localLookAt,
const cVector3d a_localUp 
)
virtual

This method sets the position and orientation of the camera. Three vectors are required and passed by argument:
a_localPosition describes the position in local coordinates of the camera.
a_localLookAt describes a point at which the camera is looking at.

a_localUp orients the camera around its rolling axis. This vector always points to the top of the camera output image.
These vectors are used in the usual gluLookAt() sense.

Parameters
a_localPositionThe position of the camera in local coordinates
a_localLookAtThe Point in local space at which the camera looks
a_localUpA vector giving the rolling orientation (points toward the top of the image)
cVector3d chai3d::cCamera::getLookVector ( ) const
inline
cVector3d chai3d::cCamera::getUpVector ( ) const
inline
cVector3d chai3d::cCamera::getRightVector ( ) const
inline
void chai3d::cCamera::setSphericalRad ( const double &  a_radius,
const double &  a_polarRad,
const double &  a_azimuthRad 
)

This method sets the position and orientation of the camera in spherical coordinates. Angles are expressed in radians.

Parameters
a_radiusDistance from origin.
a_polarRadPolar angle in radians.
a_azimuthRadAzimuth angle in radians.
void chai3d::cCamera::setSphericalDeg ( const double &  a_radius,
const double &  a_polarDeg,
const double &  a_azimuthDeg 
)

This method sets the position and orientation of the camera in spherical coordinates. Angles are expressed in degrees.

Parameters
a_radiusDistance from origin.
a_polarDegPolar angle in degrees.
a_azimuthDegAzimuth angle in degrees.
void chai3d::cCamera::setSphericalReferences ( const cVector3d a_originReference,
const cVector3d a_zenithReference,
const cVector3d a_azimuthReference 
)

This method set the reference vectors that define the basis of the spherical coordinate system.

Parameters
a_originReferenceOrigin of reference system.
a_zenithReferenceZenith direction vector.
a_azimuthReferenceAzimuth direction vector.
void chai3d::cCamera::setSphericalRadius ( const double &  a_radius)

This method sets the radius position of the camera (spherical coordinates).

Parameters
a_radiusDistance from origin.
double chai3d::cCamera::getSphericalRadius ( )
inline
void chai3d::cCamera::setSphericalPolarRad ( const double &  a_polarRad)

This method sets the polar position of the camera in radians (spherical coordinates).

Parameters
a_polarRadPolar angle in radians.
double chai3d::cCamera::getSphericalPolarRad ( )
inline
void chai3d::cCamera::setSphericalPolarDeg ( const double &  a_polarDeg)

This method sets the polar position of the camera in degrees (spherical coordinates).

Parameters
a_polarDegPolar angle in degrees.
double chai3d::cCamera::getSphericalPolarDeg ( )
inline
void chai3d::cCamera::setSphericalAzimuthRad ( const double &  a_azimuthRad)

This method sets the azimuth position of the camera in radians (spherical coordinates).

Parameters
a_azimuthRadAzimuth angle in radians.
double chai3d::cCamera::getSphericalAzimuthRad ( )
inline
void chai3d::cCamera::setSphericalAzimuthDeg ( const double &  a_azimuthDeg)

This method sets the azimuth position of the camera in degrees (spherical coordinates).

Parameters
a_azimuthDegAzimuth angle in degrees.
double chai3d::cCamera::getSphericalAzimuthDeg ( )
inline
void chai3d::cCamera::setSphericalZenithReference ( const cVector3d a_zenithReference)

This method sets the zenith reference direction vector of the camera (spherical coordinates).

Parameters
a_zenithReferenceZenith reference direction.
cVector3d chai3d::cCamera::getSphericalZenithReference ( )
inline
void chai3d::cCamera::setSphericalAzimuthReference ( const cVector3d a_azimuthReference)

This method sets the azimuth reference direction vector of the camera (spherical coordinates).

Parameters
a_azimuthReferenceAzimuth reference direction.
cVector3d chai3d::cCamera::getSphericalAzimuthReference ( )
inline
void chai3d::cCamera::setSphericalOriginReference ( const cVector3d a_originReference)

This method sets the origin target point of the camera (spherical coordinates).

Parameters
a_originReferenceOrigin reference point.
cVector3d chai3d::cCamera::getSphericalOriginReference ( )
inline
void chai3d::cCamera::setClippingPlanes ( const double  a_distanceNear,
const double  a_distanceFar 
)

This method sets the positions of the near and far clip planes.

Parameters
a_distanceNearDistance to near clipping plane.
a_distanceFarDistance to far clipping plane.
double chai3d::cCamera::getNearClippingPlane ( )
inline
double chai3d::cCamera::getFarClippingPlane ( )
inline
void chai3d::cCamera::adjustClippingPlanes ( )

This method automatically adjusts the front and back clipping planes to optimize usage of the z-buffer.

void chai3d::cCamera::setOrthographicView ( double  a_viewWidth)

This method sets the camera in orthographic mode.

Parameters
a_viewWidthWidth of orthographic view.
void chai3d::cCamera::setFieldViewAngleDeg ( double  a_fieldViewAngleDeg)

This method sets the field of view angle in degrees. This call sets the camera in perspective mode.

Parameters
a_fieldViewAngleDegField of view angle in degrees (0-180).
double chai3d::cCamera::getFieldViewAngleDeg ( )
inline
void chai3d::cCamera::setFieldViewAngleRad ( double  a_fieldViewAngleRad)
inline
double chai3d::cCamera::getFieldViewAngleRad ( )
inline
double chai3d::cCamera::getAspectRatio ( )

This method returns the aspect ratio of output image.

Returns
Aspect ratio of image. Returns 1.0 if value cannot be computed.
void chai3d::cCamera::setStereoFocalLength ( double  a_stereoFocalLength)

This method sets the stereo focal length.

Parameters
a_stereoFocalLengthFocal length.
double chai3d::cCamera::getStereoFocalLength ( )
inline
void chai3d::cCamera::setStereoEyeSeparation ( double  a_stereoEyeSeparation)

This method sets the stereo eye separation.

Parameters
a_stereoEyeSeparationDistance between the left and right eyes.
double chai3d::cCamera::getStereoEyeSeparation ( )
inline
void chai3d::cCamera::renderView ( const int  a_windowWidth,
const int  a_windowHeight,
const cEyeMode  a_eyeMode = C_STEREO_LEFT_EYE,
const bool  a_defaultBuffer = true 
)
virtual

This method renders the scene viewed by the camera.

Parameters
a_windowWidthWidth of viewport.
a_windowHeightHeight of viewport.
a_eyeModeWhen using stereo mode C_STEREO_PASSIVE_DUAL_DISPLAY, specifies which eye view to render.
a_defaultBufferIf true then the scene is rendered in the default OpenGL buffer. If __false_ then the scene is rendered in a framebuffer (cFrameBuffer) that will have been previously setup.
void chai3d::cCamera::copyImageBuffer ( cImagePtr  a_image)

This method copies the OpenGL image buffer to a cImage class structure.

Parameters
a_imageDestination image.
void chai3d::cCamera::setUseMultipassTransparency ( bool  a_enabled)
virtual

This method enables or disables multipass transparency. When this option is enabled (it's disabled by default), each time the camera is asked to render the scene, it will perform three rendering passes: a pass for non-transparent items, a pass for the back faces of transparent items, and a pass for the front faces of transparent items.
Objects being rendered are told which pass is current via the parameter supplied to the render() function.

Parameters
a_enabledIf true, multipass is enabled, false otherwise.
bool chai3d::cCamera::getUseMultipassTransparency ( )
inline
int chai3d::cCamera::getDisplayWidth ( )
inline
int chai3d::cCamera::getDisplayHeight ( )
inline
void chai3d::cCamera::updateGPU ( )

This method updates all display lists and textures to the GPU.

void chai3d::cCamera::setStereoMode ( cStereoMode  a_stereoMode)
virtual

This method sets the 3D stereo rendering mode. The following rendering modes are supported:

C_STEREO_ACTIVE: Active stereo, requires OpenGL quad buffers.
C_STEREO_PASSIVE_LEFT_RIGHT: Passive stereo. Left and Right eye images are rendered next to each other.
C_STEREO_PASSIVE_TOP_BOTTOM: Passive stereo. Left and Right eye images are rendered above each other.
C_STEREO_DISABLED: Disable stereo.
C_STEREO_PASSIVE_DUAL_DISPLAY: Passive stereo. Left and Right eye images are rendered in different framebuffers or viewports.

Parameters
a_stereoModeStereo mode.
cStereoMode chai3d::cCamera::getStereoMode ( )
inline
void chai3d::cCamera::setMirrorHorizontal ( bool  a_enabled)

This method enables or disables the output image mirroring horizontally.

Parameters
a_enabledIf true_ then mirroring is enabled, __false otherwise.
void chai3d::cCamera::setMirrorVertical ( bool  a_enabled)

This method enables or disables the output image mirroring vertically.

Parameters
a_enabledIf true_ then mirroring is enabled, __false otherwise.
bool chai3d::cCamera::getMirrorHorizontal ( )
inline
bool chai3d::cCamera::getMirrorVertical ( )
inline
void chai3d::cCamera::attachAudioDevice ( cAudioDevice a_audioDevice)
inline
void chai3d::cCamera::detachAudioDevice ( )
inline
void chai3d::cCamera::renderLayer ( cGenericObject a_graph,
int  a_width,
int  a_height 
)
protected

This method renders a 2D scene within the viewport.

Parameters
a_graphThe root of the 2d scenegraph to be rendered.
a_widthThe size of the rendering window
a_heightThe size of the rendering window

Member Data Documentation

cTransform chai3d::cCamera::m_projectionMatrix
cTransform chai3d::cCamera::m_modelViewMatrix
bool chai3d::cCamera::m_useCustomProjectionMatrix
bool chai3d::cCamera::m_useCustomModelViewMatrix
cWorld* chai3d::cCamera::m_frontLayer
cWorld* chai3d::cCamera::m_backLayer
cDirectionalLight* chai3d::cCamera::m_lightFrontLayer
cDirectionalLight* chai3d::cCamera::m_lightBackLayer
cWorld* chai3d::cCamera::m_parentWorld
protected
double chai3d::cCamera::m_distanceNear
protected
double chai3d::cCamera::m_distanceFar
protected
double chai3d::cCamera::m_fieldViewAngleDeg
protected
double chai3d::cCamera::m_orthographicWidth
protected
bool chai3d::cCamera::m_perspectiveMode
protected
bool chai3d::cCamera::m_useMultipassTransparency
protected
bool chai3d::cCamera::m_useShadowCasting
protected
double chai3d::cCamera::m_stereoFocalLength
protected
double chai3d::cCamera::m_stereoEyeSeparation
protected
cStereoMode chai3d::cCamera::m_stereoMode
protected
unsigned int chai3d::cCamera::m_lastDisplayWidth
protected
unsigned int chai3d::cCamera::m_lastDisplayHeight
protected
bool chai3d::cCamera::m_markForUpdate
protected
bool chai3d::cCamera::m_mirrorHorizontal
protected
bool chai3d::cCamera::m_mirrorVertical
protected
bool chai3d::cCamera::m_mirrorStatus
protected
double chai3d::cCamera::m_scaleH
protected
double chai3d::cCamera::m_scaleV
protected
double chai3d::cCamera::m_posPolarRad
protected
double chai3d::cCamera::m_posAzimuthRad
protected
double chai3d::cCamera::m_posRadius
protected
cVector3d chai3d::cCamera::m_zenithReference
protected
cVector3d chai3d::cCamera::m_azimuthReference
protected
cVector3d chai3d::cCamera::m_originReference
protected
cAudioDevice* chai3d::cCamera::m_audioDevice
protected

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