Doxybook2 Example
Public Types | Public Member Functions | Protected Attributes | List of all members
Engine::Graphics::Texture Interface Referenceabstract

This is a base texture class that serves as a base class for other texture types. More...

#include <Texture.hpp>

Inheritance diagram for Engine::Graphics::Texture:
Engine::Graphics::Handle Engine::Graphics::Framebuffer Engine::Graphics::Texture2D Engine::Graphics::Texture3D

Public Types

enum  Type {
  Type::UNKNOWN = 0, Type::RGBA_8, Type::RGB_8, Type::RGBA_16,
  Type::RGB_16, Type::RGBA_32, Type::RGB_32
}
 

Public Member Functions

 Texture (Type type)
 
virtual ~Texture ()=default
 
virtual int getWidth () const =0
 Returns the width of the texture in pixels. More...
 
virtual int getHeight () const =0
 Returns the height of the texture in pixels. More...
 
virtual int getDepth () const =0
 Returns the depth of the texture in pixels. More...
 
bool isLoaded () const
 

Protected Attributes

bool loaded {false}
 
Type type
 
- Protected Attributes inherited from Engine::Graphics::Handle
int handle
 

Additional Inherited Members

- Protected Member Functions inherited from Engine::Graphics::Handle
 Handle ()=default
 
virtual ~Handle ()=default
 
int getHandle () const
 

Detailed Description

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;
}

Member Enumeration Documentation

◆ Type

Enumerator
UNKNOWN 
Note
This should probably never occur
RGBA_8 
Note
Use primarly this for the best performance!
RGB_8 
RGBA_16 
RGB_16 
RGBA_32 
RGB_32 

Constructor & Destructor Documentation

◆ Texture()

Engine::Graphics::Texture::Texture ( Type  type)
explicit

◆ ~Texture()

virtual Engine::Graphics::Texture::~Texture ( )
virtualdefault

Member Function Documentation

◆ getDepth()

virtual int Engine::Graphics::Texture::getDepth ( ) const
pure virtual

Returns the depth of the texture in pixels.

Note
If this texture is 2D the depth is always 1 pixels
Returns
Depth in pixels

Implemented in Engine::Graphics::Texture2D, Engine::Graphics::Texture3D, and Engine::Graphics::Framebuffer.

◆ getHeight()

virtual int Engine::Graphics::Texture::getHeight ( ) const
pure virtual

Returns the height of the texture in pixels.

Returns
Height in pixels

Implemented in Engine::Graphics::Texture2D, Engine::Graphics::Texture3D, and Engine::Graphics::Framebuffer.

◆ getWidth()

virtual int Engine::Graphics::Texture::getWidth ( ) const
pure virtual

Returns the width of the texture in pixels.

Returns
Width in pixels

Implemented in Engine::Graphics::Texture2D, Engine::Graphics::Texture3D, and Engine::Graphics::Framebuffer.

◆ isLoaded()

bool Engine::Graphics::Texture::isLoaded ( ) const
inline

Does some more things

Member Data Documentation

◆ loaded

bool Engine::Graphics::Texture::loaded {false}
protected

◆ type

Type Engine::Graphics::Texture::type
protected

The documentation for this interface was generated from the following file:
Engine::Graphics::Texture2D
Definition: Texture2D.hpp:10
Engine.hpp