4#include <glm/gtc/quaternion.hpp>
5#include <glm/gtc/matrix_transform.hpp>
7#include "core/math/rotation.h"
8#include "core/reflect.h"
10namespace Vkm::Engine {
20 glm::vec3
scale = {1.0f, 1.0f, 1.0f};
29 const glm::mat4 rot = glm::mat4_cast(transform.rotation);
32 model[0] = rot[0] * transform.scale.x;
33 model[1] = rot[1] * transform.scale.y;
34 model[2] = rot[2] * transform.scale.z;
35 model[3] = glm::vec4(transform.position, 1.0f);
51 const glm::mat3 basis(model);
55 out.
scale = {glm::length(basis[0]), glm::length(basis[1]), glm::length(basis[2])};
59 if (glm::determinant(basis) < 0.0f) out.
scale.x = -out.
scale.x;
61 out.
rotation = Math::worldRotationOf(model);
75 transform.position + Math::computeForward(transform.rotation),
76 Math::computeUp(transform.rotation)