neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
filter.hpp
Go to the documentation of this file.
1// filter.hpp
2/*
3neogfx C++ App/Game Engine
4Copyright (c) 2020 Leigh Johnston. All Rights Reserved.
5
6This program is free software: you can redistribute it and / or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along 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>
25#include <neogfx/gfx/color.hpp>
27
28namespace neogfx::game
29{
30 struct filter
31 {
37 std::optional<aabb_2d> boundingBox;
38
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}
bool batchable(const filter &lhs, const filter &rhs)
Definition filter.hpp:88
double scalar
Definition numerical.hpp:63
static const i_string & name()
Definition filter.hpp:46
static const i_string & field_name(uint32_t aFieldIndex)
Definition filter.hpp:72
static uint32_t field_count()
Definition filter.hpp:51
static component_data_field_type field_type(uint32_t aFieldIndex)
Definition filter.hpp:55
static const neolib::uuid & id()
Definition filter.hpp:41
std::optional< aabb_2d > boundingBox
Definition filter.hpp:37
shader_filter type
Definition filter.hpp:32