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 using field_types = std::tuple<float, float, float>;
60 static constexpr size_t field_byte_offsets[num_fields] = {
61 offsetof(Velocity, x),
62 offsetof(Velocity, y),
63 offsetof(Velocity, z)
64 };
65};
66
67//------------------------------------------------------------------------------
71{
72 Traits() = delete;
74 static constexpr auto name = "AngularVelocity";
75 static constexpr auto fully_qualified_name = "Game.AngularVelocity";
76 static constexpr size_t num_fields = 3;
77 static constexpr const char* field_names[num_fields] = {
78 "x",
79 "y",
80 "z"
81 };
82 static constexpr const char* field_typenames[num_fields] = {
83 "float",
84 "float",
85 "float"
86 };
87 using field_types = std::tuple<float, float, float>;
88 static constexpr size_t field_byte_offsets[num_fields] = {
89 offsetof(AngularVelocity, x),
90 offsetof(AngularVelocity, y),
91 offsetof(AngularVelocity, z)
92 };
93};
94
95} // namespace Game
Game::EditorState.
Definition orientation.h:7
Definition velocity.h:71
static constexpr size_t num_fields
Definition velocity.h:76
static constexpr auto name
Definition velocity.h:74
static constexpr size_t field_byte_offsets[num_fields]
Definition velocity.h:88
static constexpr const char * field_names[num_fields]
Definition velocity.h:77
static constexpr const char * field_typenames[num_fields]
Definition velocity.h:82
std::tuple< float, float, float > field_types
Definition velocity.h:87
static constexpr auto fully_qualified_name
Definition velocity.h:75
Definition velocity.h:29
AngularVelocity(Math::vec3 const &v)
Definition velocity.h:31
Definition velocity.h:43
static constexpr size_t num_fields
Definition velocity.h:48
static constexpr size_t field_byte_offsets[num_fields]
Definition velocity.h:60
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_typenames[num_fields]
Definition velocity.h:54
std::tuple< float, float, float > field_types
Definition velocity.h:59
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