14 #ifndef __RE_TextureMap_h__
15 #define __RE_TextureMap_h__
25 class RE_TextureCache;
26 class re_AutoTextureSource;
40 myTexture->setInUse(
true);
43 : myTexture(src.myTexture)
46 myTexture->setInUse(
true);
51 myTexture->setInUse(
false);
54 bool isValid()
const {
return myTexture !=
nullptr; }
61 myTexture->setInUse(
false);
68 *
this = tex.myTexture;
75 myTexture->setInUse(
false);
81 {
return myTexture == tex; }
83 {
return myTexture != tex; }
85 {
return myTexture == tex.myTexture; }
87 {
return myTexture != tex.myTexture; }
90 {
return myTexture ? myTexture->getUsage() : 0; }
104 virtual int64 getMemoryUsage(
bool inclusive)
const;
106 virtual const char *className()
const;
122 const char *relativeTo);
137 const char *relativeTo,
140 void *releaseObject);
166 void setSourceModifyCallback(
const char *opname,
174 void clearStoredTexture();
198 virtual void invalidateCached();
208 void clear(
const char *clear_name =
nullptr);
212 bool isSourceValid();
216 void setValidSourceResolve(
bool valid);
224 void getResolution(
int &
w,
int &
h,
int &d);
233 float getAspectRatio();
235 float getAspectRatioXZ();
252 void sizeTo(
int w,
int h,
int d=1);
261 void maxSize(
int w,
int h,
int d);
265 void maxMemSize(
int mem_limit_mb);
269 void makePow2(
bool pow2);
275 void setMipMap(
bool mip);
280 { myFormatOption = opt; }
285 { myTextureComponent =
SYSclamp(texcomp, -1, 3); }
290 { myTextureRGBMono = fill_rgb_mono; }
294 { myOpaqueAlpha = opaque_alpha; }
310 static void backgroundTextureLoadThreads(
int n);
313 static void textureReferenceDeleted(
void *,
RE_Texture *
t);
316 static void setTextureCacheSize(
int64 size_in_mb);
317 static int64 getTextureCacheSize();
319 static int64 getTextureCacheUsage();
320 static int64 get2DTextureUsage();
321 static int64 get3DTextureUsage();
322 static int64 getMipMapUsage();
323 static int64 get3DTextureFP32Size();
324 static int64 get3DTextureFP16Size();
325 static int64 get2DTextureFP32Size();
326 static int64 get2DTextureFP16Size();
327 static int64 getOrig3DTextureFP32Size();
328 static int64 getOrig3DTextureFP16Size();
329 static int64 getOrig2DTextureFP32Size();
330 static int64 getOrig2DTextureFP16Size();
332 static void pruneTextureCache();
333 static void clearTextureCache(
bool full_clear);
334 static void debugDumpCache();
336 static int getTextureCacheSerial();
341 static void recordTextureMapUsage(
bool enable);
342 static bool recordingTextureUsage();
346 static int getNumUsedTextureMaps();
347 static int64 getUsedTextureMemory();
354 virtual void buildSourceName(
UT_String &cachedname,
355 const char *map,
const char *rel);
356 virtual void buildTextureName(
UT_String &cachedname,
357 const char *map,
const char *rel);
358 re_AutoTextureSource getTextureSource(
const char *map,
const char *relto,
360 bool deferred_load=
false,
361 bool preload_only=
false);
365 void getDesiredResolution(
RE_GPUType type,
int vsize,
366 int *
w,
int *
h,
int *d);
379 virtual bool getNodeSource(
const char *map,
const char *rel,
384 int &
w,
int &
h,
int &d);
385 virtual bool getFileSource(
const char *map,
390 int &
w,
int &
h,
int &d,
411 {
return myFormatOption; }
418 bool build_if_missing,
440 static bool cachedMapReleased(
void *tex,
void *map);
443 bool updateFileModTime(
const char *
filename,
int &mod);
453 int myTextureComponent;
454 bool myTextureRGBMono;
456 bool myAllowPreloadFlag;
457 bool myPrevSourceResult;
462 void *myModifyCallbackData;
466 RE_TextureCache *myCache;
470 bool myValidSourceResolve;
474 void *myReleaseObject;
481 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
UT_Functor1< void, IMG_File * > myFileClose
virtual const char * className() const
void checkAlphaDetails(bool check)
void operator=(RE_Texture *tex)
bool getOpaqueAlpha() const
void setNamespace(const char *ns)
void setTextureFormatOption(RE_TextureFormatExtra opt)
RE_TextureCompress getCompression() const
const char * getRelativePath() const
RE_TextureFilter & filter()
RE_TextureFormatExtra option
GLubyte GLubyte GLubyte GLubyte w
bool isLoadPending() const
bool operator!=(const RE_TextureHolder &tex) const
RE_Texture * operator->() const
GLint GLint GLsizei GLint GLenum GLenum type
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
Generic interface for reading and writing image files. This class handles the reading and writing of ...
RE_Texture * operator*() const
void fillRGBFromSingle(bool fill_rgb_mono)
UT_Functor2< IMG_File *, const char *, const IMG_FileParms & > myFileOpen
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...
OIIO_API bool copy(string_view from, string_view to, std::string &err)
bool operator==(const RE_Texture *tex) const
void setVersion(RE_CacheVersion v)
bool allowsPreload() const
Simple class for a mutli-integer cache tag.
void setPendingLoad(bool pend)
const char * getMapName() const
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
bool hasTaggedTexture() const