VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectGlTextureObjectManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvOsg/vrvOsg.h>
12 
16 
17 #include <osg/ref_ptr>
18 
19 #include <boost/thread/mutex.hpp>
20 
21 #include <map>
22 #include <unordered_map>
23 
24 namespace osg
25 {
26  class Texture;
27  class Image;
28 }
29 
30 namespace makVrv
31 {
32  class DtDe;
33  class DtMeifConverter;
34  class DtIndirectDefaultTexturesContainer;
35  class DtIndirectLimitTextureStrategy;
36  class DtIndirectTextureLimitAdjustedMipMap;
37 
39  class DtIndirectGlTextureObject;
40 
61  {
62  public:
64  static DtIndirectGlTextureObjectManager& instance(DtDe& de);
65 
68 
75 
76  public:
84  virtual DtIndirectGlTextureObject* getOrCreate(osg::ref_ptr<osg::Texture> osgTexture, bool& imageBeingProcessed
85  , const DtIndirectLimitTextureStrategy& indirectLimitTextureStrategy
86  , int flags);
87 
91 
98  virtual bool removeEntry(unsigned int textureId);
99 
101  virtual unsigned int outOfMemoryTextureId(void) const;
102 
106  virtual DtVector2<int> seenImageSize(const std::string& imageFileAbsolutePath) const;
107 
109  virtual void addImguiTextureUI(unsigned int contextID);
110 
111  protected:
114 
116  static void registerInstance(DtIndirectGlTextureObjectManager* manager, DtDe& de);
117 
119  static DtIndirectGlTextureObjectManager* findInstance(DtDe& de);
120 
121  protected:
123  virtual unsigned int createCompressedGlTexture2d(osg::ref_ptr<osg::Texture> osgTexture, osg::ref_ptr<osg::Image> osgImage
124  , const DtIndirectLimitTextureStrategy& indirectLimitTextureStrategy
125  , bool regularPath
126  , bool& aboveCutoff) const;
127 
129  virtual unsigned int createUnCompressedGlTexture2d(osg::ref_ptr<osg::Texture> osgTexture, osg::ref_ptr<osg::Image> osgImage
130  , const DtIndirectLimitTextureStrategy& indirectLimitTextureStrategy) const;
131 
133  virtual unsigned int createGlTexture2dArray(osg::ref_ptr<osg::Texture> osgTexture) const;
134 
136  virtual void setupWrapFilteringAndAniso(unsigned int textureId, osg::ref_ptr<osg::Texture> osgTexture) const;
137 
139  virtual bool textureWillPutMemoryAboveCutoff(int sizeOfTextureInBytes) const;
140 
142  virtual bool textureMatches(unsigned int textureId, const osg::ref_ptr<osg::Texture>& osgTexture) const;
143 
146  virtual DtIndirectGlTextureObject* findMatchingTextureAndUpdateReference(const osg::ref_ptr<osg::Texture>& osgTexture);
147 
148  protected:
150 
152 
154  std::map<osg::ref_ptr<const osg::Texture>, DtIndirectGlTextureObject*> myOsgTextureToIndirectGlTexture;
155 
157  std::map<unsigned int, DtIndirectGlTextureObject*> myIdToGlTextures;
158 
159  boost::mutex myMutex;
160 
162 
164 
167 
168  static const std::string theClassName;
169 
170  std::unordered_map<std::string, DtVector2<int> > mySeenImages;
171 
173  };
174 }
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
Encapsulate a gl texture object that is created/used in indirect rendering The life time of these is ...
Definition: DtIndirectGlTextureObject.h:26
2 dimensional vector
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Class responsible for converting images into MAK encrypted image files.
Definition: DtMeifConverter.h:25
This manager manages the lifetime of the actual gl texture objects (gl unsigned ints) in the indirect...
Definition: DtIndirectGlTextureObjectManager.h:60
std::map< osg::ref_ptr< const osg::Texture >, DtIndirectGlTextureObject * > myOsgTextureToIndirectGlTexture
of osg texture to the indirect gl texture object
Definition: DtIndirectGlTextureObjectManager.h:154
boost::mutex myMutex
Definition: DtIndirectGlTextureObjectManager.h:159
std::unordered_map< std::string, DtVector2< int > > mySeenImages
Definition: DtIndirectGlTextureObjectManager.h:170
Contains makVrv::DtVirtualBaseClass class.
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))
std::map< unsigned int, DtIndirectGlTextureObject * > myIdToGlTextures
another map for fast look up
Definition: DtIndirectGlTextureObjectManager.h:157
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtSignalConnectionManager myConnections
Definition: DtIndirectGlTextureObjectManager.h:151
loads and contains various core default textures used by the indirect system
Definition: DtIndirectDefaultTexturesContainer.h:27
DtIndirectLimitTextureStrategy * myNoLimitStrategy
Definition: DtIndirectGlTextureObjectManager.h:172
This class is passed as a pointer to DtIndirectTextureProcessor. The processor then uses this in conj...
Definition: DtIndirectLimitTextureStrategy.h:65
static const std::string theClassName
Definition: DtIndirectGlTextureObjectManager.h:168
Base class to provide boost signal/slot management.
DtIndirectDefaultTexturesContainer & myDefaultTexturesContainer
cache to avoid repeated look ups via DtIndirectDefaultTexturesContainer::instance(myDe) ...
Definition: DtIndirectGlTextureObjectManager.h:166
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
DtMeifConverter * myImageCompressor
Definition: DtIndirectGlTextureObjectManager.h:161
DtDe & myDe
Definition: DtIndirectGlTextureObjectManager.h:149
int myOutOfMemoryTextureId
Definition: DtIndirectGlTextureObjectManager.h:163

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)