VR-Forces 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) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvOsg/vrvOsg.h>
12 
15 #include <vrvMath/DtVector2.h>
16 
17 #include <boost/thread/mutex.hpp>
18 
19 #include <map>
20 #include <unordered_map>
21 #include <unordered_set>
22 
23 namespace makVrv
24 {
25  class DtDe;
26  class DtMeifConverter;
27  class DtIndirectDefaultTexturesContainer;
28  class DtIndirectLimitTextureStrategy;
29  class DtIndirectTextureLimitAdjustedMipMap;
30  class DtIndirectLog;
31  class DtIndirectTextureResidencyManager;
32  class DtIndirectTexturePrototype;
33  class DtIndirectImagePrototype;
34  class DtIndirectGlTextureObject;
35  class DtIndirectImagePrototypeManager;
36 
38  {
39  LOADED = 0, LOADING = 1, FAILED = 2, UNKNOWN = 3
40  };
41 
43  {
44  public:
47  bool myCreated = false;
48  unsigned int myUploadedMemoryInBytes = 0;
49  };
50 
53 
62  {
63  public:
65  static DtIndirectGlTextureObjectManager& instance(DtDe& de);
66 
69 
76 
77  public:
84  virtual DtIndirectGlTextureObjectResult getOrCreate(const DtIndirectTexturePrototype* vrvTexture, int textureLimitStrategy);
85 
88  virtual DtIndirectGlTextureObject* get(const DtIndirectTexturePrototype* vrvTexture);
89 
91  virtual bool has(unsigned int textureId) const;
92 
96  // When this is called:
97  // -the entry is added to the internal residency manager for making this texture non-resident in all contexts.
98  // -the entry is removed. (this also makes it so, that queries for vrvTexture that used to return this texture
99  // , will cause an entirely new texture object to be created)
100  virtual bool removeEntry(DtIndirectGlTextureObject* indirectGlTextureObject);
101 
103  virtual unsigned int outOfMemoryTextureId(void) const;
104 
108  virtual DtVector2<int> seenImageSize(const std::string& imageFileAbsolutePath) const;
109 
111  virtual void run(unsigned int frameNumber);
112 
114  virtual std::unordered_set<DtIndirectGlTextureObject*>& texturesSet(void);
115 
120  virtual void printStatsWhenNoWindows(void);
121 
122  protected:
125 
126  protected:
128  virtual unsigned int createCompressedGlTexture2d(const DtIndirectTexturePrototype* vrvTexture, const DtIndirectImagePrototype* vrvImage
129  , const DtIndirectLimitTextureStrategy& indirectLimitTextureStrategy
130  , bool regularPath
131  , unsigned int& outUploadedMemory
132  , bool& aboveCutoff) const;
133 
135  virtual unsigned int createUnCompressedGlTexture2d(const DtIndirectTexturePrototype* vrvTexture, const DtIndirectImagePrototype* vrvImage
136  , const DtIndirectLimitTextureStrategy& indirectLimitTextureStrategy, unsigned int& outUploadedMemory) const;
137 
139  virtual unsigned int createGlTexture2dArray(const DtIndirectTexturePrototype* vrvTexture, unsigned int& outUploadedMemory) const;
140 
142  virtual unsigned int createGlTexture3D(const DtIndirectTexturePrototype* vrvTexture, unsigned int& outUploadedMemory) const;
143 
145  virtual void setupWrapFilteringAndAniso(unsigned int textureId, const DtIndirectTexturePrototype* vrvTexture) const;
146 
148  virtual bool textureWillPutMemoryAboveCutoff(int sizeOfTextureInBytes) const;
149 
151  virtual DtIndirectLimitTextureStrategy* limitTextureStrategy(int strategyType);
152 
153  protected:
155 
157 
159  std::unordered_map<const DtIndirectTexturePrototype*, DtIndirectGlTextureObject*> myTexturePrototypeToObject;
160  std::unordered_map<DtIndirectGlTextureObject*, const DtIndirectTexturePrototype* > myTextureObjectToPrototype;
161 
163  std::unordered_map<unsigned int, DtIndirectGlTextureObject*> myIdToGlTextures;
164 
166  std::unordered_set<DtIndirectGlTextureObject*> mySetIndirectGlTextureObjects;
167 
168  boost::mutex myMutex;
169 
171 
173 
176 
177  static const std::string theClassName;
178 
179  std::unordered_map<std::string, DtVector2<int> > mySeenImages;
180 
183 
185 
187 
189  };
190 }
std::unordered_map< DtIndirectGlTextureObject *, const DtIndirectTexturePrototype * > myTextureObjectToPrototype
Definition: DtIndirectGlTextureObjectManager.h:160
Definition: DtIndirectGlTextureObjectManager.h:39
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
Encapsulate an OpenGL texture object that is created/used in indirect rendering.
Definition: DtIndirectGlTextureObject.h:36
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
DtIndirectGlTextureObject * myIndirectGlTextureObject
Definition: DtIndirectGlTextureObjectManager.h:45
This manager manages the lifetime of the actual gl texture objects (gl unsigned ints) in the indirect...
Definition: DtIndirectGlTextureObjectManager.h:61
Manager class that handles texture objects and texture handle residency, as contexts get created and ...
Definition: DtIndirectTextureResidencyManager.h:108
std::unordered_map< unsigned int, DtIndirectGlTextureObject * > myIdToGlTextures
another map for fast look up
Definition: DtIndirectGlTextureObjectManager.h:163
bool myCreated
Definition: DtIndirectGlTextureObjectManager.h:47
boost::mutex myMutex
Definition: DtIndirectGlTextureObjectManager.h:168
Definition: DtIndirectGlTextureObjectManager.h:39
std::unordered_set< DtIndirectGlTextureObject * > mySetIndirectGlTextureObjects
another set for fast look up
Definition: DtIndirectGlTextureObjectManager.h:166
std::unordered_map< std::string, DtVector2< int > > mySeenImages
Definition: DtIndirectGlTextureObjectManager.h:179
DtIndirectImagePrototypeManager & myImagePrototypeManager
Definition: DtIndirectGlTextureObjectManager.h:188
Contains makVrv::DtVirtualBaseClass class.
Definition: DtIndirectGlTextureObjectManager.h:42
DtIndirectLimitTextureStrategy & myTerrainLimitTextureStrategy
Definition: DtIndirectGlTextureObjectManager.h:182
std::unordered_map< const DtIndirectTexturePrototype *, DtIndirectGlTextureObject * > myTexturePrototypeToObject
of vrv texture to the indirect gl texture object
Definition: DtIndirectGlTextureObjectManager.h:159
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtSignalConnectionManager myConnections
Definition: DtIndirectGlTextureObjectManager.h:156
DtIndirectImagePrototypeManager creates/manages/deletes DtIndirectImagePrototypes.
Definition: DtIndirectImagePrototypeManager.h:51
loads and contains various core default textures used by the indirect system
Definition: DtIndirectDefaultTexturesContainer.h:30
DtIndirectGlTextureObjectStatus myLoadStatus
Definition: DtIndirectGlTextureObjectManager.h:46
DtIndirectLimitTextureStrategy * myNoLimitStrategy
Definition: DtIndirectGlTextureObjectManager.h:181
The indirect system uses this in conjunction with the system wide limits (for entity/terrain) to clam...
Definition: DtIndirectLimitTextureStrategy.h:65
DtIndirectTextureResidencyManager * myIndirectTextureResidencyManager
Definition: DtIndirectGlTextureObjectManager.h:186
This class is specifically used by the indirect system It&#39;s separate so that it doesn&#39;t interfere wit...
Definition: DtIndirectLog.h:30
static const std::string theClassName
Definition: DtIndirectGlTextureObjectManager.h:177
Base class to provide boost signal/slot management.
DtIndirectDefaultTexturesContainer & myDefaultTexturesContainer
cache to avoid repeated look ups via DtIndirectDefaultTexturesContainer::instance(myDe) ...
Definition: DtIndirectGlTextureObjectManager.h:175
Definition: DtIndirectGlTextureObjectManager.h:39
Definition: DtIndirectGlTextureObjectManager.h:39
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:76
VRV/Indirect uses its own texture paradigm: DtIndirectTexturePrototype, which is a &#39;template&#39; for mak...
Definition: DtIndirectTexturePrototype.h:53
unsigned int myUploadedMemoryInBytes
Definition: DtIndirectGlTextureObjectManager.h:48
DtMeifConverter * myImageCompressor
Definition: DtIndirectGlTextureObjectManager.h:170
DtIndirectLog & myIndirectLog
Definition: DtIndirectGlTextureObjectManager.h:184
DtIndirectImagePrototype represents an image template.
Definition: DtIndirectImagePrototype.h:36
DtIndirectGlTextureObjectStatus
Definition: DtIndirectGlTextureObjectManager.h:37
DtDe & myDe
Definition: DtIndirectGlTextureObjectManager.h:154
int myOutOfMemoryTextureId
Definition: DtIndirectGlTextureObjectManager.h:172

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)