26 #ifndef _TIL_TextureMap_h_
27 #define _TIL_TextureMap_h_
48 class IMG_TTFilterInfo;
54 class TIL_TextureRaster;
96 virtual
void missingTexture(const
char *
filename)
const {};
128 : myOptions(opts.myOptions)
129 , myShared(opts.myShared)
137 myShared = src.myShared;
138 myOptions = src.myOptions;
158 static int getMaxWidth();
159 static int getMaxHeight();
160 static void setMaxSize(
int w=256,
int h=256);
164 static int getCacheSize();
165 static void setCacheSize(
int size=100);
168 static int64 getCacheMemSize();
169 static void setCacheMemSize(
int64 sizeinmb);
176 static int64 getMemoryUsage();
178 static void getConversionStats(
exint &num_conversions,
179 exint ¤t_memory,
191 float max_memory_MB = 0;
193 int autoscanline = 0;
196 int accept_untiled = 0;
197 int accept_unmipped = 0;
199 int unassociatedalpha = 0;
200 int failure_retries = 0;
201 int max_errors_per_file = 0;
202 int trust_file_extensions = 0;
207 int tiles_created = 0;
208 int tiles_current = 0;
210 int open_files_created = 0;
211 int open_files_current = 0;
212 int open_files_peak = 0;
217 int unique_files = 0;
218 float fileio_time = 0;
219 float fileopen_time = 0;
221 static bool getOIIOStats(
OIIOStats &stats);
235 static void getPtexStats(
PtexStats &stats);
253 static void bumpVersion();
256 static void closeAllFiles();
260 static void clearCache(
int only_out_of_date=0);
270 static int getAutoFlush();
271 static void setAutoFlush(
int onOff);
276 static void imageDataDied(
void *imagedata);
280 static void setNonRATError(
bool on);
281 static bool getNonRATError();
295 const til_Lookup *
lookup()
const {
return myLookup.get(); }
312 bool isValid()
const {
return myMipMapRes.size() > 0; }
313 bool mipMapped()
const {
return myMipMapRes.size() > 1; }
314 int mipCount()
const {
return myMipMapRes.size(); }
318 int myChannelCount = 0;
332 const char *relativeTo =
nullptr,
342 static
bool hasUDIM(const
char *
format);
369 static
bool validUDIMDirectory(const
UT_StringRef &udim_name);
373 const char *relativeTo,
375 bool always_resolve =
true,
376 bool force_disk_cache =
false);
384 { getResolution(getLookupHandle(), x, y); }
385 int getNChannels()
const;
392 void setFaceIndex(
int index);
398 void setPtexChannel(
int index);
408 void setFilterWidths(
float xwidth,
float ywidth);
409 void setFilterBlurs(
float xblur,
float yblur);
410 void setMipInterpolate(
int onoff);
414 void setBeerLambert(
bool beerlambert);
417 void setZSkew(
float zskew);
421 myIESNormalization =
mode;
435 bool needalpha =
true)
437 myInterpRequired = interp;
438 myAlphaRequired = needalpha;
443 myInterpRequired = interp;
478 template <
typename T>
482 colorLookup(h, u, v, clr);
484 template <
typename T>
489 colorLookup(h, u, v, clr);
492 float farvalue=1E6)
const
495 return depthLookup(h, u, v, farvalue);
497 template <
typename T>
502 bumpLookup(h, u, v, du, dv);
505 template <
typename T>
510 envLookup(h, R, angle, clr);
513 template <
typename T>
519 envLookup(h, r00, r10, r11, r01, clr);
526 { getMinMax(getLookupHandle(), min, max); }
528 { getMinMax(getLookupHandle(), min, max); }
539 {
return getTextureChecksum(getLookupHandle()); }
549 const float u[4],
const float v[4],
552 const float u[4],
const float v[4],
556 float farvalue=1E6)
const;
591 float quality,
int maxsamples);
597 float quality,
int maxsamples);
622 bool textureInfo(TextureInfo &info)
const;
627 const TextureInfo &tinfo,
635 return loadMipRaster(getLookupHandle(),
636 mip_level, tinfo, region, data);
641 bool isVolatileTexture()
const;
645 bool hasTextureChanged(
const TIL_Raster **newraster = 0);
654 const TIL_Cdf2D *getCDF(
int maxres=512);
660 void resolveHandles();
664 float quality,
int maxsamples)
const;
670 float quality,
int maxsamples)
const;
672 void updateHandles();
677 if (myOIIO || myPtex)
680 void doUpdateFilter();
695 int myIESNormalization;
696 float myIESAngleScale;
697 bool myInterpRequired;
698 bool myAlphaRequired;
TIL_TextureOptions(const UT_Options *options)
int getVersion(int version)
GT_API const UT_StringHolder filename
bool isDefault(const cgltf_texture_view &tv)
UT_FilterWrap getVWrap() const
const UT_Set< UT_StringHolder > * myFileList
TIL_BUMP_COMPUTE_TYPE getBumpCompute() const
SIM_API const UT_StringHolder angle
const UT_Filter * getYFilter() const
void colorLookup(float u, float v, UT_Vector4T< T > &clr) const
void colorLookup(const float u[4], const float v[4], UT_Vector4T< T > &clr) const
float getXFilterWidth() const
void getMinMax(UT_Vector4D &min, UT_Vector4D &max) const
forceDiskCache(bool enable=true)
TIL_PtexOrient ptexOrient() const
UT_StringHolder searchpath
const UT_StringHolder & getTextureChecksum() const
TIL_MissingTexture()
Callback for missing texture.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
int getPtexChannel() const
Tto convert(const Tfrom &source)
float iesAngleScale() const
UT_Array< UT_Vector2i > myMipMapRes
fpreal depthLookup(float u, float v, float farvalue=1E6) const
void setPtexOrient(TIL_PtexOrient o)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
const IMG_TextureFilter & getFilter() const
Query filter information.
GA_API const UT_StringHolder scale
GLint GLint GLsizei GLint GLenum GLenum type
IMG_TextureFilter & getFilter()
float getYFilterWidth() const
void setIESNormalization(int mode)
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
OIIO_UTIL_API uint64_t file_size(string_view path) noexcept
TIL_TextureOptions(const TIL_TextureOptions &opts)
GLint GLint GLsizei GLint GLenum format
TIL_TextureOptions(const UT_Options *options, UT_SharedPtr< UT_Options > shared)
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
void setColorLookup(bool interp=true, bool needalpha=true)
const UT_Vector4 & getBorder() const
HUSD_API const char * raster()
const TIL_TextureOptions & operator=(const TIL_TextureOptions &src)
bool loadMipRaster(int mip_level, const TextureInfo &tinfo, const UT_DimRect ®ion, void *data) const
GLuint const GLchar * name
UT_FilterWrap getUWrap() const
void getResolution(int &x, int &y)
virtual void convertToRat(const char *filename, bool ies) const
Callback invoked when a texture is converted internally to a .rat.
GLfloat GLfloat GLfloat GLfloat h
A map of string to various well defined value types.
GLint GLint GLsizei GLint border
bool getInterpRequired() const
void getMinMax(UT_Vector4F &min, UT_Vector4F &max) const
const UT_Filter * getXFilter() const
void envLookup(const UT_Vector3T< T > &r00, const UT_Vector3T< T > &r10, const UT_Vector3T< T > &r11, const UT_Vector3T< T > &r01, UT_Vector4T< T > &clr) const
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void envLookup(const UT_Vector3T< T > &R, fpreal angle, UT_Vector4T< T > &clr) const
GLubyte GLubyte GLubyte GLubyte w
IMG_ColorSpace
Modes for how to translate colors in images for texture lookups.
OIIO_API size_t max_open_files()
Get the maximum number of open file handles allowed on this system.
void bumpLookup(float u, float v, T &du, T &dv) const
int iesNormalization() const
void setBumpLookup(bool interp=false, TIL_BUMP_COMPUTE_TYPE type=TIL_BUMP_PRECOMPUTE)
bool getAlphaRequired() const
void setIESAngleScale(float scale)
const til_Lookup * lookup() const
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter