Changeset 8267 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics
- Timestamp:
- Jun 8, 2006, 4:28:24 PM (19 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
r8255 r8267 58 58 LoadParam(root, "range", this, FogEffect, setFogRange); 59 59 LoadParam(root, "color", this, FogEffect, setFogColor); 60 LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn); 61 LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut); 60 62 61 63 LOAD_PARAM_START_CYCLE(root, element); … … 70 72 //default values 71 73 this->fogActivate = false; 72 this->fogFadeDuration = 0; 74 this->fogFadeInDuration = 0; 75 this->fogFadeOutDuration = 0; 73 76 this->localTimer = 0; 74 77 … … 79 82 this->colorVector = Vector(0.7, 0.7, 0.7); 80 83 84 return 0; 81 85 } 82 86 … … 98 102 glEnable(GL_FOG); 99 103 // glClearColor(0.5, 0.5, 0.5, 1.0); 104 105 return 0; 100 106 } 101 107 … … 108 114 109 115 glDisable(GL_FOG); 116 117 return 0; 110 118 } 111 119 112 120 void FogEffect::draw() const { 113 121 114 if (this->fogFade Duration != 0 && this->localTimer < this->fogFadeDuration)122 if (this->fogFadeInDuration > 0 && this->localTimer < this->fogFadeInDuration) 115 123 glFogf(GL_FOG_DENSITY, this->fogFadeDensity); 116 124 //else … … 124 132 125 133 126 if (this->fogFade Duration != 0 && this->localTimer < this->fogFadeDuration) {134 if (this->fogFadeInDuration > 0 && this->localTimer < this->fogFadeInDuration) { 127 135 this->localTimer += dt; 128 float progress = this->localTimer / this->fogFade Duration;136 float progress = this->localTimer / this->fogFadeInDuration; 129 137 this->fogFadeDensity = progress * this->fogDensity; 130 138 } … … 136 144 this->deactivate(); 137 145 138 this->fogFadeDuration = 10; 146 if (!this->fogFadeInDuration > 0) 147 this->fogFadeInDuration = 20; 148 139 149 this->localTimer = 0; 140 150 this->activate(); -
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
r8255 r8267 33 33 inline void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; } 34 34 inline void setFogColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); } 35 inline void setFogFadeIn(float fadein) { this->fogFadeInDuration = fadein; } 36 inline void setFogFadeOut(float fadeout) { this->fogFadeOutDuration = fadeout; } 37 35 38 inline void setFogOption(const std::string& option) { if (option == "activate") this->fogActivate = true; } 36 39 … … 41 44 42 45 bool fogActivate; 43 GLfloat fogFadeDuration; 46 GLfloat fogFadeInDuration; 47 GLfloat fogFadeOutDuration; 48 44 49 float localTimer; 45 50 -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8261 r8267 86 86 LoadParam(root, "life", this, RainEffect, setRainLife); 87 87 LoadParam(root, "wind", this, RainEffect, setRainWind); 88 LoadParam(root, "startraining", this, RainEffect, setRainStart); 88 LoadParam(root, "fadeinduration", this, RainEffect, setRainFadeIn); 89 LoadParam(root, "fadeoutduration", this, RainEffect, setRainFadeOut); 89 90 90 91 LOAD_PARAM_START_CYCLE(root, element); … … 109 110 this->rainMaxParticles = this->rainRate * this->rainLife; 110 111 this->rainWindForce = 0; 111 this->rainStartDuration = 0; 112 this->rainFadeInDuration = 0; 113 this->rainFadeOutDuration = 0; 112 114 this->localTimer = 0; 113 115 this->soundRainVolume = 0.8f; … … 117 119 lightMan = LightManager::getInstance(); 118 120 this->rainAmbient = lightMan->getAmbientColor(); 121 122 return 0; 119 123 } 120 124 … … 155 159 156 160 lightMan->setAmbientColor(.1,.1,.1); 161 162 return 0; 157 163 } 158 164 … … 170 176 // Restore Light Ambient 171 177 lightMan->setAmbientColor(this->rainAmbient, this->rainAmbient, this->rainAmbient); 178 179 return 0; 172 180 } 173 181 … … 182 190 } 183 191 184 if (this->rain StartDuration != 0 && this->localTimer < this->rainStartDuration) {192 if (this->rainFadeInDuration != 0 && this->localTimer < this->rainFadeInDuration) { 185 193 this->localTimer += dt; 186 float progress = this->localTimer / this->rain StartDuration;194 float progress = this->localTimer / this->rainFadeInDuration; 187 195 188 196 // Dim Light … … 210 218 this->deactivate(); 211 219 212 this->rainStartDuration = 10; 220 if (!this->rainFadeInDuration > 0) 221 this->rainFadeInDuration = 20; 222 213 223 this->localTimer = 0; 214 224 this->activate(); -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h
r8255 r8267 47 47 inline void setRainLife(float life) { this->rainLife = life; } 48 48 inline void setRainWind(int force) { this->rainWindForce = force; } 49 inline void setRainStart(float duration) { this->rainStartDuration = duration; } 49 inline void setRainStart(float duration) { this->rainFadeInDuration = duration; } 50 51 inline void setRainFadeIn(float fadein) { this->rainFadeInDuration = fadein; } 52 inline void setRainFadeOut(float fadeout) { this->rainFadeOutDuration = fadeout; } 53 50 54 51 55 inline void setRainOption(const std::string& option) { … … 59 63 ParticleEmitter* emitter; 60 64 65 GLfloat rainFadeInDuration; 66 GLfloat rainFadeOutDuration; 61 67 float localTimer; 62 68 … … 68 74 GLfloat rainMaxParticles; 69 75 int rainWindForce; 70 GLfloat rainStartDuration;71 76 bool rainMove; 72 77 bool rainActivate; -
branches/atmospheric_engine/src/lib/graphics/graphics_engine.cc
r8148 r8267 145 145 return -1; 146 146 this->initVideo(640, 480, 16); 147 148 return 0; 147 149 } 148 150 … … 186 188 187 189 //ge->activate(); 190 191 return 0; 188 192 } 189 193 … … 238 242 239 243 this->isInit = true; 244 245 return 0; 240 246 } 241 247 … … 289 295 glEnable(GL_CULL_FACE); 290 296 glCullFace(GL_FRONT); 297 298 return 0; 291 299 } 292 300 … … 379 387 } 380 388 #endif /* __WIN32__ */ 389 390 return 0; 381 391 } 382 392 … … 413 423 { 414 424 this->setResolution(resizeInfo.w, resizeInfo.h, this->bitsPerPixel); 425 426 return 0; 415 427 } 416 428
Note: See TracChangeset
for help on using the changeset viewer.