VR-Forces 4.8 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) 2019 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
18 
20 
23 
25 
26 #include <osg/Geometry>
27 
28 #include <tbb/concurrent_queue.h>
29 #include <tbb/task.h>
30 #include <boost/thread.hpp>
31 
32 #include <list>
33 
34 namespace makVrv
35 {
36  class DtGlBuffer;
37  class DtCoreGlBufferCreator;
38  class DtAggregatedGeometry;
39  class DtAggregatedGeometryCopyDataAsync;
40  class DtIndirectGeometryAggregator;
41  class DtIndirectGeometryRegistrar;
42  class DtIndirectAggregateHelper;
43 
48  {
49  //optional
51 
52  std::string myModelName;
53  int myModelID;
58 
63 
66  };
67 
71  {
75  osg::Matrix myMatrix;
76  };
77 
80  class DtAggregatedGeometryCopyDataAsync : public tbb::task
81  {
82  public:
84  {
85 
86  };
87 
88  virtual tbb::task* execute();
89 
90  protected:
91 
93  };
94 
95 
100  {
101  public:
104 
106  DtAggregatedGeometry(DtCoreGlBufferCreator& coreGlBufferCreator);
107 
109  virtual ~DtAggregatedGeometry();
110 
112  virtual void releaseGLObjects(osg::State* state) const;
113 
115  virtual void addGeometryToLoad(const DtCopyDataStructure & cds);
116 
118  virtual bool hasDataToAsyncLoad();
119 
121  virtual bool hasDataToCopy();
122 
125  virtual void setDtDe(DtDe* myDe);
126 
128  boost::mutex& copyDataMutex() { return myCopyDataMutex; }
129 
131  int isCopyingData() { return myIsCopyingData; }
132 
133  private:
137  DtAggregatedGeometry &operator=(const DtAggregatedGeometry &other);
138 
139  public:
140 
141 
143  virtual int numModels(void) const;
144 
146  virtual int modelId(int index) const;
147 
149  virtual DtAggregateModelInfo* getOrCreateModelInfoFor(int modelId);
150 
152  virtual DtAggregateModelInfo* getModelInfoFor(int modelId);
153 
155  virtual const DtIndirectSwitchManager::DequeNodeSwitchInfoPairsArray& getVectorSwitchPaths(int modelId) const;
156 
158  virtual const DtIndirectLodManager::DequeIndirectLodInfoArray& getVectorLodStacks(int modelId) const;
159 
161  virtual int vertexAndAttributesBufferSize(void) const;
162 
164  virtual osg::Geometry* aggregatedGeometry(void);
165 
166 
168  virtual void printStats();
170  virtual void testDrawUsingDrawElements();
171 
173  virtual GLenum indicesType(void) const;
174 
175  virtual void copyDataQueue();
176 
177 protected:
183 
185  void configureBuffers();
186 
188  virtual void reserveMaxMemory();
189 
191  virtual void copyData(DtCopyDataStructure & data);
192 
194  virtual void convertToUIntIfNecessary(int indicesCount);
195 
197  virtual bool updateBuffers();
198 
200  virtual void bindBuffers();
201 
203  virtual void unbindBuffers();
205  virtual unsigned int vertexBufferSizeInBytes() const;
207  virtual unsigned int vertexBufferNumElements() const;
208  virtual const void* verticesPointer() const;
209  virtual unsigned int numVertices(void) const;
210 
212  virtual unsigned int normalBufferSizeInBytes() const;
213  virtual unsigned int normalBufferNumElements() const;
214  virtual const void* normalsPointer() const;
215  virtual unsigned int numNormals(void) const;
216 
218  virtual unsigned int colorBufferSizeInBytes() const;
219  virtual unsigned int colorBufferNumElements() const;
220  virtual const void* colorsPointer() const;
221  virtual unsigned int numColors(void) const;
222 
224  virtual unsigned int textureCoordsBufferSizeInBytes(unsigned int unit) const;
225  virtual unsigned int textureCoordsBufferNumElements(unsigned int unit) const;
226  virtual const void* textureCoordsPointer(unsigned int unit) const;
227  virtual unsigned int numTextureCoords(unsigned int unit) const;
228 
229  virtual unsigned int textureBufferSizeInBytes() const;
230 
231  virtual void copyTextureData(DtGlBuffer* vertexAndAttributesBuffer, int &offset) const;
232 
234  virtual const void* indexBufferPointer() const;
235  virtual unsigned int indexBufferSizeInBytes() const;
242 
243  typedef std::map<int, DtAggregateModelInfo *> MapModelsToModelInfo;
244  std::vector<int> myEnabledVertexAttribArrays;
246  std::vector<int> myScratchIndices;
248 
250 
251 
252  // not sure if I need a mutex the way I'm using this
253  tbb::concurrent_queue<DtCopyDataStructure> myDataToCopy;
254 
257 
258  tbb::atomic<int> myIsCopyingData;
259  boost::mutex myCopyDataMutex;
260 
263 
266 
267  tbb::atomic<int> myCancelTask;
268 
269  };
270 
275  {
276 
277  public:
280 
282  virtual ~DtAggregatedGeometryCreator();
283 
284  private:
289 
290  public:
293  static DtAggregatedGeometryCreator& instance(DtDe& de);
294 
296  static void registerInstance(DtDe& de,
297  DtAggregatedGeometryCreator* instance);
298 
300  virtual DtAggregatedGeometry* create(DtCoreGlBufferCreator& coreGlBufferCreator);
301 
303  //virtual DtAggregatedGeometry* create();
304 
307  };
308 
309 
310 
311 }
DtIndirectSwitchManager::DequeNodeSwitchInfoPairsArray mySwitchPaths
Definition: DtAggregatedGeometry.h:64
The DtAggregatedGeometry creator for the DtAggregatedGeometryCreator class.
Definition: DtAggregatedGeometry.h:274
tbb::concurrent_queue< DtCopyDataStructure > myDataToCopy
Definition: DtAggregatedGeometry.h:253
int myLastIndex
Definition: DtAggregatedGeometry.h:256
DtMaterial class declaration.
int myLastVertex
Definition: DtAggregatedGeometry.h:255
Virtual base class.
Definition: DtVirtualBaseClass.h:22
bool myDownloaded
is the model completely downloaded to the gpu
Definition: DtAggregatedGeometry.h:57
friend DtIndirectGeometryAggregator
Definition: DtAggregatedGeometry.h:182
DtPerGeomInstances myPerGeomInstancesTemplate
Definition: DtAggregatedGeometry.h:62
contains the information which indirect needs for all geometry found by the geometry aggregator after...
Definition: DtAggregatedGeometry.h:99
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtIndirectAggregateHelper myAggregateHelper
Definition: DtAggregatedGeometry.h:247
boost::mutex & copyDataMutex()
access to copy data mutex
Definition: DtAggregatedGeometry.h:128
contains the geometry data which DtAggregatedGeometry needs to copy into cpu and then gpu data ...
Definition: DtAggregatedGeometry.h:70
creator for DtCoreGlBuffer
Definition: DtCoreGlBuffer.h:58
DtIndirectGeometryTexturesRefPtr myTextureForThisGeometry
Definition: DtAggregatedGeometry.h:74
int myModelID
Definition: DtAggregatedGeometry.h:53
DtIndirectLodManager::DequeIndirectLodInfoArray myLodStacks
Definition: DtAggregatedGeometry.h:65
std::vector< DtPerGeomInstance > DtPerGeomInstances
Definition: DtGeometrySpecification.h:41
osg::Matrix myMatrix
Definition: DtAggregatedGeometry.h:75
DtGeometrySpecification class declaration.
helper class to the DtIndirectGeometryAggregator.
Definition: DtIndirectAggregateHelper.h:35
DtGlBuffer * myColorBuffer
Definition: DtAggregatedGeometry.h:238
std::vector< DequeIndirectLodInfos > DequeIndirectLodInfoArray
Definition: DtIndirectLodManager.h:97
int myLastVertex
last vertex in this model used for offset calculation
Definition: DtAggregatedGeometry.h:55
friend DtAggregatedGeometryCopyDataAsync
Definition: DtAggregatedGeometry.h:181
OsgTexturesArray myTextures
Definition: DtAggregatedGeometry.h:61
Contains the DtIndirectAggregateHelper class declaration.
DtAggregateModelInfo * myModelInfo
Definition: DtAggregatedGeometry.h:72
std::vector< DtIndirectGeometryTexturesRefPtr > OsgTexturesArray
Definition: DtIndirectGeometryTextures.h:125
DtGlBuffer * myIndexBuffer
Definition: DtAggregatedGeometry.h:241
DtGlBuffer * myUVBuffer
Definition: DtAggregatedGeometry.h:240
DtGlBuffer * myVertexAndAttributesBuffer
Definition: DtAggregatedGeometry.h:237
std::vector< int > myScratchIndices
Definition: DtAggregatedGeometry.h:246
std::map< int, DtAggregateModelInfo * > MapModelsToModelInfo
Definition: DtAggregatedGeometry.h:243
Contains makVrv::DtVirtualBaseClass class.
std::vector< DtMaterial > DtIndirectMaterialVector
Each model type can have a number of geometries, each with an own material.
Definition: DtMaterial.h:81
osg::ref_ptr< osg::Geometry > myGeomToProcess
Definition: DtAggregatedGeometry.h:73
DtGeometrySpecVector myGeometrySpecifications
Definition: DtAggregatedGeometry.h:59
contains the Per Model info which DtAggregatedGeometry needs It is owned by the Indirect geometry reg...
Definition: DtAggregatedGeometry.h:47
std::string myModelName
Definition: DtAggregatedGeometry.h:52
friend DtIndirectGeometryRegistrar
need lots of access to internal functions, these are effectively a tightly coupled system probably sh...
Definition: DtAggregatedGeometry.h:180
std::vector< DequeNodeSwitchInfoPairs > DequeNodeSwitchInfoPairsArray
Definition: DtIndirectSwitchManager.h:73
boost::mutex myCopyDataMutex
Definition: DtAggregatedGeometry.h:259
osg::ref_ptr< osg::Geometry > myAggregatedGeometry
Definition: DtAggregatedGeometry.h:249
DtDe & myDe
Create a DtAggregatedGeometry.
Definition: DtAggregatedGeometry.h:306
Contains makVrv::DtIndirectSwitchManager class.
tbb::atomic< int > myIsCopyingData
Definition: DtAggregatedGeometry.h:258
A generic OpenGL buffer.
Definition: DtGlBuffer.h:25
DtGlBuffer * myNormalBuffer
Definition: DtAggregatedGeometry.h:239
std::vector< int > myEnabledVertexAttribArrays
Definition: DtAggregatedGeometry.h:244
unsigned int GLenum
Definition: DtGlTextureBufferObject.h:18
Creates another thread to compress and mipmap data.
Definition: DtAggregatedGeometry.h:80
DtIndirectMaterialVector myMaterials
Definition: DtAggregatedGeometry.h:60
DtDe * myDtDe
reference to De
Definition: DtAggregatedGeometry.h:265
Contains makVrv::DtIndirectLodManager class.
boost::mutex myMutableMapModelsToModelInfoMutex
mutex needs to be used in const functions so must be mutable.
Definition: DtAggregatedGeometry.h:262
Contains DLL export macros.
tbb::atomic< int > myCancelTask
Definition: DtAggregatedGeometry.h:267
std::vector< DtGeometrySpecification > DtGeometrySpecVector
Each model type can have a number of geometries.
Definition: DtGeometrySpecification.h:94
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtAggregatedGeometryCopyDataAsync(DtAggregatedGeometry *geometry)
Definition: DtAggregatedGeometry.h:83
voidpf uLong offset
Definition: ioapi.h:42
Contains the DtIndirectGeometryTextures class declaration.
DtAggregateModelInfo()
Definition: DtAggregatedGeometry.h:50
MapModelsToModelInfo myMapModelsToModelInfo
Definition: DtAggregatedGeometry.h:245
DtAggregatedGeometry * myGeometry
Definition: DtAggregatedGeometry.h:92
int isCopyingData()
access to copy data atomic
Definition: DtAggregatedGeometry.h:131

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)