#include <TextureUtils.h>
Public Member Functions | |
Texture (GLuint target=GL_TEXTURE_2D) | |
Texture (const Texture ©) | |
Texture & | operator= (const Texture &) |
~Texture () | |
virtual bool | loadXMLSettings (const TiXmlElement *element) |
virtual bool | exportXMLSettings (std::ofstream &xmlFile) |
bool | load2D (const char *infoEndOrPath, GLuint clampS=GL_REPEAT, GLuint clampT=GL_REPEAT, GLuint magFilter=GL_LINEAR, GLuint minFilter=GL_LINEAR_MIPMAP_LINEAR, bool mipmap=true) |
bool | load2DImage (const Image &image, GLuint clampS=GL_REPEAT, GLuint clampT=GL_REPEAT, GLuint magFilter=GL_LINEAR, GLuint minFilter=GL_LINEAR_MIPMAP_LINEAR, bool mipmap=true) |
void | copyCurrentBuffer (int newTarget=-1) |
const bool | activate (GLuint unit=0) |
const bool | deactivate () |
void | setID (GLuint textureID) |
const GLuint | getID () const |
void | setTarget (GLuint target) |
const GLuint | getTarget () const |
const GLuint | getHeight () const |
const GLuint | getWidth () const |
const GLuint | getDepth () const |
void | destroy () |
Protected Attributes | |
GLuint | height |
GLuint | width |
GLuint | depth |
Private Member Functions | |
bool | loadTextureFace (const Image &image, GLuint target, bool mipmap) |
bool | finalizeLoading (const char *string) |
bool | checkForRepeat (const char *string) |
int | getMagFilteri (const std::string &value) |
int | getMinFilteri (const std::string &value) |
int | getWrapModei (const std::string &value) |
int | getTypei (const std::string &value) |
int | getValidWrapMode (int clamp) |
int | getValidMagFilter (int filter) |
int | getValidMinFilter (int filter) |
Private Attributes | |
GLuint | currUnit |
GLuint | target |
GLuint | id |
Definition at line 193 of file TextureUtils.h.
Texture::Texture | ( | GLuint | target = GL_TEXTURE_2D |
) |
Texture::Texture | ( | const Texture & | copy | ) |
Definition at line 23 of file TextureUtils.cpp.
References currUnit, depth, height, operator=(), target, and width.
Texture::~Texture | ( | ) |
bool Texture::loadXMLSettings | ( | const TiXmlElement * | element | ) | [virtual] |
Definition at line 150 of file TextureUtils.cpp.
References getMagFilteri(), getMinFilteri(), getTypei(), getWrapModei(), load2D(), target, and Logger::writeErrorLog().
Referenced by GUIClippedRectangle::loadXMLClippedRectangleInfo(), and GUIFrame::loadXMLSettings().
virtual bool Texture::exportXMLSettings | ( | std::ofstream & | xmlFile | ) | [virtual] |
bool Texture::load2D | ( | const char * | infoEndOrPath, | |
GLuint | clampS = GL_REPEAT , |
|||
GLuint | clampT = GL_REPEAT , |
|||
GLuint | magFilter = GL_LINEAR , |
|||
GLuint | minFilter = GL_LINEAR_MIPMAP_LINEAR , |
|||
bool | mipmap = true | |||
) |
Definition at line 328 of file TextureUtils.cpp.
References checkForRepeat(), Image::load(), load2DImage(), MediaPathManager::lookUpMediaPath(), and Logger::writeErrorLog().
Referenced by Lights::Init(), loadXMLSettings(), and GUIFrame::setElementsTexture().
bool Texture::load2DImage | ( | const Image & | image, | |
GLuint | clampS = GL_REPEAT , |
|||
GLuint | clampT = GL_REPEAT , |
|||
GLuint | magFilter = GL_LINEAR , |
|||
GLuint | minFilter = GL_LINEAR_MIPMAP_LINEAR , |
|||
bool | mipmap = true | |||
) |
Definition at line 349 of file TextureUtils.cpp.
References checkForRepeat(), depth, destroy(), finalizeLoading(), Image::getHeight(), Image::getPath(), getValidMagFilter(), getValidMinFilter(), getValidWrapMode(), Image::getWidth(), height, loadTextureFace(), target, width, Logger::writeErrorLog(), and Logger::writeInfoLog().
Referenced by load2D().
void Texture::copyCurrentBuffer | ( | int | newTarget = -1 |
) |
Definition at line 85 of file TextureUtils.cpp.
References activate(), deactivate(), height, target, and width.
const bool Texture::activate | ( | GLuint | unit = 0 |
) |
Definition at line 71 of file TextureUtils.cpp.
References currUnit, and target.
Referenced by copyCurrentBuffer(), GUIFrame::enableGUITexture(), Lights::Init(), GUIClippedRectangle::renderClippedBounds(), and setID().
const bool Texture::deactivate | ( | ) |
Definition at line 96 of file TextureUtils.cpp.
References target.
Referenced by copyCurrentBuffer(), GUIFrame::disableGUITexture(), GUIClippedRectangle::renderClippedBounds(), and setID().
void Texture::setID | ( | GLuint | textureID | ) |
Definition at line 107 of file TextureUtils.cpp.
References activate(), deactivate(), TexturesManager::getTextureInfo(), height, MediaInfo< MediaInfoType >::increaseUserCount(), target, width, and Logger::writeErrorLog().
Referenced by checkForRepeat(), and operator=().
const GLuint Texture::getID | ( | ) | const |
Definition at line 148 of file TextureUtils.cpp.
References id.
Referenced by Lights::DrawLights(), GUIFrame::enableGUITexture(), GUIFrame::getElementsTexture(), GUIClippedRectangle::renderClippedBounds(), and GUIClippedRectangle::setTextureRectangle().
void Texture::setTarget | ( | GLuint | target | ) |
const GLuint Texture::getTarget | ( | ) | const |
const GLuint Texture::getHeight | ( | ) | const |
Definition at line 145 of file TextureUtils.cpp.
References height.
Referenced by GUIFrame::loadXMLSettings(), and GUIClippedRectangle::setTextureRectangle().
const GLuint Texture::getWidth | ( | ) | const |
Definition at line 146 of file TextureUtils.cpp.
References width.
Referenced by GUIFrame::loadXMLSettings(), and GUIClippedRectangle::setTextureRectangle().
const GLuint Texture::getDepth | ( | ) | const |
void Texture::destroy | ( | ) |
Definition at line 306 of file TextureUtils.cpp.
References MediaInfo< MediaInfoType >::decreaseUserCount(), depth, TexturesManager::flushUnusedTextures(), TexturesManager::getTextureInfo(), height, and width.
Referenced by GUIFrame::clear(), load2DImage(), and ~Texture().
bool Texture::loadTextureFace | ( | const Image & | image, | |
GLuint | target, | |||
bool | mipmap | |||
) | [private] |
Definition at line 889 of file TextureUtils.cpp.
References Image::getDataBuffer(), Image::getFormat(), Image::getHeight(), Image::getInternalFormat(), Image::getWidth(), and Logger::writeErrorLog().
Referenced by load2DImage().
bool Texture::finalizeLoading | ( | const char * | string | ) | [private] |
Definition at line 59 of file TextureUtils.cpp.
References TexturesManager::addTextureInfo(), and Logger::writeErrorLog().
Referenced by load2DImage().
bool Texture::checkForRepeat | ( | const char * | string | ) | [private] |
Definition at line 49 of file TextureUtils.cpp.
References MediaInfo< MediaInfoType >::getMedia(), TexturesManager::getTextureInfo(), and setID().
Referenced by load2D(), and load2DImage().
int Texture::getMagFilteri | ( | const std::string & | value | ) | [private] |
int Texture::getMinFilteri | ( | const std::string & | value | ) | [private] |
int Texture::getWrapModei | ( | const std::string & | value | ) | [private] |
int Texture::getTypei | ( | const std::string & | value | ) | [private] |
int Texture::getValidWrapMode | ( | int | clamp | ) | [private] |
int Texture::getValidMagFilter | ( | int | filter | ) | [private] |
int Texture::getValidMinFilter | ( | int | filter | ) | [private] |
GLuint Texture::height [protected] |
Definition at line 300 of file TextureUtils.h.
Referenced by copyCurrentBuffer(), destroy(), getHeight(), load2DImage(), operator=(), setID(), and Texture().
GLuint Texture::width [protected] |
Definition at line 300 of file TextureUtils.h.
Referenced by copyCurrentBuffer(), destroy(), getWidth(), load2DImage(), operator=(), setID(), and Texture().
GLuint Texture::depth [protected] |
Definition at line 300 of file TextureUtils.h.
Referenced by destroy(), getDepth(), load2DImage(), operator=(), and Texture().
GLuint Texture::currUnit [private] |
Definition at line 304 of file TextureUtils.h.
Referenced by activate(), operator=(), and Texture().
GLuint Texture::target [private] |
Definition at line 304 of file TextureUtils.h.
Referenced by activate(), copyCurrentBuffer(), deactivate(), getTarget(), load2DImage(), loadXMLSettings(), operator=(), setID(), setTarget(), and Texture().
GLuint Texture::id [private] |