![]() |
VR-Forces 4.5 Class Documentation
|
Implementation of the model parser for Dynamic Terrain The DtDynamicTerrainParser visits all the nodes in a terrain patch or page and looks for osg::multiswitches with WRM switch ( switch) comments. More...

Public Types | |
Output structures | |
| typedef std::vector< osg::Matrixd > | StateTransformList |
| StateTransformList defines a vector of the world locations of each dynamic terrain switch reference discovered. | |
| typedef std::vector < DynamicTerrain::NodePathHash > | StateIndexList |
| StateIndexList defines a vector of a NodePathHash values associated with each switch reference discovered. | |
| typedef std::vector < osg::ref_ptr < DtDynamicTerrainSwitchNode > > | TerrainSwitchList |
| TerrainSwitchList defines a vector of all the dynamic terrain switches discovered. | |
Public Types inherited from makVrv::DtArticulatedModelParser | |
| 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 |
| typedef std::map< int, int > | StateValueMap |
| typedef std::vector< bool > | StateExistenceList |
| typedef boost::unordered_map < int, StateExistenceList > | StateExistenceMap |
| typedef std::vector < osg::ref_ptr< osg::Group > > | GroupList |
| typedef boost::unordered_map < std::string, GroupList > | AnnotationMap |
Public Member Functions | |
| DtDynamicTerrainParser (DtDe &de) | |
| CTOR. | |
| DtDynamicTerrainParser (DtDe &de, DtDynamicTerrainWorld &world) | |
| CTOR. | |
| virtual | ~DtDynamicTerrainParser () |
| DTOR. | |
| virtual DtDynamicTerrainWorld::FeatureHandle | parse (makVrv::DtDynamicTerrainStateManipulatorFactory &manipulatorFactory, osg::Node &node, const osg::Matrix &matrix=osg::Matrix::identity()) |
| Run the entire parsing algorithm. | |
| virtual DtDynamicTerrainWorld::FeatureHandle | parse (osg::Node &node, const osg::Matrix &matrix=osg::Matrix::identity()) |
| Run the entire parsing algorithm with defaults Calls the main parse function with the default terrain state manipulator factory. | |
| DtDynamicTerrainWorld::FeatureHandle | featureHandle () const |
| Accessor the handle to the features which have been paged in by calls to parse. | |
| virtual void | apply (osg::Group &group) |
| Apply functions used for iterating through a model using the as a node visitor. | |
| virtual void | apply (osgSim::MultiSwitch &multiswitch) |
| virtual void | apply (DtDynamicTerrainSwitchNode &terrainSwitch) |
| virtual void | apply (osg::Sequence &sequence) |
| virtual void | apply (DtDynamicTerrainSequenceNode &terrainSequence) |
get/set parsed data interface | |
| const StateTransformList & | stateTransforms () const |
| void | addStateTransform (const osg::Matrixd &mat) |
| const TerrainSwitchList & | terrainSwitches () const |
| void | addTerrainSwitch (DtDynamicTerrainSwitchNode *tSwitch) |
| const StateIndexList & | stateIndices () const |
| void | addStateIndex (DynamicTerrain::NodePathHash index) |
Public Member Functions inherited from makVrv::DtArticulatedModelParser | |
| DtArticulatedModelParser (DtDe &de) | |
| CTOR. | |
| virtual | ~DtArticulatedModelParser () |
| DTOR. | |
| virtual void | apply (osgSim::DOFTransform &transform) |
| virtual void | apply (osg::Transform &transform) |
Public Member Functions inherited from makVrv::DtModelParser | |
| DtModelParser () | |
| CTOR. | |
| virtual | ~DtModelParser () |
| DTOR. | |
Static Public Member Functions | |
| static std::string | parserFormat () |
| Get the string to indicate the parser format this parser supports. | |
Protected Types | |
| typedef boost::unordered_map < DynamicTerrain::NodePathHash, DynamicTerrain::NodePathHash > | ParentHashMap |
Protected Member Functions | |
| virtual void | runVisitor (osg::Node &, const osg::Matrix &) |
| Calls node.accept(*this). | |
| virtual bool | parseSwitchNames (const std::string &desc, osgSim::MultiSwitch &multiswitch, std::list< DtString > &stateNames) |
| Parse a switch declaration and add a state to the model if it is able to parse the description. | |
| virtual void | parseSwitchValues (const osg::Node &node, std::list< DtString > &valueNames) |
| Parse a state node. | |
| virtual void | parseValueListString (const std::string &valueList, std::list< DtString > &valueNames) |
| Parse a value list string into a list of strings. | |
| virtual void | pushSwitch (DtDynamicTerrainSwitchNode *switchNode) |
| virtual void | popSwitch () |
| virtual DtDynamicTerrainSwitchNode * | findCurrentSwitch () const |
| virtual void | pushSwitchIndex (DynamicTerrain::NodePathHash index) |
| virtual void | popSwitchIndex () |
| virtual DynamicTerrain::NodePathHash | findCurrentSwitchIndex () const |
| virtual void | pushSwitchChildCount (int child) |
| virtual void | popSwitchChildCount () |
| virtual int | findCurrentSwitchChildCount () const |
| virtual void | incrementSwitchChildCount () |
| virtual void | decrementSwitchChildCount () |
Protected Member Functions inherited from makVrv::DtArticulatedModelParser | |
| virtual bool | parseSwitchDeclaration (const std::string &desc, osgSim::MultiSwitch &multiswitch) |
| Parse a switch declaration and add a state to the model if it is able to parse the description. | |
| const DtModelSemanticsMapper::States::Id * | createCustomStateId (const std::string &stateName, DtModelSemanticsMapper &mapper) |
| Creates a custom state id if possible. | |
| virtual bool | parseStateDeclaration (const std::string &desc, osg::Group &group) |
| Parse a state node. | |
| virtual bool | parseAnnotationDeclaration (const std::string &desc, osg::Group &group) |
| Parse a annotation node. | |
| virtual bool | parsePartDeclaration (const std::string &desc, osgSim::DOFTransform &transform) |
| Parse a part declaration and add a part if the parse was successful. | |
| virtual bool | parseAnimationDeclaration (const std::string &desc, osg::Sequence &sequence) |
| Parse an animation declaration and add an animation if the part was successful. | |
| std::vector< int > | parseValueList (const std::string &valueList) |
| Parse a value list string into a list of integers. | |
| void | pushStateId (int idNumber, osgSim::MultiSwitch *lastStateId) |
| Push a state id onto a local stack. | |
| void | popStateId () |
| Pop a state id onto a local stack. | |
| osgSim::MultiSwitch * | lastStateId () const |
| int | lastStateIdNumber () const |
| void | getParts (DtArticulatedModel::PartList &parts) const |
| const PartMap & | parts () const |
| const StateMap & | states () const |
| const AnimationMap & | animations () const |
| void | addPart (int partNumber, osgSim::DOFTransform *node) |
| void | addState (int stateNumber, osgSim::MultiSwitch *node) |
| void | addAnimation (const std::string &animationName, osg::Sequence *node) |
| void | setStateValueExists (int stateNumber, int stateValue) |
| void | addAnnotationGroup (const std::string &annotation, osg::Group *group) |
| void | setDepthMask (osg::Group &parent) |
Protected Attributes | |
| DtDynamicTerrainWorld & | myWorld |
| StateTransformList | myStateTransformList |
| StateIndexList | myStateIndexList |
| TerrainSwitchList | myTerrainSwitchList |
| std::stack< std::string > | myStateNames |
| std::stack< osg::ref_ptr < DtDynamicTerrainSwitchNode > > | myCurrentSwitchStack |
| std::stack < DynamicTerrain::NodePathHash > | myCurrentSwitchIndexStack |
| std::stack< int > | myCurrentSwitchChildCountStack |
| ParentHashMap | myParentHashMap |
| DtDynamicTerrainWorld::FeatureHandle | myFeatureHandles |
Protected Attributes inherited from makVrv::DtArticulatedModelParser | |
| std::string | mySwitchTag |
| std::string | myStateTag |
| std::string | myPartTag |
| std::string | myAnimationTag |
| std::string | mySkipTag |
| std::string | myNoSkipTag |
| std::string | myAnnotationTag |
| std::string | myLoopCountTag |
| std::string | myLastFrameTimeTag |
| std::stack< osg::ref_ptr < osgSim::MultiSwitch > > | myStateIds |
| std::stack< int > | myStateIdNumbers |
| DtDe & | myDe |
Private Member Functions | |
| DtDynamicTerrainParser () | |
| Intentionally unimplemented default CTOR. | |
Additional Inherited Members | |
Public Attributes inherited from makVrv::DtArticulatedModelParser | |
| PartMap | myPartMap |
| StateMap | myStateMap |
| AnimationMap | myAnimationMap |
| AnnotationMap | myAnnotationMap |
| StateExistenceMap | myStateExistenceMap |
| StateValueMap | myStateValueMap |
Implementation of the model parser for Dynamic Terrain The DtDynamicTerrainParser visits all the nodes in a terrain patch or page and looks for osg::multiswitches with WRM switch ( switch) comments.
It is derived from DtArticulatedModelParser, which it can use to help with parsing of the WRM comments. Since it is common for terrain to use external references to objects, there may be multiple references to the same switch; to support different states for these external references, it replaces the osg::multiswitch with a DtDynamicTerrainSwitchNode, which can support switch state for each node path reference to that switch. In addition, the parser will also look for osg::Sequences with animation comments that are found under switches. These are assumed to be animated transitions between the states associated with the switches. Since this may also be externally referenced, these osg::Sequences are replaced with DtDynamicTerrainSequenceNodes, which provide the same type of reference support. These sequences are not part of the parser output directly, but are fed to their associated switches as discovered. As with the DtArticulatedModelParser, instances of the new switches, and related state information, as well as the world location of each reference, is stored in lists which remain available as long as the parser itself exists. The multiswitches and sequences replaced by the parser can still be found in the base class lists, but are no longer in the scene graph (and will go away unless you keep an osg::ref_ptr to them).
| typedef std::vector< osg::Matrixd > makVrv::DtDynamicTerrainParser::StateTransformList |
StateTransformList defines a vector of the world locations of each dynamic terrain switch reference discovered.
| typedef std::vector< DynamicTerrain::NodePathHash > makVrv::DtDynamicTerrainParser::StateIndexList |
StateIndexList defines a vector of a NodePathHash values associated with each switch reference discovered.
| typedef std::vector<osg::ref_ptr< DtDynamicTerrainSwitchNode> > makVrv::DtDynamicTerrainParser::TerrainSwitchList |
TerrainSwitchList defines a vector of all the dynamic terrain switches discovered.
Note that there are many duplicates here. The transforms, nodePath hashes and terrain switches in these lists correspond one to one. So a hundred references to the same switch would result in a hundred different transforms in the transform list; a hundred different node path hashes, one for each reference; and then a hundred osg::ref_ptrs to the same underlying switch node used to manage those one hundred references
|
protected |
| makVrv::DtDynamicTerrainParser::DtDynamicTerrainParser | ( | DtDe & | de | ) |
CTOR.
| [in] | de |
| makVrv::DtDynamicTerrainParser::DtDynamicTerrainParser | ( | DtDe & | de, |
| DtDynamicTerrainWorld & | world | ||
| ) |
CTOR.
| [in] | de | |
| [in] | world |
|
private |
Intentionally unimplemented default CTOR.
|
virtual |
DTOR.
|
virtual |
Run the entire parsing algorithm.
Run the visitor on the node (by calling runVisitor) and then add the dynamic features created to the terrain world. The handle to the paged in features are available through featureHandle.
|
virtual |
Run the entire parsing algorithm with defaults Calls the main parse function with the default terrain state manipulator factory.
|
inline |
Accessor the handle to the features which have been paged in by calls to parse.
|
static |
Get the string to indicate the parser format this parser supports.
Reimplemented from makVrv::DtArticulatedModelParser.
|
virtual |
Apply functions used for iterating through a model using the as a node visitor.
Reimplemented from makVrv::DtArticulatedModelParser.
|
virtual |
Reimplemented from makVrv::DtArticulatedModelParser.
|
virtual |
|
virtual |
Reimplemented from makVrv::DtArticulatedModelParser.
|
virtual |
| const StateTransformList& makVrv::DtDynamicTerrainParser::stateTransforms | ( | ) | const |
| void makVrv::DtDynamicTerrainParser::addStateTransform | ( | const osg::Matrixd & | mat | ) |
| const TerrainSwitchList& makVrv::DtDynamicTerrainParser::terrainSwitches | ( | ) | const |
| void makVrv::DtDynamicTerrainParser::addTerrainSwitch | ( | DtDynamicTerrainSwitchNode * | tSwitch | ) |
| const StateIndexList& makVrv::DtDynamicTerrainParser::stateIndices | ( | ) | const |
| void makVrv::DtDynamicTerrainParser::addStateIndex | ( | DynamicTerrain::NodePathHash | index | ) |
|
protectedvirtual |
Calls node.accept(*this).
Thus function exists so that subclasses can override the visitation step to run custom code (i.e. VRF has another parsing pass which needs to be run before the algorithm continues).
|
protectedvirtual |
Parse a switch declaration and add a state to the model if it is able to parse the description.
| true | if a state was added. |
| false | if a state was not added. |
|
protectedvirtual |
Parse a state node.
A state is added if a declaration was parsed.
| true | if a state was added. |
| false | if a state was not added. |
|
protectedvirtual |
Parse a value list string into a list of strings.
For example, "0,1,damage" becomes "0", "1", "damage"
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |