From: Mikko Rasa Date: Wed, 24 Feb 2010 21:56:25 +0000 (+0000) Subject: Fix 4th column of camera matrix X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=75adf0a90054f4f418663b7d347260cf31b6c046;p=libs%2Fgl.git Fix 4th column of camera matrix Add getters for camera lens parameters --- diff --git a/source/camera.cpp b/source/camera.cpp index b392f672..c63fc930 100644 --- a/source/camera.cpp +++ b/source/camera.cpp @@ -137,9 +137,9 @@ void Camera::compute_matrix() matrix[6] = -look_dir.y; matrix[10] = -look_dir.z; - matrix[12] = -position.x; - matrix[13] = -position.y; - matrix[14] = -position.z; + matrix[12] = -position.x*matrix[0]-position.y*matrix[4]-position.z*matrix[8]; + matrix[13] = -position.x*matrix[1]-position.y*matrix[5]-position.z*matrix[9]; + matrix[14] = -position.x*matrix[2]-position.y*matrix[6]-position.z*matrix[10]; } } // namespace GL diff --git a/source/camera.h b/source/camera.h index 8be79abf..a2d2993a 100644 --- a/source/camera.h +++ b/source/camera.h @@ -32,6 +32,10 @@ public: void set_field_of_view(float); void set_aspect(float); void set_depth_clip(float, float); + float get_field_of_view() const { return fov; } + float get_aspect() const { return aspect; } + float get_near_clip() const { return clip_near; } + float get_far_clip() const { return clip_far; } void set_position(const Vector3 &); void set_look_direction(const Vector3 &);