VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectTextureProcessor.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvOsg/vrvOsg.h>
12 
15 
17 
18 #include <tbb/atomic.h>
19 
20 #include <boost/thread/condition_variable.hpp>
21 
22 #include <string>
23 
24 namespace makVrv
25 {
26  class DtOsgCullVisitor;
27  class DtOsgRenderer;
28  class DtIndirectTextureResidencyManager;
29  class DtWindow;
30  class DtIndirectTextureProcessor;
31  class DtIndirectGlTextureObjectManager;
32  class DtIndirectGlTextureObject;
34 
36 
38  template <>
39  inline const char* creatorTypeName<DtIndirectTextureProcessor>(void) { return "DtIndirectTextureProcessorCreator"; }
40 
42  class DT_DLL_VRVOSG DtIndirectTextureProcessor : public osg::Referenced
43  {
44  public:
47 
49  virtual ~DtIndirectTextureProcessor();
50 
51  protected:
53  DtIndirectTextureProcessor(DtDe& de, const DtIndirectLimitTextureStrategy& indirectLimitTextureStrategy);
54 
55  private:
57  DtIndirectTextureProcessor() = delete;
61  DtIndirectTextureProcessor &operator=(const DtIndirectTextureProcessor &other) = delete;
62  public:
63 
65  virtual void launchTextureLoadsIfNecessary(DtOsgRenderer* renderer);
66 
68  virtual void ts_addTexturesToLoad(int beforeTextureIndex, int afterTextureIndex, VectorIndirectGeometryTexturesRefPtrs& textures);
69 
71  virtual void ts_addTextureToLoad(osg::Texture* texture, int flags);
72 
74  virtual void ts_unloadTextures(const std::set< osg::ref_ptr<osg::Texture> >& texturesToUnload);
75 
77  virtual void ts_moveToToLoadIfNotInToLoadOrLoadingOrNotLoaded(const std::map< osg::ref_ptr<osg::Texture>, int >& texturesToUnload);
78 
80  virtual unsigned int streamTexturesToGpu(const osg::RenderInfo& renderInfo);
81 
83  virtual unsigned int texturesUpdatedFrameNum() const;
84 
86  virtual int numTexturesRemaining() const;
87 
89  virtual void releaseGLObjects(osg::State* state) const;
90 
92  virtual void stopWork();
93 
96  virtual int numTexturesToLoad() const;
97 
100  virtual int numTexturesLoading() const;
101 
103  virtual bool texureFailed(osg::Texture* texture) const;
104 
106  virtual bool inJobQueue() const;
107 
109  virtual boost::condition_variable& waitCondition();
110 
113  virtual bool inTextureToGCMap(const osg::GraphicsContext* graphicsContext, unsigned int textureObject) const;
114 
116  virtual bool readyForBindless(const DtIndirectGlTextureObject* indirectGlTextureObject, const osg::GraphicsContext* graphicsContext) const;
117 
119  virtual void makeTexturesResidentIfNeeded(const osg::GraphicsContext* graphicsContext) const;
120 
122  virtual void setTextureLoadTimeSlicePeriod(float period);
129  virtual float textureLoadTimeSlicePeriod(void) const;
131 
134  virtual DtIndirectGlTextureObject* getTextureObject(osg::ref_ptr<osg::Texture> osgTexture, int flags) const;
135 
136  protected:
137 
138  // internal
140  virtual void addTexturesToLoad(const DtIndirectGeometryTextures* osgGeometryTextures);
141 
143  virtual void addTextureToLoad(osg::Texture* texture, int flags);
144 
146  virtual osg::Operation * createTextureLoadJob();
147 
150  virtual void printStats(void) const;
151  protected:
152 
153  typedef std::set<osg::ref_ptr<osg::Texture> > SetTextures;
154  typedef std::map<osg::ref_ptr<osg::Texture>, int > SetTexturesAndFlags;
155 
160 
163 
164  tbb::atomic<bool> myInJobQueue;
165 
168 
169  mutable unsigned int myTexturesUpdatedFrameNum;
170  unsigned int myLastFrameNumber;
171 
174  boost::condition_variable myWaitCondition;
175 
178 
180 
183 
185 
186  };
187 
188 
189 }
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
SetTexturesAndFlags myMutableTexturesLoading
Definition: DtIndirectTextureProcessor.h:157
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:87
Encapsulate a gl texture object that is created/used in indirect rendering The life time of these is ...
Definition: DtIndirectGlTextureObject.h:26
std::vector< DtIndirectGeometryTexturesRefPtr > VectorIndirectGeometryTexturesRefPtrs
Definition: DtIndirectGeometryTextures.h:141
OpenThreads::Mutex myWorkMutex
Definition: DtIndirectTextureProcessor.h:173
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
unsigned int myTexturesUpdatedFrameNum
Definition: DtIndirectTextureProcessor.h:169
SetTexturesAndFlags myMutableTexturesToLoad
Definition: DtIndirectTextureProcessor.h:156
SetTexturesAndFlags myMutableTexturesLoaded
Definition: DtIndirectTextureProcessor.h:158
This manager manages the lifetime of the actual gl texture objects (gl unsigned ints) in the indirect...
Definition: DtIndirectGlTextureObjectManager.h:60
Manager class that handles texture objects and texture residency, as contexts get created and destroy...
Definition: DtIndirectTextureResidencyManager.h:50
float myTextureLoadTimeSlicePeriod
time slice period to load textures
Definition: DtIndirectTextureProcessor.h:162
tbb::atomic< bool > myInJobQueue
Definition: DtIndirectTextureProcessor.h:164
const char * creatorTypeName< DtIndirectTextureProcessor >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectTextureProcessor.h:39
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
bool myStopWork
Definition: DtIndirectTextureProcessor.h:172
class to hold osg Textures (diffuse map texture + effect textures) basically just a list of osg textu...
Definition: DtIndirectGeometryTextures.h:26
DtIndirectTextureResidencyManager * myTextureResidencyManager
handle residency, textures as contexts get created/destroyed
Definition: DtIndirectTextureProcessor.h:177
std::set< osg::ref_ptr< osg::Texture > > SetTextures
Definition: DtIndirectTextureProcessor.h:153
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
Definition: DtIndirectTextureProcessor.h:42
This class is passed as a pointer to DtIndirectTextureProcessor. The processor then uses this in conj...
Definition: DtIndirectLimitTextureStrategy.h:65
boost::condition_variable myWaitCondition
Definition: DtIndirectTextureProcessor.h:174
DtIndirectGlTextureObjectManager & myIndirectTextureObjectManager
cached reference to the de keyed texture object manager
Definition: DtIndirectTextureProcessor.h:182
SetTextures myMutableTexturesFailed
Definition: DtIndirectTextureProcessor.h:159
DtVirtualBaseClassCreator< DtIndirectTextureProcessor, const DtIndirectLimitTextureStrategy & > DtIndirectTextureProcessorCreator
Definition: DtIndirectTextureProcessor.h:33
std::map< osg::ref_ptr< osg::Texture >, int > SetTexturesAndFlags
Definition: DtIndirectTextureProcessor.h:154
class for creating a job that runs in the main thread. created/launched via DtIndirectTextureProcesso...
Definition: DtIndirectTextureLoadJob.h:22
Contains DLL export macros.
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:70
DtDe & myDe
Definition: DtIndirectTextureProcessor.h:179
Contains the DtIndirectGeometryTextures class declaration.
friend DtIndirectTextureProcessorCreator
The creator class needs to be a friend so it can create this class.
Definition: DtIndirectTextureProcessor.h:46
const DtIndirectLimitTextureStrategy & myIndirectLimitTextureStrategy
Definition: DtIndirectTextureProcessor.h:184
unsigned int myLastFrameNumber
Definition: DtIndirectTextureProcessor.h:170

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)