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.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc
index ba056d0..092cc26 100644
--- a/src/render/camera.cc
+++ b/src/render/camera.cc
@@ -374,6 +374,30 @@ void Camera::frustum()
gl::translate(-1.0f * camera_eye);
}
+void Camera::frustum_default(float distance, float cx, float cy)
+{
+ // Change to the projection matrix and set our viewing volume large enough for the skysphere
+ gl::matrixmode(GL_PROJECTION);
+ gl::loadidentity();
+
+ // note: the factor 2.0f probably has to be 1.0f/frustum_size
+ gl::translate(2.0f*(-State::width() * 0.5f + cx)/State::width() , 2.0f*(State::height() * 0.5f - cy)/State::height(), 0.0f);
+
+ gl::frustum(-camera_frustum_size, camera_frustum_size, -camera_frustum_size/State::aspect(), camera_frustum_size/State::aspect(), camera_frustum_front, 1023.0f);
+
+ gl::matrixmode(GL_MODELVIEW);
+ gl::loadidentity();
+
+ // map world coordinates to opengl coordinates
+ gl::rotate(90.0f, 0.0f, 1.0f, 0.0f);
+ gl::rotate(-90.0f, 1.0f , 0.0f, 0.0f);
+
+ gl::translate(distance+1.0f, 0.0f, 0.0f);
+
+ // extra model rotation
+ gl::rotate(-core::application()->time() / 8.0f *360.0f , 0.0f, 0.0f, 1.0f);
+}
+
void Camera::ortho()
{
// switch to orthographic projection