#include <RE_OGLTextureCache.h>
Public Member Functions | |
| RE_OGLTextureCache () | |
| ~RE_OGLTextureCache () | |
| int | addTexture (RE_Render *r, PXL_Raster *texture) |
| Add a regular texture from a raster and return its unique ID. | |
| int | addMipMapTexture (RE_Render *r, UT_PtrArray< PXL_Raster * > levels) |
| void | removeTexture (int id) |
| Remove a texture from the cache. | |
| void | clearTextureCache () |
| Free all textures. | |
| int | getTextureVersion () const |
| void | renderTexture (RE_Render *r, int x, int y, int w, int h, int id, fpreal alpha=1.0f) |
| Render a given texture at (x, y) with width and height w, h. | |
| bool | startTexture (RE_Render *r, int id, int &cacheindex) |
| void | endTexture (RE_Render *r, int id) |
| Stop drawing using the given texture. | |
| void | beginTextureDefer (RE_Render *r) |
| void | endTextureDefer (RE_Render *r) |
Static Public Member Functions | |
| static bool | isTexture (int id) |
| Checks if the given texture ID is valid. | |
Definition at line 68 of file RE_OGLTextureCache.h.
| RE_OGLTextureCache::RE_OGLTextureCache | ( | ) |
| RE_OGLTextureCache::~RE_OGLTextureCache | ( | ) |
| int RE_OGLTextureCache::addMipMapTexture | ( | RE_Render * | r, | |
| UT_PtrArray< PXL_Raster * > | levels | |||
| ) |
Add a mip-mapped texture, with many levels defined by the rasters passed as levels, and return its unique ID. The levels must all be powers of two in size, and must follow the progression from 2^Nx2^N, 2^(N-1)x2^(N-1), ..., 1x1.
| int RE_OGLTextureCache::addTexture | ( | RE_Render * | r, | |
| PXL_Raster * | texture | |||
| ) |
Add a regular texture from a raster and return its unique ID.
| void RE_OGLTextureCache::beginTextureDefer | ( | RE_Render * | r | ) |
These methods record the textures to be drawn, and draws them all at once when endTextureDefer() is called.
| void RE_OGLTextureCache::clearTextureCache | ( | ) |
Free all textures.
| void RE_OGLTextureCache::endTexture | ( | RE_Render * | r, | |
| int | id | |||
| ) |
Stop drawing using the given texture.
| void RE_OGLTextureCache::endTextureDefer | ( | RE_Render * | r | ) |
| int RE_OGLTextureCache::getTextureVersion | ( | ) | const [inline] |
Returns a version # for the cache; every time it is cleared, this number is bumped;
Definition at line 91 of file RE_OGLTextureCache.h.
| static bool RE_OGLTextureCache::isTexture | ( | int | id | ) | [static] |
Checks if the given texture ID is valid.
| void RE_OGLTextureCache::removeTexture | ( | int | id | ) |
Remove a texture from the cache.
| void RE_OGLTextureCache::renderTexture | ( | RE_Render * | r, | |
| int | x, | |||
| int | y, | |||
| int | w, | |||
| int | h, | |||
| int | id, | |||
| fpreal | alpha = 1.0f | |||
| ) |
Render a given texture at (x, y) with width and height w, h.
| bool RE_OGLTextureCache::startTexture | ( | RE_Render * | r, | |
| int | id, | |||
| int & | cacheindex | |||
| ) |
Helper methods. You can use this to draw non-square textures. These bind the current texture to be the one specified. Drawing polygons with texture coordinates (i.e., uv coordinates) will use this texture.
1.5.9