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 DtGpuArenaUploadState;
39  class DtDe;
40  class DtIndirectModelSubGeometry;
41  class DtIndirectLimitTextureStrategy;
42  class DtGlDeleteObjectManager;
43  class DtGpuCulling;
44 
47 
50 
52  template <>
53  inline const char* creatorTypeName<DtIndirectModelInfo>(void) { return "DtIndirectModelInfoCreator"; }
54 
57  {
58  BindlessPtrNV myVertexBufferBindless = {};
59  BindlessPtrNV myAdditionalBufferBindless = {};
60  BindlessPtrNV myIndexBufferBindless = {};
61  };
62 
69  {
70  public:
71 
72  //friend class so that it can be created only by its creator
74 
76  virtual ~DtIndirectModelInfo();
77 
79  DtIndirectModelInfo() = delete;
80 
83 
85  DtIndirectModelInfo& operator=(const DtIndirectModelInfo&) = delete;
86 
87  protected:
88 
91 
92  public:
93 
97  virtual void unloadBuffers();
98 
100  virtual bool buffersUploadedToGpu() const;
101 
105  virtual bool processGpuBufferUploads(DtGpuArenaUploadState& uploadState);
106 
109  virtual void texturesSet(std::map< const DtIndirectTexturePrototype*, int >& texturesSet) const;
110 
114  virtual void addUser(const DtGpuCulling* user);
115 
119  virtual void removeUser(const DtGpuCulling* user);
120 
124  virtual void computeMaxTextureResolution(const DtIndirectLimitTextureStrategy& limitStrategy);
125 
127  virtual const BindlessPtrNV& vertexBufferBindless(int index) const;
128 
130  virtual const BindlessPtrNV& additionalBufferBindless(int index) const;
131 
133  virtual const BindlessPtrNV& indexBufferBindless(int index) const;
134 
136  virtual int numSubGeometries() const;
137 
139  virtual int maxCoords(int index) const;
140 
142  virtual int numVertices(int index) const;
143 
145  virtual int numIndices(int index) const;
146 
150  virtual void addSubGeometry(DtIndirectModelSubGeometry* modelSubGeometry);
151 
154  virtual DtIndirectModelSubGeometry* subGeometry(int index) const;
155 
160  virtual void promoteDataFromSubGeosToMe();
161 
162  protected:
163 
166  virtual void resetGpuUploads();
167 
169  virtual bool isDefaultTexture(const DtIndirectTexturePrototype* texture) const;
170 
172  virtual bool glBuffersContainAnyData() const;
173 
175  virtual void releaseGLObjects(osg::State* state);
176 
178  virtual void createIndirectBuffers();
179 
181  virtual void deleteIndirectBuffers();
182 
188  virtual void computeChunkUploadSize(unsigned int& desiredUploadSize, unsigned int& maxUploadSize) const;
189 
192  virtual void prepareToUploadGpuDataForBuffer(DtGlBuffer& buffer, std::vector<uint8_t>& stagingData);
193 
196  virtual void prepareToUploadGpuData();
197 
199  virtual void updateBindlessPointers();
200 
201  public:
202 
204  std::string myModelName;
205 
206  std::string myModelDefName;
207 
210 
212  DtGeometrySpecVector myGeometrySpecifications;
213 
216 
218  std::vector<DtIndirectGeometryTextures> myTextures;
219 
222 
225 
228 
231 
235 
238 
240 
241  protected:
242 
243  static const BindlessPtrNV theInvalidBindless;
244 
247 
250  {
251  unsigned int myTotalSize = 0;
252  unsigned int myUploadOffset = 0;
253  unsigned int myUploadSize = 0;
254  const unsigned char* myUploadData = nullptr;
255  DtGlBuffer* myBuffer = nullptr;
256  };
257 
258  std::vector<GpuBufferUploadInfo> myGpuBufferUploads;
259 
260  std::unordered_set<const DtGpuCulling*> myUsers;
261  boost::mutex myUserMutex;
262 
263  DtGlBuffer* myVertexAndAttributesBuffer = nullptr;
264  DtGlBuffer* myIndexBuffer = nullptr;
265 
268 
269  std::vector<uint8_t> myVertexBufferData;
270  std::vector<uint8_t> myIndexBufferData;
271 
272  std::vector<DtIndirectModelSubGeoProps> mySubGeoPropsVec;
273  std::vector<DtIndirectSubGeoBindlessBuffers> mySubGeoBindlessBuffersVec;
274 
277  std::vector<DtIndirectModelSubGeometry*> myVectorModelSubGeometries;
278  };
279 }
boost::mutex myUserMutex
Definition: DtIndirectModelInfo.h:261
Contains makVrv::DtIndirectUvOffsetManager class.
friend DtIndirectModelInfoCreator
Definition: DtIndirectModelInfo.h:73
Structure for a bindless buffer of an individual sub geometry.
Definition: DtIndirectModelInfo.h:56
DtMaterial class declaration.
BindlessPtrNV myAdditionalBufferBindless
Definition: DtIndirectModelInfo.h:59
DtGeometrySpecVector myGeometrySpecifications
the vector of all geometry specs
Definition: DtIndirectModelInfo.h:212
std::string myModelDefName
Definition: DtIndirectModelInfo.h:206
DtDe & myDe
Definition: DtIndirectModelInfo.h:245
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtGlDeleteObjectManager & myGlDeleteObjectManager
Definition: DtIndirectModelInfo.h:246
This class is a component of the DtIndirectGeometry It inputs are: -&gt; the instances registered with Dt...
Definition: DtGpuCulling.h:91
std::vector< DtIndirectModelSubGeometry * > myVectorModelSubGeometries
the same size as the spec vector above 1 sub-geometry for each spec
Definition: DtIndirectModelInfo.h:277
DtVector2< int > myMaxTextureResolutionInXandY
Definition: DtIndirectModelInfo.h:239
DtIndirectUvOffsetManager::ScrollableUvOffsetIdsAndMultipliers myScrollableUvOffsetIdsAndMultipliers
uv offset ids and multipliers
Definition: DtIndirectModelInfo.h:227
Holds information for a specific GPU buffer upload.
Definition: DtIndirectModelInfo.h:249
DtVirtualBaseClassCreator< DtIndirectModelInfo > DtIndirectModelInfoCreator
creator
Definition: DtIndirectModelInfo.h:46
DtIndirectLodManager::DequeIndirectLodInfoArray myLodStacks
lod paths
Definition: DtIndirectModelInfo.h:233
const char * creatorTypeName< DtIndirectModelInfo >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectModelInfo.h:53
int myNumLightSources
the number of light sources
Definition: DtIndirectModelInfo.h:237
std::vector< DequeIndirectLodInfos > DequeIndirectLodInfoArray
Definition: DtIndirectLodManager.h:70
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
std::deque< NodeDofInfoPair > DequeNodeDofInfoPairs
Definition: DtIndirectDofManager.h:77
Contains makVrv::DtIndirectDofManager class.
std::vector< DtIndirectGeometryTextures > myTextures
vector of the textures in this model
Definition: DtIndirectModelInfo.h:218
std::string myModelName
the model name
Definition: DtIndirectModelInfo.h:204
std::map< std::string, unsigned int > AnnotationToUvOffsetMap
Definition: DtIndirectUvOffsetManager.h:54
Contains makVrv::DtIndirectModelSubGeometry class.
DtIndirectUvOffsetManager::AnnotationToUvOffsetMap myAnnotationToUvOffsetIdMap
annotation to uv offset map
Definition: DtIndirectModelInfo.h:224
DtIndirectSwitchManager::DequeNodeSwitchInfoPairsArray mySwitchPaths
switch paths
Definition: DtIndirectModelInfo.h:230
BindlessPtrNV myIndexBufferBindless
Definition: DtIndirectModelInfo.h:60
std::unordered_map< int, MultiplierAndTrackSide > ScrollableUvOffsetIdsAndMultipliers
Definition: DtIndirectUvOffsetManager.h:66
Manages and tracks memory usage statistics for GPU resource upload operations.
Definition: DtGpuArenaUploadState.h:39
std::vector< uint8_t > myVertexBufferData
Definition: DtIndirectModelInfo.h:269
std::vector< PerGeomInstance > DtPerGeomInstances
Definition: DtPerGeomInstance.h:26
std::vector< DequeNodeSwitchInfoPairs > DequeNodeSwitchInfoPairsArray
Definition: DtIndirectSwitchManager.h:78
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:258
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:270
BindlessPtrNV myVertexBufferBindless
Definition: DtIndirectModelInfo.h:58
bool myBuffersUploadedToGpu
Are the model data buffers completely uploaded to the gpu.
Definition: DtIndirectModelInfo.h:267
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:243
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:215
std::unordered_set< const DtGpuCulling * > myUsers
Definition: DtIndirectModelInfo.h:260
int myModelID
the model id
Definition: DtIndirectModelInfo.h:209
Contains DLL export macros.
DtIndirectDofManager::DequeNodeDofInfoPairs myDofPaths
Definition: DtIndirectModelInfo.h:234
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:272
Contains the DtIndirectGeometryTextures class declaration.
std::vector< DtIndirectSubGeoBindlessBuffers > mySubGeoBindlessBuffersVec
Definition: DtIndirectModelInfo.h:273
DtPerGeomInstances myPerGeomInstancesTemplate
vector of the per geom instances
Definition: DtIndirectModelInfo.h:221
DtPerGeomInstance class declaration.
Contains the per Model info which the indirect module needs These objects are owned by the Indirect g...
Definition: DtIndirectModelInfo.h:68
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 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)