From cd460f42d4468b80d3929aad5b93674fa0b2897c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 30 Jan 2011 09:44:36 +0000 Subject: [PATCH] Adjust depth clip according to camera distance --- viewer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/viewer.cpp b/viewer.cpp index 43036209..d89b34bd 100644 --- a/viewer.cpp +++ b/viewer.cpp @@ -107,8 +107,7 @@ Viewer::Viewer(int argc, char **argv): lighting.attach(0, light); camera.set_up_direction(GL::Vector3(0, 0, 1)); - camera.set_position(GL::Vector3(distance, 0, 0)); - camera.look_at(GL::Vector3(0, 0, 0)); + update_camera(); } Viewer::~Viewer() @@ -227,6 +226,7 @@ void Viewer::update_camera() float cp = cos(pitch); float sp = sin(pitch); camera.set_position(GL::Vector3(-cy*cp*distance, -sy*cp*distance, -sp*distance)); + camera.set_depth_clip(distance*0.02, distance*50); camera.look_at(GL::Vector3(0, 0, 0)); } @@ -236,5 +236,5 @@ void Viewer::update_light() float sy = sin(light_yaw); float cp = cos(light_pitch); float sp = sin(light_pitch); - light.set_position(GL::Vector4(-cy*cp, -sy*cp, -sp)); + light.set_position(GL::Vector4(-cy*cp, -sy*cp, -sp, 0)); } -- 2.45.2