neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
filter.hpp
Go to the documentation of this file.
1
// filter.hpp
2
/*
3
neogfx C++ App/Game Engine
4
Copyright (c) 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/gfx/primitives.hpp
>
27
28
namespace
neogfx::game
29
{
30
struct
filter
31
{
32
shader_filter
type
;
33
scalar
arg1
;
34
scalar
arg2
;
35
scalar
arg3
;
36
scalar
arg4
;
37
std::optional<aabb_2d>
boundingBox
;
38
39
struct
meta
:
i_component_data::meta
40
{
41
static
const
neolib::uuid
&
id
()
42
{
43
static
const
neolib::uuid
sId = { 0x91d07f77, 0x775c, 0x42f5, 0x881f, { 0x9, 0x6e, 0x1d, 0xa9, 0xba, 0x9 } };
44
return
sId;
45
}
46
static
const
i_string
&
name
()
47
{
48
static
const
string
sName =
"Filter"
;
49
return
sName;
50
}
51
static
uint32_t
field_count
()
52
{
53
return
5;
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::Enum;
61
case
1:
62
case
2:
63
case
3:
64
case
4:
65
return
component_data_field_type::Scalar;
66
case
5:
67
return
component_data_field_type::Aabb2d | component_data_field_type::Optional;
68
default
:
69
throw
invalid_field_index
();
70
}
71
}
72
static
const
i_string
&
field_name
(uint32_t aFieldIndex)
73
{
74
static
const
string
sFieldNames[] =
75
{
76
"Type"
,
77
"Arg1"
,
78
"Arg2"
,
79
"Arg3"
,
80
"Arg4"
,
81
"Bounding Box"
82
};
83
return
sFieldNames[aFieldIndex];
84
}
85
};
86
};
87
88
inline
bool
batchable
(
const
filter
& lhs,
const
filter
& rhs)
89
{
90
// todo
91
return
lhs.
type
== rhs.
type
&&
92
lhs.
arg1
== rhs.
arg1
&&
93
lhs.
arg2
== rhs.
arg2
&&
94
lhs.
arg3
== rhs.
arg3
&&
95
lhs.
arg4
== rhs.
arg4
;
96
}
97
}
neolib::i_string
Definition
i_string.hpp:49
color.hpp
primitives.hpp
neogfx::game
Definition
aabb_octree.hpp:31
neogfx::game::batchable
bool batchable(const filter &lhs, const filter &rhs)
Definition
filter.hpp:88
neogfx::shader_filter
shader_filter
Definition
primitives.hpp:75
neolib::ecs::component_data_field_type
component_data_field_type
Definition
i_component_data.hpp:52
neolib::math::scalar
double scalar
Definition
numerical.hpp:63
neogfx.hpp
string.hpp
neogfx::game::filter::meta
Definition
filter.hpp:40
neogfx::game::filter::meta::name
static const i_string & name()
Definition
filter.hpp:46
neogfx::game::filter::meta::field_name
static const i_string & field_name(uint32_t aFieldIndex)
Definition
filter.hpp:72
neogfx::game::filter::meta::field_count
static uint32_t field_count()
Definition
filter.hpp:51
neogfx::game::filter::meta::field_type
static component_data_field_type field_type(uint32_t aFieldIndex)
Definition
filter.hpp:55
neogfx::game::filter::meta::id
static const neolib::uuid & id()
Definition
filter.hpp:41
neogfx::game::filter
Definition
filter.hpp:31
neogfx::game::filter::arg4
scalar arg4
Definition
filter.hpp:36
neogfx::game::filter::boundingBox
std::optional< aabb_2d > boundingBox
Definition
filter.hpp:37
neogfx::game::filter::arg3
scalar arg3
Definition
filter.hpp:35
neogfx::game::filter::arg2
scalar arg2
Definition
filter.hpp:34
neogfx::game::filter::arg1
scalar arg1
Definition
filter.hpp:33
neogfx::game::filter::type
shader_filter type
Definition
filter.hpp:32
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::uuid
Definition
uuid.hpp:51
uuid.hpp
include
neogfx
game
filter.hpp
Generated by
1.9.8