Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_graphics
Rendering
Texture.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
GlSystem.hpp
"
4
#include "../OpenGL/GlTexture.hpp"
5
6
#include <
ivorium_systems/ivorium_systems.hpp
>
7
#include <
ivorium_core/ivorium_core.hpp
>
8
9
#include <optional>
10
11
namespace
iv
12
{
13
14
//---------------------------------------------------------------------------------------
17
class
Texture
18
{
19
public
:
20
enum class
Filtering
21
{
22
Nearest
,
23
SmoothMsdf
,
24
Smooth2D
,
25
Smooth3D
26
};
27
28
struct
Metadata
29
{
30
int2
size
;
31
float
density
;
32
Filtering
filtering
;
33
PixelFormat
format
;
34
ColorSpace
color_space
;
35
float
msdf_pixelRange
;
36
37
bool
hitmap
;
38
bool
instant_loading
;
39
40
Metadata
();
41
};
42
43
public
:
44
ClientMarker
cm
;
45
46
Texture
(
Instance
* inst );
47
Instance
*
instance
()
const
;
48
49
Metadata
const
&
metadata
()
const
;
50
GlTexture
const
*
gl_texture
()
const
;
51
bool
hittest
(
int
x,
int
y )
const
;
52
53
protected
:
54
Metadata
_metadata
;
55
GlTexture
_gl_texture
;
56
std::vector< bool >
_hitmap
;
57
58
private
:
59
Instance
* inst;
60
};
61
62
//---------------------------------------------------------------------------------------
65
class
Texture_Resource
:
public
SingularResource
< Texture >
66
{
67
public
:
68
ClientMarker
cm
;
69
Texture_Resource
(
Instance
* inst,
ResourcePath
const
&
path
) :
70
SingularResource
<
Texture
>( inst,
path
),
71
cm
( inst, this,
"Texture_Resource"
)
72
{
73
this->cm.
inherits
( this->
SingularResource< Texture >::cm
);
74
}
75
};
76
77
//--------------------------------- StingIO ---------------------------------------------
78
template
<>
79
struct
StringIO
<
Texture
::Filtering > :
public
StringIO_Table
< Texture::Filtering >
80
{
81
static
const
ValuesType
Values
;
82
};
83
84
}