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
47 union
48 {
49 struct
50 {
56 glm::vec3 position;
57
62 glm::quat rotation;
63
68 glm::vec3 scale;
69 };
70
75 glm::mat4 transform;
76 };
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.
glm::vec3 scale
Scale factor to apply to each of the axes.
TransformComponent()
Constructs a new transform component.
glm::mat4 transform
Complete transformation.
glm::dvec3 coordinates
Global coordinates.
glm::quat rotation
Rotation given as a quaternion.
static void registerType()
Register the type in the type system.
glm::vec3 position
Local position relative to the global coordinates, or the parent coordinate system if the parent fiel...
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
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