VR-Forces 4.1 Class Documentation
List of all members | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
makVrv::DtOsgArticulatedModel Class Reference

An articulated model manipulator for controlling an articulated model. More...

Inheritance diagram for makVrv::DtOsgArticulatedModel:
Inheritance graph
[legend]

Public Types

typedef std::vector< osg::Node * > NodeList
typedef boost::unordered_map
< int, NodeList
NodePathCache
typedef std::vector
< osg::ref_ptr
< osgSim::DOFTransform > > 
PartTransformList
typedef boost::unordered_map
< int, PartTransformList
PartMap
typedef std::vector
< osg::ref_ptr
< osgSim::MultiSwitch > > 
StateList
typedef boost::unordered_map
< int, StateList
StateMap
typedef std::vector
< osg::ref_ptr< osg::Sequence > > 
AnimationList
typedef boost::unordered_map
< std::string, AnimationList
AnimationMap
- Public Types inherited from makVrv::DtArticulatedModel
typedef std::vector< int > PartList

Public Member Functions

 DtOsgArticulatedModel (DtDe &, DtUniqueID id)
 CTOR.
virtual ~DtOsgArticulatedModel ()
 DTOR.
virtual void setModelDefinition (const std::string &str)
 Override the set model definition function.
virtual std::string className () const
 Get the class name of the model instance owner.
virtual void setModelScalingEnabled (bool b)
 Indicate whether or not this model may be model-scaled Default is false.
virtual void setLocalModelScalingEnabled (bool enabled)
 Indicates whether local model scaling for the model is enabled.
virtual void setLocalModelScalingAmount (float localScl)
 Sets the amount of local scaling to apply to the model.
virtual void setPosition (int vtx, const DtVector &position)
 Set the position of a control vertex in the model.
virtual void setOrientation (int vtx, const DtTaitBryan &orientation)
 Set the orientation of a vertex in the model.
virtual void setVisible (bool isVisible)
 Set the visible state of the model and scene connector.
virtual void setPartTranslation (int partNumber, const DtVector &transform, const DtVector &velocity)
 Update the part translation.
virtual void setPartOrientation (int partNumber, const DtTaitBryan &orientation, const DtVector &rotationalVelocity)
 Rotate the part.
virtual void setState (int stateNumber, int stateValue)
 Set the state on the model.
virtual void setAnimationFrame (const std::string &animationName, int frameIndex)
 Set the current frame of an animation.
virtual void setAnimationRange (const std::string &animationName, int firstFrameIndex, int lastFrameIndex)
 Set the animation range.
virtual void setAnimationSpeed (const std::string &animationName, double framesPerSecond)
 Set the animation speed.
virtual bool findPartPositionAndOrientation (int partNumber, DtVector &position, DtQuat &ori)
 Finds the absolute position and orientation of a part.
DtVector partTranslation (int partNumber)
 Get a part translation.
DtTaitBryan partOrientation (int partNumber)
 Get a part orientation.
int state (int stateNumber)
 Get the state value.
int animationFrameCount (const std::string &animationName)
 Get number of frames in an animation.
int animationCurrentFrame (const std::string &animationName)
 Get the current frame of an animation.
int animationFirstFrame (const std::string &animationName)
 Get the first frame in the current range in an animation.
int animationLastFrame (const std::string &animationName)
 Get the last frame in the current range in an animation.
double animationSpeed (const std::string &animationName)
 Get the speed of an animation.
const PartMapparts () const
 Get a map of the current parts.
virtual void getParts (PartList &parts) const
 Only a list of all the parts.
const StateMapstates () const
 Get a map of the current states.
const AnimationMapanimations () const
 Get a map of the current animations.
virtual void addPart (int partNumber, osgSim::DOFTransform *node)
 Add a part off the DOF transform node and a part Number.
virtual void addState (int stateNumber, osgSim::MultiSwitch *node)
 Add a switch off the DOF switch node and a part number.
virtual void setStateValueExists (int stateNumber, int stateValue)
 Set when a state value exists; only state values that have had this method called on them will be used.
virtual void addAnimation (const std::string &animationName, osg::Sequence *node)
 Add animation Sequence.
virtual void setColor (float r, float g, float b, float a)
 Finds the absolute position and orientation of a part.
virtual void setPartVisibility (int partNumber, bool onOff)
 Finds the absolute position and orientation of a part.
virtual void setSolid (bool isSolid)
 Set whether or not other scene objects can ground clamp to this model.
- Public Member Functions inherited from makVrv::DtArticulatedModel
 DtArticulatedModel (DtDe &, DtUniqueID id)
 CTOR.
virtual ~DtArticulatedModel ()
 DTOR.
- Public Member Functions inherited from makVrv::DtModel
 DtModel (DtDe &de, DtUniqueID id)
 CTOR.
virtual ~DtModel ()
 DTOR.
virtual void saveModelToFile (const std::string &filename)
unsigned int transformSize () const
 Get the number of position/orientations this model has.
virtual void removePosition (int vtx)
 Remove a transform at the given position.
const DtVectorposition (int vtx=0) const
 Get the Position of a given point.
const DtTaitBryan & orientation (int vtx=0) const
 Get the Orientation of a given point.
virtual void enableColorBlending (bool b)
 Enable / disable color blending for this model.
virtual void setBlendColor (float r, float g, float b, float a)
 Set color to use if color blending is enabled.
virtual void getBlendColor (float &r, float &g, float &b, float &a)
 Returns the blend color.
virtual bool colorBlendingEnabled () const
 Returns whether or not blending is enabled.
virtual int modelSet () const
 Get the model set this model is part of.
const DtVectorboundingBoxExtents () const
 Get the bounding box extents of the model instance.
void getBoundingBoxExtents (double &x, double &y, double &z) const
 Get the bounding box extents of the model instance.
const DtVectorboundingBoxCenter () const
 Get the bounding box center of the model instance.
void getBoundingBoxCenter (double &x, double &y, double &z) const
 Get the bounding box center of the model instance.
void getBoundingBoxComponents (DtVector &minimum, DtVector &maximum)
void setContributesToBound (bool trueOrFalse)
 Set whether this model instance contributes to an object's overall bounding volume.
bool contributesToBound () const
 Get whether this model instance contributes to an object's overall bounding volume.
DtDede ()
 Get the DtDe object.
virtual void setModelInstance (DtModelInstance *modelInstance)
 Internally set the model instance pointer.
virtual bool visible () const
 Get the visible state of the model.
DtUniqueID parentSceneObjectID () const
 Parent of the model.
virtual void addedToSceneObjectAsProp (const DtUniqueID &sceneObj)
 Called when a scene object added the model as a prop.
virtual void addedToSceneObject (const DtUniqueID &sceneObj, int modelSet, int visualizerType)
 Called when a scene object added the model with the given model set and visualizer type.
virtual void removedFromSceneObject ()
 Called when the model was removed from a scene object.
virtual DtModelInstancemodelInstance ()
 Get the model instance.
virtual const DtModelInstancemodelInstance () const
 Get the model instance.
int visualizerType () const
 The visualizer type determines which channel-specific group node this model will be parented to, and consequently, which observer setting will cause it to be rendered in which channel.

Protected Types

typedef std::vector< boolStateExistenceList
typedef boost::unordered_map
< int, StateExistenceList
StateExistenceMap

Protected Member Functions

virtual void addToScene (const DtUniqueID &sceneObjectId, int modelSet, int visualizerType)
 Virtual Functions to be implemented, add this model to the scene.
virtual void removeFromScene ()
 Virtual Functions to be implemented, remove this model from the scene.
virtual void disablePart (int partNumber)
virtual void enablePart (int partNumber)
virtual void modelInstanceToBeDeleted ()
virtual void modelInstanceCreated (bool castShadows)

Static Protected Member Functions

static void matrixdToTaitBryan (const osg::Matrixd &rotation, DtTaitBryan &tb)
static double clampUnity (double x)

Protected Attributes

StateExistenceMap myStateExistenceMap
DtOsgSceneConnectormySceneConnector
PartMap myPartMap
StateMap myStateMap
AnimationMap myAnimationMap
NodePathCache myNodePathCache
bool myUseSwitch

Static Protected Attributes

static const unsigned int theNodePathCacheSize = 4

Additional Inherited Members

- Public Attributes inherited from makVrv::DtModel
boost::signal< void(DtModel *)> signal_modelToBeDestroyed
 Signal emitted when the model is to be destroyed.
boost::signal< void(DtModel *)> signal_modelChanged
boost::signal< bool(DtModel
*, bool), SlotReturnOR
signal_visibilityChangeRequested
 Signal when the visibility has been requested, if any slot returns false, it will not change.
boost::signal< void(DtModelInstance
*, DtModel *)> 
signal_modelInstanceCreated
 Signal emitted when the model instance is created.
boost::signal< void(DtModelInstance
*, DtModel *)> 
signal_modelInstanceToBeDestroyed
 Signal emitted when the model instance is to be destroyed.

Detailed Description

An articulated model manipulator for controlling an articulated model.

Member Typedef Documentation

typedef std::vector<osg::Node*> makVrv::DtOsgArticulatedModel::NodeList
typedef boost::unordered_map<int, NodeList> makVrv::DtOsgArticulatedModel::NodePathCache
typedef std::vector<osg::ref_ptr<osgSim::DOFTransform> > makVrv::DtOsgArticulatedModel::PartTransformList
typedef boost::unordered_map<int, PartTransformList > makVrv::DtOsgArticulatedModel::PartMap
typedef std::vector< osg::ref_ptr<osgSim::MultiSwitch> > makVrv::DtOsgArticulatedModel::StateList
typedef boost::unordered_map<int, StateList > makVrv::DtOsgArticulatedModel::StateMap
typedef std::vector< osg::ref_ptr<osg::Sequence> > makVrv::DtOsgArticulatedModel::AnimationList
typedef boost::unordered_map<std::string, AnimationList > makVrv::DtOsgArticulatedModel::AnimationMap
typedef boost::unordered_map<int, StateExistenceList> makVrv::DtOsgArticulatedModel::StateExistenceMap
protected

Constructor & Destructor Documentation

makVrv::DtOsgArticulatedModel::DtOsgArticulatedModel ( DtDe ,
DtUniqueID  id 
)

CTOR.

virtual makVrv::DtOsgArticulatedModel::~DtOsgArticulatedModel ( )
virtual

DTOR.

Member Function Documentation

virtual void makVrv::DtOsgArticulatedModel::setModelDefinition ( const std::string &  str)
virtual

Override the set model definition function.

Use this to parse a model after it is loaded.

Implements makVrv::DtArticulatedModel.

virtual std::string makVrv::DtOsgArticulatedModel::className ( ) const
virtual

Get the class name of the model instance owner.

This is used to control how model instances are created.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setModelScalingEnabled ( bool  b)
virtual

Indicate whether or not this model may be model-scaled Default is false.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setLocalModelScalingEnabled ( bool  enabled)
virtual

Indicates whether local model scaling for the model is enabled.

Local model scaling overrides generic (global) model scaling. Default is false.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setLocalModelScalingAmount ( float  localScl)
virtual

Sets the amount of local scaling to apply to the model.

Only applies when local model scaling is enabled.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setPosition ( int  vtx,
const DtVector position 
)
virtual

Set the position of a control vertex in the model.

Reimplemented from makVrv::DtModel.

virtual void makVrv::DtOsgArticulatedModel::setOrientation ( int  vtx,
const DtTaitBryan &  orientation 
)
virtual

Set the orientation of a vertex in the model.

Reimplemented from makVrv::DtModel.

virtual void makVrv::DtOsgArticulatedModel::setVisible ( bool  isVisible)
virtual

Set the visible state of the model and scene connector.

Parameters
[in]isVisibleis the new visible state; true = visible, false = hidden.

Reimplemented from makVrv::DtModel.

virtual void makVrv::DtOsgArticulatedModel::setPartTranslation ( int  partNumber,
const DtVector transform,
const DtVector velocity 
)
virtual

Update the part translation.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setPartOrientation ( int  partNumber,
const DtTaitBryan &  orientation,
const DtVector rotationalVelocity 
)
virtual

Rotate the part.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setState ( int  stateNumber,
int  stateValue 
)
virtual

Set the state on the model.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setAnimationFrame ( const std::string &  animationName,
int  frameIndex 
)
virtual

Set the current frame of an animation.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setAnimationRange ( const std::string &  animationName,
int  firstFrameIndex,
int  lastFrameIndex 
)
virtual

Set the animation range.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setAnimationSpeed ( const std::string &  animationName,
double  framesPerSecond 
)
virtual

Set the animation speed.

Implements makVrv::DtArticulatedModel.

virtual bool makVrv::DtOsgArticulatedModel::findPartPositionAndOrientation ( int  partNumber,
DtVector position,
DtQuat ori 
)
virtual

Finds the absolute position and orientation of a part.

This function is more efficient than calling both the position and orientation functions.

Implements makVrv::DtArticulatedModel.

DtVector makVrv::DtOsgArticulatedModel::partTranslation ( int  partNumber)

Get a part translation.

Return values
0,0,0when the part number is invalid.
DtTaitBryan makVrv::DtOsgArticulatedModel::partOrientation ( int  partNumber)

Get a part orientation.

Return values
0,0,0when the part number is invalid.
int makVrv::DtOsgArticulatedModel::state ( int  stateNumber)

Get the state value.

Return values
-1when the state number is invalid.
int makVrv::DtOsgArticulatedModel::animationFrameCount ( const std::string &  animationName)

Get number of frames in an animation.

Return values
-1when the animation number is invalid.
int makVrv::DtOsgArticulatedModel::animationCurrentFrame ( const std::string &  animationName)

Get the current frame of an animation.

Return values
-1when the animation number is invalid.
int makVrv::DtOsgArticulatedModel::animationFirstFrame ( const std::string &  animationName)

Get the first frame in the current range in an animation.

Return values
-1when the animation number is invalid.
int makVrv::DtOsgArticulatedModel::animationLastFrame ( const std::string &  animationName)

Get the last frame in the current range in an animation.

Return values
-1when the animation number is invalid.
double makVrv::DtOsgArticulatedModel::animationSpeed ( const std::string &  animationName)

Get the speed of an animation.

Return values
-1.0when the animation number is invalid.
const PartMap& makVrv::DtOsgArticulatedModel::parts ( ) const

Get a map of the current parts.

virtual void makVrv::DtOsgArticulatedModel::getParts ( PartList parts) const
virtual

Only a list of all the parts.

Implements makVrv::DtArticulatedModel.

const StateMap& makVrv::DtOsgArticulatedModel::states ( ) const

Get a map of the current states.

const AnimationMap& makVrv::DtOsgArticulatedModel::animations ( ) const

Get a map of the current animations.

virtual void makVrv::DtOsgArticulatedModel::addPart ( int  partNumber,
osgSim::DOFTransform *  node 
)
virtual

Add a part off the DOF transform node and a part Number.

virtual void makVrv::DtOsgArticulatedModel::addState ( int  stateNumber,
osgSim::MultiSwitch *  node 
)
virtual

Add a switch off the DOF switch node and a part number.

virtual void makVrv::DtOsgArticulatedModel::setStateValueExists ( int  stateNumber,
int  stateValue 
)
virtual

Set when a state value exists; only state values that have had this method called on them will be used.

virtual void makVrv::DtOsgArticulatedModel::addAnimation ( const std::string &  animationName,
osg::Sequence *  node 
)
virtual

Add animation Sequence.

virtual void makVrv::DtOsgArticulatedModel::setColor ( float  r,
float  g,
float  b,
float  a 
)
virtual

Finds the absolute position and orientation of a part.

This function is more efficient than calling both the position and orientation functions.

Reimplemented from makVrv::DtModel.

virtual void makVrv::DtOsgArticulatedModel::setPartVisibility ( int  partNumber,
bool  onOff 
)
virtual

Finds the absolute position and orientation of a part.

This function is more efficient than calling both the position and orientation functions.

Implements makVrv::DtArticulatedModel.

virtual void makVrv::DtOsgArticulatedModel::setSolid ( bool  isSolid)
virtual

Set whether or not other scene objects can ground clamp to this model.

Implements makVrv::DtModel.

virtual void makVrv::DtOsgArticulatedModel::addToScene ( const DtUniqueID sceneObjectId,
int  modelSet,
int  visualizerType 
)
protectedvirtual

Virtual Functions to be implemented, add this model to the scene.

Implements makVrv::DtModel.

virtual void makVrv::DtOsgArticulatedModel::removeFromScene ( )
protectedvirtual

Virtual Functions to be implemented, remove this model from the scene.

Implements makVrv::DtModel.

virtual void makVrv::DtOsgArticulatedModel::disablePart ( int  partNumber)
protectedvirtual
virtual void makVrv::DtOsgArticulatedModel::enablePart ( int  partNumber)
protectedvirtual
virtual void makVrv::DtOsgArticulatedModel::modelInstanceToBeDeleted ( )
protectedvirtual
virtual void makVrv::DtOsgArticulatedModel::modelInstanceCreated ( bool  castShadows)
protectedvirtual
static void makVrv::DtOsgArticulatedModel::matrixdToTaitBryan ( const osg::Matrixd &  rotation,
DtTaitBryan &  tb 
)
staticprotected
static double makVrv::DtOsgArticulatedModel::clampUnity ( double  x)
staticprotected

Member Data Documentation

StateExistenceMap makVrv::DtOsgArticulatedModel::myStateExistenceMap
protected
DtOsgSceneConnector* makVrv::DtOsgArticulatedModel::mySceneConnector
protected
PartMap makVrv::DtOsgArticulatedModel::myPartMap
protected
StateMap makVrv::DtOsgArticulatedModel::myStateMap
protected
AnimationMap makVrv::DtOsgArticulatedModel::myAnimationMap
protected
NodePathCache makVrv::DtOsgArticulatedModel::myNodePathCache
protected
const unsigned int makVrv::DtOsgArticulatedModel::theNodePathCacheSize = 4
staticprotected
bool makVrv::DtOsgArticulatedModel::myUseSwitch
protected

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

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)