|
Brenta Engine 1.2
|
Texture class. More...
#include <texture.hpp>
Public Member Functions | |
| texture () | |
| Empty constructor, does nothing. | |
| texture (const std::string &path, bool flip=true, const std::string &type="texture_diffuse") | |
| Creates a new tecture. | |
| constexpr | texture (texture &&other) noexcept |
| constexpr texture & | operator= (texture &&other) noexcept |
| unsigned int | get_id () const |
| void | bind (GLenum target, GLint wrapping=GL_REPEAT, GLint filtering_min=GL_NEAREST, GLint filtering_mag=GL_NEAREST, GLboolean has_mpmap=GL_TRUE, GLint mipmap_min=GL_LINEAR_MIPMAP_LINEAR, GLint mipmap_mag=GL_LINEAR) |
Static Public Member Functions | |
| static void | active_texture (GLenum texture) |
| Activate a texture unit. | |
| static unsigned int | load (const std::string &path, bool flip=true) |
| Load a texture from a file. | |
| static void | bind_id (GLenum target, unsigned int id, GLint wrapping=GL_REPEAT, GLint filtering_min=GL_NEAREST, GLint filtering_mag=GL_NEAREST, GLboolean has_mipmap=GL_TRUE, GLint mipmap_min=GL_LINEAR_MIPMAP_LINEAR, GLint mipmap_mag=GL_LINEAR) |
| Bind a texture. | |
Data Fields | |
| unsigned int | id |
| std::string | type |
| std::string | path |
Texture class.
This class is used to load and manage textures.
Definition at line 19 of file texture.hpp.
|
inline |
Empty constructor, does nothing.
Definition at line 64 of file texture.hpp.
| texture::texture | ( | const std::string & | path, |
| bool | flip = true, |
||
| const std::string & | type = "texture_diffuse" |
||
| ) |
Creates a new tecture.
| path | Path to the texture file |
| flip | Whether the texture sould be flipped or not |
| type | An optional string that may be used by other systems |
Definition at line 15 of file texture.cpp.
|
inlineconstexprnoexcept |
Definition at line 75 of file texture.hpp.
| texture::~texture | ( | ) |
Definition at line 25 of file texture.cpp.
|
static |
Activate a texture unit.
This method activates a texture unit. Arg is GL_TEXTURE0 + x
Definition at line 39 of file texture.cpp.
| void texture::bind | ( | GLenum | target, |
| GLint | wrapping = GL_REPEAT, |
||
| GLint | filtering_min = GL_NEAREST, |
||
| GLint | filtering_mag = GL_NEAREST, |
||
| GLboolean | has_mpmap = GL_TRUE, |
||
| GLint | mipmap_min = GL_LINEAR_MIPMAP_LINEAR, |
||
| GLint | mipmap_mag = GL_LINEAR |
||
| ) |
Definition at line 64 of file texture.cpp.
|
static |
Bind a texture.
This method binds a texture to a target. The texture is bound with the specified wrapping and filtering modes.
You need to bind the texture before using it in the shader.
Definition at line 53 of file texture.cpp.
| unsigned int texture::get_id | ( | ) | const |
Definition at line 34 of file texture.cpp.
|
static |
Load a texture from a file.
This method loads a texture from a file and returns the texture ID. The texture is loaded using the stb_image library.
| path | Path to the texture file |
Definition at line 44 of file texture.cpp.
Definition at line 83 of file texture.hpp.
| unsigned int brenta::texture::id |
Definition at line 23 of file texture.hpp.
| std::string brenta::texture::path |
Definition at line 25 of file texture.hpp.
| std::string brenta::texture::type |
Definition at line 24 of file texture.hpp.