Cogs.Core
TransformComponent.h
1#pragma once
2
3#include "Foundation/ComponentModel/Component.h"
4
5#include <glm/matrix.hpp>
6#include <glm/vec3.hpp>
7#include <glm/gtc/quaternion.hpp>
8
9namespace Cogs
10{
11 namespace Core
12 {
22 {
23 public:
28
30 static void registerType();
31
41 glm::dvec3 coordinates;
42
48 {
49 struct TRS
50 {
56 glm::vec3 position;
57
62 glm::quat rotation;
63
68 glm::vec3 scale;
69 } trs;
70
75 glm::mat4 matrix;
76 } transform;
77
83 uint32_t transformFlags = 0;
84
93 };
94 }
95}
96
97template<> inline Cogs::StringView getName<Cogs::Core::TransformComponent>() { return "TransformComponent"; }
Base class for Component instances.
Definition: Component.h:143
Defines a 4x4 transformation matrix for the entity and a global offset for root entities.
uint32_t transformFlags
Transform flags.
ComponentModel::ComponentHandle parent
Parent transform of the component.
TransformComponent()
Constructs a new transform component.
glm::dvec3 coordinates
Global coordinates.
static void registerType()
Register the type in the type system.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:50
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Handle to a Component instance.
Definition: Component.h:67
static ComponentHandle Empty()
Returns an empty, invalid handle. Will evaluate to false if tested against using operator bool().
Definition: Component.h:119
glm::quat rotation
Rotation given as a quaternion.
glm::vec3 scale
Scale factor to apply to each of the axes.
glm::vec3 position
Local position relative to the global coordinates, or the parent coordinate system if the parent fiel...
Usage of the transform field and the TRS fields is exclusive to one or the other, so the data is stor...
glm::mat4 matrix
Complete transformation.