neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
mesh_filter.hpp
Go to the documentation of this file.
1
// mesh_filter.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 <
neolib/core/uuid.hpp
>
24
#include <
neolib/core/string.hpp
>
25
#include <
neogfx/gfx/color.hpp
>
26
#include <
neogfx/game/ecs_ids.hpp
>
27
#include <
neogfx/game/component.hpp
>
28
#include <
neogfx/game/mesh.hpp
>
29
#include <
neogfx/game/transformation.hpp
>
30
31
namespace
neogfx::game
32
{
33
struct
mesh_filter
34
{
35
shared<game::mesh>
sharedMesh
;
36
std::optional<game::mesh>
mesh
;
37
std::optional<mat44>
transformation
;
38
39
struct
meta
:
i_component_data::meta
40
{
41
static
const
neolib::uuid
&
id
()
42
{
43
static
const
neolib::uuid
sId = { 0x4dc667e1, 0x9284, 0x4834, 0xb4eb, { 0xa5, 0x9c, 0x34, 0x34, 0xe, 0xef } };
44
return
sId;
45
}
46
static
const
i_string
&
name
()
47
{
48
static
const
string
sName =
"Mesh Filter"
;
49
return
sName;
50
}
51
static
uint32_t
field_count
()
52
{
53
return
3;
54
}
55
static
component_data_field_type
field_type
(uint32_t aFieldIndex)
56
{
57
switch
(aFieldIndex)
58
{
59
case
0:
60
return
component_data_field_type::ComponentData | component_data_field_type::Shared;
61
case
1:
62
return
component_data_field_type::ComponentData | component_data_field_type::Optional;
63
case
2:
64
return
component_data_field_type::Mat44 | component_data_field_type::Optional;
65
default
:
66
throw
invalid_field_index
();
67
}
68
}
69
static
neolib::uuid
field_type_id
(uint32_t aFieldIndex)
70
{
71
switch
(aFieldIndex)
72
{
73
case
0:
74
case
1:
75
return
mesh::meta::id
();
76
case
2:
77
return
neolib::uuid
{};
78
default
:
79
throw
invalid_field_index
();
80
}
81
}
82
static
const
i_string
&
field_name
(uint32_t aFieldIndex)
83
{
84
static
const
string
sFieldNames[] =
85
{
86
"Shared Mesh"
,
87
"Mesh"
,
88
"Transformation"
89
};
90
return
sFieldNames[aFieldIndex];
91
}
92
};
93
};
94
}
neolib::i_string
Definition
i_string.hpp:49
color.hpp
mesh.hpp
neogfx::game
Definition
aabb_octree.hpp:31
neolib::ecs::component_data_field_type
component_data_field_type
Definition
i_component_data.hpp:52
component.hpp
ecs_ids.hpp
neogfx.hpp
string.hpp
neogfx::game::mesh::meta::id
static const neolib::uuid & id()
Definition
mesh.hpp:39
neogfx::game::mesh_filter::meta
Definition
mesh_filter.hpp:40
neogfx::game::mesh_filter::meta::field_type
static component_data_field_type field_type(uint32_t aFieldIndex)
Definition
mesh_filter.hpp:55
neogfx::game::mesh_filter::meta::field_name
static const i_string & field_name(uint32_t aFieldIndex)
Definition
mesh_filter.hpp:82
neogfx::game::mesh_filter::meta::name
static const i_string & name()
Definition
mesh_filter.hpp:46
neogfx::game::mesh_filter::meta::id
static const neolib::uuid & id()
Definition
mesh_filter.hpp:41
neogfx::game::mesh_filter::meta::field_type_id
static neolib::uuid field_type_id(uint32_t aFieldIndex)
Definition
mesh_filter.hpp:69
neogfx::game::mesh_filter::meta::field_count
static uint32_t field_count()
Definition
mesh_filter.hpp:51
neogfx::game::mesh_filter
Definition
mesh_filter.hpp:34
neogfx::game::mesh_filter::sharedMesh
shared< game::mesh > sharedMesh
Definition
mesh_filter.hpp:35
neogfx::game::mesh_filter::transformation
std::optional< mat44 > transformation
Definition
mesh_filter.hpp:37
neogfx::game::mesh_filter::mesh
std::optional< game::mesh > mesh
Definition
mesh_filter.hpp:36
neolib::ecs::i_component_data::meta::invalid_field_index
Definition
i_component_data.hpp:134
neolib::ecs::i_component_data::meta
Definition
i_component_data.hpp:133
neolib::ecs::shared
Definition
component.hpp:504
neolib::uuid
Definition
uuid.hpp:51
transformation.hpp
uuid.hpp
include
neogfx
game
mesh_filter.hpp
Generated by
1.9.8