![]() |
VR-Forces 4.10 Class Documentation
|
DtDynamicTerrainSwitchNode replaces an osgSim::multiswitch in a terrain patch (or page) that is tagged with a WRM ' switch' comment if that patch/page is parsed by the dynamic terrain parser. More...

Classes | |
| struct | SequenceDescriptor |
Public Types | |
| typedef std::list< DtString > | StateNameList |
| StateNameList defines a list of the names this switch can be referred to by, as discovered with WRM ' switch' comments. More... | |
| typedef std::list< DtString > | ValueNameList |
| ValueNameList defines a list of the names of state values (like 'on', or 'off', or 'damaged' etc. More... | |
| typedef boost::unordered_map < DtString, int > | ValueChildMap |
| ValueChildMap defines an unordered map of value names to the child indices to which they correspond. More... | |
Public Types inherited from makVrv::DtMultiReferencedNodeContainer< DtSwitchInstanceState > | |
| typedef boost::function< void(DynamicTerrain::NodePathHash)> | NodeReferenceFunction |
| Function type that runs on node reference. More... | |
Public Member Functions | |
| DtDynamicTerrainSwitchNode () | |
| CTOR. More... | |
| DtDynamicTerrainSwitchNode (const DtDynamicTerrainSwitchNode &, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
| Copy CTOR. More... | |
| virtual | ~DtDynamicTerrainSwitchNode () |
| DTOR. More... | |
| virtual const char * | className () const |
| Return the className to OSG. More... | |
| virtual void | setState (DynamicTerrain::NodePathHash hashIndex, int state) |
| Set the active state for a switch node reference. More... | |
| virtual void | setState (DynamicTerrain::NodePathHash hashIndex, const std::string &valueName) |
| Set the active state for a switch node reference using a value specified with an ' state' WRM comment on the child. More... | |
| virtual void | setState (int state) |
| Set the active state for ALL switch references in this container param[in] state state/child to make the active state. More... | |
| virtual void | setState (const std::string &valueName) |
| Set the active state for ALL switch references using a state value name param[in] valueName ' state' name for the state. More... | |
| virtual int | numStates () const |
| Get the number of states this switch has. More... | |
| virtual void | setStateNames (const StateNameList &stateNames) |
| Set the names found for this switch param[in] stateNames the list of names found for this switch. More... | |
| virtual void | setPositionInModelCoordinates (osg::Vec3d pos) |
| Set the position of this switch in model coordinates. More... | |
| virtual osg::Vec3d | positionInModelCoordinates () const |
| Get the position of this switch in model coordinates. More... | |
| virtual const StateNameList & | stateNames () const |
| Get the names found for this switch. More... | |
| virtual void | addValues (int state, const ValueNameList &valueNames) |
| Associate a list of value names with a state/child param[in] state the state/child associated with this list of names param[in] valueNames the list of names this state/child is known by. More... | |
| virtual void | addSequence (DtDynamicTerrainSequenceNode *sequence, DynamicTerrain::NodePathHash seqIndex, DynamicTerrain::NodePathHash switchIndex, int childCount) |
| Add a sequence which is under this switch. More... | |
| virtual const ValueChildMap & | valueToChildMap () const |
| Get the map that converts values (by name) to states/children. More... | |
| virtual const osg::BoundingSphere & | originalBounds () const |
| getter for the originalBounds of this switch. More... | |
| virtual void | setOriginalBounds (const osg::BoundingSphere &bounds) |
| setter for the original bounds. More... | |
Public Member Functions inherited from makVrv::DtMultiReferencedNodeContainer< DtSwitchInstanceState > | |
| DtMultiReferencedNodeContainer () | |
| CTOR. More... | |
| DtMultiReferencedNodeContainer (const DtMultiReferencedNodeContainer &orig) | |
| Copy CTOR param[in] orig the DtMultiReferencedNodeContainer to copy. More... | |
| virtual | ~DtMultiReferencedNodeContainer () |
| DTOR. More... | |
| virtual DynamicTerrain::NodePathHash | addNodeInstance (const osg::NodePath &nodePath) |
| Add a reference to a node and return the hash for the passed in node path. More... | |
| virtual void | setDefaultState (const DtSwitchInstanceState &state) |
| Specify a default state used to initialize each node reference when added. More... | |
| virtual const DtSwitchInstanceState & | defaultState () const |
| Get the default state used for node references. More... | |
| virtual void | setState (DynamicTerrain::NodePathHash hashIndex, const DtSwitchInstanceState &state) |
| Set the state of a node reference. More... | |
| virtual void | setState (const DtSwitchInstanceState &state) |
| Set the state of all node references. More... | |
| virtual bool | getState (DynamicTerrain::NodePathHash hashIndex, DtSwitchInstanceState &state) |
| Get the state of node instance. More... | |
| virtual DynamicTerrain::NodePathHash | calcNodePathHashValue (const osg::NodePath &nodePath) |
| Calculate a node hash, checks all known depths that nodes werer added at. More... | |
| virtual void | forEachNodeReference (NodeReferenceFunction &perNodeFunction) |
| Execute a function on each node reference in the container. More... | |
Public Attributes | |
| boost::signalslib::signal < void(DtDynamicTerrainSwitchNode *, DynamicTerrain::NodePathHash, int)> | signal_setSwitch |
| signal for things to listen to so they can find out when a switch changes More... | |
Protected Types | |
| typedef std::list < SequenceDescriptor > | SequenceInstanceList |
| typedef boost::unordered_map < DynamicTerrain::NodePathHash, SequenceInstanceList > | SwitchToSequenceMap |
Protected Types inherited from makVrv::DtMultiReferencedNodeContainer< DtSwitchInstanceState > | |
| typedef boost::unordered_map < DynamicTerrain::NodePathHash, DtSwitchInstanceState > | NodeInstanceMap |
Protected Member Functions | |
| virtual void | traverse (osg::NodeVisitor &nv) |
| Traverse the node. More... | |
| virtual void | setStateBindable (DynamicTerrain::NodePathHash hashIndex, int state) |
| This method is a workaround to get boost::bind to use the actual setState (which this calls). More... | |
Protected Attributes | |
| SwitchToSequenceMap | mySwitchToSequenceMap |
| StateNameList | myStateNames |
| ValueChildMap | myValueToChildMap |
| osg::BoundingSphere | myOriginalbounds |
| osg::Vec3d | myPosInModelCoords |
Protected Attributes inherited from makVrv::DtMultiReferencedNodeContainer< DtSwitchInstanceState > | |
| NodeInstanceMap | myNodeInstanceMap |
| std::set< int > | myNodePathDepths |
| DtSwitchInstanceState | myDefaultState |
| boost::mutex | myMapMutex |
DtDynamicTerrainSwitchNode replaces an osgSim::multiswitch in a terrain patch (or page) that is tagged with a WRM ' switch' comment if that patch/page is parsed by the dynamic terrain parser.
It supports multiple references to itself by extending DtMultiReferencedNodeContainer, with DtSwitchInstanceState as its template parameter. During a traversal of this node, a node path hash is requested and used to look up the state of the switch for that particular reference. the accept method is only called for those children associated with the current state.
To support transition animations between states, the DtDynamicTerrainSwitchNode also maintains information about osg::Sequences found under the switch. Those osg::Sequences will be replaced in the scene graph with DtDynamicTerrainSequenceNodes; so it tracks their node path hashes (since they will be referenced as many times as the switch is); which state of the switch the DtDynamicTerrainSequenceNode(s) corresponds to; and osg::ref_ptrs to the DtDynamicTerrainSequenceNode(s) themselves. When a switch is set to a new state, it checks for a DtDynamicTerrainSequenceNode related to it; if any exist, it will invoke each sequence's reset() method (which includes node path hash to specify a reference to that sequence), so the sequence referense can be set to its START state.
| typedef std::list<DtString> makVrv::DtDynamicTerrainSwitchNode::StateNameList |
StateNameList defines a list of the names this switch can be referred to by, as discovered with WRM ' switch' comments.
Currently, only the first found will be used as the key to dynamic terrain state changes
| typedef std::list<DtString> makVrv::DtDynamicTerrainSwitchNode::ValueNameList |
ValueNameList defines a list of the names of state values (like 'on', or 'off', or 'damaged' etc.
discovered on the osg::multiswitch as ' state' WRM comments
| typedef boost::unordered_map<DtString, int> makVrv::DtDynamicTerrainSwitchNode::ValueChildMap |
ValueChildMap defines an unordered map of value names to the child indices to which they correspond.
|
protected |
|
protected |
| makVrv::DtDynamicTerrainSwitchNode::DtDynamicTerrainSwitchNode | ( | ) |
CTOR.
| makVrv::DtDynamicTerrainSwitchNode::DtDynamicTerrainSwitchNode | ( | const DtDynamicTerrainSwitchNode & | , |
| const osg::CopyOp & | copyop = osg::CopyOp::SHALLOW_COPY |
||
| ) |
Copy CTOR.
|
virtual |
DTOR.
|
inlinevirtual |
Return the className to OSG.
|
virtual |
Set the active state for a switch node reference.
In addition to saving the state for the reference, this checks for and activates any sequences that are under this state. Note that there is a one-to-one correspondence between the state and the child node in the osg::Group param[in] hashIndex node path hash for the referenced switch param[in] state state / child to make active
|
virtual |
Set the active state for a switch node reference using a value specified with an ' state' WRM comment on the child.
This looks up the child in the valueToChildMap param[in] hashIndex node path hash for the referenced switch param[in] valueName name of the state to make active
|
virtual |
Set the active state for ALL switch references in this container param[in] state state/child to make the active state.
|
virtual |
Set the active state for ALL switch references using a state value name param[in] valueName ' state' name for the state.
|
virtual |
Get the number of states this switch has.
|
virtual |
Set the names found for this switch param[in] stateNames the list of names found for this switch.
|
virtual |
Set the position of this switch in model coordinates.
This may come to us via an comment. If not, it is computed by OSG as the center of the bounding sphere that encompasses ALL the geometry under the multiswitch
|
virtual |
Get the position of this switch in model coordinates.
|
virtual |
Get the names found for this switch.
|
virtual |
Associate a list of value names with a state/child param[in] state the state/child associated with this list of names param[in] valueNames the list of names this state/child is known by.
|
virtual |
Add a sequence which is under this switch.
|
virtual |
Get the map that converts values (by name) to states/children.
|
virtual |
getter for the originalBounds of this switch.
This is the bounds that is used for calculating the location of this switch node so that it matches the location that the VRF Backend is using. The node::_boundingSphere changes if there are any light points under this switch so we have to save off the original bounds when this node is created.
|
virtual |
setter for the original bounds.
|
protectedvirtual |
Traverse the node.
The path that the node visitor used to traverse to this node is used the calculate a node path hash, which in turn is used to find the state of the reference to this node. Only the active state/child is 'accept'ed. param[in] nv the node visitor performing the traversal
|
protectedvirtual |
This method is a workaround to get boost::bind to use the actual setState (which this calls).
I suspect this is related to the fact that this class is derived from a templated base class; boost::bind doesn't want to work with any method that is an override of that base class' methods param[in] hashIndex node path hash for the referenced switch param[in] state state / child to make active
| boost::signalslib::signal<void(DtDynamicTerrainSwitchNode*, DynamicTerrain::NodePathHash, int)> makVrv::DtDynamicTerrainSwitchNode::signal_setSwitch |
signal for things to listen to so they can find out when a switch changes
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |