| 74 | } |
| 75 | |
| 76 | quaternion Transform::GetWorldRotation() |
| 77 | { |
| 78 | if (!HasParent()) { |
| 79 | return GetLocalRotation(); |
| 80 | } |
| 81 | |
| 82 | //the list of transformations to apply |
| 83 | list<matrix4> rotations; |
| 84 | GetParentMatrixStack(rotations); |
| 85 | |
| 86 | matrix4 finalRot = matrix4(1.0); //construct identity matrix |
| 87 | //apply all the transforms |
| 88 | for (auto& transform : rotations) { |
| 89 | finalRot *= transform; |
| 90 | } |
| 91 | |
| 92 | //apply local rotation |
| 93 | finalRot *= glm::toMat4(GetLocalRotation()); |
| 94 | |
| 95 | //return the result as a quaternion |
| 96 | return glm::toQuat(finalRot); |
| 97 | } |
| 98 | |
| 99 | void RavEngine::Transform::Apply() |
| 100 | { |
no test coverage detected