14 #ifndef __RE_TextureMap_h__
15 #define __RE_TextureMap_h__
28 class RE_TextureCache;
29 class re_AutoTextureSource;
43 myTexture->setInUse(
true);
46 : myTexture(src.myTexture)
49 myTexture->setInUse(
true);
54 myTexture->setInUse(
false);
57 bool isValid()
const {
return myTexture !=
nullptr; }
64 myTexture->setInUse(
false);
71 *
this = tex.myTexture;
78 myTexture->setInUse(
false);
84 {
return myTexture == tex; }
86 {
return myTexture != tex; }
88 {
return myTexture == tex.myTexture; }
90 {
return myTexture != tex.myTexture; }
93 {
return myTexture ? myTexture->getUsage() : 0; }
108 virtual int64 getMemoryUsage(
bool inclusive)
const;
110 virtual const char *className()
const;
126 const char *relativeTo);
134 const char *relativeTo,
137 void *releaseObject);
154 vector_size(1),
w(0),
h(0), d(0),
164 void setSourceModifyCallback(
const char *opname,
172 void clearStoredTexture();
196 virtual void invalidateCached();
206 void clear(
const char *clear_name =
nullptr);
210 bool isSourceValid();
214 void setValidSourceResolve(
bool valid);
222 void getResolution(
int &
w,
int &
h,
int &d);
231 float getAspectRatio();
233 float getAspectRatioXZ();
250 void sizeTo(
int w,
int h,
int d=1);
259 void maxSize(
int w,
int h,
int d);
263 void maxMemSize(
int mem_limit_mb);
267 void makePow2(
bool pow2);
273 void setMipMap(
bool mip);
278 { myFormatOption = opt; }
283 { myTextureComponent =
SYSclamp(texcomp, -1, 3); }
288 { myTextureRGBMono = fill_rgb_mono; }
292 { myOpaqueAlpha = opaque_alpha; }
308 static void backgroundTextureLoadThreads(
int n);
311 static void textureReferenceDeleted(
void *,
RE_Texture *
t);
314 static void setTextureCacheSize(
int64 size_in_mb);
315 static int64 getTextureCacheSize();
317 static int64 getTextureCacheUsage();
318 static int64 get2DTextureUsage();
319 static int64 get3DTextureUsage();
320 static int64 getMipMapUsage();
321 static int64 get3DTextureFP32Size();
322 static int64 get3DTextureFP16Size();
323 static int64 get2DTextureFP32Size();
324 static int64 get2DTextureFP16Size();
325 static int64 getOrig3DTextureFP32Size();
326 static int64 getOrig3DTextureFP16Size();
327 static int64 getOrig2DTextureFP32Size();
328 static int64 getOrig2DTextureFP16Size();
330 static void pruneTextureCache();
331 static void clearTextureCache(
bool full_clear);
332 static void debugDumpCache();
334 static int getTextureCacheSerial();
339 static void recordTextureMapUsage(
bool enable);
340 static bool recordingTextureUsage();
344 static int getNumUsedTextureMaps();
345 static int64 getUsedTextureMemory();
352 virtual void buildSourceName(
UT_String &cachedname,
353 const char *map,
const char *rel);
354 virtual void buildTextureName(
UT_String &cachedname,
355 const char *map,
const char *rel);
356 re_AutoTextureSource getTextureSource(
const char *map,
const char *relto,
358 bool deferred_load=
false,
359 bool preload_only=
false);
363 void getDesiredResolution(
RE_GPUType type,
int vsize,
364 int *
w,
int *
h,
int *d);
377 virtual bool getNodeSource(
const char *map,
const char *rel,
382 int &
w,
int &
h,
int &d);
383 virtual bool getFileSource(
const char *map,
388 int &
w,
int &
h,
int &d,
409 {
return myFormatOption; }
416 bool build_if_missing,
434 static bool cachedMapReleased(
void *tex,
void *map);
437 bool updateFileModTime(
const char *
filename, time_t &
mod);
447 int myTextureComponent;
448 bool myTextureRGBMono;
450 bool myAllowPreloadFlag;
451 bool myPrevSourceResult;
456 void *myModifyCallbackData;
460 RE_TextureCache *myCache;
464 bool myValidSourceResolve;
468 void *myReleaseObject;
475 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
GLint GLint GLsizei GLint GLenum GLenum type
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)
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
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
GA_API const UT_StringHolder parms
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