diff options
author | Stijn Buys <ingar@osirion.org> | 2009-04-16 19:36:15 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-04-16 19:36:15 +0000 |
commit | 6ab4021827e91303ac6fe2276f5567810b7e0496 (patch) | |
tree | 82c50c5a4bdc63da51c5bee9c122d165fd872aa6 /src/render/camera.cc | |
parent | a95028547981614e06ea7a6d22b853b85418cea3 (diff) |
updated a few help messages, added 3d modelview to the buy menu
Diffstat (limited to 'src/render/camera.cc')
-rw-r--r-- | src/render/camera.cc | 24 |
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 |