Engine::Graphics::Texture
Module: An example game engine / Graphical related classes
This is a base texture class that serves as a base class for other texture types. More...
#include <Texture.hpp>
Inherits from Engine::Graphics::Handle
Inherited by Engine::Graphics::Framebuffer, Engine::Graphics::Texture2D, Engine::Graphics::Texture3D
Public Types
| Name | |
|---|---|
| enum class | Type { UNKNOWN = 0, RGBA_8, RGB_8, RGBA_16, RGB_16, RGBA_32, RGB_32} |
Public Functions
| Name | |
|---|---|
| Texture(Type type) | |
| virtual | ~Texture() =default |
| virtual int | getWidth() const =0 Returns the width of the texture in pixels. |
| virtual int | getHeight() const =0 Returns the height of the texture in pixels. |
| virtual int | getDepth() const =0 Returns the depth of the texture in pixels. |
| bool | isLoaded() const |
Protected Attributes
| Name | |
|---|---|
| bool | loaded |
| Type | type |
Additional inherited members
Public Functions inherited from Engine::Graphics::Handle
| Name | |
|---|---|
| Handle() =default | |
| virtual | ~Handle() =default |
| int | getHandle() const |
Protected Attributes inherited from Engine::Graphics::Handle
| Name | |
|---|---|
| int | handle |
Detailed Description
class Engine::Graphics::Texture;
This is a base texture class that serves as a base class for other texture types.
Bug: This has some weird bug too!
#include <iostream>
#include <memory>
#include "Engine.hpp"
// A dummy example
int main() {
// Create pixels buffer
const auto pixels = std::make_unique<uint8_t[]>(new uint8_t[1024*1024*3]);
fillData(*pixels, "path/to/texture.png");
// Create a texture out of the pixels
Engine::Graphics::Texture2D texture(1024, 1024, *data);
// Done
return 0;
}
Filename: example-1.cpp
Public Types Documentation
enum Type
| Enumerator | Value | Description |
|---|---|---|
| UNKNOWN | 0 | |
| RGBA_8 | ||
| RGB_8 | ||
| RGBA_16 | ||
| RGB_16 | ||
| RGBA_32 | ||
| RGB_32 |
Public Functions Documentation
function Texture
explicit Texture(
Type type
)
function ~Texture
virtual ~Texture() =default
function getWidth
virtual int getWidth() const =0
Returns the width of the texture in pixels.
Return: Width in pixels
Reimplemented by: Engine::Graphics::Framebuffer::getWidth, Engine::Graphics::Texture3D::getWidth, Engine::Graphics::Texture2D::getWidth
function getHeight
virtual int getHeight() const =0
Returns the height of the texture in pixels.
Return: Height in pixels
Reimplemented by: Engine::Graphics::Framebuffer::getHeight, Engine::Graphics::Texture3D::getHeight, Engine::Graphics::Texture2D::getHeight
function getDepth
virtual int getDepth() const =0
Returns the depth of the texture in pixels.
Return: Depth in pixels
Note: If this texture is 2D the depth is always 1 pixels
Reimplemented by: Engine::Graphics::Framebuffer::getDepth, Engine::Graphics::Texture3D::getDepth, Engine::Graphics::Texture2D::getDepth
function isLoaded
inline bool isLoaded() const
Does some more things
Protected Attributes Documentation
variable loaded
bool loaded {false};
variable type
Type type;
Updated on 2022-10-19 at 22:22:01 +0000