From 6d29d8a5aed5af58cca4de9cb878a261bf11c110 Mon Sep 17 00:00:00 2001 From: Yoann Date: Sat, 14 Jan 2012 15:27:16 +0100 Subject: [PATCH] =?UTF-8?q?R=C3=A9ajustement=20de=20la=20skybox.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.cpp | 35 ++++++++++++++++++++--------------- view.hh | 3 ++- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/view.cpp b/view.cpp index b4afc5b..1fdb372 100644 --- a/view.cpp +++ b/view.cpp @@ -9,7 +9,7 @@ View::View(Chose* _root) fogColor[1] = 0.5; fogColor[2] = 0.5; fogColor[3] = 1.0; - density = 0.00001; + density = 0.000015; initWindow(); mainLoop(); } @@ -92,20 +92,10 @@ void View::displayAxes() { glEnable(GL_LIGHTING); } -void View::renderScene(int lastTime, int currentTime) { - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ; - - camera.animation(currentTime-lastTime); - camera.setCamera(); - lod.setCamera(camera.cameraCenter); - - setLight(); - //displayAxes(); - int z = 40000; - int d = 70000; +void View::setSkybox() { + int z = 40000; + int d = 160000; + glDisable(GL_FOG); glDisable(GL_LIGHTING); glPushMatrix(); glTranslated(camera.cameraCenter.x,camera.cameraCenter.y,0); @@ -137,6 +127,21 @@ void View::renderScene(int lastTime, int currentTime) { glEnd(); glPopMatrix(); glEnable(GL_LIGHTING); + glEnable(GL_FOG); +} + +void View::renderScene(int lastTime, int currentTime) { + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ; + + camera.animation(currentTime-lastTime); + camera.setCamera(); + lod.setCamera(camera.cameraCenter); + + setLight(); + setSkybox(); glBegin(GL_TRIANGLES); root->display(); diff --git a/view.hh b/view.hh index 28cef9e..72e6d94 100644 --- a/view.hh +++ b/view.hh @@ -38,7 +38,7 @@ private : public : Camera camera; static const int frontFrustum = 1; - static const int backFrustum = 160000; // 1km + static const int backFrustum = 400000; // 1km private: Lod lod; GLfloat fogColor[4]; @@ -57,6 +57,7 @@ public : private : void setLight(); + void setSkybox(); }; #endif