Changeset 8837 in orxonox.OLD for branches/mountain_lake
- Timestamp:
- Jun 27, 2006, 5:26:04 PM (18 years ago)
- Location:
- branches/mountain_lake/src/lib/graphics/effects
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mountain_lake/src/lib/graphics/effects/cloud_effect.cc
r8793 r8837 26 26 #include "shader.h" 27 27 #include "shell_command.h" 28 #include "t_animation.h" 28 29 29 30 #include "parser/tinyxml/tinyxml.h" … … 34 35 Vector CloudEffect::newSkyColor; 35 36 37 bool CloudEffect::fadeSky; 38 bool CloudEffect::fadeCloud; 39 float CloudEffect::fadeTime; 40 36 41 using namespace std; 37 42 … … 68 73 { 69 74 PRINTF(0)("Initializing CloudEffect\n"); 70 75 71 76 this->offsetZ = 0; 72 77 this->animationSpeed = 2; … … 75 80 this->planetRadius = 1500; 76 81 this->divs = 50; 82 fadeSky = false; 83 fadeCloud = false; 77 84 78 85 skyColor = Vector(0.0f, 0.0f, 0.8f); … … 80 87 newSkyColor = skyColor; 81 88 newCloudColor = cloudColor; 82 this->fadeTime = 3;83 89 84 90 this->noise3DTexSize = 128; … … 176 182 this->offset->set(0.0f, 0.0f, offsetZ); 177 183 178 //if(cloudColor != newCloudColor) 179 //{ 180 // TODO: fade from cloudColor to newCloudColor 181 cloudColor = newCloudColor; 184 if(cloudColor != newCloudColor) 185 { 186 if(fadeCloud) 187 { 188 this->cloudColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudX); 189 this->cloudColorFadeX->setInfinity(ANIM_INF_CONSTANT); 190 this->cloudColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudY); 191 this->cloudColorFadeY->setInfinity(ANIM_INF_CONSTANT); 192 this->cloudColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudZ); 193 this->cloudColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 194 195 this->cloudColorFadeX->addKeyFrame(cloudColor.x, fadeTime, ANIM_LINEAR); 196 this->cloudColorFadeX->addKeyFrame(newCloudColor.x, 0, ANIM_LINEAR); 197 198 this->cloudColorFadeY->addKeyFrame(cloudColor.y, fadeTime, ANIM_LINEAR); 199 this->cloudColorFadeY->addKeyFrame(newCloudColor.y, 0, ANIM_LINEAR); 200 201 this->cloudColorFadeZ->addKeyFrame(cloudColor.z, fadeTime, ANIM_LINEAR); 202 this->cloudColorFadeZ->addKeyFrame(newCloudColor.z, 0, ANIM_LINEAR); 203 204 fadeCloud = false; 205 206 this->cloudColorFadeX->replay(); 207 this->cloudColorFadeY->replay(); 208 this->cloudColorFadeZ->replay(); 209 } 210 182 211 this->cloudcolor->set(this->cloudColor.x, this->cloudColor.y, this->cloudColor.z); 183 //} 184 //if(cloudColor != newCloudColor) 185 //{ 186 // TODO: fade from skyColor to newSkyColor 187 skyColor = newSkyColor; 212 } 213 214 if(skyColor != newSkyColor) 215 { 216 if(fadeSky) 217 { 218 this->skyColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyX); 219 this->skyColorFadeX->setInfinity(ANIM_INF_CONSTANT); 220 this->skyColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyY); 221 this->skyColorFadeY->setInfinity(ANIM_INF_CONSTANT); 222 this->skyColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyZ); 223 this->skyColorFadeZ->setInfinity(ANIM_INF_CONSTANT); 224 225 this->skyColorFadeX->addKeyFrame(skyColor.x, fadeTime, ANIM_LINEAR); 226 this->skyColorFadeX->addKeyFrame(newSkyColor.x, 0, ANIM_LINEAR); 227 228 this->skyColorFadeY->addKeyFrame(skyColor.y, fadeTime, ANIM_LINEAR); 229 this->skyColorFadeY->addKeyFrame(newSkyColor.y, 0, ANIM_LINEAR); 230 231 this->skyColorFadeZ->addKeyFrame(skyColor.z, fadeTime, ANIM_LINEAR); 232 this->skyColorFadeZ->addKeyFrame(newSkyColor.z, 0, ANIM_LINEAR); 233 234 fadeSky = false; 235 236 this->skyColorFadeX->replay(); 237 this->skyColorFadeY->replay(); 238 this->skyColorFadeZ->replay(); 239 } 240 188 241 this->skycolor->set(this->skyColor.x, this->skyColor.y, this->skyColor.z); 189 //}242 } 190 243 191 244 this->shader->deactivateShader(); … … 194 247 195 248 196 void CloudEffect::changeSkyColor(Vector color) 249 void CloudEffect::setColorSkyX(float color) 250 { 251 skyColor.x = color; 252 } 253 void CloudEffect::setColorSkyY(float color) 254 { 255 skyColor.y = color; 256 } 257 void CloudEffect::setColorSkyZ(float color) 258 { 259 skyColor.z = color; 260 } 261 void CloudEffect::setColorCloudX(float color) 262 { 263 cloudColor.x = color; 264 } 265 void CloudEffect::setColorCloudY(float color) 266 { 267 cloudColor.y = color; 268 } 269 void CloudEffect::setColorCloudZ(float color) 270 { 271 cloudColor.z = color; 272 } 273 274 void CloudEffect::changeSkyColor(Vector color, float time) 197 275 { 198 276 newSkyColor = color; 199 } 200 201 202 void CloudEffect::changeCloudColor(Vector color) 277 fadeSky = true; 278 fadeTime = time; 279 } 280 281 282 void CloudEffect::changeCloudColor(Vector color, float time) 203 283 { 204 284 newCloudColor = color; 285 fadeCloud = true; 286 fadeTime = time; 205 287 } 206 288 -
branches/mountain_lake/src/lib/graphics/effects/cloud_effect.h
r8793 r8837 31 31 #define at2(rx,ry) ( rx * q[0] + ry * q[1] ) 32 32 #define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] ) 33 34 // FORWARD DECLARATION 35 template <class T> class tAnimation; 33 36 34 37 … … 82 85 virtual void tick(float dt); 83 86 84 static void changeSkyColor(Vector color); 85 static void changeCloudColor(Vector color); 87 static void changeSkyColor(Vector color, float time); 88 static void changeCloudColor(Vector color, float time); 89 90 void setColorSkyX(float color); 91 void setColorSkyY(float color); 92 void setColorSkyZ(float color); 93 void setColorCloudX(float color); 94 void setColorCloudY(float color); 95 void setColorCloudZ(float color); 86 96 87 97 static Vector cloudColor; … … 101 111 bool cloudActivate; 102 112 float animationSpeed; 103 float fadeTime;104 113 105 114 static Vector newSkyColor; … … 108 117 // Material cloudMaterial; 109 118 Skydome* skydome; 119 120 tAnimation<CloudEffect>* skyColorFadeX; 121 tAnimation<CloudEffect>* skyColorFadeY; 122 tAnimation<CloudEffect>* skyColorFadeZ; 123 tAnimation<CloudEffect>* cloudColorFadeX; 124 tAnimation<CloudEffect>* cloudColorFadeY; 125 tAnimation<CloudEffect>* cloudColorFadeZ; 126 static bool fadeSky; 127 static bool fadeCloud; 128 static float fadeTime; 110 129 111 130 // SHADER STUFF -
branches/mountain_lake/src/lib/graphics/effects/rain_effect.cc
r8793 r8837 103 103 this->rainFadeOutDuration = 0; 104 104 105 this->cloudColor = Vector(0. 8f, 0.8f, 0.8f);105 this->cloudColor = Vector(0.6f, 0.6f, 0.6f); 106 106 this->skyColor = Vector(0.0f, 0.0f, 0.0f); 107 107 … … 180 180 if (this->rainWindForce != 0) 181 181 this->soundSource.play(this->windBuffer, 0.1f * this->rainWindForce, true); 182 183 if (this->rainFadeInDuration == 0)184 lightMan->setAmbientColor(.1,.1,.1);185 182 186 183 // Change the cloudcolor,skycolor 187 184 this->oldCloudColor = CloudEffect::cloudColor; 188 185 this->oldSkyColor = CloudEffect::skyColor; 189 CloudEffect::changeCloudColor(this->cloudColor );190 CloudEffect::changeSkyColor(this->skyColor );186 CloudEffect::changeCloudColor(this->cloudColor, this->rainFadeInDuration); 187 CloudEffect::changeSkyColor(this->skyColor, this->rainFadeInDuration); 191 188 } 192 189 … … 207 204 lightMan->setAmbientColor(this->rainAmbient, this->rainAmbient, this->rainAmbient); 208 205 209 CloudEffect::changeCloudColor(this->oldCloudColor );210 CloudEffect::changeSkyColor(this->oldSkyColor );206 CloudEffect::changeCloudColor(this->oldCloudColor, this->rainFadeOutDuration); 207 CloudEffect::changeSkyColor(this->oldSkyColor, this->rainFadeOutDuration); 211 208 } 212 209 … … 291 288 292 289 if (!this->rainFadeInDuration > 0) 293 this->rainFadeInDuration = 20;290 this->rainFadeInDuration = 10; 294 291 295 292 this->localTimer = 0; … … 308 305 309 306 if (!this->rainFadeOutDuration > 0) 310 this->rainFadeOutDuration = 20;307 this->rainFadeOutDuration = 10; 311 308 312 309 this->localTimer = 0;
Note: See TracChangeset
for help on using the changeset viewer.