namespace Msp::Game {
+TransformValues TransformValues::from_matrix(const LinAl::Matrix<float, 4, 4> &m)
+{
+ LinAl::Vector<float, 3> p = m.column(3).slice<3>(0);
+
+ LinAl::Vector<float, 3> x = m.column(0).slice<3>(0);
+ LinAl::Vector<float, 3> y = m.column(1).slice<3>(0);
+ LinAl::Vector<float, 3> z = m.column(2).slice<3>(0);
+ LinAl::Vector<float, 3> s(x.norm(), y.norm(), z.norm());
+
+ LinAl::Vector<float, 3> ul_cols[3] = { x/s.x, y/s.y, z/s.z };
+ auto r = Geometry::Quaternion<float>::from_matrix(LinAl::Matrix<float, 3, 3>::from_columns(ul_cols));
+
+ return { p, r, s };
+}
+
Transform::Transform(Handle<Entity> e):
BufferedComponent<TransformData>(e)
{ }
const LinAl::Vector<float, 3> &s = LinAl::Vector<float, 3>(1.0f, 1.0f, 1.0f)):
position(p), rotation(r), scale(s)
{ }
+
+ static TransformValues from_matrix(const LinAl::Matrix<float, 4, 4> &);
};
struct TransformData