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>
26
27namespace neogfx
28{
29 template <typename T>
31
32 template <>
34 {
35 static constexpr texture_data_format DATA_FORMAT = texture_data_format::Red;
37 };
38 template <>
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 <>
50 template <>
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}
i_texture & data() override
shader_array(const size_u32 &aInitialSize)
const i_texture & data() const override
basic_size< uint32_t > size_u32
texture_data_type
Definition i_texture.hpp:64
texture_data_format
Definition i_texture.hpp:56
texture_sampling
Definition i_texture.hpp:42
std::array< uint8_t, 4 > avec4u8
std::array< float, 4 > avec4f