Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::render::Texture Class Reference

#include <OxygenEngine/render/texture.h>

Inheritance diagram for oe::render::Texture:
[legend]
Collaboration diagram for oe::render::Texture:
[legend]

Public Member Functions

 Texture (const int32_t width, const int32_t height, const uint8_t *data, const int32_t nb_channels=0, const int32_t internal_format=0, const int32_t format=0, const int32_t type=0, const uint8_t max_mips=1)
 
 Texture (const std::string &filename, const bool &is_srgb=false, const uint8_t max_mips=1)
 
 Texture (const uint32_t width, const uint32_t height, const std::function< glm::vec4(const uint32_t i, const uint32_t j)> generator, const uint8_t max_mips=1)
 
 Texture (const uint32_t width, const uint32_t height, const oe::scene::Material &generator, const int32_t nb_channels=0, const int32_t internal_format=0, const int32_t format=0, const int32_t type=0, const uint8_t max_mips=1)
 
virtual void use (const uint8_t &layer)
 
virtual void enableBilinearFiltering (bool enabled=true)
 
virtual void generateMipMaps ()
 
void clampToEdge ()
 
void wrapRepeat ()
 
void fillTextureData (const std::vector< uint8_t > &data, const unsigned int &face, const unsigned int &mip_level)
 
std::vector< uint8_t > fetchTextureData (const unsigned int &face, const unsigned int &mip_level)
 
unsigned int getWidth () const
 
unsigned int getHeight () const
 
unsigned int getHandle () const
 
int getImageInternalFormat () const
 
int getImageFormat () const
 
int getImageType () const
 

Static Public Member Functions

static TexturegenerateFromCompressed (const int32_t compression, const int32_t width, const int32_t height, const int32_t data_size, const uint8_t *data)
 

Protected Member Functions

 Texture (const Texture &)=delete
 
Textureoperator= (const Texture &)=delete
 
void _generate_texture (const int32_t width, const int32_t height, const uint8_t *data, const int32_t nb_channels=0, const int32_t internal_format=0, const int32_t format=0, const int32_t type=0, const uint8_t max_mips=1)
 

Protected Attributes

uint32_t _internal_id = 0
 
int32_t _width
 
int32_t _height
 
int _internal_format = 0
 
int _format = 0
 
int _type = 0
 

Friends

class Framebuffer
 

Detailed Description

Texture wrapper

Constructor & Destructor Documentation

◆ Texture() [1/3]

oe::render::Texture::Texture ( const std::string &  filename,
const bool &  is_srgb = false,
const uint8_t  max_mips = 1 
)

Load texture from a file

Parameters
filenameThe image file
is_srgbSet to true if the image need to be loaded as sRGB or linear color space
Note
You can omit the extension, this method will try the following extensions in order: .tga, .jpg, .png

◆ Texture() [2/3]

oe::render::Texture::Texture ( const uint32_t  width,
const uint32_t  height,
const std::function< glm::vec4(const uint32_t i, const uint32_t j)>  generator,
const uint8_t  max_mips = 1 
)

Generate a RGBA texture from a function returning a vec4

◆ Texture() [3/3]

oe::render::Texture::Texture ( const uint32_t  width,
const uint32_t  height,
const oe::scene::Material generator,
const int32_t  nb_channels = 0,
const int32_t  internal_format = 0,
const int32_t  format = 0,
const int32_t  type = 0,
const uint8_t  max_mips = 1 
)

Generate a texture from a material

Member Function Documentation

◆ fetchTextureData()

std::vector< uint8_t > oe::render::Texture::fetchTextureData ( const unsigned int &  face,
const unsigned int &  mip_level 
)

Get texture data from OpenGL memory


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