Changeset 8267 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
- Timestamp:
- Jun 8, 2006, 4:28:24 PM (18 years ago)
- File:
-
- 1 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();
Note: See TracChangeset
for help on using the changeset viewer.