#include <texture.h>
Public Member Functions | |
virtual void | clear ()=0 |
virtual bool | attribute (const std::string &name, TypeDesc type, const void *val)=0 |
virtual bool | attribute (const std::string &name, int val)=0 |
virtual bool | attribute (const std::string &name, float val)=0 |
virtual bool | attribute (const std::string &name, double val)=0 |
virtual bool | attribute (const std::string &name, const char *val)=0 |
virtual bool | attribute (const std::string &name, const std::string &val)=0 |
virtual bool | getattribute (const std::string &name, TypeDesc type, void *val)=0 |
Get the named attribute, store it in value. | |
virtual bool | getattribute (const std::string &name, int &val)=0 |
virtual bool | getattribute (const std::string &name, float &val)=0 |
virtual bool | getattribute (const std::string &name, double &val)=0 |
virtual bool | getattribute (const std::string &name, char **val)=0 |
virtual bool | getattribute (const std::string &name, std::string &val)=0 |
virtual bool | texture (ustring filename, TextureOptions &options, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy, float *result)=0 |
virtual bool | texture (ustring filename, TextureOptions &options, Runflag *runflags, int beginactive, int endactive, VaryingRef< float > s, VaryingRef< float > t, VaryingRef< float > dsdx, VaryingRef< float > dtdx, VaryingRef< float > dsdy, VaryingRef< float > dtdy, float *result)=0 |
virtual bool | texture (ustring filename, TextureOptions &options, const Imath::V3f &P, const Imath::V3f &dPdx, const Imath::V3f &dPdy, float *result)=0 |
virtual bool | texture (ustring filename, TextureOptions &options, Runflag *runflags, int beginactive, int endactive, VaryingRef< Imath::V3f > P, VaryingRef< Imath::V3f > dPdx, VaryingRef< Imath::V3f > dPdy, float *result)=0 |
virtual bool | shadow (ustring filename, TextureOptions &options, const Imath::V3f &P, const Imath::V3f &dPdx, const Imath::V3f &dPdy, float *result)=0 |
virtual bool | shadow (ustring filename, TextureOptions &options, Runflag *runflags, int beginactive, int endactive, VaryingRef< Imath::V3f > P, VaryingRef< Imath::V3f > dPdx, VaryingRef< Imath::V3f > dPdy, float *result)=0 |
virtual bool | environment (ustring filename, TextureOptions &options, const Imath::V3f &R, const Imath::V3f &dRdx, const Imath::V3f &dRdy, float *result)=0 |
virtual bool | environment (ustring filename, TextureOptions &options, Runflag *runflags, int beginactive, int endactive, VaryingRef< Imath::V3f > R, VaryingRef< Imath::V3f > dRdx, VaryingRef< Imath::V3f > dRdy, float *result)=0 |
virtual std::string | resolve_filename (const std::string &filename) const =0 |
virtual bool | get_texture_info (ustring filename, ustring dataname, TypeDesc datatype, void *data)=0 |
virtual bool | get_imagespec (ustring filename, ImageSpec &spec)=0 |
virtual const ImageSpec * | imagespec (ustring filename)=0 |
virtual bool | get_texels (ustring filename, TextureOptions &options, int level, int xbegin, int xend, int ybegin, int yend, int zbegin, int zend, TypeDesc format, void *result)=0 |
virtual std::string | geterror () const =0 |
virtual std::string | getstats (int level=1, bool icstats=true) const =0 |
virtual void | invalidate (ustring filename)=0 |
virtual void | invalidate_all (bool force=false)=0 |
Static Public Member Functions | |
static TextureSystem * | create (bool shared=true) |
static void | destroy (TextureSystem *x) |
Define an API to an abstract class that that manages texture files, caches of open file handles as well as tiles of texels so that truly huge amounts of texture may be accessed by an application with low memory footprint, and ways to perform antialiased texture, shadow map, and environment map lookups.
virtual bool OpenImageIO::TextureSystem::attribute | ( | const std::string & | name, | |
TypeDesc | type, | |||
const void * | val | |||
) | [pure virtual] |
Set an attribute controlling the texture system. Return true if the name and type were recognized and the attrib was set. Documented attributes: int max_open_files : maximum number of file handles held open float max_memory_MB : maximum tile cache size, in MB string searchpath : colon-separated search path for texture files matrix44 worldtocommon : the world-to-common transformation matrix44 commontoworld : the common-to-world transformation int autotile : if >0, tile size to emulate for non-tiled images int automip : if nonzero, emulate mipmap on the fly
virtual void OpenImageIO::TextureSystem::clear | ( | ) | [pure virtual] |
Close everything, free resources, start from scratch.
static TextureSystem* OpenImageIO::TextureSystem::create | ( | bool | shared = true |
) | [static] |
Create a TextureSystem and return a pointer. This should only be freed by passing it to TextureSystem::destroy()!
If shared==true, it's intended to be shared with other like-minded owners in the same process who also ask for a shared cache. If false, a private image cache will be created.
static void OpenImageIO::TextureSystem::destroy | ( | TextureSystem * | x | ) | [static] |
Destroy a TextureSystem that was created using TextureSystem::create().
virtual bool OpenImageIO::TextureSystem::environment | ( | ustring | filename, | |
TextureOptions & | options, | |||
Runflag * | runflags, | |||
int | beginactive, | |||
int | endactive, | |||
VaryingRef< Imath::V3f > | R, | |||
VaryingRef< Imath::V3f > | dRdx, | |||
VaryingRef< Imath::V3f > | dRdy, | |||
float * | result | |||
) | [pure virtual] |
Retrieve an environment map lookup for direction R, for many points at once.
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.
virtual bool OpenImageIO::TextureSystem::environment | ( | ustring | filename, | |
TextureOptions & | options, | |||
const Imath::V3f & | R, | |||
const Imath::V3f & | dRdx, | |||
const Imath::V3f & | dRdy, | |||
float * | result | |||
) | [pure virtual] |
Retrieve an environment map lookup for direction R.
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.
virtual bool OpenImageIO::TextureSystem::get_imagespec | ( | ustring | filename, | |
ImageSpec & | spec | |||
) | [pure virtual] |
Get the ImageSpec associated with the named texture (specifically, the first MIP-map level). If the file is found and is an image format that can be read, store a copy of its specification in spec and return true. Return false if the file was not found or could not be opened as an image file by any available ImageIO plugin.
virtual bool OpenImageIO::TextureSystem::get_texels | ( | ustring | filename, | |
TextureOptions & | options, | |||
int | level, | |||
int | xbegin, | |||
int | xend, | |||
int | ybegin, | |||
int | yend, | |||
int | zbegin, | |||
int | zend, | |||
TypeDesc | format, | |||
void * | result | |||
) | [pure virtual] |
Retrieve the rectangle of raw unfiltered texels spanning [xbegin..xend) X [ybegin..yend) X [zbegin..zend), with "exclusive end" a la STL, specified as integer pixel coordinates in the designated MIP-map level, storing the texel values beginning at the address specified by result. The texel values will be converted to the type specified by format. It is up to the caller to ensure that result points to an area of memory big enough to accommodate the requested rectangle (taking into consideration its dimensions, number of channels, and data format).
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.
virtual bool OpenImageIO::TextureSystem::get_texture_info | ( | ustring | filename, | |
ustring | dataname, | |||
TypeDesc | datatype, | |||
void * | data | |||
) | [pure virtual] |
Get information about the given texture. Return true if found and the data has been put in *data. Return false if the texture doesn't exist, doesn't have the requested data, if the data doesn't match the type requested. or some other failure.
virtual bool OpenImageIO::TextureSystem::getattribute | ( | const std::string & | name, | |
TypeDesc | type, | |||
void * | val | |||
) | [pure virtual] |
Get the named attribute, store it in value.
virtual std::string OpenImageIO::TextureSystem::geterror | ( | ) | const [pure virtual] |
If any of the API routines returned false indicating an error, this routine will return the error string (and clear any error flags). If no error has occurred since the last time geterror() was called, it will return an empty string.
virtual std::string OpenImageIO::TextureSystem::getstats | ( | int | level = 1 , |
|
bool | icstats = true | |||
) | const [pure virtual] |
Return the statistics output as a huge string.
Return a pointer to an ImageSpec associated with the named texture (specifically, the first MIP-map level) if the file is found and is an image format that can be read, otherwise return NULL.
This method is much more efficient than get_imagespec(), since it just returns a pointer to the spec held internally by the underlying ImageCache (rather than copying the spec to the user's memory). However, the caller must beware that the pointer is only valid as long as nobody (even other threads) calls invalidate() on the file, or invalidate_all(), or destroys the TextureSystem.
virtual void OpenImageIO::TextureSystem::invalidate | ( | ustring | filename | ) | [pure virtual] |
Invalidate any cached information about the named file. A client might do this if, for example, they are aware that an image being held in the cache has been updated on disk.
virtual void OpenImageIO::TextureSystem::invalidate_all | ( | bool | force = false |
) | [pure virtual] |
Invalidate all cached data for all textures. If force is true, everything will be invalidated, no matter how wasteful it is, but if force is false, in actuality files will only be invalidated if their modification times have been changed since they were first opened.
virtual std::string OpenImageIO::TextureSystem::resolve_filename | ( | const std::string & | filename | ) | const [pure virtual] |
Given possibly-relative 'filename', resolve it using the search path rules and return the full resolved filename.
virtual bool OpenImageIO::TextureSystem::shadow | ( | ustring | filename, | |
TextureOptions & | options, | |||
Runflag * | runflags, | |||
int | beginactive, | |||
int | endactive, | |||
VaryingRef< Imath::V3f > | P, | |||
VaryingRef< Imath::V3f > | dPdx, | |||
VaryingRef< Imath::V3f > | dPdy, | |||
float * | result | |||
) | [pure virtual] |
Retrieve a shadow lookup for position P at many points at once.
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.
virtual bool OpenImageIO::TextureSystem::shadow | ( | ustring | filename, | |
TextureOptions & | options, | |||
const Imath::V3f & | P, | |||
const Imath::V3f & | dPdx, | |||
const Imath::V3f & | dPdy, | |||
float * | result | |||
) | [pure virtual] |
Retrieve a shadow lookup for a single position P.
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.
virtual bool OpenImageIO::TextureSystem::texture | ( | ustring | filename, | |
TextureOptions & | options, | |||
Runflag * | runflags, | |||
int | beginactive, | |||
int | endactive, | |||
VaryingRef< Imath::V3f > | P, | |||
VaryingRef< Imath::V3f > | dPdx, | |||
VaryingRef< Imath::V3f > | dPdy, | |||
float * | result | |||
) | [pure virtual] |
Retrieve a 3D texture lookup at many points at once.
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.
virtual bool OpenImageIO::TextureSystem::texture | ( | ustring | filename, | |
TextureOptions & | options, | |||
const Imath::V3f & | P, | |||
const Imath::V3f & | dPdx, | |||
const Imath::V3f & | dPdy, | |||
float * | result | |||
) | [pure virtual] |
Retrieve a 3D texture lookup at a single point.
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.
virtual bool OpenImageIO::TextureSystem::texture | ( | ustring | filename, | |
TextureOptions & | options, | |||
Runflag * | runflags, | |||
int | beginactive, | |||
int | endactive, | |||
VaryingRef< float > | s, | |||
VaryingRef< float > | t, | |||
VaryingRef< float > | dsdx, | |||
VaryingRef< float > | dtdx, | |||
VaryingRef< float > | dsdy, | |||
VaryingRef< float > | dtdy, | |||
float * | result | |||
) | [pure virtual] |
Retrieve filtered (possibly anisotropic) texture lookups for several points at once.
All of the VaryingRef parameters (and fields in options) describe texture lookup parameters at an array of positions. But this routine only computes them from indices i where beginactive <= i < endactive, and ONLY when runflags[i] is nonzero.
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.
virtual bool OpenImageIO::TextureSystem::texture | ( | ustring | filename, | |
TextureOptions & | options, | |||
float | s, | |||
float | t, | |||
float | dsdx, | |||
float | dtdx, | |||
float | dsdy, | |||
float | dtdy, | |||
float * | result | |||
) | [pure virtual] |
Filtered 2D texture lookup for a single point.
s,t are the texture coordinates; dsdx, dtdx, dsdy, and dtdy are the differentials of s and t change in some canonical directions x and y. The choice of x and y are not important to the implementation; it can be any imposed 2D coordinates, such as pixels in screen space, adjacent samples in parameter space on a surface, etc.
Return true if the file is found and could be opened by an available ImageIO plugin, otherwise return false.