VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectFeatureGeomHandler.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 
13 
15 
17 
19 
20 #include <osgEarth/StateSetCache>
21 #include <osgEarth/Layer>
22 
23 #include <osg/observer_ptr>
24 
25 #include <boost/thread/mutex.hpp>
26 #include <boost/thread/condition_variable.hpp>
27 
28 #include <tbb/atomic.h>
29 #include <tbb/task.h>
30 
31 #include <set>
32 
33 namespace osgEarth
34 {
35  class Layer;
36  class SubstituteModelFilterNode;
37  class ExtrudeGeometryFilterNode;
38 }
39 namespace osg
40 {
41  class Node;
42  class Group;
43 }
44 
45 namespace makVrv
46 {
47  class DtDe;
48  class DtCellToGeoTypicalIndirectGeoMap;
49  class DtCellToGeoSpecificIndirectGeoMap;
50  class DtIndirectModelsContainer;
51  class DtModelSemanticsMapper;
52  class DtIndirectFeatureGeomHandler;
53 
56  class DtIndirectFeatureGeomHandlerAsyncLoader : public tbb::task
57  {
58  public:
61  std::string requestMarkerName);
63  virtual tbb::task* execute();
64 
65  public:
66  protected:
68  std::string myRequestMarkerName;
69 
70  };
71 
79  {
80  public:
83 
84  protected:
86  DtIndirectFeatureGeomHandler(DtDe& de, const osgEarth::Layer& layer, const DtIndirectFadeParameters& fadeParameters, bool dynamicTerrainInstallerActive, bool cullFaceEnabled);
87 
90 
91  private:
95  DtIndirectFeatureGeomHandler &operator=(const DtIndirectFeatureGeomHandler &other) = delete;
96 
97  public:
99  virtual void onDataPremerge(osg::Node* data);
100 
102  virtual void onDataUnloaded(const osg::Node* data);
103 
108  virtual const osg::Node* preloadModelAndRunDynamicTerrainParser(const std::string& modelName);
109 
111  virtual void markTaskFinished();
112 
113  protected:
115  virtual void processSubstituteModelFilterNodes(osg::Node* data);
116 
118  virtual void processExtrudeGeometryFilterNodes(osg::Node* data);
119 
121  virtual void processExtrudeGeometryFilterNode(osgEarth::ExtrudeGeometryFilterNode* pFeatureNode, osg::Node* data);
122 
123 
127  virtual void processSubstituteModelFilterNode(const osgEarth::SubstituteModelFilterNode* pFeatureNode, const osg::Node* data);
128 
130  virtual void processSubstituteModelFilterNodeAsGT(const osgEarth::SubstituteModelFilterNode* pFeatureNode, const osg::Group* keyNode);
131 
133  virtual void processSubstituteModelFilterNodeAsGS(const osgEarth::SubstituteModelFilterNode* pFeatureNode, const osg::Group* keyNode);
134 
137  virtual void processCustomFeatures(osg::Node* data);
138 
140  virtual void processCustomFeature(const osgEarth::CustomFeatureNode* pFeatureNode, const osg::Node* key);
141 
142  protected:
143 
150  osg::observer_ptr<const osgEarth::Layer> myLayer;
151 
155 
158 
162 
164 
166  boost::condition_variable myProcessedNodeMapCondition;
168  std::map<std::string, NodeRefPtr > myProcessedNodeMap;
169  std::map<std::string, bool > myIsProcessingNodeMap;
170 
171 
173  static tbb::atomic<int> theTotalNumActiveAsyncTasks;
174 
176  tbb::atomic<int> myActiveAsyncTasks;
177 
179  boost::condition_variable myWaitCondition;
180  boost::mutex myWaitMutex;
181 
183 
185 
187  const bool myCullFaceEnabled;
188  };
189 
192  {
193  public:
196 
199 
200  private:
205 
206  public:
208  virtual DtIndirectFeatureGeomHandler* create(const osgEarth::Layer& layer, const DtIndirectFadeParameters& fadeParameters, bool dynamicTerrainInstallerActive, bool cullFaceEnabled) const;
209 
212  static DtIndirectFeatureGeomHandlerCreator& instance(DtDe& de);
213 
215  static const std::string& theClassName();
216  protected:
218  };
219 }
virtual tbb::task * execute()
runs the task in a background thread
static tbb::atomic< int > theTotalNumActiveAsyncTasks
tracks how many total threads are active to avoid preemption
Definition: DtIndirectFeatureGeomHandler.h:173
Virtual base class.
Definition: DtVirtualBaseClass.h:19
DtIndirectFeatureGeomHandler * myHandler
Definition: DtIndirectFeatureGeomHandler.h:67
Helper for managing a map of feature tile nodes (for a layer) to DtCellGeoSpecificIndirectGeo DtCellG...
Definition: DtCellToGeoSpecificIndirectGeoMap.h:39
std::map< std::string, bool > myIsProcessingNodeMap
Definition: DtIndirectFeatureGeomHandler.h:169
tbb::atomic< int > myActiveAsyncTasks
tracks how many threads are active from this particular instance, when 0 the tasks are done...
Definition: DtIndirectFeatureGeomHandler.h:176
#define DT_DLL_VRVOSGEARTH
Definition: vrvOsgEarth.h:21
std::map< std::string, NodeRefPtr > myProcessedNodeMap
Definition: DtIndirectFeatureGeomHandler.h:168
DtIndirectFeatureGeomHandlerAsyncLoader(DtIndirectFeatureGeomHandler *handler, std::string requestMarkerName)
constructor
boost::mutex myWaitMutex
Definition: DtIndirectFeatureGeomHandler.h:180
const bool myDynamicTerrainInstallerActive
Definition: DtIndirectFeatureGeomHandler.h:186
Helper for managing a map of feature tile nodes (for a layer) to DtCellGeoTypicalIndirectGeo DtCellGe...
Definition: DtCellToGeoTypicalIndirectGeoMap.h:39
osg::ref_ptr< osgEarth::StateSetCache > myStateSetCache
Definition: DtIndirectFeatureGeomHandler.h:182
DtIndirectModelsContainer * myGTModelsContainer
Definition: DtIndirectFeatureGeomHandler.h:154
DtDe & myDe
Definition: DtIndirectFeatureGeomHandler.h:217
class used to collect geometry coming in via feature_geom and add it to the indirect engine...
Definition: DtIndirectFeatureGeomHandler.h:78
Creates another async class to load nodes.
Definition: DtIndirectFeatureGeomHandler.h:56
DtIndirectFadeParameters myFadeParameters
Definition: DtIndirectFeatureGeomHandler.h:184
class for holding an indirect geometry registrar (which holds the information about how to draw model...
Definition: DtIndirectModelsContainer.h:43
Contains makVrv::DtVirtualBaseClass class.
std::string myRequestMarkerName
Definition: DtIndirectFeatureGeomHandler.h:68
Custom Feature Node.
Definition: CustomFeatureNode.h:43
osg::ref_ptr< const osg::Node > NodeRefPtr
Definition: DtIndirectFeatureGeomHandler.h:167
Contains the CustomFeatureNode class declaration.
const bool myCullFaceEnabled
Definition: DtIndirectFeatureGeomHandler.h:187
struct for holding the fade parameters used by the indirect rendering cull compute shader ...
Definition: DtIndirectFadeParameters.h:17
Definition: DtIndirectFeatureGeomHandler.h:191
DtCellToGeoSpecificIndirectGeoMap * myCellToGSIndirectGeoMap
GeoSpecific stuff.
Definition: DtIndirectFeatureGeomHandler.h:157
boost::mutex myProcessedNodeMapMutex
Definition: DtIndirectFeatureGeomHandler.h:165
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtCellToGeoTypicalIndirectGeoMap * myCellToGTIndirectGeoMap
GeoTypical stuff.
Definition: DtIndirectFeatureGeomHandler.h:153
DtCellToGeoSpecificIndirectGeoMap * myCellToProceduralGSIndirectGeoMap
Procedural stuff.
Definition: DtIndirectFeatureGeomHandler.h:161
DtModelSemanticsMapper & myModelSematicsMapper
Definition: DtIndirectFeatureGeomHandler.h:163
DtDe & myDe
Definition: DtIndirectFeatureGeomHandler.h:144
boost::condition_variable myWaitCondition
signaling mutex and condition
Definition: DtIndirectFeatureGeomHandler.h:179
boost::condition_variable myProcessedNodeMapCondition
Definition: DtIndirectFeatureGeomHandler.h:166
The DtModelSemanticsMapper object is responsible for mapping Names of model semantics declarations (f...
Definition: DtModelSemanticsMapper.h:27
Contains DLL export macros.
Contains makVrv::DtIndirectFadeParameters class.
osg::observer_ptr< const osgEarth::Layer > myLayer
store by observer ptr here onDataPremerge for a node can get launched (in another thread) just after ...
Definition: DtIndirectFeatureGeomHandler.h:150

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)