VR-Forces 4.8 Class Documentation
 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) 2020 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvOsg/vrvOsg.h>
12 
15 #include <vrvOsg/DtMeifConverter.h>
16 
18 
20 
21 #include <tbb/atomic.h>
22 
23 #include <boost/thread/condition_variable.hpp>
24 
25 #include <string>
26 
27 namespace makVrv
28 {
29  class DtOsgCullVisitor;
30  class DtOsgRenderer;
31  class DtGLDeleteObjectManager;
32  class DtWindow;
34 
36 
37  template <>
38  inline const char* creatorTypeName<DtIndirectTextureProcessor>(void) { return "DtIndirectTextureProcessorCreator"; }
39 
41  class DT_DLL_VRVOSG DtIndirectTextureProcessor : public osg::Referenced
42  {
43  public:
44  // Inner class for creating a job that runs in the main thread.
45  class LoadingJob : public osg::Operation
46  {
47  public:
50  virtual ~LoadingJob();
51 
53  virtual void operator () (osg::Object * sv);
54 
56  virtual void release();
57 
58  protected:
60 
61  };
62 
64  virtual ~DtIndirectTextureProcessor();
65 
68 
69  protected:
70 
73 
74  private:
79 
80  public:
81 
83  virtual void launchTextureLoadsIfNecessary(DtOsgRenderer* renderer);
84 
86  virtual void ts_addTexturesToLoad(int beforeTextureIndex, int afterTextureIndex, OsgTexturesArray& textures);
87 
89  virtual void ts_addTextureToLoad(osg::Texture* texture);
90 
92  virtual unsigned int streamTexturesToGpu(osg::RenderInfo& renderInfo);
93 
95  virtual unsigned int texturesUpdatedFrameNum();
96 
98  virtual int numTexturesRemaining();
99 
101  virtual void releaseGLObjects(osg::State* state) const;
102 
104  virtual void makeTexturesResidentIfNeeded(osg::RenderInfo& renderInfo) const;
105 
107  virtual bool ts_setCompressionDisabledHint(osg::Image* image, bool val) const;
108 
110  virtual bool ts_compressionDisabledHint(osg::Image* image) const;
111 
113  virtual void stopWork();
114 
116  virtual int numTexturesToLoad();
117 
119  virtual int numTexturesLoading();
120 
122  virtual bool inJobQueue();
123 
125  virtual boost::condition_variable& waitCondition();
126 
129  virtual bool inTextureToGCMap(osg::GraphicsContext* gContext, osg::Texture::TextureObject* texObj) const;
130 
131  protected:
132 
133  // internal
135  virtual void addTexturesToLoad(const DtIndirectGeometryTextures* osgGeometryTextures);
136 
138  virtual void addTextureToLoad( osg::Texture* texture);
139 
141  virtual osg::Operation * createJob();
142 
143  virtual void collectNewTexturesAcrosssNonSharedContextIds(const osg::RenderInfo& renderInfo, osg::Texture::TextureObject* ts) const;
144  virtual void makeNewTexturesAcrosssNonSharedContextIdsResident(osg::GraphicsContext* gc) const;
145 
147  virtual void addTextureToGCMap(osg::GraphicsContext* gContext, osg::Texture::TextureObject* texObj) const;
148 
150  virtual void slot_windowToBeDestroyed(DtWindow* window);
151 
152  protected:
153 
154  typedef std::set<osg::ref_ptr<osg::Texture> > SetTextures;
155 
159 
160  tbb::atomic<bool> myInJobQueue;
161 
162  mutable unsigned int myTexturesUpdatedFrameNum;
163  unsigned int myLastFrameNumber;
167  boost::condition_variable myWaitCondition;
168 
169  typedef std::set<unsigned int> SetNonSharedContextIds;
170  typedef std::map<unsigned int, SetNonSharedContextIds> MapContextIdsToNonSharedContextIds;
173  typedef std::map<osg::GraphicsContext*, unsigned int> MapGCToContextIds;
178 
179  // Set since each object should have 1 copy of each texture
180  typedef std::set<osg::ref_ptr<osg::Texture::TextureObject> > TexturesSet;
181 
182  typedef std::map<osg::GraphicsContext*, TexturesSet> MapNonSharedContextIdsToNewTexturesArray;
185 
186  typedef std::map<osg::GraphicsContext*, TexturesSet> MapGCToTexSet;
189 
192 
196  };
197 
198 
199 }
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
osg::ref_ptr< DtIndirectTextureProcessor > myTextureProcessor
Definition: DtIndirectTextureProcessor.h:59
std::map< osg::GraphicsContext *, unsigned int > MapGCToContextIds
Definition: DtIndirectTextureProcessor.h:173
OpenThreads::Mutex myMutableTextureResidencyMutex
Definition: DtIndirectTextureProcessor.h:172
Manager to delete GLBuffer in the main thread.
Definition: DtGlDeleteObjectManager.h:33
Abstract Base class.
Definition: DtWindow.h:25
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:125
DtMeifConverter myImageCompressor
Definition: DtIndirectTextureProcessor.h:164
OpenThreads::Mutex myWorkMutex
Definition: DtIndirectTextureProcessor.h:166
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Class responsible for converting images into MAK encrypted image files.
Definition: DtMeifConverter.h:25
unsigned int myTexturesUpdatedFrameNum
Definition: DtIndirectTextureProcessor.h:162
Definition: featureContext.h:37
DtVirtualBaseClassCreator< DtIndirectTextureProcessor > DtIndirectTextureProcessorCreator
Definition: DtIndirectTextureProcessor.h:33
Definition: DtIndirectTextureProcessor.h:45
SetTextures myMutableTexturesToLoad
Definition: DtIndirectTextureProcessor.h:156
std::map< osg::GraphicsContext *, TexturesSet > MapGCToTexSet
Definition: DtIndirectTextureProcessor.h:186
DtGLDeleteObjectManager * myGLManager
Definition: DtIndirectTextureProcessor.h:193
std::set< osg::ref_ptr< osg::Texture::TextureObject > > TexturesSet
Definition: DtIndirectTextureProcessor.h:180
MapContextIdsToNonSharedContextIds myMutableMapContextIdsToNonSharedContextIds
Definition: DtIndirectTextureProcessor.h:171
TexturesSet myMutableAllSeenTextures
Texture ids for all textures that we have seen so far in all contexts.
Definition: DtIndirectTextureProcessor.h:191
std::map< osg::GraphicsContext *, TexturesSet > MapNonSharedContextIdsToNewTexturesArray
Definition: DtIndirectTextureProcessor.h:182
tbb::atomic< bool > myInJobQueue
Definition: DtIndirectTextureProcessor.h:160
const char * creatorTypeName< DtIndirectTextureProcessor >(void)
Definition: DtIndirectTextureProcessor.h:38
Definition: DtVirtualBaseClassCreator.h:14
bool myStopWork
Definition: DtIndirectTextureProcessor.h:165
std::vector< DtIndirectGeometryTexturesRefPtr > OsgTexturesArray
Definition: DtIndirectGeometryTextures.h:125
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
class to hold osg Textures (diffuse map texture + effect textures) basically just a list of osg textu...
Definition: DtIndirectGeometryTextures.h:27
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:24
MapGCToContextIds myMutableGCToContextIds
For slot_windowToBeDestroyed, keep track of graphcs context and the OSG context id since some functio...
Definition: DtIndirectTextureProcessor.h:177
std::set< osg::ref_ptr< osg::Texture > > SetTextures
Definition: DtIndirectTextureProcessor.h:154
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
Definition: DtIndirectTextureProcessor.h:41
DtSignalConnectionManager myConnections
Definition: DtIndirectTextureProcessor.h:194
MapNonSharedContextIdsToNewTexturesArray myMutableMapNonSharedContextIdsToNewTexturesSet
The nex textures that have been seen in this context.
Definition: DtIndirectTextureProcessor.h:184
boost::condition_variable myWaitCondition
Definition: DtIndirectTextureProcessor.h:167
Contains makVrv::DtMeifConverter class.
SetTextures myMutableTexturesLoaded
Definition: DtIndirectTextureProcessor.h:158
Base class to provide boost signal/slot management.
std::map< unsigned int, SetNonSharedContextIds > MapContextIdsToNonSharedContextIds
Definition: DtIndirectTextureProcessor.h:170
SetTextures myMutableTexturesLoading
Definition: DtIndirectTextureProcessor.h:157
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtDe & myDe
Definition: DtIndirectTextureProcessor.h:195
Contains the DtIndirectGeometryTextures class declaration.
friend DtIndirectTextureProcessorCreator
The creator class needs to be a freind so it can create this class.
Definition: DtIndirectTextureProcessor.h:67
unsigned int myLastFrameNumber
Definition: DtIndirectTextureProcessor.h:163
MapGCToTexSet myMutableMapGraphicsContextToTexturesSet
Which textures have we seen in what contexts.
Definition: DtIndirectTextureProcessor.h:188
std::set< unsigned int > SetNonSharedContextIds
Definition: DtIndirectTextureProcessor.h:169

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)