VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtAggregatedGeometry.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
11 
12 #pragma once
13 
14 #include <vrvOsg/vrvOsg.h>
15 
23 
25 
29 
31 
32 #include <osg/Geometry>
33 
34 #include <tbb/concurrent_queue.h>
35 #include <tbb/task.h>
36 #include <boost/thread.hpp>
37 
38 #include <list>
39 
40 namespace makVrv
41 {
42  class DtGlBuffer;
43  class DtCoreGlBufferCreator;
44  class DtAggregatedGeometry;
45  class DtAggregatedGeometryCopyDataAsync;
46  class DtIndirectGeometryAggregator;
47  class DtIndirectGeometryRegistrar;
48  class DtIndirectAggregateHelper;
49 
50  struct DtAggregateModelInfo;
51 
52 
54  {
58  osg::Matrix myMatrix;
59  };
60 
64  {
65  public:
66  //constructor
68 
69  //execute the task
70  virtual tbb::task* execute() override;
71 
72  protected:
73 
75  };
76 
79 
82 
84  template <>
85  inline const char* creatorTypeName<DtAggregatedGeometry>(void) { return "DtAggregatedGeometryCreator"; }
86 
87 
92  {
93  public:
96 
98  virtual ~DtAggregatedGeometry();
99 
100  protected:
103  private:
105  DtAggregatedGeometry() = delete;
106 
108  DtAggregatedGeometry(const DtAggregatedGeometry &other) = delete;
109 
111  DtAggregatedGeometry &operator=(const DtAggregatedGeometry &other) = delete;
112 
113  public:
115  virtual void releaseGLObjects(osg::State* state) const;
116 
118  virtual void addGeometryToLoad(const DtCopyModelDataStructure & cds);
119 
121  virtual bool hasDataToAsyncLoad() const;
122 
124  virtual bool hasDataToCopy() const;
125 
127  virtual boost::mutex& copyDataMutex();
128 
130  virtual int isCopyingData() const;
131 
133  virtual int numModels(void) const;
134 
136  virtual int modelId(int index) const;
137 
139  virtual DtAggregateModelInfo* getOrCreateModelInfoFor(int modelId);
140 
142  virtual DtAggregateModelInfo* getModelInfoFor(int modelId);
143 
145  virtual const DtIndirectSwitchManager::DequeNodeSwitchInfoPairsArray& getVectorSwitchPaths(int modelId) const;
146 
148  virtual const DtIndirectLodManager::DequeIndirectLodInfoArray& getVectorLodStacks(int modelId) const;
149 
150  virtual const DtIndirectDofManager::DequeNodeDofInfoPairs& getVectorDofPaths(int modelId) const;
151 
153  virtual int vertexAndAttributesBufferSize(void) const;
154 
156  virtual const osg::Geometry* aggregatedGeometry(void) const;
157 
160  virtual osg::Geometry* aggregatedGeometry(void);
161 
163  virtual void testDrawUsingDrawElements();
164 
167  virtual unsigned int vertexAndAttributesBufferHandle() const;
168 
171  virtual unsigned int colorBufferHandle() const;
172 
175  virtual unsigned int normalBufferHandle() const;
176 
178  virtual unsigned int uvBufferHandle() const;
179 
181  virtual unsigned int indexBufferHandle() const;
182 
184  virtual GLenum indicesType(void) const;
185 
187  virtual void copyDataQueue();
188 
190  virtual void printVertexBuffer(std::ostream& os);
191 
193  virtual void printIndexBuffer(std::ostream& os);
194 
196  virtual void printStats(std::ostream& os);
197 
199  virtual bool updateBuffers();
200 
202  virtual void bindBuffers();
203 
205  virtual void unbindBuffers();
206 
207  protected:
209  virtual void configureBuffers();
210 
212  virtual void reserveMaxMemory();
213 
215  virtual void copyData(DtCopyModelDataStructure & data);
216 
217 
219  virtual unsigned int vertexBufferSizeInBytes() const;
223  virtual unsigned int vertexBufferNumElements() const;
225  virtual unsigned int numVertices(void) const;
227  virtual const void* verticesPointer() const;
228 
230  virtual unsigned int normalBufferSizeInBytes() const;
231  virtual unsigned int normalBufferNumElements() const;
232  virtual const void* normalsPointer() const;
233  virtual unsigned int numNormals(void) const;
234 
236  virtual unsigned int colorBufferSizeInBytes() const;
237  virtual unsigned int colorBufferNumElements() const;
238  virtual const void* colorsPointer() const;
239  virtual unsigned int numColors(void) const;
240 
242  virtual unsigned int textureCoordsBufferSizeInBytes(unsigned int unit) const;
243  virtual unsigned int textureCoordsBufferNumElements(unsigned int unit) const;
244  virtual const void* textureCoordsPointer(unsigned int unit) const;
245  virtual unsigned int numTextureCoords(unsigned int unit) const;
246 
248  virtual unsigned int textureBufferSizeInBytes() const;
249 
250  //Copy texture data from
251  virtual void copyTextureData(DtGlBuffer* vertexAndAttributesBuffer, int &offset) const;
252 
254  virtual const void* indexBufferPointer() const;
255  virtual unsigned int indexBufferSizeInBytes() const;
257 
258  protected:
264 
265  typedef std::map<int, DtAggregateModelInfo *> MapModelsToModelInfo;
266  std::vector<int> myEnabledVertexAttribArrays;
268 
269  std::vector<int> myScratchIndices;
271 
273 
274  // not sure if I need a mutex the way I'm using this
275  tbb::concurrent_queue<DtCopyModelDataStructure> myModelDataToCopy;
276 
279 
280  tbb::atomic<int> myIsCopyingData;
281  boost::mutex myCopyDataMutex;
282 
285 
288 
289  tbb::atomic<int> myCancelTask;
290 
291  };
292 
293 }
Contains makVrv::DtIndirectUvOffsetManager class.
int myLastIndex
Definition: DtAggregatedGeometry.h:278
Contains makVrv::DtLightPointNode class.
DtMaterial class declaration.
int myLastVertex
Definition: DtAggregatedGeometry.h:277
DtIndirectGeometryTexturesRefPtr myTextureForThisGeometry
Definition: DtAggregatedGeometry.h:57
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
DtIndirectAggregateHelper myAggregateHelper
Definition: DtAggregatedGeometry.h:270
Definition: DtAggregatedGeometry.h:53
DtGeometrySpecification class declaration.
DtAggregateModelInfo * myModelInfo
Definition: DtAggregatedGeometry.h:55
helper class to the DtIndirectGeometryAggregator.
Definition: DtIndirectAggregateHelper.h:35
DtGlBuffer * myColorBuffer
Definition: DtAggregatedGeometry.h:260
std::vector< DequeIndirectLodInfos > DequeIndirectLodInfoArray
Definition: DtIndirectLodManager.h:67
friend DtAggregatedGeometryCreator
only creator can create
Definition: DtAggregatedGeometry.h:95
Contains the DtIndirectAggregateHelper class declaration.
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
DtGlBuffer * myIndexBuffer
Definition: DtAggregatedGeometry.h:263
DtGlBuffer * myUVBuffer
Definition: DtAggregatedGeometry.h:262
DtGlBuffer * myVertexAndAttributesBuffer
Definition: DtAggregatedGeometry.h:259
std::deque< NodeDofInfoPair > DequeNodeDofInfoPairs
Definition: DtIndirectDofManager.h:74
std::vector< int > myScratchIndices
Definition: DtAggregatedGeometry.h:269
std::map< int, DtAggregateModelInfo * > MapModelsToModelInfo
Definition: DtAggregatedGeometry.h:265
Contains makVrv::DtIndirectDofManager class.
contains the Per Model info which DtAggregatedGeometry needs It is owned by the Indirect geometry reg...
Definition: DtAggregateModelInfo.h:31
std::vector< DequeNodeSwitchInfoPairs > DequeNodeSwitchInfoPairsArray
Definition: DtIndirectSwitchManager.h:76
boost::mutex myCopyDataMutex
Definition: DtAggregatedGeometry.h:281
osg::ref_ptr< osg::Geometry > myAggregatedGeometry
Definition: DtAggregatedGeometry.h:272
Contains makVrv::DtIndirectSwitchManager class.
tbb::atomic< int > myIsCopyingData
Definition: DtAggregatedGeometry.h:280
A generic OpenGL buffer.
Definition: DtGlBuffer.h:27
DtGlBuffer * myNormalBuffer
Definition: DtAggregatedGeometry.h:261
std::vector< int > myEnabledVertexAttribArrays
Definition: DtAggregatedGeometry.h:266
unsigned int GLenum
Definition: DtGlTextureBufferObject.h:18
Creates another thread to compress and mipmap data.
Definition: DtAggregatedGeometry.h:63
Contains makVrv::DtIndirectLodManager class.
boost::mutex myMutableMapModelsToModelInfoMutex
mutex needs to be used in const functions so must be mutable.
Definition: DtAggregatedGeometry.h:284
Contains DLL export macros.
tbb::atomic< int > myCancelTask
Definition: DtAggregatedGeometry.h:289
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
osg::ref_ptr< osg::Geometry > myGeomToProcess
Definition: DtAggregatedGeometry.h:56
DtDe & myDe
reference to De
Definition: DtAggregatedGeometry.h:287
tbb::concurrent_queue< DtCopyModelDataStructure > myModelDataToCopy
Definition: DtAggregatedGeometry.h:275
voidpf uLong offset
Definition: ioapi.h:42
Contains the DtIndirectGeometryTextures class declaration.
MapModelsToModelInfo myMapModelsToModelInfo
Definition: DtAggregatedGeometry.h:267
DtAggregatedGeometry * myGeometry
Definition: DtAggregatedGeometry.h:74
osg::Matrix myMatrix
Definition: DtAggregatedGeometry.h:58
DtVirtualBaseClassCreator< DtAggregatedGeometry > DtAggregatedGeometryCreator
creator
Definition: DtAggregatedGeometry.h:78
DtPerGeomInstance class declaration.
const char * creatorTypeName< DtAggregatedGeometry >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtAggregatedGeometry.h:85

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)