OpenRaider  0.1.4-dev
Open Source Tomb Raider Game Engine implementation
Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
TextureManager Class Reference

#include <TextureManager.h>

Collaboration diagram for TextureManager:
[legend]

Static Public Member Functions

static int initialize ()
 
static int initializeSplash ()
 
static void shutdown ()
 
static void clear ()
 
static void prepare ()
 
static int numTextures (TextureStorage s=TextureStorage::GAME)
 
static int bindTexture (unsigned int n, TextureStorage s)
 Bind texture to next free texture unit. More...
 
static int loadBufferSlot (unsigned char *image=nullptr, unsigned int width=256, unsigned int height=256, ColorMode mode=ColorMode::RGBA, unsigned int bpp=32, TextureStorage s=TextureStorage::GAME, int slot=-1, bool filter=true)
 Loads Buffer as texture. More...
 
static int loadImage (std::string filename, TextureStorage s=TextureStorage::GAME, int slot=-1)
 
static void addTile (TextureTile *t)
 
static int numTiles ()
 
static TextureTilegetTile (int index)
 
static void addAnimatedTile (int index, int tile)
 
static int numAnimatedTiles ()
 
static int getFirstTileAnimation (int index)
 
static int getNextTileAnimation (int index, int tile)
 
static BufferManagergetBufferManager (int tex, TextureStorage store)
 
static void display ()
 
static unsigned int getTextureID (int n, TextureStorage s)
 
static void setPalette (int index, glm::vec4 color)
 
static glm::vec4 getPalette (int index)
 
static void addIndexedTexture (unsigned char *image, unsigned int width, unsigned int height)
 

Static Private Member Functions

static std::vector< unsigned int > & getIds (TextureStorage s)
 
static std::vector< int > & getUnits (TextureStorage s)
 
static void bindTextureId (unsigned int n, TextureStorage s, unsigned int unit)
 
static int loadPCX (std::string filename, TextureStorage s, int slot)
 

Static Private Attributes

static std::vector< unsigned int > mTextureIdsGame
 
static std::vector< unsigned int > mTextureIdsSystem
 
static std::vector< TextureTile * > tiles
 
static std::vector< std::vector< int > > animations
 
static std::vector< int > gameUnits
 
static std::vector< int > systemUnits
 
static unsigned int nextFreeTextureUnit = 0
 
static std::vector< BufferManagergameBuffers
 
static std::vector< BufferManagersystemBuffers
 
static std::array< glm::vec4, 256 > colorPalette
 
static std::vector< std::tuple< unsigned char *, unsigned int, unsigned int > > indexedTextures
 

Detailed Description

Definition at line 67 of file TextureManager.h.

Member Function Documentation

int TextureManager::initialize ( )
static

Definition at line 62 of file TextureManager.cpp.

int TextureManager::initializeSplash ( )
static

Definition at line 83 of file TextureManager.cpp.

void TextureManager::shutdown ( )
static

Definition at line 107 of file TextureManager.cpp.

void TextureManager::clear ( )
static

Definition at line 120 of file TextureManager.cpp.

void TextureManager::prepare ( )
static

Definition at line 312 of file TextureManager.cpp.

int TextureManager::numTextures ( TextureStorage  s = TextureStorage::GAME)
static

Definition at line 207 of file TextureManager.cpp.

int TextureManager::bindTexture ( unsigned int  n,
TextureStorage  s 
)
static

Bind texture to next free texture unit.

Parameters
nID of texture to bind
sPlace where texture is stored
Returns
ID of GL texture unit to which this texture is bound.

Definition at line 219 of file TextureManager.cpp.

int TextureManager::loadBufferSlot ( unsigned char *  image = nullptr,
unsigned int  width = 256,
unsigned int  height = 256,
ColorMode  mode = ColorMode::RGBA,
unsigned int  bpp = 32,
TextureStorage  s = TextureStorage::GAME,
int  slot = -1,
bool  filter = true 
)
static

Loads Buffer as texture.

Parameters
imagepixmap matching other params
widthwidth of image
heightheight of image
modemode of image
bppbits per pixel of image
sWhich TextureStorage should be accessed
slotslot (ID) of image
filterif the texture should be mipmap filtered
Returns
texture ID or < 0 on error

Definition at line 141 of file TextureManager.cpp.

int TextureManager::loadImage ( std::string  filename,
TextureStorage  s = TextureStorage::GAME,
int  slot = -1 
)
static

Definition at line 331 of file TextureManager.cpp.

void TextureManager::addTile ( TextureTile t)
static

Definition at line 240 of file TextureManager.cpp.

int TextureManager::numTiles ( )
static

Definition at line 244 of file TextureManager.cpp.

TextureTile & TextureManager::getTile ( int  index)
static

Definition at line 248 of file TextureManager.cpp.

void TextureManager::addAnimatedTile ( int  index,
int  tile 
)
static

Definition at line 254 of file TextureManager.cpp.

int TextureManager::numAnimatedTiles ( )
static

Definition at line 261 of file TextureManager.cpp.

int TextureManager::getFirstTileAnimation ( int  index)
static

Definition at line 265 of file TextureManager.cpp.

int TextureManager::getNextTileAnimation ( int  index,
int  tile 
)
static

Definition at line 271 of file TextureManager.cpp.

BufferManager * TextureManager::getBufferManager ( int  tex,
TextureStorage  store 
)
static

Definition at line 284 of file TextureManager.cpp.

void TextureManager::display ( )
static

Definition at line 394 of file TextureManager.cpp.

unsigned int TextureManager::getTextureID ( int  n,
TextureStorage  s 
)
static

Definition at line 235 of file TextureManager.cpp.

void TextureManager::setPalette ( int  index,
glm::vec4  color 
)
static

Definition at line 292 of file TextureManager.cpp.

glm::vec4 TextureManager::getPalette ( int  index)
static

Definition at line 298 of file TextureManager.cpp.

void TextureManager::addIndexedTexture ( unsigned char *  image,
unsigned int  width,
unsigned int  height 
)
static

Definition at line 304 of file TextureManager.cpp.

std::vector< unsigned int > & TextureManager::getIds ( TextureStorage  s)
staticprivate

Definition at line 380 of file TextureManager.cpp.

std::vector< int > & TextureManager::getUnits ( TextureStorage  s)
staticprivate

Definition at line 387 of file TextureManager.cpp.

void TextureManager::bindTextureId ( unsigned int  n,
TextureStorage  s,
unsigned int  unit 
)
staticprivate
FIXME:
Query GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS

Definition at line 211 of file TextureManager.cpp.

int TextureManager::loadPCX ( std::string  filename,
TextureStorage  s,
int  slot 
)
staticprivate

Definition at line 355 of file TextureManager.cpp.

Member Data Documentation

std::vector< unsigned int > TextureManager::mTextureIdsGame
staticprivate

Definition at line 132 of file TextureManager.h.

std::vector< unsigned int > TextureManager::mTextureIdsSystem
staticprivate

Definition at line 133 of file TextureManager.h.

std::vector< TextureTile * > TextureManager::tiles
staticprivate

Definition at line 135 of file TextureManager.h.

std::vector< std::vector< int > > TextureManager::animations
staticprivate

Definition at line 136 of file TextureManager.h.

std::vector< int > TextureManager::gameUnits
staticprivate

Definition at line 138 of file TextureManager.h.

std::vector< int > TextureManager::systemUnits
staticprivate

Definition at line 139 of file TextureManager.h.

unsigned int TextureManager::nextFreeTextureUnit = 0
staticprivate

Definition at line 140 of file TextureManager.h.

std::vector< BufferManager > TextureManager::gameBuffers
staticprivate

Definition at line 142 of file TextureManager.h.

std::vector< BufferManager > TextureManager::systemBuffers
staticprivate

Definition at line 143 of file TextureManager.h.

std::array< glm::vec4, 256 > TextureManager::colorPalette
staticprivate

Definition at line 145 of file TextureManager.h.

std::vector< std::tuple< unsigned char *, unsigned int, unsigned int > > TextureManager::indexedTextures
staticprivate

Definition at line 146 of file TextureManager.h.


The documentation for this class was generated from the following files: