int main(int argc, const char * argv[]) {
glm::mat4 t(1);
glm::mat4 r(1);
glm::mat4 s(1);
t = glm::translate(t, glm::vec3(10.0f, 0.0f, 50.0f));
r = glm::rotate(r, glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f));
s = glm::scale(s, glm::vec3(-3.0f, -5.0f, -10.0f));
glm::mat4 trs = t * r * s;
glm::vec3 restorePos;
glm::vec3 restoreRot;
glm::vec3 restoreSca;
getPRS(trs, restorePos, restoreRot, restoreSca);
}
将Matrix4x4转换为位置,缩放,Euler三个vector3
void getPRS(const glm::mat4 &trs, glm::vec3 &pos, glm::vec3& rot, glm::vec3& sca) {
pos.x = transformation[3][0];
pos.y = transformation[3][1];
pos.z = transformation[3][2];
}
如何表达腐败和sca以使功能正确?