TheAtlasEngine
 
Loading...
Searching...
No Matches
components.hpp
1#pragma once
2#include <string>
3#include <glm/glm.hpp>
4#include <flecs.h>
5#include <vector>
6#include <core/math/utilities.hpp>
7
8namespace atlas {
9
10 struct transform {
11 glm::highp_vec3 position{ 0.f };
12 glm::highp_vec4 quaternion{ 0.f, 0, 0, 1 };
13 glm::highp_vec3 rotation{ 0.f };
14 glm::highp_vec3 scale{ 1.f };
15
18 void set_rotation(const glm::highp_vec3& p_value) {
19 rotation = p_value;
20 quaternion = from_quat(rotation);
21 }
22 };
23
25 glm::vec4 ambient{ 0.2f };
26 glm::vec4 diffuse{ 0.5f };
27 glm::vec4 specular{ 1.f };
28 float shininess = 0.5f;
29 };
31 glm::vec3 direction{ 0.f };
32 glm::vec3 view_position{ 0.f };
33 // {x, y, z, w: intensity}
34 glm::vec4 ambient{ 1.f };
35 glm::vec4 diffuse{ 1.f };
36 // {x, y, z, w: intensity}
37 glm::vec4 specular{ 1.f, 1.f, 0.f, 0.f };
38 glm::vec4 color{ 1.f };
39 };
40
41 struct point_light {
42 glm::vec3 position; // this is provided by the transform
43 glm::vec4 color = { 1.f, 1.f, 1.f, 1.f };
44 float attenuation = 1.f;
45 float constant = 1.f;
46 float linear = 1.f;
47 float quadratic = 1.f;
48
49 glm::vec4 ambient = glm::vec4(1.f);
50 glm::vec4 diffuse = glm::vec4(1.f);
51 glm::vec4 specular = glm::vec4(1.f);
52 };
53
61 struct mesh_source {
62 bool flip = false; // this is for flipping the texture coordinates
63 glm::vec4 color{ 1.f };
64 std::string model_path = "";
65 std::string diffuse = "";
66 std::string specular = "";
67 };
68
74 // represented as {near: x, far: y}
75 glm::vec2 plane{ 0.f };
76
77 // Activate to be the current camera
78 bool is_active = false;
79
80 // Defaults to 45.0f in radians
81 float field_of_view = glm::radians(45.f);
82 };
83
97 namespace tag {
98
100 struct editor {};
101
103 struct serialize {
104 bool enable = false;
105 };
106 };
107
109
120 glm::mat4 projection;
121 glm::mat4 view;
122 };
123
124}; // namespace atlas
Definition components.hpp:30
Definition components.hpp:24
Loads a mesh source.
Definition components.hpp:61
define a game object to have a perspective camera that can correspond to it
Definition components.hpp:73
Definition components.hpp:41
TODO: Consider either relocating where this is and how it gets handled.
Definition components.hpp:119
to indicate which entities are editor-only
Definition components.hpp:100
to tag entities to serialize through the serializer
Definition components.hpp:103
Definition components.hpp:10
void set_rotation(const glm::highp_vec3 &p_value)
sets rotation and automatically converts rotation glm::vec3 to quaternion
Definition components.hpp:18