VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtPagedTilesIndirectManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
14 
17 
18 #include <osg/Matrixd>
19 #include <osg/Geode>
20 
21 #include <string>
22 #include <vector>
23 #include <unordered_set>
24 
25 #include <boost/thread/condition.hpp>
26 
27 namespace osg
28 {
29  class Node;
30  class Group;
31 }
32 
33 namespace makVrv
34 {
35  class DtCellToGeoTypicalIndirectGeoMap;
36  class DtCellToGeoSpecificIndirectGeoMap;
37  class DtCellIndirectGeo;
38  class DtCellGeoTypicalIndirectGeo;
39  class DtCellGeoSpecificIndirectGeo;
40  class DtIndirectModelsContainer;
41  class DtIndirectVisitorControlGroupCreator;
42  class DtIndirectTextureLoaderNode;
43  struct DtNodePlusTraversalInfo;
44  class DtLightPointNode;
45 }
46 
47 //Debug/testing option for seeing if rendering the proxy nodes as a GS cell works better vs a GT cell
48 // Currently should be set to 1 since we want to use GT cells
49 #define DTPAGEDTILESINDIRECTMANAGER_PROXIES_USE_GT 1
50 
51 namespace makVrv
52 {
55 
58 
60  template <>
61  inline const char* creatorTypeName<DtPagedTilesIndirectManager>(void) { return "DtPagedTilesIndirectManagerCreator"; }
62 
63 
68  {
69 
70  protected:
71 
72  //Constructor, adjustLodStart is used if it is a metaflight terrain.
73  DtPagedTilesIndirectManager(DtDe& de, bool adjustLodStart, bool connectToPagingSignals);
74 
77 
78  public:
80  virtual ~DtPagedTilesIndirectManager();
81 
83  DtPagedTilesIndirectManager() = delete;
84 
87 
89  DtPagedTilesIndirectManager& operator=(const DtPagedTilesIndirectManager&) = delete;
90 
91  public:
92 
93  typedef std::vector< DtNodePlusTraversalInfo > ProxyNodesArray;
94 
96  virtual void setName(const std::string& name);
97 
102  virtual void nodePagedIn(const osg::Node* node, const std::string& fileName, osg::NodePath& parentalNodePath, bool oceanExtracted);
103 
107  virtual void nodePagingOut(const osg::Node* node);
108 
112  virtual void addTextureLoaderToSceneGraph(osg::Group& myTerrainGroup);
113 
117  virtual void slot_postTick();
118 
120  virtual void setMetaflightGroup(osg::Node* node);
121 
122  public:
124  boost::signalslib::signal<void(const DtPagedTilesIndirectManager&)> signal_terrainInstancesReadyToRender;
125  protected:
126 
131  virtual void slot_childLoaded(const osg::Group* page, const osg::Node* child, const std::string& fileName, osg::Node*& returnedNode);
132 
134  virtual bool shouldHandlePage(const osg::Group* page);
135 
140  virtual void slot_childPagedIn(const osg::Group* page, const osg::Node* child);
141 
144  virtual void indirectChildFromPageIn(const osg::Group* page, const osg::Node* child, const std::string& fileName, osg::NodePath& parentalNodePath, bool oceanExtracted);
145 
147  virtual void keyNodeGettingDeleted(const osg::Group* child, DtCellToGeoTypicalIndirectGeoMap* cellMap);
148 
150  virtual void keyNodeGettingDeleted(const osg::Group* child, DtCellToGeoSpecificIndirectGeoMap* cellMap);
151 
156  virtual void slot_childAboutToPageOut(const osg::Group* page, const osg::Node* child);
157 
161  virtual bool processProxyNodes(osg::Group *indirectGroup, const osg::Group* child, std::set<osg::Node*>& foundProxyNodes,
162  osg::NodePath& parentalNodePath);
163 
165  virtual void processGeodes(osg::Group* indirectGroup, osg::Group* child, const std::string& fileName,
166  const std::set<osg::Node*>& foundProxyNodes, bool backgroundThread, osg::NodePath& parentalNodePath, bool oceanIsIndirect);
167 
169  virtual void replaceChildWithGroup(const osg::Group* child, const osg::Group* childReplacement);
170 
172  virtual void indirectThisChild(osg::Group* intersectionGroup, osg::Group* child, const std::string& fileName,
173  bool backgroundThread, osg::NodePath& parentalNodePath, bool oceanExtracted);
174 
176  virtual void disconnectSignalsAndWait();
177 
179  virtual void printHierarchy(const osg::Node* node) const;
180 
182  virtual void removeNestedProxyNodes(ProxyNodesArray& proxyNodesArray) const;
183 
185  virtual DtIndirectModelsContainer* GTModelsContainer();
186 
188  virtual void terrainSkinCellCreatedAndInstancesAdded(const DtCellGeoSpecificIndirectGeo* cell, const std::unordered_set<int>& instances);
189 
191  virtual void terrainSkinCellGettingDeleted(const DtCellGeoSpecificIndirectGeo* cell);
192 
193  protected:
195 
196 #if DTPAGEDTILESINDIRECTMANAGER_PROXIES_USE_GT
199 #else
200  DtCellToGeoSpecificIndirectGeoMap* myCellToGSIndirectGeoMap;
201 #endif
202 
204 
206  std::unordered_map<const DtCellGeoSpecificIndirectGeo*, std::unordered_set<int> > myMapCelltoSetGeodesInCell;
207 
210 
212  typedef std::vector<boost::signalslib::connection> Connections;
213 
216 
219 
221 
222  boost::mutex mySignalMutex;
223  boost::condition mySignalConditional;
228  };
229 }
boost::mutex myMapCelltoSetGeodesInCellMutex
lock for the map above
Definition: DtPagedTilesIndirectManager.h:209
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
Helper for managing a map of feature tile nodes (for a layer) to DtCellGeoSpecificIndirectGeo DtCellG...
Definition: DtCellToGeoSpecificIndirectGeoMap.h:39
DtCellToGeoSpecificIndirectGeoMap * myCellToGSIndirectGeoMapTerrainSkin
Definition: DtPagedTilesIndirectManager.h:203
handles the management of paged tiles and terrain patches being added to the indirect rendering syste...
Definition: DtPagedTilesIndirectManager.h:67
DtIndirectVisitorControlGroupCreator & myIndirectGeoIntersectionGroupCreator
Definition: DtPagedTilesIndirectManager.h:226
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
boost::mutex mySignalMutex
Definition: DtPagedTilesIndirectManager.h:222
std::vector< DtNodePlusTraversalInfo > ProxyNodesArray
Definition: DtPagedTilesIndirectManager.h:93
DtIndirectModelsContainer * myGTModelsContainer
Definition: DtPagedTilesIndirectManager.h:198
Connections myConnections
The connected signals for paging.
Definition: DtPagedTilesIndirectManager.h:215
bool myAdjustLodStart
Definition: DtPagedTilesIndirectManager.h:225
Helper for managing a map of feature tile nodes (for a layer) to DtCellGeoTypicalIndirectGeo DtCellGe...
Definition: DtCellToGeoTypicalIndirectGeoMap.h:39
creator for DtIndirectVisitorControlGroup
Definition: DtIndirectVisitorControlGroup.h:56
osg::Node * myMetaflightGroupNode
Definition: DtPagedTilesIndirectManager.h:227
friend DtPagedTilesIndirectManagerCreator
friend class creator so that it is the only thing that will create DtPageTilesIndirectManagers ...
Definition: DtPagedTilesIndirectManager.h:76
class for holding an indirect geometry registrar (which holds the information about how to draw model...
Definition: DtIndirectModelsContainer.h:55
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
DtVirtualBaseClassCreator< DtPagedTilesIndirectManager, const bool &, const bool & > DtPagedTilesIndirectManagerCreator
creator
Definition: DtPagedTilesIndirectManager.h:54
boost::signalslib::signal< void(const DtPagedTilesIndirectManager &)> signal_terrainInstancesReadyToRender
Emitted when instances of the terrain skin are ready to render.
Definition: DtPagedTilesIndirectManager.h:124
std::vector< boost::signalslib::connection > Connections
A collection of signals.
Definition: DtPagedTilesIndirectManager.h:212
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtDe & myDe
Definition: DtPagedTilesIndirectManager.h:194
osg::ref_ptr< DtIndirectTextureLoaderNode > myTextureLoaderNode
Definition: DtPagedTilesIndirectManager.h:220
boost::condition mySignalConditional
Definition: DtPagedTilesIndirectManager.h:223
Helper for managing indirect geometry, its intersection group and registrar corresponding to a &#39;tile ...
Definition: DtCellGeoSpecificIndirectGeo.h:26
int mySignalWaitCount
Definition: DtPagedTilesIndirectManager.h:224
Base class to provide boost signal/slot management.
const char * creatorTypeName< DtPagedTilesIndirectManager >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtPagedTilesIndirectManager.h:61
Contains DLL export macros.
std::unordered_map< const DtCellGeoSpecificIndirectGeo *, std::unordered_set< int > > myMapCelltoSetGeodesInCell
map of each cell to the set of instance ids (in the indirect geometry) for that cell ...
Definition: DtPagedTilesIndirectManager.h:206
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
DtSignalConnectionManager myOtherConnections
manager for other connections
Definition: DtPagedTilesIndirectManager.h:218
DtCellToGeoTypicalIndirectGeoMap * myCellToGTIndirectGeoMap
Definition: DtPagedTilesIndirectManager.h:197

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)