H3D::TraverseInfo Class Reference

TraverseInfo is a structure that is passed along when traversing the scene graph. More...

#include <H3D/TraverseInfo.h>

List of all members.

Classes

class  InvalidHapticsDeviceIndex
 Thrown when trying to get hold of a H3DHapticsDevice using an invalid device index. More...

Public Types

typedef AutoRefVector
< RefCountedClass
RefCountedVector
 Used to get all the X3DLightNodes that are global.

Public Member Functions

 TraverseInfo (const vector< H3DHapticsDevice * > &_haptics_devices)
 Constructor.
unsigned int nrLayers ()
 Returns the number of haptics layers that are available and initialized.
void initializeLayers (unsigned int nr_layers)
 Make sure that the TraverseInfo object have enough resources allocated for the given amount of haptic layers.
void setCurrentLayer (unsigned int layer)
 Set the currently active haptic layer.
unsigned int getCurrentLayer ()
 Get the currently active haptic layer.
int getHapticsDeviceIndex (H3DHapticsDevice *hd)
 Returns the index of the given H3DHapticsDevice.
void addHapticShape (int device_index, HAPI::HAPIHapticShape *shape)
 Adds a HapticShape to be rendered by a H3DHapticsDevice.
void addHapticShape (H3DHapticsDevice *hd, HAPI::HAPIHapticShape *shape)
 Adds a HapticShape to be rendered by a H3DHapticsDevice.
void addHapticShapeToAll (HAPI::HAPIHapticShape *shape)
 Adds a HapticShape to be rendered by all H3DHapticsDevices.
const HapticShapeVectorgetHapticShapes (int device_index)
 Get the HapticShapes that has been added for the H3DHapticsDevice with the given device_index.
const HapticShapeVectorgetHapticShapes (H3DHapticsDevice *hd)
 Get the HapticShapes that has been added for the given H3DHapticsDevice.
void addForceEffect (int device_index, HAPI::HAPIForceEffect *effect)
 Adds a HAPIForceEffect to be rendered by a H3DHapticsDevice.
void addForceEffect (H3DHapticsDevice *hd, HAPI::HAPIForceEffect *effect)
 Adds a HAPIForceEffect to be rendered by a H3DHapticsDevice.
void addForceEffectToAll (HAPI::HAPIForceEffect *effect)
 Adds a HAPIForceEffect to be rendered by all H3DHapticsDevices.
const HapticEffectVectorgetForceEffects (int device_index)
 Get the HAPIForceEffects that has been added for the H3DHapticsDevice with the given device_index.
const HapticEffectVectorgetForceEffects (H3DHapticsDevice *hd)
 Get the HAPIForceEffects that has been added for the given H3DHapticsDevice.
void setCurrentSurface (H3DSurfaceNode *s)
 Sets the surface that is active in the current traversal.
H3DSurfaceNodegetCurrentSurface ()
 Get the surface that is active in the current traversal.
const vector< H3DHapticsDevice * > & getHapticsDevices ()
 Get the haptics devices that are available.
void disableHaptics ()
 When called, future calls to addHapticShapes() and addForceEffects() functions will not add any shapes until enableHaptics() is called.
void enableHaptics ()
 When called, the addHapticShapes() and addForceEffects() functions calls will add HapticShapes to render.
void setMultiPassTransparency (bool b)
 If multi pass transparency is set to true the scene will be rendered three times graphically, once for all solid objects, once for the back side of transparent objects and once for the front face of transparent objects.
bool getMultiPassTransparency ()
 See if multi pass transparency objects have been encountered.
bool hapticsEnabled ()
 Check whether haptics is enabled or not.
void pushMatrices (const Matrix4f &forward, const Matrix4f &inverse)
 This function should be called when we move into a nested coordinate space with the transformation matrices between the coordinate spaces.
void popMatrices ()
 This function should be called when we move out from a nested coordinate space.
const Matrix4f & getAccForwardMatrix ()
 Get the accumulated forward transformation matrix, i.e.
const Matrix4f & getAccInverseMatrix ()
 Get the accumulated inverse transformation matrix, i.e.


Detailed Description

TraverseInfo is a structure that is passed along when traversing the scene graph.

It contains information needed during the traversing, including e.g. transform matrices, available haptics devices etc. Geometry nodes must register the shapes to render haptically by calls to the addHapticShape() function calls.


Constructor & Destructor Documentation

H3D::TraverseInfo::TraverseInfo ( const vector< H3DHapticsDevice * > &  _haptics_devices  )  [inline]

Constructor.

Parameters:
_haptics_devices The HapticDevice instances that are available to render HapticShapes on.


Member Function Documentation

void H3D::TraverseInfo::addForceEffect ( H3DHapticsDevice hd,
HAPI::HAPIForceEffect effect 
) [inline]

Adds a HAPIForceEffect to be rendered by a H3DHapticsDevice.

Shapes will only be added if hapticsEnabled() is true.

Parameters:
hd The H3DHapticsDevice to render the shape on.
effect The HAPIForceEffect to render.

void TraverseInfo::addForceEffect ( int  device_index,
HAPI::HAPIForceEffect effect 
)

Adds a HAPIForceEffect to be rendered by a H3DHapticsDevice.

Effects will only be added if hapticsEnabled() is true.

Parameters:
device_index The index of the H3DHapticsDevice to render the shape on.
effect The HAPIForceEffect to render.

References H3D_FULL_LOCATION, hapticsEnabled(), H3DUtil::RefCountedClass::ref(), and H3DUtil::RefCountedClass::unref().

Referenced by H3D::ViscosityEffect::traverseSG(), H3D::TimeFunctionEffect::traverseSG(), H3D::SpringEffect::traverseSG(), H3D::PositionFunctionEffect::traverseSG(), and H3D::MagneticGeometryEffect::traverseSG().

void TraverseInfo::addForceEffectToAll ( HAPI::HAPIForceEffect effect  ) 

Adds a HAPIForceEffect to be rendered by all H3DHapticsDevices.

Effects will only be added if hapticsEnabled() is true.

Parameters:
effect The HAPIForceEffect to render.

References hapticsEnabled(), H3DUtil::RefCountedClass::ref(), and H3DUtil::RefCountedClass::unref().

Referenced by H3D::ForceField::traverseSG().

void H3D::TraverseInfo::addHapticShape ( H3DHapticsDevice hd,
HAPI::HAPIHapticShape shape 
) [inline]

Adds a HapticShape to be rendered by a H3DHapticsDevice.

Shapes will only be added if hapticsEnabled() is true.

Parameters:
hd The H3DHapticsDevice to render the shape on.
shape The HapticShape to render.

void TraverseInfo::addHapticShape ( int  device_index,
HAPI::HAPIHapticShape shape 
)

Adds a HapticShape to be rendered by a H3DHapticsDevice.

Shapes will only be added if hapticsEnabled() is true.

Parameters:
device_index The index of the H3DHapticsDevice to render the shape on.
shape The HapticShape to render.

References H3D::X3DGeometryNode::getHapticShapeId(), HAPI::HAPIHapticShape::getShapeId(), HAPI::HAPIHapticShape::getUserData(), H3D_FULL_LOCATION, hapticsEnabled(), and HAPI::HAPIHapticShape::setShapeId().

Referenced by H3D::Sphere::traverseSG().

void TraverseInfo::addHapticShapeToAll ( HAPI::HAPIHapticShape shape  ) 

Adds a HapticShape to be rendered by all H3DHapticsDevices.

Shapes will only be added if hapticsEnabled() is true.

Parameters:
shape The HapticShape to render.

References H3D::X3DGeometryNode::getHapticShapeId(), HAPI::HAPIHapticShape::getShapeId(), HAPI::HAPIHapticShape::getUserData(), hapticsEnabled(), and HAPI::HAPIHapticShape::setShapeId().

Referenced by H3D::X3DGeometryNode::traverseSG().

void H3D::TraverseInfo::disableHaptics (  )  [inline]

When called, future calls to addHapticShapes() and addForceEffects() functions will not add any shapes until enableHaptics() is called.

Referenced by H3D::ClipPlane::disableHapticsState(), H3D::ClipPlane::enableHapticsState(), H3D::Scene::idle(), H3D::X3DShapeNode::traverseSG(), and H3D::ToggleGroup::traverseSG().

void H3D::TraverseInfo::enableHaptics (  )  [inline]

When called, the addHapticShapes() and addForceEffects() functions calls will add HapticShapes to render.

Haptics is enabled by default.

Referenced by H3D::ClipPlane::disableHapticsState(), H3D::X3DShapeNode::traverseSG(), and H3D::ToggleGroup::traverseSG().

const Matrix4f& H3D::TraverseInfo::getAccForwardMatrix (  )  [inline]

const Matrix4f& H3D::TraverseInfo::getAccInverseMatrix (  )  [inline]

int H3D::TraverseInfo::getHapticsDeviceIndex ( H3DHapticsDevice hd  )  [inline]

Returns the index of the given H3DHapticsDevice.

-1 is returned if the H3DHapticsDevice is not in the vector of haptics devices.

bool H3D::TraverseInfo::hapticsEnabled (  )  [inline]

Check whether haptics is enabled or not.

If disabled the addHapticsShapes() functions will have no effect. Geometry nodes that add shapes should check that haptics is enabled before doing any calculations deciding what to render. This is because any HapticShape created will not be rendered anyway so no computer resources should be used creating them.

Referenced by addForceEffect(), addForceEffectToAll(), addHapticShape(), addHapticShapeToAll(), H3D::ClipPlane::enableHapticsState(), H3D::X3DGeometryNode::traverseSG(), H3D::ViscosityEffect::traverseSG(), H3D::ToggleGroup::traverseSG(), H3D::TimeFunctionEffect::traverseSG(), H3D::SpringEffect::traverseSG(), H3D::Sphere::traverseSG(), H3D::PositionFunctionEffect::traverseSG(), H3D::MagneticGeometryEffect::traverseSG(), and H3D::ForceField::traverseSG().

void H3D::TraverseInfo::initializeLayers ( unsigned int  nr_layers  )  [inline]

Make sure that the TraverseInfo object have enough resources allocated for the given amount of haptic layers.

unsigned int H3D::TraverseInfo::nrLayers (  )  [inline]

Returns the number of haptics layers that are available and initialized.

If you need more you will have to use the initializeLayers() function

Referenced by H3D::Scene::idle().

void H3D::TraverseInfo::pushMatrices ( const Matrix4f &  forward,
const Matrix4f &  inverse 
) [inline]

This function should be called when we move into a nested coordinate space with the transformation matrices between the coordinate spaces.

Parameters:
forward Transformation matrix between the space we move into to the previous space.
inverse The inverse of forward.

Referenced by H3D::MatrixTransform::traverseSG().

void H3D::TraverseInfo::setCurrentLayer ( unsigned int  layer  )  [inline]

Set the currently active haptic layer.

The currently active haptic layer determines which layer later calls to addHapticShape and addHapticShapeToAll should add the shapes to.

Referenced by H3D::Scene::idle().

void H3D::TraverseInfo::setMultiPassTransparency ( bool  b  )  [inline]

If multi pass transparency is set to true the scene will be rendered three times graphically, once for all solid objects, once for the back side of transparent objects and once for the front face of transparent objects.

This is in order to avoid artifacts for transparent objects when rendered int the wrong order.

Referenced by H3D::X3DShapeNode::traverseSG().


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

Generated on Fri Nov 7 10:31:18 2008 for H3D API by  doxygen 1.5.7