Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc @ 7381

Last change on this file since 7381 was 7381, checked in by hdavid, 18 years ago

branches/atmospheric_engine: renamed classes to WeatherEffect and SunEffect

File size: 2.4 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: hdavid, amaechler
13*/
14
15#include "fog_effect.h"
16
17#include "util/loading/load_param.h"
18#include "util/loading/factory.h"
19
20#include "glincl.h"
21
22
23
24using namespace std;
25
26CREATE_FACTORY(FogEffect, CL_FOG_EFFECT);
27
28
29FogEffect::FogEffect(const TiXmlElement* root)
30{
31  //this->setClassID(CL_FOG_EFFECT, "FogEffect");
32/*
33  this->fogMode = GL_LINEAR;
34  this->fogDensity = 0.001f;
35  this->fogStart = 10.0f;
36  this->fogEnd = 1000.0f;
37*/
38  if (root != NULL)
39    this->loadParams(root);
40
41  this->activate();
42}
43
44
45
46FogEffect::~FogEffect()
47{
48  this->deactivate();
49}
50
51
52void FogEffect::loadParams(const TiXmlElement* root)
53{
54  WeatherEffect::loadParams(root);
55
56/*
57  LoadParam(root, "fog-mode", this, FogEffect, setFogMode);
58
59  LoadParam(root, "fog-density", this, FogEffect, setFogDensity);
60
61  LoadParam(root, "fog-color", this, FogEffect, setFogColor);*/
62
63  LoadParam(root, "test", this, FogEffect, setTest);
64
65
66}
67
68void FogEffect::setTest(int test)
69{
70  PRINTF(0)("\n\ntest: %i\n\n", test);
71}
72
73bool FogEffect::init()
74{}
75
76
77
78bool FogEffect::activate()
79{/*
80  PRINTF(0)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f, color %f, %f, %f\n", this->fogMode, this->fogDensity,
81             this->fogStart, this->fogEnd, this->colorVector.x, this->colorVector.y, this->colorVector.z);
82
83  glEnable(GL_FOG);
84  {
85//     GLfloat fogColor[4] = {0.7, 0.6, 0.6, 1.0};
86    GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
87
88    glFogi(GL_FOG_MODE, this->fogMode);
89    glFogfv(GL_FOG_COLOR, fogColor);
90    glFogf(GL_FOG_DENSITY, this->fogDensity);
91    glHint(GL_FOG_HINT, GL_DONT_CARE);
92    glFogf(GL_FOG_START, this->fogStart);
93    glFogf(GL_FOG_END, this->fogEnd);
94
95    //glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE);
96  }
97  glClearColor(0.5, 0.5, 0.5, 1.0);*/
98}
99
100
101
102bool FogEffect::deactivate()
103{
104  //glDisable(GL_FOG);
105}
106
107
108/*
109GLint FogEffect::stringToFogMode(const std::string& mode)
110{
111  if(mode == "GL_LINEAR")
112    return GL_LINEAR;
113  else if(mode == "GL_EXP")
114    return GL_EXP;
115  else if(mode == "GL_EXP2" )
116    return GL_EXP2;
117  else
118    return -1;
119}
120*/
121
Note: See TracBrowser for help on using the repository browser.