neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
shader_array.hpp
Go to the documentation of this file.
1
// shader_array.hpp
2
/*
3
neogfx C++ App/Game Engine
4
Copyright (c) 2018, 2020 Leigh Johnston. All Rights Reserved.
5
6
This program is free software: you can redistribute it and / or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <
neogfx/neogfx.hpp
>
23
#include <
neogfx/gfx/i_texture_manager.hpp
>
24
#include <
neogfx/gfx/texture.hpp
>
25
#include <
neogfx/gfx/i_shader_array.hpp
>
26
27
namespace
neogfx
28
{
29
template
<
typename
T>
30
struct
crack_shader_array_data_type
;
31
32
template
<>
33
struct
crack_shader_array_data_type
<uint8_t>
34
{
35
static
constexpr
texture_data_format
DATA_FORMAT =
texture_data_format::Red
;
36
static
constexpr
texture_data_type
DATA_TYPE =
texture_data_type::UnsignedByte
;
37
};
38
template
<>
39
struct
crack_shader_array_data_type
<float>
40
{
41
static
constexpr
texture_data_format
DATA_FORMAT =
texture_data_format::Red
;
42
static
constexpr
texture_data_type
DATA_TYPE =
texture_data_type::Float
;
43
};
44
template
<>
45
struct
crack_shader_array_data_type
<
avec4u8
>
46
{
47
static
constexpr
texture_data_format
DATA_FORMAT =
texture_data_format::RGBA
;
48
static
constexpr
texture_data_type
DATA_TYPE =
texture_data_type::UnsignedByte
;
49
};
50
template
<>
51
struct
crack_shader_array_data_type
<
avec4f
>
52
{
53
static
constexpr
texture_data_format
DATA_FORMAT =
texture_data_format::RGBA
;
54
static
constexpr
texture_data_type
DATA_TYPE =
texture_data_type::Float
;
55
};
56
57
template
<
typename
T>
58
class
shader_array
:
public
i_shader_array
<T>
59
{
60
public
:
61
shader_array
(
const
size_u32
& aInitialSize) :
62
iTexture{ aInitialSize, 1.0,
texture_sampling
::
Data
,
crack_shader_array_data_type
<T>::DATA_FORMAT,
crack_shader_array_data_type
<T>::DATA_TYPE }
63
{
64
}
65
public
:
66
const
i_texture
&
data
()
const override
67
{
68
return
iTexture;
69
}
70
i_texture
&
data
()
override
71
{
72
return
iTexture;
73
}
74
private
:
75
texture
iTexture;
76
};
77
}
neogfx::i_shader_array
Definition
i_shader_array.hpp:29
neogfx::i_texture
Definition
i_texture.hpp:84
neogfx::shader_array
Definition
shader_array.hpp:59
neogfx::shader_array::data
i_texture & data() override
Definition
shader_array.hpp:70
neogfx::shader_array::shader_array
shader_array(const size_u32 &aInitialSize)
Definition
shader_array.hpp:61
neogfx::shader_array::data
const i_texture & data() const override
Definition
shader_array.hpp:66
neogfx::texture
Definition
texture.hpp:35
texture.hpp
i_shader_array.hpp
i_texture_manager.hpp
neogfx
Definition
action.hpp:28
neogfx::size_u32
basic_size< uint32_t > size_u32
Definition
geometrical.hpp:1252
neogfx::texture_data_type
texture_data_type
Definition
i_texture.hpp:64
neogfx::texture_data_type::Float
@ Float
neogfx::texture_data_type::UnsignedByte
@ UnsignedByte
neogfx::texture_data_format
texture_data_format
Definition
i_texture.hpp:56
neogfx::texture_data_format::RGBA
@ RGBA
neogfx::texture_data_format::Red
@ Red
neogfx::texture_sampling
texture_sampling
Definition
i_texture.hpp:42
neogfx::texture_sampling::Data
@ Data
neolib::math::avec4u8
std::array< uint8_t, 4 > avec4u8
Definition
numerical.hpp:623
neolib::math::avec4f
std::array< float, 4 > avec4f
Definition
numerical.hpp:638
neogfx.hpp
neogfx::crack_shader_array_data_type
Definition
shader_array.hpp:30
include
neogfx
gfx
shader_array.hpp
Generated by
1.9.8