Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/camera.cc')
-rw-r--r--src/render/camera.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc
index ae7cd43..108e4db 100644
--- a/src/render/camera.cc
+++ b/src/render/camera.cc
@@ -23,6 +23,9 @@ const float pitch_track = -15.0f;
const float pitch_overview = -5.0f;
float Camera::camera_aspect = 1.0f;
+int Camera::camera_width = 0;
+int Camera::camera_height = 0;
+
float Camera::camera_frustum_size = 0.5f;
float Camera::camera_frustum_front = 1.0f;
math::Vector3f Camera::camera_eye;
@@ -45,6 +48,8 @@ float Camera::distance;
void Camera::init()
{
camera_aspect = 1.0f;
+ camera_height = 0;
+ camera_width = 0;
camera_frustum_size = 0.5f;
camera_frustum_front = 1.0f;
@@ -72,8 +77,10 @@ void Camera::shutdown()
{
}
-void Camera::set_aspect(int width, int height)
+void Camera::resize(int width, int height)
{
+ camera_width = width;
+ camera_height = height;
camera_aspect = (float) width / (float) height;
}
@@ -303,7 +310,7 @@ void Camera::frame(float seconds)
camera_eye = camera_target - (distance * camera_axis.forward());
}
-void Camera::draw()
+void Camera::frustum()
{
// Change to the projection matrix and set our viewing volume large enough for the skysphere
gl::matrixmode(GL_PROJECTION);
@@ -325,6 +332,17 @@ void Camera::draw()
gl::translate(-1.0f * camera_eye);
}
+void Camera::ortho()
+{
+ // switch to orthographic projection
+ gl::matrixmode(GL_PROJECTION);
+ gl::loadidentity();
+ glOrtho(0, camera_width, camera_height, 0, -16.0f, 16.0f);
+
+ gl::matrixmode(GL_MODELVIEW);
+ gl::loadidentity();
+}
+
void Camera::set_direction(float direction)
{
target_direction = direction;