Nebula
Loading...
Searching...
No Matches
position.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
9struct Position : public Math::vec3
10{
11 using Math::vec3::vec3; // default constructor
13 {
14 this->load(&v.x);
15 }
16
17 struct Traits;
18};
19
20//------------------------------------------------------------------------------
24{
25 Traits() = delete;
26 using type = Position;
27 static constexpr auto name = "Position";
28 static constexpr auto fully_qualified_name = "Game.Position";
29 static constexpr size_t num_fields = 3;
30 static constexpr const char* field_names[num_fields] = {
31 "x",
32 "y",
33 "z"
34 };
35 static constexpr const char* field_typenames[num_fields] = {
36 "float",
37 "float",
38 "float"
39 };
40 using field_types = std::tuple<float, float, float>;
41 static constexpr size_t field_byte_offsets[num_fields] = {
42 offsetof(Position, x),
43 offsetof(Position, y),
44 offsetof(Position, z)
45 };
48 static constexpr uint32_t fixed_column_index = 1;
49};
50
51} // namespace Game
Game::EditorState.
Definition orientation.h:7
Definition position.h:24
std::tuple< float, float, float > field_types
Definition position.h:40
static constexpr const char * field_typenames[num_fields]
Definition position.h:35
static constexpr auto name
Definition position.h:27
static constexpr auto fully_qualified_name
Definition position.h:28
static constexpr uint32_t fixed_column_index
This is the column that the entity position will reside in, in every table.
Definition position.h:48
static constexpr size_t num_fields
Definition position.h:29
static constexpr size_t field_byte_offsets[num_fields]
Definition position.h:41
static constexpr const char * field_names[num_fields]
Definition position.h:30
Definition position.h:10
Position(Math::vec3 const &v)
Definition position.h:12
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