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 void set_position(const LinAl::Vector<float, 3> &);
30 void set_rotation(const Geometry::Quaternion<float> &);
31 void set_scale(const LinAl::Vector<float, 3> &);
32 const TransformValues &get_values() const { return values; }
33 const LinAl::Vector<float, 3> &get_position() const { return values.position; }
34 const Geometry::Quaternion<float> &get_rotation() const { return values.rotation; }
35 const LinAl::Vector<float, 3> &get_scale() const { return values.scale; }
36 const LinAl::Matrix<float, 4, 4> &get_world_matrix() const { return world_matrix; }
38 void update_world_matrix(const Transform *);
41 } // namespace Msp::Game