galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::graphics::TextureArray Class Referencefinal

OpenGL texture array. More...

#include <TextureArray.hpp>

+ Inheritance diagram for galaxy::graphics::TextureArray:
+ Collaboration diagram for galaxy::graphics::TextureArray:

Public Member Functions

 TextureArray ()
 Constructor.
 
 TextureArray (TextureArray &&)
 Move constructor.
 
TextureArrayoperator= (TextureArray &&)
 Move assignment operator.
 
virtual ~TextureArray ()
 Destructor.
 
bool add (const std::string &file)
 Add a texture to the texture array.
 
void build (const int width, const int height)
 Creates the array texture.
 
bool build_from_tileset (const std::string &file, const int tile_size)
 Creates an array texture from a tileset.
 
void bind () override
 Activate context.
 
void unbind () override
 Deactivate context.
 
- Public Member Functions inherited from galaxy::graphics::Texture
 Texture (Texture &&)
 Move constructor.
 
Textureoperator= (Texture &&)
 Move assignment operator.
 
virtual ~Texture ()
 Destructor.
 
TextureView make_view (const unsigned int minlevel=0, const unsigned int numlevels=1, const unsigned int minlayer=0, const unsigned int numlayers=1)
 Create a texture view.
 
void mode (const TextureMode mode)
 Set texture mode.
 
TextureMode mode () const
 Get texture mode.
 
void filter (const TextureFilter filter)
 Set filter when texture is (up/down)scaled in OpenGL.
 
TextureFilter filter () const
 Get texture filter.
 
void anisotropy (const int level)
 Set ansiotropic filtering level.
 
int anisotropy () const
 Get current anisotropy level.
 
float width () const
 Get texture width.
 
float height () const
 Get texture height.
 
unsigned int id () const
 Gets opengl handle.
 

Private Attributes

meta::vector< unsigned char * > m_data
 Data from adding a file to the texture array. Not kept after building.
 

Additional Inherited Members

- Protected Member Functions inherited from galaxy::graphics::Texture
 Texture ()
 Constructor.
 
- Protected Attributes inherited from galaxy::graphics::Texture
unsigned int m_id
 OpenGL id.
 
int m_width
 Cached width.
 
int m_height
 Cached height.
 
TextureMode m_mode
 Mode.
 
TextureFilter m_filter
 Filter.
 
int m_anisotropy
 Ansiotrophy level.
 

Detailed Description

Constructor & Destructor Documentation

◆ TextureArray() [1/2]

galaxy::graphics::TextureArray::TextureArray ( )

Constructor.

Definition at line 20 of file TextureArray.cpp.

◆ TextureArray() [2/2]

galaxy::graphics::TextureArray::TextureArray ( TextureArray && t)

Move constructor.

Definition at line 26 of file TextureArray.cpp.

◆ ~TextureArray()

galaxy::graphics::TextureArray::~TextureArray ( )
virtual

Destructor.

Definition at line 41 of file TextureArray.cpp.

Member Function Documentation

◆ operator=()

TextureArray & galaxy::graphics::TextureArray::operator= ( TextureArray && t)

Move assignment operator.

Definition at line 31 of file TextureArray.cpp.

+ Here is the call graph for this function:

◆ add()

bool galaxy::graphics::TextureArray::add ( const std::string & file)
nodiscard

Add a texture to the texture array.

All textures must be the same size.

Parameters
fileTexture to load in vfs.
Returns
True if texture array created successfully.

Definition at line 52 of file TextureArray.cpp.

◆ build()

void galaxy::graphics::TextureArray::build ( const int width,
const int height )

Creates the array texture.

Parameters
widthShared width of all textures.
heightShared height of all textures.

Definition at line 70 of file TextureArray.cpp.

+ Here is the call graph for this function:

◆ build_from_tileset()

bool galaxy::graphics::TextureArray::build_from_tileset ( const std::string & file,
const int tile_size )
nodiscard

Creates an array texture from a tileset.

Parameters
fileTexture in VFS to load.
tile_sizeSize of the tile i.e. Width/Height.
Returns
True if texture loaded successfully.

Definition at line 113 of file TextureArray.cpp.

+ Here is the call graph for this function:

◆ bind()

void galaxy::graphics::TextureArray::bind ( )
overridevirtual

Activate context.

Implements galaxy::graphics::Texture.

Definition at line 179 of file TextureArray.cpp.

◆ unbind()

void galaxy::graphics::TextureArray::unbind ( )
overridevirtual

Deactivate context.

Implements galaxy::graphics::Texture.

Definition at line 184 of file TextureArray.cpp.

Member Data Documentation

◆ m_data

meta::vector<unsigned char*> galaxy::graphics::TextureArray::m_data
private

Data from adding a file to the texture array. Not kept after building.

Definition at line 93 of file TextureArray.hpp.


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