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/*
3neogfx C++ App/Game Engine
4Copyright (c) 2018, 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>
28#include <neogfx/game/mesh.hpp>
30
31namespace neogfx::game
32{
34 {
36 std::optional<game::mesh> mesh;
37 std::optional<mat44> transformation;
38
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}
static const neolib::uuid & id()
Definition mesh.hpp:39
static component_data_field_type field_type(uint32_t aFieldIndex)
static const i_string & field_name(uint32_t aFieldIndex)
static const i_string & name()
static const neolib::uuid & id()
static neolib::uuid field_type_id(uint32_t aFieldIndex)
shared< game::mesh > sharedMesh
std::optional< mat44 > transformation
std::optional< game::mesh > mesh