Engine::Graphics::Texture #
An example game engine / Graphical related classes / Texture
Defined in header <src/Graphics/Texture.hpp>
class Texture;
This is a base texture class that serves as a base class for other texture types.
Description
#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
Bug: This has some weird bug too!
Inherits from Handle
Inherited by: Texture
is a base class for
Framebuffer, Texture2D, and Texture3D
Public Types #
Member Types | Definition |
---|---|
Type | Type (enum) |
Public Functions #
Member Functions | Description |
---|---|
(constructor) | (function) |
(destructor) = default | (virtual function) |
getWidth const = 0 | Returns the width of the texture in pixels. (virtual function) |
getHeight const = 0 | Returns the height of the texture in pixels. (virtual function) |
getDepth const = 0 | Returns the depth of the texture in pixels. (virtual function) |
isLoaded const | (function) |
Protected Attributes #
Member Protected Attributes | Description |
---|---|
loaded | bool (protected variable) |
type | Type (protected variable) |
Additional inherited members #
Public Functions(inherited from Engine::Graphics::Handle)
Member Functions | Description |
---|---|
Handle = default | (function) |
~Handle = default | (virtual function) |
getHandle const | (function) |
Protected Attributes(inherited from Engine::Graphics::Handle)
Member Protected Attributes | Description |
---|---|
handle | int (protected variable) |
Public Types #
enum Type #
Defined in header <src/Graphics/Texture.hpp>
enum class Type;
Enumerator | Value | Description |
---|---|---|
UNKNOWN | 0 | |
RGBA_8 | ||
RGB_8 | ||
RGBA_16 | ||
RGB_16 | ||
RGBA_32 | ||
RGB_32 |
Public Functions #
function Texture #
Defined in header <src/Graphics/Texture.hpp>
explicit Texture(Type type);
Exception Safety
Basic exception guarantee.
function ~Texture #
Defined in header <src/Graphics/Texture.hpp>
virtual ~Texture() = default;
Exception Safety
Basic exception guarantee.
function getWidth #
Defined in header <src/Graphics/Texture.hpp>
virtual int
getWidth() const = 0;
Returns the width of the texture in pixels.
Return value
Width in pixels
Exception Safety
Basic exception guarantee.
function getHeight #
Defined in header <src/Graphics/Texture.hpp>
virtual int
getHeight() const = 0;
Returns the height of the texture in pixels.
Return value
Height in pixels
Exception Safety
Basic exception guarantee.
function getDepth #
Defined in header <src/Graphics/Texture.hpp>
virtual int
getDepth() const = 0;
Returns the depth of the texture in pixels.
Return value
Depth in pixels
Notes
If this texture is 2D the depth is always 1 pixels
Exception Safety
Basic exception guarantee.
function isLoaded #
Defined in header <src/Graphics/Texture.hpp>
bool
isLoaded() const;
Exception Safety
Basic exception guarantee.
Protected Attributes #
variable loaded #
Defined in header <src/Graphics/Texture.hpp>
bool loaded {false};
variable type #
Defined in header <src/Graphics/Texture.hpp>
Type type;
Updated on 2023-04-03