Changeset 6768 in orxonox.OLD for branches/network/src/lib/graphics/effects/fog_effect.cc
- Timestamp:
- Jan 26, 2006, 1:13:10 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/graphics/effects/fog_effect.cc
r6752 r6768 22 22 #include "factory.h" 23 23 24 #include "glincl.h" 25 26 24 27 25 28 using namespace std; 26 29 27 CREATE_FACTORY(FogEffect, CL_ LIGHT);30 CREATE_FACTORY(FogEffect, CL_FOG_EFFECT); 28 31 29 32 … … 35 38 FogEffect::FogEffect(const TiXmlElement* root) 36 39 { 40 41 this->fogMode = GL_EXP2; 42 this->fogDensity = 0.001f; 43 this->fogStart = 10.0f; 44 this->fogEnd = 1000.0f; 45 37 46 38 47 if (root != NULL) … … 55 64 GraphicsEffect::loadParams(root); 56 65 57 // LoadParam(root, "diffuse-color", this, FogEffect, setDiffuseColor) 58 // .describe("sets the diffuse color of the FogEffect (red [0-1], green [0-1], blue [0-1])"); 66 LoadParam(root, "fog-effect", this, FogEffect, setFogMode) 67 .describe("sets the the fog mode {GL_LINEAR, GL_EXP, GL_EXP2}"); 68 69 LoadParam(root, "fog-density", this, FogEffect, setFogDensity) 70 .describe("sets the the fog density of the exponentionl functions"); 71 72 LoadParam(root, "fog-range", this, FogEffect, setFogRange) 73 .describe("sets the the range of the linear functions"); 59 74 } 60 75 … … 72 87 bool FogEffect::activate() 73 88 { 74 /* glEnable(GL_FOG); 89 PRINTF(4)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity, 90 this->fogStart, this->fogEnd); 91 92 glEnable(GL_FOG); 75 93 { 76 GLfloat fogColor[4] = {0.5, 0.5, 1.0};94 GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0}; 77 95 78 GLint fogMode = GL_EXP; 79 glFogi(GL_FOG_MODE, fogMode); 96 glFogi(GL_FOG_MODE, this->fogMode); 80 97 glFogfv(GL_FOG_COLOR, fogColor); 81 gfFogf(GL_FOG_DENSITY, 0.35f); 98 glFogf(GL_FOG_DENSITY, this->fogDensity); 99 glHint(GL_FOG_HINT, GL_DONT_CARE); 100 glFogf(GL_FOG_START, this->fogStart); 101 glFogf(GL_FOG_END, this->fogEnd); 82 102 83 84 }*/ 103 //glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE); 104 } 105 glClearColor(0.5, 0.5, 0.5, 1.0); 85 106 } 86 107 … … 90 111 */ 91 112 bool FogEffect::deactivate() 92 {} 113 { 114 glDisable(GL_FOG); 115 } 116 117 118 /** 119 * converts a gl mode char to a GLint 120 * @param mode the mode character 121 */ 122 GLint FogEffect::charToFogMode(const char* mode) 123 { 124 if( !strcmp( "GL_LINEAR", mode)) 125 return GL_LINEAR; 126 else if( !strcmp("GL_EXP", mode)) 127 return GL_EXP; 128 else if(!strcmp("GL_EXP2", mode) ) 129 return GL_EXP2; 130 else 131 return -1; 132 } 133
Note: See TracChangeset
for help on using the changeset viewer.