Nebula
Loading...
Searching...
No Matches
velocity.h
Go to the documentation of this file.
1#pragma once
2#include "core/types.h"
3#include "game/entity.h"
4#include "math/vec3.h"
5//------------------------------------------------------------------------------
6namespace Game
7{
8
9//------------------------------------------------------------------------------
17struct Velocity : public Math::vec3
18{
19 using Math::vec3::vec3;// default constructor
21 {
22 this->load(&v.x);
23 }
24
25 struct Traits;
26};
27
29{
30 using Math::vec3::vec3; // default constructor
32 {
33 this->load(&v.x);
34 }
35
36 struct Traits;
37};
38
39//------------------------------------------------------------------------------
43{
44 Traits() = delete;
45 using type = Velocity;
46 static constexpr auto name = "Velocity";
47 static constexpr auto fully_qualified_name = "Game.Velocity";
48 static constexpr size_t num_fields = 3;
49 static constexpr const char* field_names[num_fields] = {
50 "x",
51 "y",
52 "z"
53 };
54 static constexpr const char* field_typenames[num_fields] = {
55 "float",
56 "float",
57 "float"
58 };
59 static constexpr const char* field_descriptions[num_fields] = {
60 nullptr,
61 nullptr,
62 nullptr
63 };
64 using field_types = std::tuple<float, float, float>;
65 static constexpr size_t field_byte_offsets[num_fields] = {
66 offsetof(Velocity, x),
67 offsetof(Velocity, y),
68 offsetof(Velocity, z)
69 };
70 static constexpr bool field_hide_in_inspector[num_fields] = {
71 false,
72 false,
73 false
74 };
75};
76
77//------------------------------------------------------------------------------
81{
82 Traits() = delete;
84 static constexpr auto name = "AngularVelocity";
85 static constexpr auto fully_qualified_name = "Game.AngularVelocity";
86 static constexpr size_t num_fields = 3;
87 static constexpr const char* field_names[num_fields] = {
88 "x",
89 "y",
90 "z"
91 };
92 static constexpr const char* field_typenames[num_fields] = {
93 "float",
94 "float",
95 "float"
96 };
97 static constexpr const char* field_descriptions[num_fields] = {
98 nullptr,
99 nullptr,
100 nullptr
101 };
102 using field_types = std::tuple<float, float, float>;
103 static constexpr size_t field_byte_offsets[num_fields] = {
104 offsetof(AngularVelocity, x),
105 offsetof(AngularVelocity, y),
106 offsetof(AngularVelocity, z)
107 };
108 static constexpr bool field_hide_in_inspector[num_fields] = {
109 false,
110 false,
111 false
112 };
113};
114
115} // namespace Game
Game::EditorState.
Definition graphicsmanager.h:60
Definition velocity.h:81
static constexpr size_t num_fields
Definition velocity.h:86
static constexpr auto name
Definition velocity.h:84
static constexpr size_t field_byte_offsets[num_fields]
Definition velocity.h:103
static constexpr const char * field_names[num_fields]
Definition velocity.h:87
static constexpr const char * field_descriptions[num_fields]
Definition velocity.h:97
static constexpr bool field_hide_in_inspector[num_fields]
Definition velocity.h:108
static constexpr const char * field_typenames[num_fields]
Definition velocity.h:92
std::tuple< float, float, float > field_types
Definition velocity.h:102
static constexpr auto fully_qualified_name
Definition velocity.h:85
Definition velocity.h:29
AngularVelocity(Math::vec3 const &v)
Definition velocity.h:31
Definition velocity.h:43
static constexpr bool field_hide_in_inspector[num_fields]
Definition velocity.h:70
static constexpr size_t num_fields
Definition velocity.h:48
static constexpr size_t field_byte_offsets[num_fields]
Definition velocity.h:65
static constexpr const char * field_names[num_fields]
Definition velocity.h:49
static constexpr auto fully_qualified_name
Definition velocity.h:47
static constexpr const char * field_descriptions[num_fields]
Definition velocity.h:59
static constexpr const char * field_typenames[num_fields]
Definition velocity.h:54
std::tuple< float, float, float > field_types
Definition velocity.h:64
static constexpr auto name
Definition velocity.h:46
A component that stores the linear velocity of an entity.
Velocity(Math::vec3 const &v)
Definition velocity.h:20
A 3D vector.
Definition vec3.h:40
float v[3]
Definition vec3.h:97
vec3()=default
default constructor, NOTE: does NOT setup components!
void load(const scalar *ptr)
load content from 16-byte-aligned memory
Definition vec3.h:162
float x
Definition vec3.h:94
float z
Definition vec3.h:94
float y
Definition vec3.h:94