ASGE
3.2.0
Simple Game Framework in GL
|
#include <Texture.hpp>
Public Types | |
enum | Format { MONOCHROME = 1 , MONOCHROME_ALPHA = 2 , RGB = 3 , RGBA = 4 } |
enum class | MinFilter : uint32_t { LINEAR , LINEAR_MIPMAP_NEAREST , LINEAR_MIPMAP_LINEAR , NEAREST , NEAREST_MIPMAP_LINEAR , NEAREST_MIPMAP_NEAREST } |
enum class | UVWrapMode { CLAMP , REPEAT , MIRRORED } |
using | MagFilter = GameSettings::MagFilter |
Public Member Functions | |
Texture2D (int width, int height) noexcept | |
virtual | ~Texture2D ()=default |
void | setFormat (Format f) noexcept |
Format | getFormat () const |
virtual void | updateMagFilter (MagFilter filter)=0 |
virtual void | updateMinFilter (MinFilter filter)=0 |
virtual void | updateUVWrapping (UVWrapMode s, UVWrapMode t)=0 |
virtual void | updateMips ()=0 |
virtual PixelBuffer * | getPixelBuffer () noexcept=0 |
virtual const PixelBuffer * | getPixelBuffer () const noexcept=0 |
float | getWidth () const noexcept |
float | getHeight () const noexcept |
a simple 2D non-renderable texture.
A texture is used to load images into the GPU. They retain a handle or link to it and the renderers are free to implement any caching systems they see fit.
Definition at line 56 of file Texture.hpp.
< Shorthand for MagFilter
Definition at line 61 of file Texture.hpp.
The format of the texture
Definition at line 66 of file Texture.hpp.
|
strong |
Min filters used when scaling textures downwards
Definition at line 77 of file Texture.hpp.
|
strong |
modes that controlling the UV texture wrapping
When sampling textures and using UV coordinates outside of the normalised range, wrapping modes can be used to control the resultant sampled pixel. For example, REPEAT will continuously wrap the texture. This is good for when you want to sample outside the normal [0,1] range but still obtain a resultant pixel. A use case for this is a scrolling background layer.
Enumerator | |
---|---|
CLAMP | Clamps the texture to [0,1]. |
REPEAT | Repeats the texture. |
MIRRORED | Mirrors the image with each repeat. |
Definition at line 98 of file Texture.hpp.
|
inlinenoexcept |
Default constructor.
width | The width of the texture. |
height | the height of the texture. |
Definition at line 110 of file Texture.hpp.
|
virtualdefault |
Default destructor. The destructor does not free the memory used on the GPU. This is handled inside the platform's specific implementation.
|
inline |
Retrieves the format of the stored texture.
Definition at line 135 of file Texture.hpp.
|
inlinenoexcept |
Retrieves the width of the loaded texture.
Definition at line 198 of file Texture.hpp.
|
pure virtualnoexcept |
Retrieves the texture from GPU memory. Retrieving memory from the GPU like this is a slow process. It is best to do this infrequently.
|
pure virtualnoexcept |
Retrieves the texture from GPU memory. Retrieving memory from the GPU like this is a slow process. It is best to do this infrequently.
|
inlinenoexcept |
Retrieves the width of the loaded texture.
Definition at line 192 of file Texture.hpp.
|
inlinenoexcept |
Sets the format of the texture.
f | The format of the stored texture. |
Definition at line 128 of file Texture.hpp.
|
pure virtual |
Sets the filtering used for texture magnification. Allows the type of filtering applied when
sampling the texture under magnification to be changed.
filter | The magnification filter to apply. |
|
pure virtual |
Sets the filtering used for texture minification. Allows the type of filtering applied when
sampling the texture under minification to be changed.
filter | The minification filter to apply. |
|
pure virtual |
Rebuilds the mip maps used for minification.
|
pure virtual |
Controls how the UV coordinates are wrapped.
When sampling the texture, UV coordinates outside of the range of [0,1] can either be clamped or repeated. It is also possible to clamp in one direction, and repeat in another as both directions (s,t) can be controlled independently of each other.
s | The wrapping mode for the x dimension. |
t | The wrapping mode for the y dimension. |