]> git.tdb.fi Git - libs/gl.git/blobdiff - viewer.cpp
Update header names
[libs/gl.git] / viewer.cpp
index 43036209b50b68c171060c7d19afc588f475cbc7..e6826bf052d41ae9744ac20083e47378263479de 100644 (file)
@@ -1,14 +1,7 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2010  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #include <cmath>
 #include <msp/core/application.h>
 #include <msp/fs/utils.h>
-#include <msp/gbase/simplewindow.h>
+#include <msp/graphics/simplewindow.h>
 #include <msp/gl/blend.h>
 #include <msp/gl/camera.h>
 #include <msp/gl/framebuffer.h>
@@ -107,8 +100,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 +219,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 +229,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));
 }