![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <Texture.hpp>
Classes | |
| struct | Flag |
| class | FormatBundle |
Public Member Functions | |
| Texture (const std::string &name, const unsigned int glTarget) | |
| Constructor. More... | |
| virtual | ~Texture () override=0 |
| Virtual destructor. More... | |
| void | destroy () |
| Destroy this texture, erasing it from video memory. More... | |
| bool | bind (const unsigned int texUnit=0) const |
| Bind this texture. More... | |
| void | unbind (const unsigned int texUnit=0) const |
| Unbind a current texture. More... | |
| bool | isValid () const |
| Check if this texture is valid. More... | |
| void | setSampler (const TextureSampler &sampler) |
| Set a texture sampler. More... | |
| void | removeSampler () |
| Remove the bound texture sampler. More... | |
| const TextureSampler * | getSampler () const |
| Get the currently bound sampler. More... | |
| virtual glm::uvec2 | getSize () const =0 |
| Get the texture size. More... | |
| virtual unsigned int | getPixelDepth () const =0 |
| Get the texture pixel depth. More... | |
| Texture & | setFilterMode (const TextureSampler::Filter mode, const float param=1.f) |
| Set the filtering mode. More... | |
| Texture & | setRepeatMode (const TextureSampler::Repeat repeat) |
| Set the repeating mode. More... | |
| Texture & | setBorderColor (const Color &color) |
| Set the border color. More... | |
| TextureSampler::Filter | getFilterMode () const |
| Get the filtering mode. More... | |
| TextureSampler::Repeat | getRepeatMode () const |
| Get the repeating mode. More... | |
| float | getAnisotropyLevel () const |
| Get the anisotropy level. More... | |
| const Color & | getBorderColor () const |
| Get the border color. More... | |
| unsigned int | getHandle () const |
| Get the OpenGL handle for this texture. More... | |
Public Member Functions inherited from jop::Resource | |
| Resource (const std::string &name) | |
| Constructor. More... | |
| virtual | ~Resource ()=0 |
| Virtual destructor. More... | |
| const std::string & | getName () const |
| Get the name of this resource. More... | |
| void | setPersistence (const unsigned short level) |
| Set the persistence level. More... | |
| unsigned short | getPersistence () const |
| Get the persistence level. More... | |
Public Member Functions inherited from jop::SafeReferenceable< Resource > | |
| WeakReference< Resource > | getReference () const |
| Get a weak reference to the bound object. More... | |
Public Member Functions inherited from jop::SerializeInfo | |
| SerializeInfo () | |
| void | setSerializePackage (const uint16 package) |
| uint16 | getSerializePackage () const |
| void | setShouldSerialize (const bool set) |
| bool | shouldSerialize () const |
| void | setLightSerializeable (const bool set) |
| bool | isLightSerializeable () const |
Static Public Member Functions | |
| static unsigned int | getMaxTextureUnits () |
| Get the maximum texture units. More... | |
| static void | setUnpackAlignment (const Format format) |
| Set the pixel store alignment. More... | |
| static bool | allowSRGB () |
| Check is the sRGB color space is allowed. More... | |
| static bool | allowGenMipmaps (const glm::uvec2 &size, const bool srgb) |
| Check is automatic mipmap generation is allowed. More... | |
Protected Member Functions | |
| void | setAlphaSwizzle (const Format format) |
| Set the swizzle mask for 8 bit textures. More... | |
Protected Member Functions inherited from jop::Resource | |
| Resource (const Resource &other, const std::string &newName) | |
| Copy constructor. More... | |
Protected Member Functions inherited from jop::SafeReferenceable< Resource > | |
| SafeReferenceable (Resource *ref) | |
| Constructor. More... | |
| SafeReferenceable (SafeReferenceable< Resource > &&other) | |
| Move constructor. More... | |
| SafeReferenceable & | operator= (SafeReferenceable< Resource > &&other) |
| Move assignment operator. More... | |
| ~SafeReferenceable () | |
| Protected destructor. More... | |
Static Protected Member Functions | |
| static Format | getFormatFromDepth (const uint32 depth) |
| Get the texture format from pixel depth. More... | |
| static unsigned int | getDepthFromFormat (const Format format) |
| Get the texture pixel depth from format. More... | |
Protected Attributes | |
| Format | m_format |
| Must be filled by derived classes during load() More... | |
Definition at line 37 of file Texture.hpp.
|
strong |
Texture format
| Enumerator | |
|---|---|
| None |
For internal functionality, do not use (except with RenderTexture) |
| Alpha_UB_8 |
8 bit alpha texture |
| RGB_UB_8 |
24 bit RGB texture |
| RGBA_UB_8 |
32 bit RGBA texture |
| RGB_F_16 |
48 bit floating point RGB texture \warning On GLES 2.0, supported only with the extension GL_OES_texture_half_float |
| RGBA_F_16 |
64 bit floating point RGBA texture \warning On GLES 2.0, supported only with the extension GL_OES_texture_half_float |
| Depth_US_16 |
16 bit depth texture \warning On GLES 2.0, supported only with the extension OES_depth_texture |
| Depth_UI_24 |
24 bit depth texture \warning On GLES 2.0, supported only with the extension OES_depth_texture |
| Stencil_UB_8 |
8 bit stencil texture \warning Not supported on GLES 3.0 or lesser. On GLES 3.1 supported with the extension OES_texture_stencil8 |
| DepthStencil_UI_24_B_8 |
24 bit depth, 8 bit stencil \warning On GLES 2.0, supported only with the extension OES_packed_depth_stencil |
Definition at line 59 of file Texture.hpp.
| jop::Texture::Texture | ( | const std::string & | name, |
| const unsigned int | glTarget | ||
| ) |
Constructor.
| name | Name of the resource |
| glTarget | The OpenGL texture target, e.g. GL_TEXTURE_2D |
|
overridepure virtual |
Virtual destructor.
|
static |
Check is automatic mipmap generation is allowed.
|
static |
Check is the sRGB color space is allowed.
| bool jop::Texture::bind | ( | const unsigned int | texUnit = 0 | ) | const |
Bind this texture.
| texUnit | The texture unit to bind this texture to |
| void jop::Texture::destroy | ( | ) |
Destroy this texture, erasing it from video memory.
| float jop::Texture::getAnisotropyLevel | ( | ) | const |
Get the anisotropy level.
| const Color& jop::Texture::getBorderColor | ( | ) | const |
Get the border color.
|
staticprotected |
Get the texture pixel depth from format.
| format | The format |
| TextureSampler::Filter jop::Texture::getFilterMode | ( | ) | const |
Get the filtering mode.
Get the texture format from pixel depth.
| depth | The pixel depth value in bytes |
| unsigned int jop::Texture::getHandle | ( | ) | const |
Get the OpenGL handle for this texture.
|
static |
Get the maximum texture units.
|
pure virtual |
Get the texture pixel depth.
Implemented in jop::Cubemap, and jop::Texture2D.
| TextureSampler::Repeat jop::Texture::getRepeatMode | ( | ) | const |
Get the repeating mode.
| const TextureSampler* jop::Texture::getSampler | ( | ) | const |
Get the currently bound sampler.
|
pure virtual |
| bool jop::Texture::isValid | ( | ) | const |
Check if this texture is valid.
| void jop::Texture::removeSampler | ( | ) |
Remove the bound texture sampler.
After this call, the texture-specific sampling parameters will be used.
|
protected |
Set the swizzle mask for 8 bit textures.
By default Texture2D and Cubemap swizzle the R component to the A component. This way the alpha component can be referenced via the a component in shaders, maintaining the same functionality across GLES 2.0 and 3.0.
| format | The format. If this is not Alpha_UB_8, nothing happens |
Set the border color.
| color | The border color |
| Texture& jop::Texture::setFilterMode | ( | const TextureSampler::Filter | mode, |
| const float | param = 1.f |
||
| ) |
Set the filtering mode.
| mode | The filtering mode |
| param | Possible anisotropic filtering level |
| Texture& jop::Texture::setRepeatMode | ( | const TextureSampler::Repeat | repeat | ) |
Set the repeating mode.
| repeat | The repeating mode |
| void jop::Texture::setSampler | ( | const TextureSampler & | sampler | ) |
Set a texture sampler.
After this call, this texture will use the sampling parameters defined by the sampler object until it is removed.
| sampler | The texture sampler to set |
|
static |
Set the pixel store alignment.
This set the OpenGL UNPACK_ALIGNMENT parameter appropriately.
| format | The texture format |
| void jop::Texture::unbind | ( | const unsigned int | texUnit = 0 | ) | const |
Unbind a current texture.
| texUnit | The texture unit to unbind a texture from |
|
protected |
Must be filled by derived classes during load()
Definition at line 313 of file Texture.hpp.
1.8.11