VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pagedNode2Visitors.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
15 
16 #include <osg/NodeVisitor>
17 #include <osg/ref_ptr>
18 #include <osg/Node>
19 #include <osg/LightSource>
20 #include <osgEarth/PagedNode>
21 
22 #include <geometry/chord.h>
23 
24 #include <set>
25 #include <vector>
26 #include <unordered_set>
27 
31 
32 typedef std::vector<osg::Matrix> MatrixStack;
33 
37 {
38 public:
39 
42 
44  virtual void apply(osg::Node& node);
45 
47  virtual const bool encounteredPagedNode2() const;
48 
49 protected:
50 
53 };
54 
55 
57 {
58 public:
60  : myStack(stack)
61  , myTmpTop(myStack.top())
62  {
63  myStack.pop();
64  }
66  {
67  myStack.push(myTmpTop);
68  }
69  std::stack <osg::ref_ptr<osg::Node> >& myStack;
71 };
72 
76 {
77 public:
79 
80  bool isFullyLoaded() const;
81  void apply(osg::Node& node);
82  void apply(osgEarth::PagedNode2& pagedNode);
84  void apply(osg::PagedLOD& node);
85  void apply(osg::LightSource& ls);
86 
87  void manualUpdate();
88  void reset();
89  size_t count() { return myCount; }
90 
91  void setNodePathHint(const std::stack <osg::ref_ptr<osg::Node> >& hint)
92  {
93  myNodePathHint = hint;
94  }
95 protected:
96 
102  std::set < osg::ref_ptr < osgEarth::PagingManager> > myPagingManagers;
103 
104  std::set< std::string > myLoadingList;
105  std::stack <osg::ref_ptr<osg::Node> > myNodePathHint;
106  size_t myCount;
107 };
108 
109 
113 {
114 public:
115  PagedNode2CollectTrianglesVisitor(const Coordinate_System* cs, DtTerrainPagingGeometryPtr geometry, const DrawableList& existingDrawable, DrawableMap& newDrawable,
116  DtNodeBoundingExtendedInfoMap& pagedInBoundingMap, const NodePagingRecordMap& pagedInNodes);
117 
118  void apply(osg::Node& node);
119  void apply(osgEarth::PagedNode2& pagedNode);
120  void apply(osg::Drawable& drawable);
122  void apply(osg::PagedLOD& node);
123  void apply(osg::LightSource& ls);
124 
125 
126 protected:
127 
130  {
132  {
133  verts = new osg::Vec3Array();
134  }
135 #if OSG_VERSION_LESS_THAN(3,5,6)
136  inline void operator () (const osg::Vec3& v1, const osg::Vec3& v2, const osg::Vec3& v3, bool treatVertexDataAsTemporary)
137 #else
138  inline void operator () (const osg::Vec3& v1, const osg::Vec3& v2, const osg::Vec3& v3)
139 #endif
140  {
141  verts->push_back(v1);
142  verts->push_back(v2);
143  verts->push_back(v3);
144  }
146  };
147 
148  inline void pushPagedNode2(osgEarth::PagedNode2& pagedNode2) { myPagedNode2Stack.push_back(&pagedNode2); }
149  inline void popPagedNode2() { myPagedNode2Stack.pop_back(); }
150 
151  typedef std::vector<DtNodeId> PagedNode2Stack;
157 };
158 
162 {
163 public:
165 
166  void apply(osg::Node& node);
167  void manualUpdate();
168  bool isUnloaded();
169 
170 protected:
171 
175  std::set < osg::ref_ptr < osgEarth::PagingManager> > myPagingManagers;
176 };
177 
181 {
182 public:
184 
185  PagedNode2ActiveVisitor(const NodePagingRecordMap& pagedInNode, const NodePagingRecordMap& emptyPagedInNode, NodePagingRecordMap& pagedOutNodes);
186  void apply(osg::Node& node);
187  void apply(osgEarth::PagedNode2& pagedNode);
188  void apply(osg::LightSource& ls);
189 
190 protected:
191 
193  bool addToPagedOutVolumesList(DtNodeBoundingInfo* pagedOutArea);
194 
199  std::set< osg::Node* > _traversedNodes;
200  int _level;
201 };
202 
204 {
205 public:
207 
208  void apply(osg::Node& node);
209  void apply(osgEarth::PagedNode2& pagedNode);
210 
211 
212  void manualUpdate();
213  const std::stack< osg::ref_ptr < osg::Node> >& nodesTraveled() const
214  {
215  return myNodesTraveledInReverse;
216  }
217 
218 public:
219  std::set < osg::ref_ptr < osgEarth::PagingManager> > myPagingManagers;
220  std::stack < osg::ref_ptr < osg::Node> > myNodesTraveledInReverse;
221 
222 };
223 
225 size_t getDrawableHash(const osg::Drawable& drawable, const osg::Matrix& matrix);
DtBoost::shared_ptr< DtNodeBoundingInfo > DtNodeBoundingInfoPtr
Definition: boundingNodeInfo.h:87
boost::unordered_map< DtNodeId, DtPagedInExtendInfo > DtNodeBoundingExtendedInfoMap
Definition: boundingNodeInfo.h:133
const NodePagingRecordMap & myPagedInNodes
Holds all the nodes which have been paged in.
Definition: pagedNode2Visitors.h:196
bool addToPagedOutVolumesList(DtNodeBoundingInfoPtr pagedOutArea)
DtBoost::shared_ptr< DtTerrainPagingGeometry > DtTerrainPagingGeometryPtr
Definition: terrainPagingGeometry.h:46
osg::ref_ptr< osg::Vec3Array > verts
Definition: pagedNode2Visitors.h:145
bool myPagedNode2encountered
Definition: pagedNode2Visitors.h:174
void setNodePathHint(const std::stack< osg::ref_ptr< osg::Node > > &hint)
Definition: pagedNode2Visitors.h:91
osg::ref_ptr< osg::Node > myTmpTop
Definition: pagedNode2Visitors.h:70
std::map< std::string, NodePagingRecord > NodePagingRecordMap
Definition: vantageTerrainImplementationUtil.h:101
size_t getDrawableHash(const osg::Drawable &drawable, const osg::Matrix &matrix)
Return a unique ID for a drawable and it&#39;s matrix.
Visitor that tracks whether any part of the terrain contain a pagedNode2.
Definition: pagedNode2Visitors.h:36
Visitor that collect the triangles once pagedNode2 data are loaded in the intersecting area...
Definition: pagedNode2Visitors.h:112
std::stack< osg::ref_ptr< osg::Node > > myNodePathHint
Definition: pagedNode2Visitors.h:105
std::vector< osg::Matrix > MatrixStack
Definition: pagedNode2Visitors.h:32
structure to retrieve the triangles
Definition: pagedNode2Visitors.h:129
Visitor that load all the pagedNode2 data that intersecting with an area.
Definition: pagedNode2Visitors.h:75
std::set< osg::Node * > _traversedNodes
Definition: pagedNode2Visitors.h:199
DrawableMap & myNewDrawable
Definition: pagedNode2Visitors.h:154
size_t myCount
Definition: pagedNode2Visitors.h:106
DtScopedNodeStackPoopPusher(std::stack< osg::ref_ptr< osg::Node > > &stack)
Definition: pagedNode2Visitors.h:59
PagedNode2Stack myPagedNode2Stack
Definition: pagedNode2Visitors.h:152
std::set< std::string > myLoadingList
Definition: pagedNode2Visitors.h:104
const DrawableList & myExistingDrawable
Definition: pagedNode2Visitors.h:153
Subclass of DtPageInVisitor which pages in only nodes that fall along a particular geometry...
Definition: pageInVisitor.h:104
Definition: coordSystem.h:54
std::vector< DtNodeId > PagedNode2Stack
Definition: pagedNode2Visitors.h:151
DtNodeBoundingExtendedInfoMap & myPagedInBoundingMap
Definition: pagedNode2Visitors.h:155
const NodePagingRecordMap & myPagedInNodes
Definition: pagedNode2Visitors.h:156
Visitor class used to find the active paged of a OSG scene graph.
Definition: boundingVolumeTerrainSourcePager.h:48
std::set< osg::ref_ptr< osgEarth::PagingManager > > myPagingManagers
Definition: pagedNode2Visitors.h:102
std::map< size_t, DrawableInfo > DrawableMap
Definition: vantageTerrainImplementationUtil.h:83
Visitor that unload a pageNode2.
Definition: pagedNode2Visitors.h:161
NodePagingRecordMap & myPagedNode2OutNodes
Definition: pagedNode2Visitors.h:197
bool myFullyLoaded
Fully loaded is initially set to true then when traversing the scene graph it will check if all inter...
Definition: pagedNode2Visitors.h:101
void popPagedNode2()
Definition: pagedNode2Visitors.h:149
CollectTriangles()
Definition: pagedNode2Visitors.h:131
void pushPagedNode2(osgEarth::PagedNode2 &pagedNode2)
Definition: pagedNode2Visitors.h:148
Definition: boundingNodeInfo.h:19
osg::ref_ptr< osg::Node > myPagedNode2ToUnload
Definition: pagedNode2Visitors.h:172
A DtChord is a finite line segment in 3-space, represented by two points. Data derived from the two e...
std::set< osg::ref_ptr< osgEarth::PagingManager > > myPagingManagers
Definition: pagedNode2Visitors.h:219
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
std::stack< osg::ref_ptr< osg::Node > > & myStack
Definition: pagedNode2Visitors.h:69
std::stack< osg::ref_ptr< osg::Node > > myNodesTraveledInReverse
Definition: pagedNode2Visitors.h:220
Definition: pagedNode2Visitors.h:56
virtual ~DtScopedNodeStackPoopPusher()
Definition: pagedNode2Visitors.h:65
virtual void apply(osg::Transform &node)
bool myEncounteredPagedNode2
Whether or not the visitor has yet encountered a pagedNode2 node.
Definition: pagedNode2Visitors.h:52
size_t count()
Definition: pagedNode2Visitors.h:89
std::set< size_t > DrawableList
Definition: vantageTerrainImplementationUtil.h:82
const NodePagingRecordMap & myEmptyPagedInNodes
Definition: pagedNode2Visitors.h:198
Visitor that check loaded (active page in/out bounding sphere) pagedNode2.
Definition: pagedNode2Visitors.h:180
int _level
Definition: pagedNode2Visitors.h:200
Definition: pagedNode2Visitors.h:203
bool myEndTraversal
Definition: pagedNode2Visitors.h:173
const std::stack< osg::ref_ptr< osg::Node > > & nodesTraveled() const
Definition: pagedNode2Visitors.h:213
virtual void apply(osg::LOD &node)
std::set< osg::ref_ptr< osgEarth::PagingManager > > myPagingManagers
Definition: pagedNode2Visitors.h:175

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)