|
@@ -15,6 +15,8 @@ void createCamera(camera_t *camera)
|
|
|
{
|
|
|
camera->position = vec3(0, 0, 0);
|
|
|
camera->direction = vec3(0, 0, 1 );
|
|
|
+ camera->target = vec4FromVec3(vec3(0, 0, 1));
|
|
|
+ camera->up = vec3(0, 1, 0);
|
|
|
camera->yawAngle = 0;
|
|
|
camera->pitchAngle = 0;
|
|
|
}
|
|
@@ -36,7 +38,7 @@ void cameraMoveBackward(camera_t *camera, double distance)
|
|
|
camera->position = vec3SubVectors(camera->position, velocity);
|
|
|
}
|
|
|
|
|
|
-void cameraMoveAbsolute(camera_t *camera, double x, double y, double z)
|
|
|
+void cameraMoveRelative (camera_t *camera, double x, double y, double z)
|
|
|
{
|
|
|
camera->position.x += x;
|
|
|
camera->position.y += y;
|
|
@@ -48,7 +50,8 @@ void cameraRotateBy(camera_t *camera, double yaw, double pitch)
|
|
|
camera->yawAngle += yaw;
|
|
|
camera->pitchAngle += pitch;
|
|
|
|
|
|
- matrix4_t rotationMatrix = mat4ProdMat4(mat4RotationX(camera->yawAngle), mat4RotationY(camera->pitchAngle));
|
|
|
+ matrix4_t rotationMatrix = mat4ProdMat4(mat4RotationY(camera->yawAngle),
|
|
|
+ mat4RotationX(camera->pitchAngle));
|
|
|
camera->direction = vec3FromVec4(mat4ProdVec4(rotationMatrix, camera->target));
|
|
|
}
|
|
|
|