VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectGeometryRegistrar.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
21 
23 
25 
26 #include <osg/Node>
27 #include <osg/Geometry>
28 #include <osg/Texture>
29 #include <osg/Referenced>
30 
31 #include <tbb/concurrent_queue.h>
32 #include <tbb/atomic.h>
33 #include <tbb/task.h>
34 
35 #include <boost/signals.hpp>
36 
37 #include <string>
38 #include <vector>
39 
40 
41 #define INDIRECTGEOMETRYREGISTRAR_DEBUG 0
42 
43 namespace osgUtil{
44  class CullVisitor;
45 };
46 
47 namespace osgEarth {
48  class VirtualProgram;
49 };
50 
51 namespace makVrv
52 {
53  class DtGlBuffer;
54 
55  class DtIndirectGeometryRegistrar;
56 
57  class DtIndirectTextureCollectionPolicy;
58 
59  class DtAggregatedGeometry;
60 
61  class DtAggregatedGeometryCreator;
62  class DtIndirectGeometryAggregatorCreator;
63  class DtCoreGlBufferCreator;
64  class DtOsgShaderManager;
65 
66 
76 
80 
89 
101  class DT_DLL_VRVOSG DtIndirectGeometryRegistrar : public osg::Referenced
102  {
103  protected:
106  const DtIndirectTextureCollectionPolicy& textureCollectionPolicy,
107  DtAggregatedGeometryCreator& aggregatedGeometryCreator,
108  DtIndirectGeometryAggregatorCreator& indirectGeometryAggregatorCreator,
109  DtCoreGlBufferCreator& coreGlBufferCreator);
110 
113 
114  protected:
115 
117  virtual ~DtIndirectGeometryRegistrar();
118 
119  private:
122 
125 
127  DtIndirectGeometryRegistrar(const DtIndirectGeometryRegistrar& lhs, const osg::CopyOp& copyop);
128 
131 
132 
133 
134  public:
135 
136  virtual void setName(const std::string& name);
137 
138  // ! Thread safe method - can be called in any paging thread or the main render thread
139  // ! This needs to be 'queued' up because the actual registration can happen when rebuild rebuildIfNeeded
140  // ! is called from somewhere in the main thread (e.g. via the drawImplementation of DtIndirectGeometry)
141  // \param modelId: The model id
142  // \param modelFileName is used only for debugging messages for the aggregator
143  virtual void queueUpRegisterModel(int modelId, osg::ref_ptr<const osg::Node> model, const std::string& modelFileName,
144  bool cullFaceEnabled = false,
145  const DtIndirectPolygonOffset& polygonOffset = DtIndirectPolygonOffset(0.0f,0.0f));
146 
149  virtual void processRegisterModelQueue(DtOsgRenderer* renderer);
150 
152  virtual bool beingProcessed();
153 
155  virtual unsigned int rebuildIfNeeded(osg::RenderInfo& renderInfo, unsigned int currentFrameNum);
156 
158  virtual unsigned int numModelsInQueue();
159 
161  virtual int numModels(void) const;
162 
164  virtual int modelId(int index) const;
165 
167  virtual bool isModelDownloaded(int modelId) const;
168 
170  virtual DtAggregateModelInfo* modelInfoForModelID(int modelId) const;
171 
173  virtual int numGeometriesForModelID(int modelId) const;
174 
176  virtual void bindBuffers();
180 
181  virtual void unbindBuffers();
183 
185  virtual const DtIndirectTextureCollectionPolicy& textureCollectionPolicy(void) const;
186 
188  virtual DtIndirectTextureProcessor& textureProcessor();
189 
192  virtual const DtIndirectEffectTexturesTemplate& effectTexturesState(void) const;
193 
195  virtual DtIndirectGeometryStateManager& stateContainer(void) const;
196 
198  virtual GLenum indicesType(void) const;
199 
203  virtual void releaseGLObjects(osg::State* state) const;
204 
207  virtual bool registeredModelsDirty();
208 
210  virtual void drainModelQueue(DtOsgRenderer* renderer);
211 
213  virtual DtAggregatedGeometry* aggregatedGeometry();
214 
216  virtual void setPagerHandlesModelLoading(bool value);
217  virtual bool pagerHandlesModelLoading();
218 
220  virtual boost::mutex& addingModelsMutex();
221 
222  protected:
225  virtual void registerModel(int modelId, osg::ref_ptr<const osg::Node> model, const std::string& modelFileName,
226  bool cullFaceEnabled = true,
227  const DtIndirectPolygonOffset& polygonOffset = DtIndirectPolygonOffset(0.0f, 0.0f));
228 
232  virtual bool allTexturesReady(const int modelId, unsigned int contextID) const;
233 
234  protected:
235 
236 
238 
241 
243  {
244  public:
246  : myModelId(0)
247  , myCullFaceEnabled(true)
248  {
249 
250  }
251  RegisterModelOp(const RegisterModelOp& rhs);
252  RegisterModelOp& operator=(const RegisterModelOp& rhs);
253  public:
256  // used only for debugging messages
257  std::string myModelFileName;
260  };
261 
262  typedef tbb::concurrent_queue<RegisterModelOp> QueueRegisterModelOps;
264 
266 
268 
270  unsigned int myLastRebuiltFrameNum;
271 
273  tbb::atomic<bool> myBeingProcessed;
274  boost::mutex myAddingModelsMutex;
275 
279 
282 
284  };
285 
289  {
290  public:
291 
294 
297 
299  //init is also called here so the registrar is not created without init being called.
300  // This must be done the same way in all derived creators!!!!!
301  virtual DtIndirectGeometryRegistrar* create(DtIndirectTextureCollectionPolicy& textureCollectionPolicy,
302  DtAggregatedGeometryCreator& aggregatedGeometryCreator,
303  DtIndirectGeometryAggregatorCreator& indirectGeometryAggregatorCreator,
304  DtCoreGlBufferCreator& coreGlBufferCreator) const;
305 
308  static DtIndirectGeometryRegistrarCreator& instance(DtDe& de);
309 
311  static const std::string& theClassName();
312  protected:
314  };
315 }
The DtAggregatedGeometry creator for the DtAggregatedGeometryCreator class.
Definition: DtAggregatedGeometry.h:274
Definition: DtIndirectGeometryRegistrar.h:242
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:125
Virtual base class.
Definition: DtVirtualBaseClass.h:22
DtIndirectPolygonOffset myPolygonOffset
Definition: DtIndirectGeometryRegistrar.h:259
QueueRegisterModelOps myQueueRegisterModelOps
Definition: DtIndirectGeometryRegistrar.h:263
contains the information which indirect needs for all geometry found by the geometry aggregator after...
Definition: DtAggregatedGeometry.h:99
DtDe & myDe
Definition: DtIndirectGeometryRegistrar.h:313
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Contains the DtIndirectTextureProcessor class declaration.
creator for DtCoreGlBuffer
Definition: DtCoreGlBuffer.h:58
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:101
DtGeometrySpecification class declaration.
Abstract class to look in the stateset and collect textures specified via its template The effect tex...
Definition: DtIndirectTextureCollectionPolicy.h:38
std::string myModelFileName
Definition: DtIndirectGeometryRegistrar.h:257
creator for DtIndirectGeometryAggregator
Definition: DtIndirectGeometryAggregator.h:211
bool myCullFaceEnabled
Definition: DtIndirectGeometryRegistrar.h:258
Indirect rendering works because we are able to combine multiple geometries into a single &#39;aggregated...
Definition: DtIndirectGeometryAggregator.h:63
DtIndirectGeometryRegistrar & operator=(const DtIndirectGeometryRegistrar &other)
Assignment Operator Not implemented – Assignment Not Allowed.
Definition: DtIndirectGeometryRegistrar.h:130
osg::ref_ptr< const osg::Node > myModel
Definition: DtIndirectGeometryRegistrar.h:255
Contains the DtIndirectEffectTexturesTemplate class declaration.
RegisterModelOp()
Definition: DtIndirectGeometryRegistrar.h:245
Contains makVrv::DtVirtualBaseClass class.
DtIndirectEffectTexturesTemplate myEffectTexturesState
Definition: DtIndirectGeometryRegistrar.h:239
Simple state/glmodes class for handling setting up modes It can now handle generic state modes and at...
Definition: DtIndirectGeometryStateManager.h:29
osg::ref_ptr< DtIndirectTextureProcessor > myTextureProcessor
Definition: DtIndirectGeometryRegistrar.h:267
tbb::atomic< bool > myBeingProcessed
Definition: DtIndirectGeometryRegistrar.h:273
DtIndirectGeometryAggregator * myAggregator
Definition: DtIndirectGeometryRegistrar.h:272
Contains the DtIndirectGeometryStateManager class declaration.
const DtIndirectTextureCollectionPolicy * myTextureCollectionPolicy
Definition: DtIndirectGeometryRegistrar.h:265
contains the Per Model info which DtAggregatedGeometry needs It is owned by the Indirect geometry reg...
Definition: DtAggregatedGeometry.h:47
DtDe & myDe
DtDe reference.
Definition: DtIndirectGeometryRegistrar.h:281
bool myPagerHandlesModelLoading
Definition: DtIndirectGeometryRegistrar.h:240
Definition: DtIndirectTextureProcessor.h:41
bool myRegisteredModelsDirty
Definition: DtIndirectGeometryRegistrar.h:269
boost::mutex myAddingModelsMutex
Definition: DtIndirectGeometryRegistrar.h:274
Contains makVrv::DtIndirectSwitchManager class.
DtOsgShaderManager injects custom shaders into the scenes, and keeps their uniform parameters set to ...
Definition: DtOsgShaderManager.h:55
unsigned int GLenum
Definition: DtGlTextureBufferObject.h:18
creator for DtIndirectGeometryRegistrar
Definition: DtIndirectGeometryRegistrar.h:288
Contains makVrv::DtIndirectLodManager class.
DtIndirectGeometryStateManager myMutableStateContainer
mutable since it is needed to be used in drawImplementaion for the indirect geometry not private so i...
Definition: DtIndirectGeometryRegistrar.h:278
non virtual container class for defining a polygon offset state
Definition: DtIndirectPolygonOffset.h:18
DtAggregatedGeometry * myAggregatedGeometry
Definition: DtIndirectGeometryRegistrar.h:237
Contains DLL export macros.
int myModelId
Definition: DtIndirectGeometryRegistrar.h:254
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
tbb::concurrent_queue< RegisterModelOp > QueueRegisterModelOps
Definition: DtIndirectGeometryRegistrar.h:262
Contains the DtIndirectGeometryAggregator class declaration.
DtOsgShaderManager & myShaderManager
Definition: DtIndirectGeometryRegistrar.h:283
unsigned int myLastRebuiltFrameNum
Definition: DtIndirectGeometryRegistrar.h:270
Class that allows you to abstractly register effect texture types the effect texture types are client...
Definition: DtIndirectEffectTexturesTemplate.h:38

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)