VR-Forces Developer's Guide
 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) 2024 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 #include <unordered_set>
38 
39 #define INDIRECTGEOMETRYREGISTRAR_DEBUG 0
40 
41 namespace osgUtil{
42  class CullVisitor;
43 };
44 
45 namespace osgEarth {
46  class VirtualProgram;
47 };
48 
49 namespace makVrv
50 {
51  class DtGlBuffer;
52 
53  class DtIndirectGeometryRegistrar;
54 
55  class DtIndirectTextureCollectionPolicy;
56  class DtIndirectModelInfoContainer;
57 
58  class DtOsgShaderManager;
59 
60  class DtIndirectModelInfo;
61 
62  class DtOsgRenderer;
63 
64 
67 
70 
72  template <>
73  inline const char* creatorTypeName<DtIndirectGeometryRegistrar>(void) { return "DtIndirectGeometryRegistrarCreator"; }
74 
84 
88 
97 
109  class DT_DLL_VRVOSG DtIndirectGeometryRegistrar : public osg::Referenced
110  {
111  protected:
114 
115  protected:
118  , const std::string& textureCollectionPolicyName
119  , const DtIndirectLimitTextureStrategy& limitTextureStrategy
120  );
121 
123  virtual ~DtIndirectGeometryRegistrar();
124 
125  private:
127  DtIndirectGeometryRegistrar() = delete;
128 
131 
133  DtIndirectGeometryRegistrar(const DtIndirectGeometryRegistrar& lhs, const osg::CopyOp& copyop) = delete;
134 
136  DtIndirectGeometryRegistrar& operator=(const DtIndirectGeometryRegistrar& other) = delete;
137  public:
139  virtual void setName(const std::string& name);
140 
141  // ! Thread safe method - can be called in any paging thread or the main render thread
142  // ! This needs to be 'queued' up because the actual registration can happen when rebuild rebuildIfNeeded
143  // ! is called from somewhere in the main thread (e.g. via the drawImplementation of DtIndirectGeometry)
144  // \param modelId: The model id
145  // \param modelFileName is used only for debugging messages for the aggregator
146  virtual void queueUpRegisterModel(const DtIndirectModelRegistrationInfo& info);
147 
150  virtual void processRegisterModelQueue();
151 
153  virtual void processRegisterModelQueueAsync();
154 
156  virtual bool beingProcessed();
157 
159  virtual bool hasTasksEnqueued();
160 
162  virtual unsigned int updateBuildNumber();
163 
165  virtual unsigned int numModelsInQueue() const;
166 
168  virtual int numModels(void) const;
169 
171  virtual int modelId(int index) const;
172 
174  virtual int numGeometriesForModelID(int modelId) const;
175 
177  virtual bool isModelDownloaded(int modelId) const;
178 
181  virtual const DtIndirectModelInfo* findModelInfoForModelId(int modelId) const;
182 
184  virtual const DtIndirectModelInfoContainer* modelInfoContainer() const;
185 
187  virtual DtIndirectModelInfoContainer* modelInfoContainer();
188 
190  virtual const DtIndirectTextureCollectionPolicy& textureCollectionPolicy(void) const;
191 
194  virtual const DtIndirectEffectTexturesTemplate& effectTexturesState(void) const;
195 
197  virtual DtIndirectGeometryStateManager& stateManager(void) const;
198 
200  virtual GLenum indicesType(void) const;
201 
205  virtual void releaseGLObjects(osg::State* state) const;
206 
209  virtual bool registeredModelsDirty() const;
210 
212  virtual void setPagerHandlesModelLoading(bool value);
213  virtual bool pagerHandlesModelLoading();
214 
216  virtual int numTexCoordArrays(void) const;
217 
219  virtual boost::mutex& addingModelsMutex();
220 
222  virtual void findModelInfosThatUseThisImageFileForItsTextures(std::set<DtIndirectModelInfo*>& modelInfos, const std::string& absoluteFileName) const;
223  protected:
226  virtual void registerModel(const DtIndirectModelRegistrationInfo& info);
227 
228  protected:
229 
231 
233 
235 
236  typedef tbb::concurrent_queue<DtIndirectModelRegistrationInfo> QueueRegisterModelOps;
238 
240 
242  unsigned int myCurrentBuildNumber;
243 
245  tbb::atomic<bool> myBeingProcessed;
246  tbb::atomic<int> myNumberOfTasksEnqueued;
247  boost::mutex myAddingModelsMutex;
248 
252 
255 
257 
259  std::unordered_map< std::string, std::set<int> > myImagesToModelsThatAreUsingIt;
260  };
261 
262 }
tbb::atomic< int > myNumberOfTasksEnqueued
Definition: DtIndirectGeometryRegistrar.h:246
QueueRegisterModelOps myQueueRegisterModelOps
Definition: DtIndirectGeometryRegistrar.h:237
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:109
Class that loads and contains a bunch of models registered with the registrar. It is owned by the Ind...
Definition: DtIndirectModelInfoContainer.h:86
DtVirtualBaseClassCreator< DtIndirectGeometryRegistrar, const std::string &, const DtIndirectLimitTextureStrategy & > DtIndirectGeometryRegistrarCreator
creator
Definition: DtIndirectGeometryRegistrar.h:66
Abstract class to look in the stateset and collect textures specified via its template The effect tex...
Definition: DtIndirectTextureCollectionPolicy.h:43
The information required to register a model with the registrar.
Definition: DtIndirectModelRegistrationInfo.h:24
std::unordered_map< std::string, std::set< int > > myImagesToModelsThatAreUsingIt
map of absolute image file names to models that use it
Definition: DtIndirectGeometryRegistrar.h:259
Indirect rendering works because we are able to combine multiple geometries into a single &#39;aggregated...
Definition: DtIndirectGeometryAggregator.h:90
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:232
Simple state/glmodes class for handling setting up modes It can now handle generic state modes and at...
Definition: DtIndirectGeometryStateManager.h:31
tbb::atomic< bool > myBeingProcessed
Definition: DtIndirectGeometryRegistrar.h:245
DtIndirectGeometryAggregator * myAggregator
Definition: DtIndirectGeometryRegistrar.h:244
Contains the DtIndirectGeometryStateManager class declaration.
tbb::concurrent_queue< DtIndirectModelRegistrationInfo > QueueRegisterModelOps
Definition: DtIndirectGeometryRegistrar.h:236
DtDe & myDe
DtDe reference.
Definition: DtIndirectGeometryRegistrar.h:254
bool myPagerHandlesModelLoading
Definition: DtIndirectGeometryRegistrar.h:234
bool myRegisteredModelsDirty
Definition: DtIndirectGeometryRegistrar.h:241
The indirect system uses this in conjunction with the system wide limits (for entity/terrain) to clam...
Definition: DtIndirectLimitTextureStrategy.h:65
boost::mutex myAddingModelsMutex
Definition: DtIndirectGeometryRegistrar.h:247
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:19
unsigned int myCurrentBuildNumber
Definition: DtIndirectGeometryRegistrar.h:242
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:251
Contains DLL export macros.
Contains the DtIndirectModelRegistrationInfo class declaration.
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:72
Contains the DtIndirectGeometryAggregator class declaration.
DtIndirectTextureCollectionPolicy * myTextureCollectionPolicy
Definition: DtIndirectGeometryRegistrar.h:239
DtOsgShaderManager & myShaderManager
Definition: DtIndirectGeometryRegistrar.h:256
friend DtIndirectGeometryRegistrarCreator
friend class creator so that DtIndirectGeometryRegistrar can only be created by the creator ...
Definition: DtIndirectGeometryRegistrar.h:113
Class that allows you to abstractly register effect texture types the effect texture types are client...
Definition: DtIndirectEffectTexturesTemplate.h:40
DtIndirectModelInfoContainer * myModelInfoContainer
Definition: DtIndirectGeometryRegistrar.h:230
Contains the per Model info which the indirect module needs It is owned by the Indirect geometry regi...
Definition: DtIndirectModelInfo.h:55
const char * creatorTypeName< DtIndirectGeometryRegistrar >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectGeometryRegistrar.h:73

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)