Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. auto Transform::getMatrix() const -> Matrix4f
  2. {
  3. auto parentMat = parent == nullptr
  4. ? Matrix4f::createIdentity()
  5. : parent->getMatrix();
  6.  
  7. auto parentPos = parent == nullptr
  8. ? Vector3f::zero()
  9. : parent->getWorldPosition();
  10.  
  11. auto toParentNeg = Matrix4f::createTranslation(-parentPos.x, -parentPos.y, -parentPos.z);
  12. auto toParent = Matrix4f::createTranslation(parentPos.x, parentPos.y, parentPos.z);
  13. auto rot = localRotation.transform(); // Get a matrix representation of this quaternion
  14.  
  15. return parentMat * toParent * rot * toParentNeg;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement