VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectModelInfo.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2025 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <string>
15 
22 
23 #define CPU_SIDE_COMPILATION 1
24 #include <../data/shaders/indirect/GeometrySpecification.h>
25 
28 
30 
31 #include <boost/thread/mutex.hpp>
32 
33 #include <unordered_set>
34 
35 namespace makVrv
36 {
38  class DtDe;
39  class DtIndirectModelSubGeometry;
40  class DtIndirectLimitTextureStrategy;
41  class DtGlDeleteObjectManager;
42  class DtGpuCulling;
43 
46 
49 
51  template <>
52  inline const char* creatorTypeName<DtIndirectModelInfo>(void) { return "DtIndirectModelInfoCreator"; }
53 
56  {
57  BindlessPtrNV myVertexBufferBindless = {};
58  BindlessPtrNV myAdditionalBufferBindless = {};
59  BindlessPtrNV myIndexBufferBindless = {};
60  };
61 
68  {
69  public:
70 
71  //friend class so that it can be created only by its creator
73 
75  virtual ~DtIndirectModelInfo();
76 
78  DtIndirectModelInfo() = delete;
79 
82 
84  DtIndirectModelInfo& operator=(const DtIndirectModelInfo&) = delete;
85 
86  protected:
87 
90 
91  public:
92 
96  virtual void unloadBuffers();
97 
99  virtual bool buffersUploadedToGpu() const;
100 
104  virtual bool processGpuBufferUploads(unsigned int& uploadedMemory);
105 
108  virtual void texturesSet(std::map< const DtIndirectTexturePrototype*, int >& texturesSet) const;
109 
113  virtual void addUser(const DtGpuCulling* user);
114 
118  virtual void removeUser(const DtGpuCulling* user);
119 
123  virtual void computeMaxTextureResolution(const DtIndirectLimitTextureStrategy& limitStrategy);
124 
126  virtual const BindlessPtrNV& vertexBufferBindless(int index) const;
127 
129  virtual const BindlessPtrNV& additionalBufferBindless(int index) const;
130 
132  virtual const BindlessPtrNV& indexBufferBindless(int index) const;
133 
135  virtual int numSubGeometries() const;
136 
138  virtual int maxCoords(int index) const;
139 
141  virtual int numVertices(int index) const;
142 
144  virtual int numIndices(int index) const;
145 
149  virtual void addSubGeometry(DtIndirectModelSubGeometry* modelSubGeometry);
150 
153  virtual DtIndirectModelSubGeometry* subGeometry(int index) const;
154 
159  virtual void promoteDataFromSubGeosToMe();
160 
161  protected:
162 
165  virtual void resetGpuUploads();
166 
168  virtual bool isDefaultTexture(const DtIndirectTexturePrototype* texture) const;
169 
171  virtual bool glBuffersContainAnyData() const;
172 
174  virtual void releaseGLObjects(osg::State* state);
175 
177  virtual void createIndirectBuffers();
178 
180  virtual void deleteIndirectBuffers();
181 
187  virtual void computeChunkUploadSize(unsigned int& desiredUploadSize, unsigned int& maxUploadSize) const;
188 
191  virtual void prepareToUploadGpuDataForBuffer(DtGlBuffer& buffer, std::vector<uint8_t>& stagingData);
192 
195  virtual void prepareToUploadGpuData();
196 
198  virtual void updateBindlessPointers();
199 
200  public:
201 
203  std::string myModelName;
204 
205  std::string myModelDefName;
206 
209 
211  DtGeometrySpecVector myGeometrySpecifications;
212 
215 
217  std::vector<DtIndirectGeometryTextures> myTextures;
218 
221 
224 
227 
230 
234 
237 
239 
240  protected:
241 
242  static const BindlessPtrNV theInvalidBindless;
243 
246 
249  {
250  unsigned int myTotalSize = 0;
251  unsigned int myUploadOffset = 0;
252  unsigned int myUploadSize = 0;
253  const unsigned char* myUploadData = nullptr;
254  DtGlBuffer* myBuffer = nullptr;
255  };
256 
257  std::vector<GpuBufferUploadInfo> myGpuBufferUploads;
258 
259  std::unordered_set<const DtGpuCulling*> myUsers;
260  boost::mutex myUserMutex;
261 
262  DtGlBuffer* myVertexAndAttributesBuffer = nullptr;
263  DtGlBuffer* myIndexBuffer = nullptr;
264 
267 
268  std::vector<uint8_t> myVertexBufferData;
269  std::vector<uint8_t> myIndexBufferData;
270 
271  std::vector<DtIndirectModelSubGeoProps> mySubGeoPropsVec;
272  std::vector<DtIndirectSubGeoBindlessBuffers> mySubGeoBindlessBuffersVec;
273 
276  std::vector<DtIndirectModelSubGeometry*> myVectorModelSubGeometries;
277  };
278 }
boost::mutex myUserMutex
Definition: DtIndirectModelInfo.h:260
Contains makVrv::DtIndirectUvOffsetManager class.
friend DtIndirectModelInfoCreator
Definition: DtIndirectModelInfo.h:72
Structure for a bindless buffer of an individual sub geometry.
Definition: DtIndirectModelInfo.h:55
DtMaterial class declaration.
BindlessPtrNV myAdditionalBufferBindless
Definition: DtIndirectModelInfo.h:58
DtGeometrySpecVector myGeometrySpecifications
the vector of all geometry specs
Definition: DtIndirectModelInfo.h:211
std::string myModelDefName
Definition: DtIndirectModelInfo.h:205
DtDe & myDe
Definition: DtIndirectModelInfo.h:244
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtGlDeleteObjectManager & myGlDeleteObjectManager
Definition: DtIndirectModelInfo.h:245
This class is a component of the DtIndirectGeometry It inputs are: -&gt; the instances registered with Dt...
Definition: DtGpuCulling.h:88
std::vector< DtIndirectModelSubGeometry * > myVectorModelSubGeometries
the same size as the spec vector above 1 sub-geometry for each spec
Definition: DtIndirectModelInfo.h:276
DtVector2< int > myMaxTextureResolutionInXandY
Definition: DtIndirectModelInfo.h:238
DtIndirectUvOffsetManager::ScrollableUvOffsetIdsAndMultipliers myScrollableUvOffsetIdsAndMultipliers
uv offset ids and multipliers
Definition: DtIndirectModelInfo.h:226
Holds information for a specific GPU buffer upload.
Definition: DtIndirectModelInfo.h:248
DtVirtualBaseClassCreator< DtIndirectModelInfo > DtIndirectModelInfoCreator
creator
Definition: DtIndirectModelInfo.h:45
DtIndirectLodManager::DequeIndirectLodInfoArray myLodStacks
lod paths
Definition: DtIndirectModelInfo.h:232
const char * creatorTypeName< DtIndirectModelInfo >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectModelInfo.h:52
int myNumLightSources
the number of light sources
Definition: DtIndirectModelInfo.h:236
std::vector< DequeIndirectLodInfos > DequeIndirectLodInfoArray
Definition: DtIndirectLodManager.h:69
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
std::deque< NodeDofInfoPair > DequeNodeDofInfoPairs
Definition: DtIndirectDofManager.h:76
Contains makVrv::DtIndirectDofManager class.
std::vector< DtIndirectGeometryTextures > myTextures
vector of the textures in this model
Definition: DtIndirectModelInfo.h:217
std::string myModelName
the model name
Definition: DtIndirectModelInfo.h:203
std::map< std::string, unsigned int > AnnotationToUvOffsetMap
Definition: DtIndirectUvOffsetManager.h:53
Contains makVrv::DtIndirectModelSubGeometry class.
DtIndirectUvOffsetManager::AnnotationToUvOffsetMap myAnnotationToUvOffsetIdMap
annotation to uv offset map
Definition: DtIndirectModelInfo.h:223
DtIndirectSwitchManager::DequeNodeSwitchInfoPairsArray mySwitchPaths
switch paths
Definition: DtIndirectModelInfo.h:229
BindlessPtrNV myIndexBufferBindless
Definition: DtIndirectModelInfo.h:59
std::unordered_map< int, MultiplierAndTrackSide > ScrollableUvOffsetIdsAndMultipliers
Definition: DtIndirectUvOffsetManager.h:65
std::vector< uint8_t > myVertexBufferData
Definition: DtIndirectModelInfo.h:268
std::vector< PerGeomInstance > DtPerGeomInstances
Definition: DtPerGeomInstance.h:26
std::vector< DequeNodeSwitchInfoPairs > DequeNodeSwitchInfoPairsArray
Definition: DtIndirectSwitchManager.h:77
The indirect system uses this in conjunction with the system wide limits (for entity/terrain) to clam...
Definition: DtIndirectLimitTextureStrategy.h:65
Contains makVrv::DtIndirectSwitchManager class.
std::vector< GpuBufferUploadInfo > myGpuBufferUploads
Definition: DtIndirectModelInfo.h:257
A generic OpenGL buffer. This can be: -&gt; a vertex buffer -&gt; an index buffer -&gt; a shader storage buffe...
Definition: DtGlBuffer.h:29
std::vector< uint8_t > myIndexBufferData
Definition: DtIndirectModelInfo.h:269
BindlessPtrNV myVertexBufferBindless
Definition: DtIndirectModelInfo.h:57
bool myBuffersUploadedToGpu
Are the model data buffers completely uploaded to the gpu.
Definition: DtIndirectModelInfo.h:266
Vaos are OpenGL context specific. They need to be deleted in the context they are created in...
Definition: DtGlDeleteObjectManager.h:58
static const BindlessPtrNV theInvalidBindless
Definition: DtIndirectModelInfo.h:242
Contains makVrv::DtIndirectLodManager class.
geometry that is part of a model. refers to one index buffer and a vertex+color+normal+uv buffer corr...
Definition: DtIndirectModelSubGeometry.h:57
DtIndirectMaterialVector myMaterials
vector of the materials in this model
Definition: DtIndirectModelInfo.h:214
std::unordered_set< const DtGpuCulling * > myUsers
Definition: DtIndirectModelInfo.h:259
int myModelID
the model id
Definition: DtIndirectModelInfo.h:208
Contains DLL export macros.
DtIndirectDofManager::DequeNodeDofInfoPairs myDofPaths
Definition: DtIndirectModelInfo.h:233
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:76
VRV/Indirect uses its own texture paradigm: DtIndirectTexturePrototype, which is a &#39;template&#39; for mak...
Definition: DtIndirectTexturePrototype.h:53
std::vector< DtIndirectModelSubGeoProps > mySubGeoPropsVec
Definition: DtIndirectModelInfo.h:271
Contains the DtIndirectGeometryTextures class declaration.
std::vector< DtIndirectSubGeoBindlessBuffers > mySubGeoBindlessBuffersVec
Definition: DtIndirectModelInfo.h:272
DtPerGeomInstances myPerGeomInstancesTemplate
vector of the per geom instances
Definition: DtIndirectModelInfo.h:220
DtPerGeomInstance class declaration.
Contains the per Model info which the indirect module needs These objects are owned by the Indirect g...
Definition: DtIndirectModelInfo.h:67
std::vector< Material > DtIndirectMaterialVector
Each model type can have a number of geometries, each with an own material.
Definition: DtMaterial.h:46

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)