Browse Source

Changed camera and fixed TBN matrix bug.

angel 7 years ago
parent
commit
2b50af80d8
2 changed files with 5 additions and 2 deletions
  1. 2 2
      src/camera.cpp
  2. 3 0
      src/matrix.cpp

+ 2 - 2
src/camera.cpp

@@ -14,9 +14,9 @@ void Camera::update(){
     float radius = 2;
     float camX   = std::sin(t/6000) * radius;
     float camZ   = std::cos(t/6000) * radius;
-    position.x   = camX;
+    position.x   = 0;
     position.y   = 0;
-    position.z   = camZ;
+    position.z   = 2;
     target.z     = 0;
     viewMatrix   = Matrix4::lookAt(position,target,up);
     cameraFrustrum.updatePlanes(viewMatrix, position);

+ 3 - 0
src/matrix.cpp

@@ -401,6 +401,9 @@ Matrix4 Matrix4::TBNMatrix(const Vector3f &tangent, const Vector3f &biTangent, c
     tangentMat(2,1) = biTangent.z;
     tangentMat(2,2) = normal.z;
 
+    //fourth row
+    tangentMat(3,3) = 1.0;
+
     return tangentMat.transpose();
 
 }