VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDynamicTerrainParser.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
8 
9 #pragma once
10 #include <vrvOsg/vrvOsg.h>
11 
16 
17 #include <vlutil/vlString.h>
18 
19 #include <osg/Matrixd>
20 #include <osg/Group>
21 #include <boost/unordered_map.hpp>
22 
23 #include <vector>
24 #include <stack>
25 
26 namespace osgSim
27 {
28  class MultiSwitch;
29 }
30 
31 namespace osg
32 {
33  class sequence;
34 }
35 
36 namespace makVrv
37 {
38  class DtDe;
39  class DtDynamicTerrainSequenceNode;
40 
62  {
63  public:
66 
69  typedef std::vector< osg::Matrixd > StateTransformList;
70 
73  typedef std::vector< DynamicTerrain::NodePathHash > StateIndexList;
74 
80  typedef std::vector<osg::ref_ptr< DtDynamicTerrainSwitchNode> > TerrainSwitchList;
82 
86 
91 
92  private:
95 
96  public:
98  virtual ~DtDynamicTerrainParser();
99 
106  osg::Node& node,
107  const osg::Matrix& matrix = osg::Matrix::identity());
108 
112  osg::Node& node,
113  const osg::Matrix& matrix = osg::Matrix::identity());
114 
116  DtDynamicTerrainWorld::FeatureHandle featureHandle() const { return myFeatureHandles; }
117 
120  static std::string parserFormat();
121 
122  virtual void apply( osg::Group& group );
123  virtual void apply( osgSim::MultiSwitch& multiswitch );
124  virtual void apply( DtDynamicTerrainSwitchNode& terrainSwitch );
125  virtual void apply( osg::Sequence& sequence );
126  virtual void apply( DtDynamicTerrainSequenceNode& terrainSequence );
128 
131  const StateTransformList& stateTransforms() const;
132  void addStateTransform(const osg::Matrixd& mat );
133 
134  const TerrainSwitchList& terrainSwitches() const;
135  void addTerrainSwitch( DtDynamicTerrainSwitchNode* tSwitch );
136 
137  const StateIndexList& stateIndices() const;
138  void addStateIndex( DynamicTerrain::NodePathHash index );
140  protected:
145  virtual void runVisitor(osg::Node&, const osg::Matrix&);
146 
151  virtual bool parseSwitchNames( const std::string& desc,
152  osgSim::MultiSwitch& multiswitch, std::list<DtString>& stateNames );
153 
158  virtual void parseSwitchValues( const osg::Node& node, std::list<DtString>& valueNames );
159 
162  virtual void parseValueListString( const std::string& valueList, std::list<DtString>& valueNames );
163 
164  virtual void pushSwitch( DtDynamicTerrainSwitchNode* switchNode );
165  virtual void popSwitch();
166  virtual DtDynamicTerrainSwitchNode* findCurrentSwitch() const;
167 
168  virtual void pushSwitchIndex( DynamicTerrain::NodePathHash index );
169  virtual void popSwitchIndex();
170  virtual DynamicTerrain::NodePathHash findCurrentSwitchIndex() const;
171 
172  virtual void pushSwitchChildCount( int child );
173  virtual void popSwitchChildCount();
174  virtual int findCurrentSwitchChildCount() const;
175  virtual void incrementSwitchChildCount();
176  virtual void decrementSwitchChildCount();
177 
178 
179  protected:
181 
185  std::stack<std::string> myStateNames;
186  std::stack<osg::ref_ptr<DtDynamicTerrainSwitchNode> > myCurrentSwitchStack;
187  std::stack<DynamicTerrain::NodePathHash> myCurrentSwitchIndexStack;
189 
190  // maps node's hash to it's parents hash
191  typedef boost::unordered_map<DynamicTerrain::NodePathHash, DynamicTerrain::NodePathHash> ParentHashMap;
193 
195  };
196 
200  {
201  public:
202 
205  static void registerCreator(DtDe& de);
206 
209 
212 
214  virtual DtModelParser* create(DtDe& de);
215  };
216 
217 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)