diff options
Diffstat (limited to 'src/render/camera.cc')
-rw-r--r-- | src/render/camera.cc | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc index 287e4ad..8fe84a7 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -150,9 +150,8 @@ void Camera::next_mode() } } -void Camera::draw(float seconds) +void Camera::frame(float seconds) { - math::Matrix4f matrix; math::Axis target_axis; float d = 0; @@ -304,14 +303,28 @@ void Camera::draw(float seconds) distance += frustum_front; + // calculate eye position + camera_eye = camera_target - (distance * camera_axis.forward()); +} + +void Camera::draw() +{ + // Change to the projection matrix and set our viewing volume large enough for the skysphere + gl::matrixmode(GL_PROJECTION); + gl::loadidentity(); + gl::frustum(-frustum_size*Camera::aspect(), frustum_size*Camera::aspect(), + -frustum_size, frustum_size, frustum_front, 2048.0f); + + gl::matrixmode(GL_MODELVIEW); + gl::loadidentity(); + // map world coordinates to opengl coordinates gl::rotate(90.0f, 0, 1.0, 0); gl::rotate(-90.0f, 1.0f , 0, 0); - // assign transformation matrix - matrix.assign(camera_axis); - // apply the transpose of the axis transformation (the axis is orhtonormal) + math::Matrix4f matrix; + matrix.assign(camera_axis); gl::multmatrix(matrix.transpose()); // match the camera with the current target @@ -319,9 +332,6 @@ void Camera::draw(float seconds) // apply camera offset gl::translate(distance * camera_axis.forward()); - - // calculate eye position - camera_eye = camera_target - (distance * camera_axis.forward()); } void Camera::set_direction(float direction) |