VR-Forces 4.10 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) 2021 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
21 
23 
24 #include <vrvUtil/signalslib.h>
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 <string>
36 #include <vector>
37 
38 #define INDIRECTGEOMETRYREGISTRAR_DEBUG 0
39 
40 namespace osgUtil{
41  class CullVisitor;
42 };
43 
44 namespace osgEarth {
45  class VirtualProgram;
46 };
47 
48 namespace makVrv
49 {
50  class DtGlBuffer;
51 
52  class DtIndirectGeometryRegistrar;
53 
54  class DtIndirectTextureCollectionPolicy;
55 
56  class DtAggregatedGeometry;
57 
58  class DtOsgShaderManager;
59 
60  struct DtAggregateModelInfo;
61 
64 
67 
69  template <>
70  inline const char* creatorTypeName<DtIndirectGeometryRegistrar>(void) { return "DtIndirectGeometryRegistrarCreator"; }
71 
81 
85 
94 
106  class DT_DLL_VRVOSG DtIndirectGeometryRegistrar : public osg::Referenced
107  {
108  protected:
111 
112  protected:
114  DtIndirectGeometryRegistrar(DtDe& de, const DtIndirectTextureCollectionPolicy& textureCollectionPolicy);
115 
117  virtual ~DtIndirectGeometryRegistrar();
118 
119  private:
121  DtIndirectGeometryRegistrar() = delete;
122 
125 
127  DtIndirectGeometryRegistrar(const DtIndirectGeometryRegistrar& lhs, const osg::CopyOp& copyop) = delete;
128 
130  DtIndirectGeometryRegistrar& operator=(const DtIndirectGeometryRegistrar& other) = delete;
131  public:
133  virtual void setName(const std::string& name);
134 
135  // ! Thread safe method - can be called in any paging thread or the main render thread
136  // ! This needs to be 'queued' up because the actual registration can happen when rebuild rebuildIfNeeded
137  // ! is called from somewhere in the main thread (e.g. via the drawImplementation of DtIndirectGeometry)
138  // \param modelId: The model id
139  // \param modelFileName is used only for debugging messages for the aggregator
140  virtual void queueUpRegisterModel(int modelId, osg::ref_ptr<const osg::Node> model, const std::string& modelFileName,
141  bool cullFaceEnabled = false,
142  const DtIndirectPolygonOffset& polygonOffset = DtIndirectPolygonOffset(0.0f,0.0f), bool daylightControlled = false);
143 
146  virtual void processRegisterModelQueue(DtOsgRenderer* renderer);
147 
149  virtual bool beingProcessed();
150 
152  virtual unsigned int rebuildIfNeeded(const osg::RenderInfo& renderInfo);
153 
155  virtual unsigned int numModelsInQueue() const;
156 
158  virtual int numModels(void) const;
159 
161  virtual int modelId(int index) const;
162 
164  virtual int numGeometriesForModelID(int modelId) const;
165 
167  virtual bool isModelDownloaded(int modelId) const;
168 
170  virtual const DtAggregateModelInfo* modelInfoForModelID(int modelId) const;
171 
173  virtual const DtAggregatedGeometry* aggregatedGeometry() const;
174 
176  virtual DtAggregatedGeometry* aggregatedGeometry();
177 
179  virtual void bindBuffers() const;
183 
184  virtual void unbindBuffers() const;
186 
188  virtual const DtIndirectTextureCollectionPolicy& textureCollectionPolicy(void) const;
189 
191  virtual DtIndirectTextureProcessor& textureProcessor();
192 
195  virtual const DtIndirectEffectTexturesTemplate& effectTexturesState(void) const;
196 
198  virtual DtIndirectGeometryStateManager& stateManager(void) const;
199 
201  virtual GLenum indicesType(void) const;
202 
206  virtual void releaseGLObjects(osg::State* state) const;
207 
210  virtual bool registeredModelsDirty() const;
211 
213  virtual void drainModelQueue(DtOsgRenderer* renderer);
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, bool daylightControlled,
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 
237 
239 
241 
243  {
244  public:
246  RegisterModelOp();
248  RegisterModelOp(const RegisterModelOp& rhs);
250  RegisterModelOp& operator=(const RegisterModelOp& rhs);
252  ~RegisterModelOp();
253  public:
256  // used only for debugging messages
257  std::string myModelFileName;
261  };
262 
263  typedef tbb::concurrent_queue<RegisterModelOp> QueueRegisterModelOps;
265 
267 
269 
271  unsigned int myLastRebuildNumber;
272 
274  tbb::atomic<bool> myBeingProcessed;
275  boost::mutex myAddingModelsMutex;
276 
280 
283 
285  };
286 
287 }
Definition: DtIndirectGeometryRegistrar.h:242
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:90
DtIndirectPolygonOffset myPolygonOffset
Definition: DtIndirectGeometryRegistrar.h:259
QueueRegisterModelOps myQueueRegisterModelOps
Definition: DtIndirectGeometryRegistrar.h:264
contains the information which indirect needs for all geometry found by the geometry aggregator after...
Definition: DtAggregatedGeometry.h:91
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtVirtualBaseClassCreator< DtIndirectGeometryRegistrar, DtIndirectTextureCollectionPolicy & > DtIndirectGeometryRegistrarCreator
creator
Definition: DtIndirectGeometryRegistrar.h:63
Contains the DtIndirectTextureProcessor class declaration.
bool myDaylightControlled
Definition: DtIndirectGeometryRegistrar.h:260
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:106
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
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:83
osg::ref_ptr< const osg::Node > myModel
Definition: DtIndirectGeometryRegistrar.h:255
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
Contains the DtIndirectEffectTexturesTemplate class declaration.
DtIndirectEffectTexturesTemplate myEffectTexturesState
Definition: DtIndirectGeometryRegistrar.h:238
unsigned int myLastRebuildNumber
Definition: DtIndirectGeometryRegistrar.h:271
Simple state/glmodes class for handling setting up modes It can now handle generic state modes and at...
Definition: DtIndirectGeometryStateManager.h:31
osg::ref_ptr< DtIndirectTextureProcessor > myTextureProcessor
Definition: DtIndirectGeometryRegistrar.h:268
tbb::atomic< bool > myBeingProcessed
Definition: DtIndirectGeometryRegistrar.h:274
DtIndirectGeometryAggregator * myAggregator
Definition: DtIndirectGeometryRegistrar.h:273
Contains the DtIndirectGeometryStateManager class declaration.
const DtIndirectTextureCollectionPolicy * myTextureCollectionPolicy
Definition: DtIndirectGeometryRegistrar.h:266
contains the Per Model info which DtAggregatedGeometry needs It is owned by the Indirect geometry reg...
Definition: DtAggregateModelInfo.h:31
DtDe & myDe
DtDe reference.
Definition: DtIndirectGeometryRegistrar.h:282
bool myPagerHandlesModelLoading
Definition: DtIndirectGeometryRegistrar.h:240
Definition: DtIndirectTextureProcessor.h:40
bool myRegisteredModelsDirty
Definition: DtIndirectGeometryRegistrar.h:270
boost::mutex myAddingModelsMutex
Definition: DtIndirectGeometryRegistrar.h:275
Contains makVrv::DtIndirectSwitchManager class.
DtOsgShaderManager injects custom shaders into the scenes, and keeps their uniform parameters set to ...
Definition: DtOsgShaderManager.h:41
unsigned int GLenum
Definition: DtGlTextureBufferObject.h:18
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:279
non virtual container class for defining a polygon offset state
Definition: DtIndirectPolygonOffset.h:18
DtAggregatedGeometry * myAggregatedGeometry
Definition: DtIndirectGeometryRegistrar.h:236
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:263
Contains the DtIndirectGeometryAggregator class declaration.
DtOsgShaderManager & myShaderManager
Definition: DtIndirectGeometryRegistrar.h:284
friend DtIndirectGeometryRegistrarCreator
friend class creator so that DtIndirectGeometryRegistrar can only be created by the creator ...
Definition: DtIndirectGeometryRegistrar.h:110
Class that allows you to abstractly register effect texture types the effect texture types are client...
Definition: DtIndirectEffectTexturesTemplate.h:40
const char * creatorTypeName< DtIndirectGeometryRegistrar >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectGeometryRegistrar.h:70

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)