Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_graphics
Elements
Image.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
Elem.hpp
"
4
#include "
Slot.hpp
"
5
#include "
TranslucentElem.hpp
"
6
#include "../Rendering/Texture.hpp"
7
#include "../Rendering/FlatShader.hpp"
8
#include "../Rendering/SquareMesh.hpp"
9
#include <
ivorium_core/ivorium_core.hpp
>
10
11
namespace
iv
12
{
13
18
class
Image
:
public
Elem
,
public
SlotChild
,
public
TranslucentElem
,
public
Renderable
19
{
20
public
:
21
ClientMarker
cm
;
22
using
Elem::instance
;
23
Image
(
Instance
* );
24
25
void
status
(
iv::TableDebugView
* view );
26
27
// Renderable
28
virtual
void
render
(
CameraState
const
& camera, std::optional< float > depth_override )
override
;
29
30
// initialization parameters
31
DirtyAttr< ResourcePath >
attr_filename
;
32
FlatShader::Params
shading
;
33
34
// utility methods
35
// Elem
36
Image
*
enabled
(
bool
val );
37
38
// TranslucentElem
39
Image
*
preblend
(
float4
val );
40
Image
*
translucent
(
bool
val );
41
42
// Image
43
Image
*
filename
(
ResourcePath
const
& val );
44
45
// Image shader params
46
Image
*
fittingStage
(
FlatShader::FittingStage
v );
47
48
Image
*
pixelizeStage
(
FlatShader::PixelizeStage
v );
49
Image
*
pixelizeSize
(
float2
v );
50
Image
*
pixelizeOffset
(
float2
v );
51
52
Image
*
resizeStage
(
FlatShader::ResizeStage
v );
53
Image
*
resizeAnchor
(
float2
v );
54
55
Image
*
filteringStage
(
FlatShader::FilteringStage
v );
56
Image
*
filteringAlphaThreshold
(
float
v );
57
Image
*
filteringAlphaWidth
(
float
v );
58
Image
*
alpha
(
float
v );
59
60
Image
*
colorTransform
(
float4x4
const
& v );
61
62
protected
:
63
// Elem
64
virtual
void
first_pass_impl
(
ElementRenderer
* )
override
;
65
virtual
void
second_pass_impl
(
ElementRenderer
* )
override
;
66
67
// SlotChild
68
virtual
bool
picking_test_pixel_perfect
(
float2
local_pos )
override
;
69
70
private
:
71
static
float
texcoord_frame_transform_px(
float
coord_image_px,
float
tex_size,
float
image_size );
72
73
private
:
74
Texture_Resource
texture;
75
FlatShader_Resource
shader;
76
SquareMesh_Resource
square;
77
};
78
79
}