14 #ifndef __RE_TextureMap_h__
15 #define __RE_TextureMap_h__
24 class RE_TextureCache;
25 class re_AutoTextureSource;
39 myTexture->setInUse(
true);
42 : myTexture(src.myTexture)
45 myTexture->setInUse(
true);
50 myTexture->setInUse(
false);
53 bool isValid()
const {
return myTexture != NULL; }
60 myTexture->setInUse(
false);
67 *
this = tex.myTexture;
74 myTexture->setInUse(
false);
80 {
return myTexture == tex; }
82 {
return myTexture != tex; }
84 {
return myTexture == tex.myTexture; }
86 {
return myTexture != tex.myTexture; }
89 {
return myTexture ? myTexture->getUsage() : 0; }
103 virtual int64 getMemoryUsage(
bool inclusive)
const;
105 virtual const char *className()
const;
121 const char *relativeTo);
136 const char *relativeTo,
139 void *releaseObject);
162 void setSourceModifyCallback(
const char *opname,
170 void clearStoredTexture();
194 virtual void invalidateCached();
204 void clear(
const char *clear_name = NULL);
208 bool isSourceValid();
213 { myValidSourceResolve = valid; }
221 void getResolution(
int &
w,
int &
h,
int &d);
230 float getAspectRatio();
232 float getAspectRatioXZ();
249 void sizeTo(
int w,
int h,
int d=1);
258 void maxSize(
int w,
int h,
int d);
262 void maxMemSize(
int mem_limit_mb);
266 void makePow2(
bool pow2);
272 void setMipMap(
bool mip);
277 { myFormatOption = opt; }
282 { myTextureComponent =
SYSclamp(texcomp, -1, 3); }
287 { myTextureRGBMono = fill_rgb_mono; }
291 { myOpaqueAlpha = opaque_alpha; }
307 static void backgroundTextureLoadThreads(
int n);
310 static void textureReferenceDeleted(
void *,
RE_Texture *
t);
313 static void setTextureCacheSize(
int64 size_in_mb);
314 static int64 getTextureCacheSize();
316 static int64 getTextureCacheUsage();
317 static int64 get2DTextureUsage();
318 static int64 get3DTextureUsage();
319 static int64 getMipMapUsage();
320 static int64 get3DTextureFP32Size();
321 static int64 get3DTextureFP16Size();
322 static int64 get2DTextureFP32Size();
323 static int64 get2DTextureFP16Size();
324 static int64 getOrig3DTextureFP32Size();
325 static int64 getOrig3DTextureFP16Size();
326 static int64 getOrig2DTextureFP32Size();
327 static int64 getOrig2DTextureFP16Size();
329 static void pruneTextureCache();
330 static void clearTextureCache(
bool full_clear);
331 static void debugDumpCache();
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,
435 static bool cachedMapReleased(
void *tex,
void *map);
438 bool updateFileModTime(
const char *
filename,
int &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
UT_Functor1< void, IMG_File * > myFileClose
virtual const char * className() const
void checkAlphaDetails(bool check)
void operator=(RE_Texture *tex)
bool getOpaqueAlpha() const
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
GLint GLenum GLsizei GLint GLsizei const void * data
GLubyte GLubyte GLubyte GLubyte w
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
GLfloat GLfloat GLfloat GLfloat h
void fillRGBFromSingle(bool fill_rgb_mono)
GLuint GLuint GLsizei GLenum type
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const void * pixels
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)
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...
GLdouble GLdouble GLdouble r
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
void setValidSourceResolve(bool valid)
bool hasTaggedTexture() const