fluidvis
|
Public Member Functions | |
EX | Texture (const string &id) |
EX | ~Texture () |
EX void | unload () |
EX void | load () |
EX bool | isLoaded () const |
EX void | save (const string &filename) |
EX void | use (Shader &shader, const string &id) |
EX unsigned int | getTextureID () const |
EX void | setPath (const string &path) |
EX void | setWidth (int width) |
EX int | getWidth () const |
EX void | setHeight (int height) |
EX int | getHeight () const |
EX void | setPixelFormat (PixelFormat pixelFormat) |
EX PixelFormat | getPixelFormat () const |
EX void | setByteBuffer (const vector< unsigned char > &buffer) |
EX void | setFloatBuffer (const vector< float > &buffer) |
Public Member Functions inherited from sx::Uniform | |
virtual EX | ~Uniform () |
EX void | setUniformName (const string &name, const string &id) |
EX const string & | getUniformName (const string &id) const |
Public Member Functions inherited from sx::SXResource | |
virtual EX | ~SXResource () |
EX const string & | getID () const |
Additional Inherited Members | |
Protected Member Functions inherited from sx::Uniform | |
EX | Uniform (const string &id) |
Protected Attributes inherited from sx::Uniform | |
string | idToken |
unordered_map< string, string > | uniformNames |
Protected Attributes inherited from sx::SXResource | |
string | id |
EX sx::Texture::Texture | ( | const string & | id | ) |
constructor initializing this with identifier id
EX sx::Texture::~Texture | ( | ) |
deconstructor
EX int sx::Texture::getHeight | ( | ) | const |
getter of the loaded texture, if no texture is loaded, the return value isn't specified
EX PixelFormat sx::Texture::getPixelFormat | ( | ) | const |
getter of the loaded texture, if no texture is loaded, the return value isn't specified
EX unsigned int sx::Texture::getTextureID | ( | ) | const |
Returns the texture ID, which is internally used to access the shader program. If the shader is not initialized, the return value is not specified.
EX int sx::Texture::getWidth | ( | ) | const |
getter of the loaded texture, if no texture is loaded, the return value isn't specified
|
virtual |
returns true if a texture is loaded
Implements sx::SXResource.
|
virtual |
Deletes the last texture, and loads a new texture from the specified path, or from a buffer with the specified width, height and pixelFormat, or with specified width, height and pixelFormat, but without a buffer. If nothing has been specified, the method has no effect.
Implements sx::SXResource.
EX void sx::Texture::save | ( | const string & | filename | ) |
Saves the texture in a file. Currently bmp, jpg and png files are supported.
If the texture is saved in a bmp or jpg file, the saved image will have 24 bits per pixel regardless of the pixelFormat of the texture. If the texture is saved in a png file, and the pixelFormat is equal to BYTE_RGBA, the saved image will have 32 bits per pixel, and if the pixelFormat is equal to FLOAT16_RGBA or FLOAT_RGBA, the saved image will have 64 bits per pixel.
An Exception is thrown, if the texture can't be saved.
EX void sx::Texture::setByteBuffer | ( | const vector< unsigned char > & | buffer | ) |
Specifies what the texture will look like after the load() operation. Changes the pixelFormat of the next texture to BYTE_RGBA. If a path was set, or the buffer doesn't have size width * height * 4, the buffer is ignored.
EX void sx::Texture::setFloatBuffer | ( | const vector< float > & | buffer | ) |
Specifies what the texture will look like after the load() operation. Changes the pixelFormat of the next texture to FLOAT_RGBA. If a path was set, or the buffer doesn't have size width * height * 4, the buffer is ignored.
EX void sx::Texture::setHeight | ( | int | height | ) |
Specifies the height of the next texture loaded by load(). If a path was set, this parameter is ignored.
EX void sx::Texture::setPath | ( | const string & | path | ) |
Sets a path, from which the texture will be loaded by load(). If path is set, the setters for width, height, pixelFormat, byteBuffer and floatBuffer are ignored.
Currently bmp, jpg and png files are supported. If path points to file with 24 or 32 bits per pixel, method load() will initialize a BYTE_RGBA texture. If path points to a png file with 64 bits per pixel, method load() will initialize a FLOAT16_RGBA texture.
EX void sx::Texture::setPixelFormat | ( | PixelFormat | pixelFormat | ) |
Specifies the pixel format of the next texture loaded by load(). If a path was set, this parameter is ignored.
EX void sx::Texture::setWidth | ( | int | width | ) |
Specifies the width of the next texture loaded by load(). If a path was set, this parameter is ignored.
EX void sx::Texture::unload | ( | ) |
if a texture has been loaded, it's unloaded by this operation, leaving this unloaded
|
virtual |
Binds the current texture to the next free texture slot of the shader. If the texture is not loaded, the method has no effect.
Implements sx::Uniform.