INNER CODE UNIT · C++
rotation
oxylusengine/Oxylus · ResourceCompiler/private/ModelCompiler.cpp:651
rotation = glm::quat::wxyz(trs->rotation.w(), trs->rotation.x(), trs->rotation.y(), trs->rotation.z());
scale = glm::make_vec3(trs->scale.data());
} else if (const auto* mat = std::get_if<fastgltf::math::fmat4x4>(&node.transform)) {
auto transform_mat = glm::make_mat4x4(mat->data());
auto skew = glm::vec3{};
auto perspective = glm::vec4{};
glm::decompose(transform_mat, scale, rotation, translation, skew, perspective);
}
mesh_group.translation[0] = translation.x;
mesh_group.translation[1] = translation.y;
mesh_group.translation[2] = translation.z;
mesh_group.rotation[0] = rotation.x;
mesh_group.rotation[1] = rotation.y;
mesh_group.rotation[2] = rotation.z;
mesh_group.rotation[3] = rotation.w;
mesh_group.scale[0] = scale.x;
mesh_group.scale[1] = scale.y;