![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
OpenGL texture array. More...
#include <TextureArray.hpp>
Public Member Functions | |
TextureArray () | |
Constructor. | |
TextureArray (TextureArray &&) | |
Move constructor. | |
TextureArray & | operator= (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. | |
![]() | |
Texture (Texture &&) | |
Move constructor. | |
Texture & | operator= (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 | |
![]() | |
Texture () | |
Constructor. | |
![]() | |
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. | |
OpenGL texture array.
Example shader: https://github.com/fendevel/Guide-to-Modern-OpenGL-Functions?tab=readme-ov-file#texture-atlases-vs-arrays
Definition at line 24 of file TextureArray.hpp.
galaxy::graphics::TextureArray::TextureArray | ( | ) |
Constructor.
Definition at line 20 of file TextureArray.cpp.
galaxy::graphics::TextureArray::TextureArray | ( | TextureArray && | t | ) |
Move constructor.
Definition at line 26 of file TextureArray.cpp.
|
virtual |
Destructor.
Definition at line 41 of file TextureArray.cpp.
TextureArray & galaxy::graphics::TextureArray::operator= | ( | TextureArray && | t | ) |
Move assignment operator.
Definition at line 31 of file TextureArray.cpp.
|
nodiscard |
Add a texture to the texture array.
All textures must be the same size.
file | Texture to load in vfs. |
Definition at line 52 of file TextureArray.cpp.
void galaxy::graphics::TextureArray::build | ( | const int | width, |
const int | height ) |
Creates the array texture.
width | Shared width of all textures. |
height | Shared height of all textures. |
Definition at line 70 of file TextureArray.cpp.
|
nodiscard |
Creates an array texture from a tileset.
file | Texture in VFS to load. |
tile_size | Size of the tile i.e. Width/Height. |
Definition at line 113 of file TextureArray.cpp.
|
overridevirtual |
Activate context.
Implements galaxy::graphics::Texture.
Definition at line 179 of file TextureArray.cpp.
|
overridevirtual |
Deactivate context.
Implements galaxy::graphics::Texture.
Definition at line 184 of file TextureArray.cpp.
|
private |
Data from adding a file to the texture array. Not kept after building.
Definition at line 93 of file TextureArray.hpp.