SDEngine
Game Engine
Loading...
Searching...
No Matches
components.hpp
Go to the documentation of this file.
1#pragma once
2#include <VLA/Matrix.hpp>
3
5#include "SD/core/types.hpp"
7
8namespace sd::components {
9
10struct Transform {
11 VLA::Matrix4x4f world_matrix;
12};
13
14// template<>
15// struct ComponentSerializer<Transform> {
16// static void serialize(const Transform& c, Serializer& s) { s.write(c.world_matrix.A); }
17// static void deserialize(Transform& c, Serializer& s) { s.read(c.world_matrix.A); }
18// };
19
20struct Camera {
21 VLA::Matrix4x4f view;
22 VLA::Matrix4x4f proj;
23};
24
25// template<>
26// struct ComponentSerializer<Camera> {
27// static void serialize(const Camera& c, Serializer& s) {
28// s.write(c.view.A);
29// s.write(c.proj.A);
30// }
31// static void deserialize(Camera& c, Serializer& s) {
32// s.read(c.view.A);
33// s.read(c.proj.A);
34// }
35// };
36
37struct Renderable {
42 float color[4] = {1.0f, 0.0f, 0.0f, 1.0f};
43};
44
45// template<>
46// struct ComponentSerializer<Renderable> {
47// static void serialize(const Renderable& c, Serializer& s) {
48// s.write(c.mesh_id);
49// s.write(c.material_id);
50// s.write(c.render_stage);
51// s.write(c.view_mask);
52// s.write(c.color);
53// }
54// static void deserialize(Renderable& c, Serializer& s) {
55// c.mesh_id = s.read<u32>();
56// c.material_id = s.read<u32>();
57// c.render_stage = s.read<i32>();
58// c.view_mask = s.read<u32>();
59// s.read(c.color);
60// }
61// };
62
63// TODO(vatnar): this shouldnt be a string, rather a non owning slice (arena strings etc)
64struct DebugName {
65 std::string name;
66};
67
68// template<>
69// struct ComponentSerializer<DebugName> {
70// static void serialize(const DebugName& c, Serializer& s) { s.write(c.name); }
71// static void deserialize(DebugName& c, Serializer& s) { c.name = s.read_string(); }
72// };
73
74// ComponentGroup of ordered engine components, should not be redefined for any case. Things will
75// break.
77} // namespace sd::components
Definition components.hpp:8
Definition component_registration.hpp:12
Definition components.hpp:20
VLA::Matrix4x4f proj
Definition components.hpp:22
VLA::Matrix4x4f view
Definition components.hpp:21
Definition components.hpp:64
std::string name
Definition components.hpp:65
Definition components.hpp:37
float color[4]
Definition components.hpp:42
I32 render_stage
Definition components.hpp:40
U32 material_id
Definition components.hpp:39
U32 view_mask
Definition components.hpp:41
U32 mesh_id
Definition components.hpp:38
Definition components.hpp:10
VLA::Matrix4x4f world_matrix
Definition components.hpp:11
std::uint32_t U32
Definition types.hpp:15
std::int32_t I32
Definition types.hpp:10