Symphony Of Empires
Eng3D::Texture Class Reference

#include <texture.hpp>

Inheritance diagram for Eng3D::Texture:
Collaboration diagram for Eng3D::Texture:

Public Member Functions

 Texture ()=default
 
 Texture (const std::string &path)
 
 Texture (const Eng3D::IO::Asset::Base *asset)
 
 Texture (size_t _width, size_t _height, size_t _bpp=32)
 
 ~Texture () override
 
void create_dummy ()
 This dummy texture helps to avoid crashes due to missing buffers or so, and also gives visual aid of errors. More...
 
void upload (TextureOptions options=default_options)
 Frontend for uploading (schedules or instantly uploads) More...
 
void upload (SDL_Surface *surface)
 Uploads a text texture (shceduled or not) if it's scheduled, the surface is handed ownership over to the scheduler and it will be automatically deallocated once the request is fullfilled. More...
 
void gen_mipmaps () const
 
void bind () const
 Binds the texture to the current OpenGL context. More...
 
void delete_gputex ()
 Deletes the OpenGL representation of this texture. More...
 
void guillotine (const Eng3D::Texture &map, int x, int y, int w, int h)
 
void to_file (const std::string &filename) override
 
- Public Member Functions inherited from Eng3D::BinaryImage
 BinaryImage ()=default
 
 BinaryImage (const Eng3D::IO::Path &path)
 
 BinaryImage (size_t _width, size_t _height, size_t bpp=32)
 
 BinaryImage (const BinaryImage &tex)
 
BinaryImageoperator= (const BinaryImage &)=delete
 
virtual ~BinaryImage ()=default
 
virtual void from_file (const Eng3D::IO::Path &path)
 
Eng3D::Color get_pixel (size_t x, size_t y) const
 Obtains a pixel from the binary image. More...
 

Public Attributes

unsigned int id = 0
 
bool managed = false
 
- Public Attributes inherited from Eng3D::BinaryImage
std::unique_ptr< uint32_t[]> buffer
 
size_t width
 
size_t height
 
size_t bpp
 

Friends

class Eng3D::TextureManager
 

Detailed Description

Definition at line 103 of file texture.hpp.

Constructor & Destructor Documentation

◆ Texture() [1/4]

Eng3D::Texture::Texture ( )
default

◆ Texture() [2/4]

Eng3D::Texture::Texture ( const std::string &  path)
inline

Definition at line 108 of file texture.hpp.

◆ Texture() [3/4]

Eng3D::Texture::Texture ( const Eng3D::IO::Asset::Base asset)
inline

Definition at line 113 of file texture.hpp.

◆ Texture() [4/4]

Eng3D::Texture::Texture ( size_t  _width,
size_t  _height,
size_t  _bpp = 32 
)
inline

Definition at line 118 of file texture.hpp.

◆ ~Texture()

Eng3D::Texture::~Texture ( )
override

Definition at line 46 of file texture.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ bind()

void Eng3D::Texture::bind ( ) const

Binds the texture to the current OpenGL context.

Definition at line 332 of file texture.cpp.

◆ create_dummy()

void Eng3D::Texture::create_dummy ( )

This dummy texture helps to avoid crashes due to missing buffers or so, and also gives visual aid of errors.

Definition at line 64 of file texture.cpp.

◆ delete_gputex()

void Eng3D::Texture::delete_gputex ( )

Deletes the OpenGL representation of this texture.

Definition at line 339 of file texture.cpp.

Here is the caller graph for this function:

◆ gen_mipmaps()

void Eng3D::Texture::gen_mipmaps ( ) const

Definition at line 324 of file texture.cpp.

Here is the caller graph for this function:

◆ guillotine()

void Eng3D::Texture::guillotine ( const Eng3D::Texture map,
int  x,
int  y,
int  w,
int  h 
)

◆ to_file()

void Eng3D::Texture::to_file ( const std::string &  filename)
overridevirtual

Reimplemented from Eng3D::BinaryImage.

Definition at line 350 of file texture.cpp.

Here is the call graph for this function:

◆ upload() [1/2]

void Eng3D::Texture::upload ( SDL_Surface *  surface)
inline

Uploads a text texture (shceduled or not) if it's scheduled, the surface is handed ownership over to the scheduler and it will be automatically deallocated once the request is fullfilled.

Parameters
surfaceSurface to base texture from

Definition at line 136 of file texture.hpp.

◆ upload() [2/2]

void Eng3D::Texture::upload ( TextureOptions  options = default_options)
inline

Frontend for uploading (schedules or instantly uploads)

Parameters
optionsOptions for upload

Definition at line 128 of file texture.hpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ Eng3D::TextureManager

friend class Eng3D::TextureManager
friend

Definition at line 148 of file texture.hpp.

Member Data Documentation

◆ id

unsigned int Eng3D::Texture::id = 0

Definition at line 146 of file texture.hpp.

◆ managed

bool Eng3D::Texture::managed = false

Definition at line 147 of file texture.hpp.


The documentation for this class was generated from the following files: