1 #ifndef MSP_GAME_TRANSFORM_H_
2 #define MSP_GAME_TRANSFORM_H_
4 #include <msp/geometry/quaternion.h>
5 #include <msp/linal/matrix.h>
6 #include <msp/linal/vector.h>
11 struct TransformValues
13 LinAl::Vector<float, 3> position;
14 Geometry::Quaternion<float> rotation = Geometry::Quaternion<float>::one();
15 LinAl::Vector<float, 3> scale = { 1.0f, 1.0f, 1.0f };
18 class Transform: public Component
21 TransformValues values;
22 LinAl::Matrix<float, 4, 4> local_matrix;
23 LinAl::Matrix<float, 4, 4> world_matrix;
26 Transform(Handle<Entity>);
28 void set_values(const TransformValues &);
29 const TransformValues &get_values() const { return values; }
30 const LinAl::Vector<float, 3> &get_position() const { return values.position; }
31 const Geometry::Quaternion<float> &get_rotation() const { return values.rotation; }
32 const LinAl::Vector<float, 3> &get_scale() const { return values.scale; }
33 const LinAl::Matrix<float, 4, 4> &get_world_matrix() const { return world_matrix; }
35 void update_world_matrix(const Transform *);
38 } // namespace Msp::Game