jGL
Loading...
Searching...
No Matches
include
jGL
texture.h
Go to the documentation of this file.
1
#ifndef TEXTURE
2
#define TEXTURE
3
4
#include <glm/glm.hpp>
5
6
#include <
id.h
>
7
8
#include <string>
9
10
#include <
jGL/common.h
>
11
#include <stb_image.h>
12
13
namespace
jGL
14
{
15
16
class
Texture
17
{
18
19
public
:
20
21
enum class
Type
{
RGB
,
RGBA
};
22
23
Texture
()
24
:
width
(0),
height
(0),
channels
(0),
id
(
Id
::next())
25
{}
26
27
virtual
~Texture
() =
default
;
28
29
virtual
void
bind
(
unsigned
unit) = 0;
30
31
bool
operator==
(
const
Texture
& rhs)
const
{
return
this->
id
== rhs.
id
; }
32
33
const
Id
&
getId
()
const
{
return
id
; }
34
35
const
glm::ivec3
size
()
const
{
return
glm::ivec3(
width
,
height
,
channels
); }
36
37
protected
:
38
39
int
width
,
height
,
channels
;
40
41
Id
id
;
42
43
};
44
45
}
46
47
#endif
/* TEXTURE */
jGL::Texture
Definition
texture.h:17
jGL::Texture::getId
const Id & getId() const
Definition
texture.h:33
jGL::Texture::bind
virtual void bind(unsigned unit)=0
jGL::Texture::width
int width
Definition
texture.h:39
jGL::Texture::operator==
bool operator==(const Texture &rhs) const
Definition
texture.h:31
jGL::Texture::Texture
Texture()
Definition
texture.h:23
jGL::Texture::id
Id id
Definition
texture.h:41
jGL::Texture::~Texture
virtual ~Texture()=default
jGL::Texture::height
int height
Definition
texture.h:39
jGL::Texture::size
const glm::ivec3 size() const
Definition
texture.h:35
jGL::Texture::channels
int channels
Definition
texture.h:39
jGL::Texture::Type
Type
Definition
texture.h:21
jGL::Texture::Type::RGB
@ RGB
jGL::Texture::Type::RGBA
@ RGBA
common.h
id.h
jGL
A drawable graphic.
Definition
id.h:10
jGL::Id
Definition
id.h:13
Generated by
1.9.8