VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGpuCullingAndLod.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 
13 
15 
18 
20 
21 namespace osg
22 {
23  class State;
24  class RenderInfo;
25 };
26 
27 namespace makVrv
28 {
29  class DtGlBuffer;
30  class DtIndirectGeometryRegistrar;
31  class DtInstanceContainer;
32  class DtOsgShaderFilesCache;
33  class DtIndirectCullPass;
34  class DtCpuCullingHelper;
35 
51  {
52  public:
54  {
55  int offset;
57  };
58 
60  {
61  int offset;
63  };
64 
65  typedef std::vector<StateIdOffsetAndMaxCommands> VectorStateIdOffsetAndMaxCommands;
66 
67  protected:
70 
71  //friend class so that it can be created only by its creator
73 
74  public:
76  virtual ~DtGpuCullingAndLod();
77 
78  private:
84  DtGpuCullingAndLod &operator=(const DtGpuCullingAndLod &other);
85 
86  public:
88  virtual void setRegistrar(DtIndirectGeometryRegistrar* registrar);
89 
91  virtual void setCullShaderConfig(const DtCullShaderConfig& cullShaderConfig);
92 
94  virtual const DtCullShaderConfig& cullShaderConfig(void) const;
95 
97  virtual void updateGpuBuffers( DtIndirectRenderingParameters& irParams
98  , const MapIntToInt& modelIdsToNumInstances
99  , osg::RenderInfo& renderInfo);
100 
102  virtual void doCullingAndLOD(const DtIndirectViewParameters& viewParameters
104  , osg::RenderInfo& renderInfo
105  , DtGlBuffer* gpuLodVisibleBuffer);
106 
108  virtual void bindGpuOutputInstanceBuffer(void) const;
109 
111  virtual void unbindGpuOutputInstanceBuffer(void) const;
112 
118  virtual bool bindIndirectThings();
119 
121  virtual void unbindIndirectThings();
122 
125  virtual bool useInstanceCount(void) const;
126 
129  virtual int numDrawCommands(void) const;
130 
132  virtual void setShadersFolderPath(const std::string& shaderFolderPath);
133 
135  virtual const std::string& shadersFolderPath(void) const;
136 
138  virtual void setShadersFileCache(DtOsgShaderFilesCache* shaderFilesCache);
139 
141  virtual const DtOsgShaderFilesCache* shadersFileCache(void) const;
142 
144  virtual void releaseGLObjects(osg::State* state) const;
145 
147  virtual void reloadShaders() const;
148 
150  virtual unsigned int maxNumInstances(void) const;
151 
153  virtual const VectorStateIdOffsetAndMaxCommands& stateIdOffsetAndMaxCommands(void) const;
154 
155  virtual void setInstanceContainer(DtInstanceContainer * instanceContainer);
156 
158  virtual bool readyToUpdateBuffers();
159 
161  virtual bool needTextureUpdate() const;
162 
163  protected:
165  virtual void updateGpuInputInstancesBuffer();
170  virtual void updateGpuInputPerGeomInstancesBuffer();
171  virtual void updateGpuGeometrySpecificationsBuffer(const int numGeometries);
172  virtual void updateGpuMaterialsBuffer(const int numGeometries);
173  virtual void updateGpuGeometryOffsetAndSizeBuffer(int& numGeometries);
174  virtual void updateGpuIndirectBuffer();
175  virtual void clearInstanceCountofGpuIndirectBuffer();
176  virtual void clearStateIdCommandCountBuffer();
178 
181  virtual bool updateGpuTexturesBuffer(osg::RenderInfo& renderInfo);
182 
184  virtual void updateInstancesOffsetAndInstances(const MapIntToInt& modelIdsToNumInstances);
185 
187  virtual void updateStateIdMaxNumCommands(const MapIntToInt& modelIdsToNumInstances);
188 
190  virtual bool checkSpecBuffersOk(void) const;
191 
192  protected:
195 
199 
202 
206 
208  std::vector<DtGeometrySpecification> myGeometrySpecifications;
209 
212  std::vector<DtIndirectOffsetAndSize> myGeometryOffsetAndSizes;
213 
217 
220 
223 
225 
227 
229 
231 
232  std::vector<InstancesOffsetAndNumOfInstances> myInstancesOffsetAndNumInstances;
234 
235  std::string myShaderFolderPath;
237 
238  unsigned int myMaxNumInstances;
239 
240  // For when instance count is false or true
242 
243  // For when instance count if false
246 
247  // For when instance count is true
250 
252 
253  //texture state
260 
263 
267 
268 
271  };
272 
276  {
277  public:
280 
282  virtual ~DtGpuCullingAndLodCreator();
283 
285  virtual DtGpuCullingAndLod* create() const;
286 
289  static DtGpuCullingAndLodCreator& instance(DtDe& de);
290 
292  static const std::string& theClassName();
293  protected:
295  };
296 }
297 
DtGlBuffer * myGpuStateIdToMaxNumCommandsBuffer
Definition: DtGpuCullingAndLod.h:244
Contains the DtCullShaderConfig class declaration.
handles the running of the compute shader pass for indirect culling, LODing and switches ...
Definition: DtIndirectCullPass.h:35
DtIndirectCullPass * myCullPass
Definition: DtGpuCullingAndLod.h:224
int myStreamedMaterialBytes
Definition: DtGpuCullingAndLod.h:262
DtGlBuffer * myGpuOutputInstancesBuffer
The re-distributed/culled/lod&#39;ed instances (a subset of the input instances)
Definition: DtGpuCullingAndLod.h:222
DtDe & myDe
Definition: DtGpuCullingAndLod.h:294
Virtual base class.
Definition: DtVirtualBaseClass.h:22
DtInstanceContainer * myInstanceContainer
Definition: DtGpuCullingAndLod.h:194
int numOfInstances
Definition: DtGpuCullingAndLod.h:56
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtGlBuffer * myGpuSpecIndexToCommandIndexBuffer
Definition: DtGpuCullingAndLod.h:249
DtGlBuffer * myGpuTexturesBuffer
Definition: DtGpuCullingAndLod.h:226
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:101
DtGlBuffer * myGpuInstancesOffsetAndNumInstances
Definition: DtGpuCullingAndLod.h:233
int myStreamedSpecModelID
Definition: DtGpuCullingAndLod.h:264
DtGeometrySpecification class declaration.
int myNumGeometries
Definition: DtGpuCullingAndLod.h:270
int myStreamedMaterialModelID
Definition: DtGpuCullingAndLod.h:261
shader configuration storage class.
Definition: DtCullShaderConfig.h:19
Definition: DtOsgShaderFilesCache.h:22
DtCullShaderConfig myCullShaderConfig
Definition: DtGpuCullingAndLod.h:230
std::map< int, int > MapIntToInt
Definition: DtCommonTypes.h:25
MapIntToInt myModelIdToIndex
Definition: DtGpuCullingAndLod.h:228
creator for DtGpuCullingAndLod
Definition: DtGpuCullingAndLod.h:275
unsigned int myLastNumEffectTextures
Definition: DtGpuCullingAndLod.h:254
DtGlBuffer * myGpuInputInstancesBuffer
The input instances for the GPU (generated/updated from the passed in instance container) ...
Definition: DtGpuCullingAndLod.h:198
VectorInts myGeomSpecIndexToCommandIndex
Definition: DtGpuCullingAndLod.h:248
Contains makVrv::DtVirtualBaseClass class.
std::string myShaderFolderPath
Definition: DtGpuCullingAndLod.h:235
std::vector< int > VectorInts
Definition: DtCommonTypes.h:20
VectorStateIdOffsetAndMaxCommands myStateIdToMaxNumCommands
Definition: DtGpuCullingAndLod.h:241
int myMutableFirstTextureStreamedModel
Keep track of the first model using bindless textures.
Definition: DtGpuCullingAndLod.h:256
int myStreamedSpecBytes
Definition: DtGpuCullingAndLod.h:265
DtOsgShaderFilesCache * myShaderFilesCache
Definition: DtGpuCullingAndLod.h:236
Class per frame that must be passed to the DtICullingAndLOD It indicates what would have changed (ins...
Definition: DtGpuCullingAndLodDefines.h:94
int myStreamedSpecModelGeomIndex
Definition: DtGpuCullingAndLod.h:266
int offset
Definition: DtGpuCullingAndLod.h:61
Declarations for classes used in DtICullingAndLOD.
int myMutableFirstTextureStreamedIndex
What index to start using bindless textures for a model.
Definition: DtGpuCullingAndLod.h:258
A generic OpenGL buffer.
Definition: DtGlBuffer.h:25
std::vector< StateIdOffsetAndMaxCommands > VectorStateIdOffsetAndMaxCommands
Definition: DtGpuCullingAndLod.h:65
bool myNeedTextureUpdate
Definition: DtGpuCullingAndLod.h:259
The class that is used to communicate the camera viewing parameters to the DtICullingAndLOD interface...
Definition: DtGpuCullingAndLodDefines.h:38
DtGlBuffer * myGpuStateIdToCommandCountBuffer
Definition: DtGpuCullingAndLod.h:245
DtGlBuffer * myGpuIndirectBuffer
The indirect command buffer that will be generated.
Definition: DtGpuCullingAndLod.h:219
int myStreamedGeometryOffsetModelID
Definition: DtGpuCullingAndLod.h:269
std::vector< DtIndirectOffsetAndSize > myGeometryOffsetAndSizes
An internal indexing buffer that allows the cull shader to go from and intance to its GeometrySpecifi...
Definition: DtGpuCullingAndLod.h:212
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
std::vector< InstancesOffsetAndNumOfInstances > myInstancesOffsetAndNumInstances
Definition: DtGpuCullingAndLod.h:232
Helper class to manage instances This class allows you to add a DtInstance_64 Internally, however it stores this as a DtInstance (which the GPU can directly read)
Definition: DtInstanceContainer.h:27
DtIndirectGeometryRegistrar * myRegistrar
Definition: DtGpuCullingAndLod.h:193
DtGlBuffer * myGpuGeometrySpecificationsBuffer
The spec buffer containing GeometrySpecifications for all the models/lods of the passed in instances...
Definition: DtGpuCullingAndLod.h:205
This class is a component of the DtIndirectGeometry It inputs are: -&gt; the instances registered with Dt...
Definition: DtGpuCullingAndLod.h:50
unsigned int myMaxNumInstances
Definition: DtGpuCullingAndLod.h:238
DtDe & myDe
Definition: DtGpuCullingAndLod.h:251
DtGlBuffer * myGpuMaterialsBuffer
The spec buffer containing Materials for all the models/lods of the passed in instances.
Definition: DtGpuCullingAndLod.h:216
DtGlBuffer * myGpuInputPerGeomInstancesBuffer
contains switch states/ lod info
Definition: DtGpuCullingAndLod.h:201
int maxCommands
Definition: DtGpuCullingAndLod.h:62
std::vector< DtGeometrySpecification > myGeometrySpecifications
c++ buffer that holds the same info
Definition: DtGpuCullingAndLod.h:208

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)