X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FMoof%2FCamera.cc;h=6b6cfa1ac8572a26f6d8a558177813d9a342e434;hb=64bd443538f57ad1bdff6c6b35953e72141129b2;hp=b38dd143cf04a51bc4dc30068a322ea77e073a42;hpb=bfa6212d09d8735d8fd5e2638188e4a99f21ada4;p=chaz%2Fyoink diff --git a/src/Moof/Camera.cc b/src/Moof/Camera.cc index b38dd14..6b6cfa1 100644 --- a/src/Moof/Camera.cc +++ b/src/Moof/Camera.cc @@ -26,9 +26,8 @@ *******************************************************************************/ -#include -#include -#include +#include "Camera.hh" +#include "OpenGL.hh" namespace Mf { @@ -52,21 +51,22 @@ void Camera::setProjection(const Matrix4& projection) projection_ = projection; } -void Camera::setProjection(Scalar fovy, Scalar aspect, Scalar near, Scalar far) +void Camera::setProjection(Scalar fovy, Scalar aspect, Scalar abutting, + Scalar distant) { - cml::matrix_perspective_yfov_RH(projection_, fovy, aspect, near, far, - cml::z_clip_neg_one); - + cml::matrix_perspective_yfov_RH(projection_, fovy, aspect, abutting, + distant, cml::z_clip_neg_one); calculateSecondary(); } -void Camera::uploadProjectionToGL() const +void Camera::uploadToGL() const { glMatrixMode(GL_PROJECTION); - glLoadMatrix(projection_.data()); + glMultMatrix(projection_.data()); glMatrixMode(GL_MODELVIEW); + glMultMatrix(modelview_.data()); } void Camera::update(Scalar t, Scalar dt) @@ -80,11 +80,12 @@ void Camera::update(Scalar t, Scalar dt) void Camera::lookAt(const Vector3& point) { - cml::quaternion_rotation_aim_at(rotation_, position_, point, Vector3(0.0, -1.0, 0.0)); + cml::quaternion_rotation_aim_at(rotation_, position_, point, + Vector3(0.0, -1.0, 0.0)); calculateSecondary(); } -void Camera::adjustFromInput(const Event& event) +void Camera::handleEvent(const Event& event) { switch (event.type) {