Progress towards mental freedom
This commit is contained in:
@@ -44,15 +44,16 @@ namespace Nuake
|
||||
if (transform.Dirty)
|
||||
{
|
||||
auto& localTranslate = transform.GetLocalPosition();
|
||||
auto& localRot = transform.GetLocalRotation();
|
||||
auto& localRot = glm::normalize(transform.GetLocalRotation());
|
||||
auto& localScale = transform.GetLocalScale();
|
||||
|
||||
const Matrix4& translationMatrix = glm::translate(Matrix4(1.0f), localTranslate);
|
||||
//localRot.w *= -1.0f;
|
||||
|
||||
const Matrix4& rotationMatrix = glm::mat4_cast(localRot);
|
||||
const Matrix4& scaleMatrix = glm::scale(Matrix4(1.0f), localScale);
|
||||
const Matrix4& newLocalTransform = translationMatrix * rotationMatrix * scaleMatrix;
|
||||
|
||||
|
||||
//localRot *= -1.0f;
|
||||
//if(localRot.y != 0)
|
||||
// assert(newLocalTransform == transform.GetLocalTransform());
|
||||
|
||||
@@ -114,7 +115,7 @@ namespace Nuake
|
||||
camera.CameraInstance->Translation = transform.GlobalTranslation;
|
||||
|
||||
auto globalRotation = transform.GetGlobalRotation();
|
||||
auto& trnaslationMatrix = glm::translate(Matrix4(1.0f), transform.GetGlobalPosition());
|
||||
auto& translationMatrix = glm::translate(Matrix4(1.0f), transform.GetGlobalPosition());
|
||||
const Matrix4& rotationMatrix = glm::mat4_cast(globalRotation);
|
||||
Vector4 forward = Vector4(0, 0, -1, 1);
|
||||
const auto globalForward = rotationMatrix * forward;
|
||||
@@ -123,7 +124,7 @@ namespace Nuake
|
||||
const auto globalRight = rotationMatrix * right;
|
||||
camera.CameraInstance->Direction = globalForward;
|
||||
camera.CameraInstance->Right = globalRight;
|
||||
; camera.CameraInstance->SetTransform(glm::inverse(trnaslationMatrix * rotationMatrix));
|
||||
; camera.CameraInstance->SetTransform(glm::inverse(translationMatrix * rotationMatrix));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user