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) 2023 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  };
49 
52 
61  {
62  public:
64  static DtIndirectGlTextureObjectManager& instance(DtDe& de);
65 
68 
75 
76  public:
83  virtual DtIndirectGlTextureObjectResult getOrCreate(const DtIndirectTexturePrototype* vrvTexture, int textureLimitStrategy);
84 
87  virtual DtIndirectGlTextureObject* get(const DtIndirectTexturePrototype* vrvTexture);
88 
90  virtual bool has(unsigned int textureId) const;
91 
95  // When this is called:
96  // -the entry is added to the internal residency manager for making this texture non-resident in all contexts.
97  // -the entry is removed. (this also makes it so, that queries for vrvTexture that used to return this texture
98  // , will cause an entirely new texture object to be created)
99  virtual bool removeEntry(DtIndirectGlTextureObject* indirectGlTextureObject);
100 
102  virtual unsigned int outOfMemoryTextureId(void) const;
103 
107  virtual DtVector2<int> seenImageSize(const std::string& imageFileAbsolutePath) const;
108 
110  virtual void run(unsigned int frameNumber);
111 
113  virtual std::unordered_set<DtIndirectGlTextureObject*>& texturesSet(void);
114 
119  virtual void printStatsWhenNoWindows(void);
120 
121  protected:
124 
125  protected:
127  virtual unsigned int createCompressedGlTexture2d(const DtIndirectTexturePrototype* vrvTexture, const DtIndirectImagePrototype* vrvImage
128  , const DtIndirectLimitTextureStrategy& indirectLimitTextureStrategy
129  , bool regularPath
130  , bool& aboveCutoff) const;
131 
133  virtual unsigned int createUnCompressedGlTexture2d(const DtIndirectTexturePrototype* vrvTexture, const DtIndirectImagePrototype* vrvImage
134  , const DtIndirectLimitTextureStrategy& indirectLimitTextureStrategy) const;
135 
137  virtual unsigned int createGlTexture2dArray(const DtIndirectTexturePrototype* vrvTexture) const;
138 
140  virtual unsigned int createGlTexture3D(const DtIndirectTexturePrototype* vrvTexture) const;
141 
143  virtual void setupWrapFilteringAndAniso(unsigned int textureId, const DtIndirectTexturePrototype* vrvTexture) const;
144 
146  virtual bool textureWillPutMemoryAboveCutoff(int sizeOfTextureInBytes) const;
147 
149  virtual DtIndirectLimitTextureStrategy* limitTextureStrategy(int strategyType);
150 
151  protected:
153 
155 
157  std::unordered_map<const DtIndirectTexturePrototype*, DtIndirectGlTextureObject*> myTexturePrototypeToObject;
158  std::unordered_map<DtIndirectGlTextureObject*, const DtIndirectTexturePrototype* > myTextureObjectToPrototype;
159 
161  std::unordered_map<unsigned int, DtIndirectGlTextureObject*> myIdToGlTextures;
162 
164  std::unordered_set<DtIndirectGlTextureObject*> mySetIndirectGlTextureObjects;
165 
166  boost::mutex myMutex;
167 
169 
171 
174 
175  static const std::string theClassName;
176 
177  std::unordered_map<std::string, DtVector2<int> > mySeenImages;
178 
181 
183 
185 
187  };
188 }
std::unordered_map< DtIndirectGlTextureObject *, const DtIndirectTexturePrototype * > myTextureObjectToPrototype
Definition: DtIndirectGlTextureObjectManager.h:158
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:60
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:161
bool myCreated
Definition: DtIndirectGlTextureObjectManager.h:47
boost::mutex myMutex
Definition: DtIndirectGlTextureObjectManager.h:166
Definition: DtIndirectGlTextureObjectManager.h:39
std::unordered_set< DtIndirectGlTextureObject * > mySetIndirectGlTextureObjects
another set for fast look up
Definition: DtIndirectGlTextureObjectManager.h:164
std::unordered_map< std::string, DtVector2< int > > mySeenImages
Definition: DtIndirectGlTextureObjectManager.h:177
DtIndirectImagePrototypeManager & myImagePrototypeManager
Definition: DtIndirectGlTextureObjectManager.h:186
Contains makVrv::DtVirtualBaseClass class.
Definition: DtIndirectGlTextureObjectManager.h:42
DtIndirectLimitTextureStrategy & myTerrainLimitTextureStrategy
Definition: DtIndirectGlTextureObjectManager.h:180
std::unordered_map< const DtIndirectTexturePrototype *, DtIndirectGlTextureObject * > myTexturePrototypeToObject
of vrv texture to the indirect gl texture object
Definition: DtIndirectGlTextureObjectManager.h:157
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtSignalConnectionManager myConnections
Definition: DtIndirectGlTextureObjectManager.h:154
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:179
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:184
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:175
Base class to provide boost signal/slot management.
DtIndirectDefaultTexturesContainer & myDefaultTexturesContainer
cache to avoid repeated look ups via DtIndirectDefaultTexturesContainer::instance(myDe) ...
Definition: DtIndirectGlTextureObjectManager.h:173
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
DtMeifConverter * myImageCompressor
Definition: DtIndirectGlTextureObjectManager.h:168
DtIndirectLog & myIndirectLog
Definition: DtIndirectGlTextureObjectManager.h:182
DtIndirectImagePrototype represents an image template.
Definition: DtIndirectImagePrototype.h:36
DtIndirectGlTextureObjectStatus
Definition: DtIndirectGlTextureObjectManager.h:37
DtDe & myDe
Definition: DtIndirectGlTextureObjectManager.h:152
int myOutOfMemoryTextureId
Definition: DtIndirectGlTextureObjectManager.h:170

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)