Radium Engine
1.5.0
|
#include <Engine/Data/TextureManager.hpp>
Public Member Functions | |
TextureParameters & | addTexture (const std::string &name, uint width, uint height, void *data) |
Texture * | getOrLoadTexture (const TextureParameters &texParameters, bool linearize=false) |
Texture * | loadTexture (const TextureParameters &texParameters, bool linearize=false) |
void | deleteTexture (const std::string &filename) |
void | deleteTexture (Texture *texture) |
void | updateTextureContent (const std::string &texture, void *content) |
void | updatePendingTextures () |
void | loadTextureImage (TextureParameters &texParameters) |
Manage Texture loading and registration.
Definition at line 18 of file TextureManager.hpp.
TextureParameters & Ra::Engine::Data::TextureManager::addTexture | ( | const std::string & | name, |
uint | width, | ||
uint | height, | ||
void * | data | ||
) |
Add a texture giving its name, dimension and content. Useful for defining procedural textures
name | name of the texture |
width | width of the texture |
height | height of the texture |
data | pointer to the texture content |
Definition at line 26 of file TextureManager.cpp.
void Ra::Engine::Data::TextureManager::deleteTexture | ( | const std::string & | filename | ) |
Delete a named texture from the manager
filename |
Definition at line 129 of file TextureManager.cpp.
void Ra::Engine::Data::TextureManager::deleteTexture | ( | Texture * | texture | ) |
Delete a texture from the manager
texture |
Definition at line 138 of file TextureManager.cpp.
Texture * Ra::Engine::Data::TextureManager::getOrLoadTexture | ( | const TextureParameters & | texParameters, |
bool | linearize = false |
||
) |
Get or load a named texture. If image data are not presents in texParameters.texels (this field is nullptr), this method will assume that the texParameters.name field contains the fully qualified filename to be loaded to initialize texParameters.texels
If image data are presents in texParameters.texels (this field is not nullptr), the name could be of any form as no loading will occur.
This method creates, initialize OpenGL part of the texture and add the created texture to the Texture cache of the engine.
texParameters | : The description of the texture to create |
linearize | : true if the texture data (texParameters.texels) must be converted from sRGB to LinearRGB |
Definition at line 104 of file TextureManager.cpp.
Texture * Ra::Engine::Data::TextureManager::loadTexture | ( | const TextureParameters & | texParameters, |
bool | linearize = false |
||
) |
Helper function, load the texture without adding it to the manager.
Definition at line 86 of file TextureManager.cpp.
void Ra::Engine::Data::TextureManager::loadTextureImage | ( | TextureParameters & | texParameters | ) |
Load a texture as described by texParameters.
texParameters | parameters describing the texture to load. This parameter will be updated (width, height, ...) according to the loaded file properties. |
Definition at line 38 of file TextureManager.cpp.
void Ra::Engine::Data::TextureManager::updatePendingTextures | ( | ) |
Update all textures that are pending after a call to updateTextureContent.
The cooperation of updateTextureContent and updatePendingTextures allow applications to manage efficiently the on line texture generation by separating the content definition (updateTextureContent) from the OpenGL state modification (updatePendingTextures).
Definition at line 148 of file TextureManager.cpp.
void Ra::Engine::Data::TextureManager::updateTextureContent | ( | const std::string & | texture, |
void * | content | ||
) |
Lazy update the texture content from the raw pointer content. The real update will be done when calling updatePendingTextures
texture | |
content |
Definition at line 142 of file TextureManager.cpp.