commit d3f85ce2fbb370dec5b4de684bf9cb21ac4484da
parent c6ffb83438869e80334e4cdb2f6ccc1f35366ba1
Author: Yoann <yoann.b87@voila.fr>
Date: Fri, 13 Jan 2012 18:03:47 +0100
première version de brouillard.
Diffstat:
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/view.cpp b/view.cpp
@@ -4,6 +4,12 @@ View::View(Chose* _root)
: root(_root),
camera(Camera(Vertex(9600,10000,15300),0,179,1000,0.6f)),
lod(camera.cameraCenter, _root) {
+
+ fogColor[0] = 0.5;
+ fogColor[1] = 0.5;
+ fogColor[2] = 0.5;
+ fogColor[3] = 1.0;
+ density = 0.000015;
initWindow();
mainLoop();
}
@@ -40,6 +46,12 @@ void View::initWindow() {
glEnable(GL_LIGHTING); // Active l'éclairage
glEnable(GL_LIGHT0); // Active la lumière 0;
+
+ glEnable (GL_FOG);
+ glFogi (GL_FOG_MODE, GL_EXP2);
+ glFogfv (GL_FOG_COLOR, fogColor);
+ glFogf (GL_FOG_DENSITY, density);
+ glHint (GL_FOG_HINT, GL_NICEST);
}
void View::setLight() {
diff --git a/view.hh b/view.hh
@@ -41,7 +41,8 @@ public :
static const int backFrustum = 100000; // 1km
private:
Lod lod;
-
+ GLfloat fogColor[4];
+ GLfloat density;
static const int windowWidth = 1024;
static const int windowHeight = 768;