AireEngine
A 3D Open-World Game Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
Aire::TextureManager Class Reference

Texture manager. Handles texture creation, storage, and deletion. More...

#include <texManager.h>

Classes

struct  CubemapFaces
 Struct to identify cubemap faces. More...
 

Public Member Functions

 TextureManager (const TextureManager &)=delete
 
TextureManageroperator= (const TextureManager &)=delete
 
TextureHandle createTextureByImage (const char *filename, bool flipped)
 
CubeMapHandle createCubeMapByImage (const std::vector< CubemapFaces > cubemapFaces, std::string cubeMapName)
 
GLuint createTextureInGpu (std::string name, int xOffset, int yOffset, GLenum format=GL_RGBA, GLenum type=GL_UNSIGNED_BYTE, int level=0)
 
GLuint createTextureInGpu (TexturePtr const &, int xOffset=0, int yOffset=0, GLenum format=GL_RGBA, GLenum type=GL_UNSIGNED_BYTE, int level=0)
 
void createCubeMapInGpu (CubeMapPtr const &)
 
void removeTextureInGpu (std::string name, bool isCubeMap)
 
void removeTextureInGpu (TexturePtr const &)
 
void freeTextureInCpu (const TextureHandle &handle)
 
void freeTextureInCpu (const std::string &name)
 
void freeTextureInCpu (const TexturePtr &tpr)
 
void freeCubeMapInCpu (const std::string &name)
 
void freeCubeMapInCpu (const CubeMapHandle &handle)
 
void freeCubeMapInCpu (const CubeMapPtr &cpr)
 
void freeAllDataInCpu ()
 Free all texture memory stored on the CPU.
 
TexturePtr getTexturePtr (TextureHandle h)
 
TexturePtr getTexturePtrByName (std::string name)
 
CubeMapPtr getCubeMapPtr (CubeMapHandle h)
 
CubeMapPtr getCubeMapPtrByName (std::string name)
 
bool isloaded (std::string path)
 
TextureHandle getTexturePtrByPath (std::string path)
 

Static Public Member Functions

static TextureManagerget_instance ()
 

Detailed Description

Texture manager. Handles texture creation, storage, and deletion.

Member Function Documentation

◆ createCubeMapByImage()

CubeMapHandle TextureManager::createCubeMapByImage ( const std::vector< CubemapFaces > cubemapFaces,
std::string cubeMapName )

Create a cubemap, given 6 images for its faces

Parameters
cubemapFacesThe faces for the cubemap
cubeMapNameThe name to identify the cubemap with
Returns
Handle to the newly created cubemap
Here is the caller graph for this function:

◆ createCubeMapInGpu()

void TextureManager::createCubeMapInGpu ( CubeMapPtr const & cubeMap)

Create cubemap texture in GPU using CPU data Texture identified by its pointer

Parameters
cubeMapTexture pointer
Here is the caller graph for this function:

◆ createTextureByImage()

TextureHandle TextureManager::createTextureByImage ( const char * filename,
bool flipped )

Load texture from disk to memory

Parameters
filenameThe path to the texture on disk
flippedTrue if the texture should be vertically flipped
Here is the caller graph for this function:

◆ createTextureInGpu() [1/2]

GLuint TextureManager::createTextureInGpu ( std::string name,
int xOffset,
int yOffset,
GLenum format = GL_RGBA,
GLenum type = GL_UNSIGNED_BYTE,
int level = 0 )

Create texture in GPU using CPU data Texture fetched from a map using its name as identifier

Parameters
nameName to identify the texture with
xOffsetOffset along the x direction to use when setting data in the GPU buffer
yOffsetOffset along the y direction to use when setting data in the GPU buffer
formatOpenGL format for the GPU texture
typeOpenGL type for the GPU texture
levelThe level in the mip hierarchy to initilise with the texture data
Returns
The OpenGL handle to the texture buffer
Here is the caller graph for this function:

◆ createTextureInGpu() [2/2]

GLuint TextureManager::createTextureInGpu ( TexturePtr const & tex,
int xOffset = 0,
int yOffset = 0,
GLenum format = GL_RGBA,
GLenum type = GL_UNSIGNED_BYTE,
int level = 0 )

Create texture in GPU using CPU data Texture identified by its pointer

Parameters
texTexture pointer
xOffsetOffset along the x direction to use when setting data in the GPU buffer
yOffsetOffset along the y direction to use when setting data in the GPU buffer
formatOpenGL format for the GPU texture
typeOpenGL type for the GPU texture
levelThe level in the mip hierarchy to initilise with the texture data
Returns
The OpenGL handle to the texture buffer

◆ freeCubeMapInCpu() [1/3]

void TextureManager::freeCubeMapInCpu ( const CubeMapHandle & handle)

Free cube map memory on the CPU. Texture identified by handle

Parameters
handleHandle to the texture

◆ freeCubeMapInCpu() [2/3]

void TextureManager::freeCubeMapInCpu ( const CubeMapPtr & cpr)

Free cube map data memory on the CPU. Texture identified by pointer

Parameters
cprTexture pointer

◆ freeCubeMapInCpu() [3/3]

void TextureManager::freeCubeMapInCpu ( const std::string & name)

Free cube map memory on the CPU. Texture identified by name

Parameters
nameName of the texture

◆ freeTextureInCpu() [1/3]

void TextureManager::freeTextureInCpu ( const std::string & name)

Free the image data memory on the CPU. Texture identified by name

Parameters
nameName of the texture

◆ freeTextureInCpu() [2/3]

void TextureManager::freeTextureInCpu ( const TextureHandle & handle)

Free the image data memory on the CPU. Texture identified by handle

Parameters
handleHandle to the texture

◆ freeTextureInCpu() [3/3]

void TextureManager::freeTextureInCpu ( const TexturePtr & tpr)

Free the image data memory on the CPU. Texture identified by pointer

Parameters
tprTexture pointer

◆ getCubeMapPtr()

CubeMapPtr TextureManager::getCubeMapPtr ( CubeMapHandle h)

Get cube map pointer, given its handle.

Parameters
hHandle to the cube map texture
Returns
Pointer to the cube map texture
Here is the caller graph for this function:

◆ getCubeMapPtrByName()

CubeMapPtr TextureManager::getCubeMapPtrByName ( std::string name)

Get cube map pointer, given its name.

Parameters
nameName of the cube map texture
Returns
Pointer to the cube map texture

◆ getTexturePtr()

TexturePtr TextureManager::getTexturePtr ( TextureHandle h)

Get texture pointer, given its handle.

Parameters
hHandle to the texture
Returns
Pointer to the texture
Here is the caller graph for this function:

◆ getTexturePtrByName()

TexturePtr TextureManager::getTexturePtrByName ( std::string name)

Get texture pointer, given its name.

Parameters
nameName of the texture
Returns
Pointer to the texture

◆ getTexturePtrByPath()

TextureHandle Aire::TextureManager::getTexturePtrByPath ( std::string path)

Get texture handle, given its path on disk.

Parameters
pathPath of the texture on disk
Returns
Handle to the texture

◆ isloaded()

bool Aire::TextureManager::isloaded ( std::string path)

Check if the texture has been loaded from disk

Parameters
pathThe path to the texture on disk
Returns
True if the texture has been loaded and False otherwise

◆ removeTextureInGpu() [1/2]

void TextureManager::removeTextureInGpu ( std::string name,
bool isCubeMap )

Remove a texture from GPU. Texture identified by name.

Parameters
nameName to identify the texture to be removed
isCubeMapTrue if the texture to remove is a cubemap

◆ removeTextureInGpu() [2/2]

void TextureManager::removeTextureInGpu ( TexturePtr const & tex)

Remove a texture from GPU. Texture identified by pointer.

Parameters
texTexture pointer

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