14 #ifndef __RE_TextureMap_h__
15 #define __RE_TextureMap_h__
27 class RE_TextureCache;
28 class re_AutoTextureSource;
42 myTexture->setInUse(
true);
45 : myTexture(src.myTexture)
48 myTexture->setInUse(
true);
53 myTexture->setInUse(
false);
56 bool isValid()
const {
return myTexture !=
nullptr; }
63 myTexture->setInUse(
false);
70 *
this = tex.myTexture;
77 myTexture->setInUse(
false);
83 {
return myTexture == tex; }
85 {
return myTexture != tex; }
87 {
return myTexture == tex.myTexture; }
89 {
return myTexture != tex.myTexture; }
92 {
return myTexture ? myTexture->getUsage() : 0; }
105 virtual int64 getMemoryUsage(
bool inclusive)
const;
107 virtual const char *className()
const;
123 const char *relativeTo);
131 const char *relativeTo,
134 void *releaseObject);
151 vector_size(1),
w(0),
h(0), d(0),
161 void setSourceModifyCallback(
const char *opname,
169 void clearStoredTexture();
193 virtual void invalidateCached();
203 void clear(
const char *clear_name =
nullptr);
207 bool isSourceValid();
211 void setValidSourceResolve(
bool valid);
219 void getResolution(
int &
w,
int &
h,
int &d);
228 float getAspectRatio();
230 float getAspectRatioXZ();
247 void sizeTo(
int w,
int h,
int d=1);
256 void maxSize(
int w,
int h,
int d);
260 void maxMemSize(
int mem_limit_mb);
264 void makePow2(
bool pow2);
270 void setMipMap(
bool mip);
275 { myFormatOption = opt; }
280 { myTextureComponent =
SYSclamp(texcomp, -1, 3); }
285 { myTextureRGBMono = fill_rgb_mono; }
289 { myOpaqueAlpha = opaque_alpha; }
305 static void backgroundTextureLoadThreads(
int n);
308 static void textureReferenceDeleted(
void *,
RE_Texture *
t);
311 static void setTextureCacheSize(
int64 size_in_mb);
312 static int64 getTextureCacheSize();
314 static int64 getTextureCacheUsage();
315 static int64 get2DTextureUsage();
316 static int64 get3DTextureUsage();
317 static int64 getMipMapUsage();
318 static int64 get3DTextureFP32Size();
319 static int64 get3DTextureFP16Size();
320 static int64 get2DTextureFP32Size();
321 static int64 get2DTextureFP16Size();
322 static int64 getOrig3DTextureFP32Size();
323 static int64 getOrig3DTextureFP16Size();
324 static int64 getOrig2DTextureFP32Size();
325 static int64 getOrig2DTextureFP16Size();
327 static void pruneTextureCache();
328 static void clearTextureCache(
bool full_clear);
329 static void debugDumpCache();
331 static int getTextureCacheSerial();
336 static void recordTextureMapUsage(
bool enable);
337 static bool recordingTextureUsage();
341 static int getNumUsedTextureMaps();
342 static int64 getUsedTextureMemory();
349 virtual void buildSourceName(
UT_String &cachedname,
350 const char *map,
const char *rel);
351 virtual void buildTextureName(
UT_String &cachedname,
352 const char *map,
const char *rel);
353 re_AutoTextureSource getTextureSource(
const char *map,
const char *relto,
355 bool deferred_load=
false,
356 bool preload_only=
false);
360 void getDesiredResolution(
RE_GPUType type,
int vsize,
361 int *
w,
int *
h,
int *d);
374 virtual bool getNodeSource(
const char *map,
const char *rel,
379 int &
w,
int &
h,
int &d);
380 virtual bool getFileSource(
const char *map,
385 int &
w,
int &
h,
int &d,
406 {
return myFormatOption; }
413 bool build_if_missing,
431 static bool cachedMapReleased(
void *tex,
void *map);
434 bool updateFileModTime(
const char *
filename, time_t &mod);
444 int myTextureComponent;
445 bool myTextureRGBMono;
447 bool myAllowPreloadFlag;
448 bool myPrevSourceResult;
453 void *myModifyCallbackData;
457 RE_TextureCache *myCache;
461 bool myValidSourceResolve;
465 void *myReleaseObject;
472 return "RE_TextureMap";
RE_TextureFormatExtra getTextureFormatOption() const
bool operator==(const RE_TextureHolder &tex) const
GT_API const UT_StringHolder filename
void allowPreload(bool preload)
const RE_TextureFilter & filter() const
virtual const char * className() const
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
void checkAlphaDetails(bool check)
void operator=(RE_Texture *tex)
bool getOpaqueAlpha() const
void setNamespace(const char *ns)
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
void setTextureFormatOption(RE_TextureFormatExtra opt)
RE_TextureCompress getCompression() const
const char * getRelativePath() const
RE_TextureFilter & filter()
RE_TextureFormatExtra option
bool isLoadPending() const
bool operator!=(const RE_TextureHolder &tex) const
RE_Texture * operator->() const
void setTextureComponent(int texcomp)
virtual void cachedTextureFound(RE_Texture *tex)
RE_TextureCompress myCompression
UT_Vector3T< T > SYSclamp(const UT_Vector3T< T > &v, const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
RE_CacheVersion getVersion() const
void operator=(const RE_TextureHolder &tex)
IMG_FileAlphaInfo myAlphaInfo
bool operator!=(const RE_Texture *tex) const
RE_Texture * operator*() const
void fillRGBFromSingle(bool fill_rgb_mono)
RE_TextureHolder(const RE_TextureHolder &src)
GT_API const UT_StringHolder version
RE_TextureHolder(RE_Texture *tex)
GLfloat GLfloat GLfloat GLfloat h
void setOpaqueAlpha(bool opaque_alpha)
bool hasValidSourceResolve() const
virtual int getSourceOpID() const
IMG_FileAlphaInfo getAlphaDetails() const
File options for manipulating image data on load or save. This class allows you to modify the incomin...
bool operator==(const RE_Texture *tex) const
void setVersion(RE_CacheVersion v)
bool allowsPreload() const
GLubyte GLubyte GLubyte GLubyte w
Simple class for a mutli-integer cache tag.
void setPendingLoad(bool pend)
const char * getMapName() const
bool hasTaggedTexture() const