VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgFindNodesVisitor.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
22 
24 
25 #include <osg/Switch>
26 #include <osg/LOD>
27 #include <osg/PositionAttitudeTransform>
28 #include <osg/NodeVisitor>
29 #include <osg/MatrixTransform>
30 #include <osgSim/MultiSwitch>
31 #include <osgSim/DOFTransform>
32 
33 #include <vector>
34 #include <deque>
35 #include <osg/PolygonOffset>
36 
37 #include <stack>
38 
39 namespace osgSim
40 {
41  class LightPointNode;
42 }
43 
44 
45 namespace makVrv
46 {
49  {
51  : cullFaceEnabled(true)
52  {
53  }
54 
56  osg::Matrixd xform;
58  osg::NodePath nodePath;
63  };
64 
66  template <typename T>
67  struct DtOsgFindNodesVisitor : public osg::NodeVisitor
68  {
69  DtOsgFindNodesVisitor(osg::NodeVisitor::TraversalMode traversalMode);
70 
71  void apply(osg::Node& node);
72 
73  std::vector<T*> results;
74  };
75 
77  template<typename T>
78  struct DtOsgFindNodesVisitorRefPtr : public osg::NodeVisitor
79  {
80  DtOsgFindNodesVisitorRefPtr(osg::NodeVisitor::TraversalMode traversalMode);
81 
82  virtual void apply(osg::Node& node) override;
83 
84  std::vector< osg::ref_ptr<T> > results;
85  };
86 
89  template<typename T>
90  struct DtOsgFindNodesVisitorRefPtrFlattenGraph : public osg::NodeVisitor
91  {
92  DtOsgFindNodesVisitorRefPtrFlattenGraph(osg::NodeVisitor::TraversalMode traversalMode
93  , osg::Node::NodeMask gatherNodeMask = 0
94  , const std::set< osg::Node* >& nodeIgnoreList = std::set<osg::Node*>()
95  , bool adjustLodStart = false
96  , bool oceanIsIndirect = false);
97 
98  virtual bool isCullFaceEnabled(osg::StateSet* ss) const;
99 
100  virtual DtIndirectPolygonOffset gatherPolygonOffset(osg::StateSet* ss) const;
101 
102  virtual void apply(osg::Node& node) override;
103 
104  virtual bool isOcean(const osg::Node* node) const;
105 
106  // Avoid use of T to avoid shadowing class template name
107  template<typename RESULT>
108  bool checkThisNodesMask(osg::Node& node, RESULT* result);
109 
111  bool checkThisNodesMask(osg::Node& node, DtLightPointNode* result);
112 
114  bool checkThisNodesMask(osg::Node& node, osgSim::LightPointNode* result);
115 
116  std::vector< DtNodePlusTraversalInfo > results;
117  std::set< osg::Node* > nodeIgnoreList;
118  std::deque<osg::Matrixd> matrixStack;
121  osg::Node::NodeMask myGatherNodeMask;
122 
123  std::stack<bool> myCullFaceEnabledStack;
124  std::stack<DtIndirectPolygonOffset> myPolygonOffsetStack;
126 
127  // This stack (unlike the aggregator is a regular stack that
128  // can use the stack size for finding the parent dof ids by pushing/popping
130 
131  const bool myOceanIsIndirect;
132  };
133 }
134 
135 #include "DtOsgFindNodesVisitor.inl"
136 
Contains makVrv::DtIndirectSwitchInfo struct.
DtIndirectSwitchManager::DequeNodeSwitchInfoPairs switchStack
Definition: DtOsgFindNodesVisitor.h:59
DtIndirectSwitchManager::DequeNodeSwitchInfoPairs switchStack
Definition: DtOsgFindNodesVisitor.h:120
std::vector< DtNodePlusTraversalInfo > results
Definition: DtOsgFindNodesVisitor.h:116
virtual void apply(osg::Node &node) override
virtual bool isCullFaceEnabled(osg::StateSet *ss) const
virtual bool isOcean(const osg::Node *node) const
virtual void apply(osg::Node &node) override
std::set< osg::Node * > nodeIgnoreList
Definition: DtOsgFindNodesVisitor.h:117
std::deque< NodeSwitchInfoPair > DequeNodeSwitchInfoPairs
Definition: DtIndirectSwitchManager.h:76
visitor for gathering all nodes of the same type in a scene graph. Returns vector of raw pointers ...
Definition: DtOsgFindNodesVisitor.h:67
Contains makVrv::DtDynamicTerrainSequenceNode class.
structure for holding the traversal info which is gathered by the DtOsgFindNodesVisitorRefPtrFlattenG...
Definition: DtOsgFindNodesVisitor.h:48
DtOsgFindNodesVisitorRefPtr(osg::NodeVisitor::TraversalMode traversalMode)
DtIndirectLodManager::DequeIndirectLodInfos lodStack
Definition: DtOsgFindNodesVisitor.h:57
DtIndirectDofManager::DequeNodeDofInfoPairs myDofStack
Definition: DtOsgFindNodesVisitor.h:129
DtNodePlusTraversalInfo()
Definition: DtOsgFindNodesVisitor.h:50
std::deque< osg::Matrixd > matrixStack
Definition: DtOsgFindNodesVisitor.h:118
const bool myOceanIsIndirect
Definition: DtOsgFindNodesVisitor.h:131
osg::Matrixd xform
Definition: DtOsgFindNodesVisitor.h:56
std::deque< NodeDofInfoPair > DequeNodeDofInfoPairs
Definition: DtIndirectDofManager.h:75
Contains makVrv::DtIndirectDofManager class.
visitor for gathering all nodes of the same type in a scene graph. Returns vector of ref pointers ...
Definition: DtOsgFindNodesVisitor.h:78
Derived from osg::Node and is a replacement for the osgSim::LightPointNode represents a group of ligh...
Definition: DtLightPointNode.h:37
std::stack< DtIndirectPolygonOffset > myPolygonOffsetStack
Definition: DtOsgFindNodesVisitor.h:124
Contains makVrv::DtIndirectSwitchManager class.
DtIndirectPolygonOffset polygonOffset
Definition: DtOsgFindNodesVisitor.h:62
bool myAdjustLodStart
Definition: DtOsgFindNodesVisitor.h:125
DtOsgFindNodesVisitor(osg::NodeVisitor::TraversalMode traversalMode)
osg::NodePath nodePath
Definition: DtOsgFindNodesVisitor.h:58
bool cullFaceEnabled
Definition: DtOsgFindNodesVisitor.h:61
Contains makVrv::DtIndirectLodManager class.
DtOsgFindNodesVisitorRefPtrFlattenGraph(osg::NodeVisitor::TraversalMode traversalMode, osg::Node::NodeMask gatherNodeMask=0, const std::set< osg::Node * > &nodeIgnoreList=std::set< osg::Node * >(), bool adjustLodStart=false, bool oceanIsIndirect=false)
bool checkThisNodesMask(osg::Node &node, RESULT *result)
osg::Node::NodeMask myGatherNodeMask
Definition: DtOsgFindNodesVisitor.h:121
DtIndirectLodManager::DequeIndirectLodInfos lodStack
Definition: DtOsgFindNodesVisitor.h:119
non virtual container class for defining a polygon offset state
Definition: DtIndirectPolygonOffset.h:18
Contains DLL export macros.
Contains makVrv::DtDynamicTerrainSwitchNode class.
osg::ref_ptr< osg::Node > node
Definition: DtOsgFindNodesVisitor.h:55
std::stack< bool > myCullFaceEnabledStack
Definition: DtOsgFindNodesVisitor.h:123
std::vector< T * > results
Definition: DtOsgFindNodesVisitor.h:73
DtIndirectDofManager::DequeNodeDofInfoPairs dofStack
Definition: DtOsgFindNodesVisitor.h:60
visitor for gathering all nodes of the same type in a scene graph. Also gathers matrix, lod, nodepath, switch stack and if it has a sequence
Definition: DtOsgFindNodesVisitor.h:90
std::deque< IndirectLodInfo > DequeIndirectLodInfos
Definition: DtIndirectLodManager.h:66
assert macros
std::vector< osg::ref_ptr< T > > results
Definition: DtOsgFindNodesVisitor.h:84
Contains the DtIndirectPolygonOffset class declaration.
virtual DtIndirectPolygonOffset gatherPolygonOffset(osg::StateSet *ss) const
void apply(osg::Node &node)

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)