Commit 4127d71a authored by Ilya Prokhorov's avatar Ilya Prokhorov

Pre camera fix

parent 52acf739
......@@ -11,7 +11,7 @@
* Created on July 8, 2017, 10:46 AM
*/
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "FSGLCamera.h"
......@@ -21,10 +21,16 @@ FSGLCamera::FSGLCamera()
glm::mat4 FSGLCamera::matrix()
{
auto cameraMatrix = FSGLObject::matrix();
auto cameraPositionVector = cameraMatrix * glm::vec4(0.f, 0.f, 0.f, 1.f);
auto matrix = FSGLObject::matrix();
auto directionMatrix = glm::translate(cameraMatrix, glm::vec3(0, 0,-1));
auto directionVectorPosition = directionMatrix * glm::vec4(0.f, 0.f, 0.f, 1.f);
return glm::inverse(matrix);
auto upVector = glm::normalize(glm::vec4(0.0f,1.0f,0.0f,0.0f));
cameraMatrix = glm::lookAt(glm::vec3(cameraPositionVector), glm::vec3(directionVectorPosition), glm::vec3(upVector));
return cameraMatrix;
}
FSGLCamera::~FSGLCamera()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment