Changeset 8700 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects
- Timestamp:
- Jun 22, 2006, 9:24:24 AM (18 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.cc
r8668 r8700 65 65 this->animationSpeed = 2; 66 66 this->lightPos = Vector(0,0,0); 67 this->scale = 0.0 1f;68 this->atmosphericRadius = 120;69 this->planetRadius = 90;70 this->divs = 100;67 this->scale = 0.0008f; 68 this->atmosphericRadius = 4000; 69 this->planetRadius = 1500; 70 this->divs = 50; 71 71 72 72 noise3DTexSize = 128; … … 149 149 if (!this->cloudActivate) 150 150 return; 151 151 152 152 glPushAttrib(GL_ENABLE_BIT); 153 153 -
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
r8521 r8700 69 69 // default values 70 70 this->fogMode = GL_LINEAR; 71 this->fogDensity = 0.0 3;71 this->fogDensity = 0.005; 72 72 this->fogStart = 0; 73 this->fogEnd = 50;73 this->fogEnd = 200; 74 74 this->colorVector = Vector(0.3, 0.3, 0.3); 75 75 -
branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
r8521 r8700 5 5 #ifndef _FOG_EFFECT 6 6 #define _FOG_EFFECT 7 8 7 9 8 #include "weather_effect.h" -
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.cc
r8495 r8700 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: hdavid, amaechler … … 16 16 17 17 #include "state.h" 18 18 19 #include "util/loading/load_param.h" 19 20 #include "util/loading/factory.h" 21 #include "util/loading/resource_manager.h" 22 20 23 #include "effects/billboard.h" 21 24 … … 37 40 LighteningEffect::LighteningEffect(const TiXmlElement* root) 38 41 { 39 40 41 42 43 44 45 46 47 42 this->setClassID(CL_LIGHTENING_EFFECT, "LighteningEffect"); 43 44 this->init(); 45 46 if (root != NULL) 47 this->loadParams(root); 48 49 if(this->lighteningActivate) 50 this->activate(); 48 51 } 49 52 50 53 LighteningEffect::~LighteningEffect() 51 54 { 52 55 this->deactivate(); 53 56 } 54 57 55 58 void LighteningEffect::loadParams(const TiXmlElement* root) 56 59 { 57 58 59 60 61 62 63 64 65 66 67 68 69 70 60 WeatherEffect::loadParams(root); 61 62 LoadParam(root, "coord", this, LighteningEffect, coord); 63 LoadParam(root, "frequency", this, LighteningEffect, setFlashFrequency); 64 LoadParam(root, "const-time", this, LighteningEffect, setFlashConstTime); 65 LoadParam(root, "rising-time", this, LighteningEffect, setFlashRisingTime); 66 LoadParam(root, "size", this, LighteningEffect, setFlashSize); 67 LoadParam(root, "seed", this, LighteningEffect, setFlashSeed); 68 69 LOAD_PARAM_START_CYCLE(root, element); 70 { 71 LoadParam_CYCLE(element, "option", this, LighteningEffect, setLighteningOption); 72 } 73 LOAD_PARAM_END_CYCLE(element); 71 74 } 72 75 … … 74 77 void LighteningEffect::init() 75 78 { 76 77 78 79 80 81 82 83 84 85 86 87 88 89 79 //default values 80 this->lighteningActivate = false; 81 82 this->time = 0.0; 83 this->flashFrequency = 4.0f; 84 this->mainFrequency = 4.0f; 85 this->flashConstTime = 0.1f; 86 this->flashRisingTime = 0.03f; 87 88 this->width = 700.0f; 89 this->height = 250.0f; 90 this->seedWidth = 50.0f; 91 this->seedHeight = 50.0f; 92 this->bNewCoordinate = false; 90 93 this->lighteningMove = false; 91 94 92 93 94 95 this->seedX = 500.f; 96 this->seedZ = 1000.0f; 97 this->seedTime = 2.0f; 95 98 96 99 this->mainPosX = 3000; … … 98 101 this->mainPosZ = 0; 99 102 100 // initialize lightening textures 101 this->billboard[0] = new Billboard(NULL); 102 this->billboard[0]->setTexture("maps/lightning_bolt1.png"); 103 this->billboard[0]->setSize(this->width, this->height); 104 this->billboard[0]->setVisibiliy(false); 105 106 this->billboard[1] = new Billboard(NULL); 107 this->billboard[1]->setTexture("maps/lightning_bolt2.png"); 108 this->billboard[1]->setSize(this->width, this->height); 109 this->billboard[1]->setVisibiliy(false); 110 111 this->billboard[2] = new Billboard(NULL); 112 this->billboard[2]->setTexture("maps/lightning_bolt3.png"); 113 this->billboard[2]->setSize(this->width, this->height); 114 this->billboard[2]->setVisibiliy(false); 115 116 this->billboard[3] = new Billboard(NULL); 117 this->billboard[3]->setTexture("maps/lightning_bolt4.png"); 118 this->billboard[3]->setSize(this->width, this->height); 119 this->billboard[3]->setVisibiliy(false); 120 121 if (this->lighteningMove) { 122 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 123 this->billboard[0]->setAbsCoor(this->cameraCoor.x+3000,900,this->cameraCoor.z+0); 124 this->billboard[1]->setAbsCoor(this->cameraCoor.x+3000,900,this->cameraCoor.z+0); 125 this->billboard[2]->setAbsCoor(this->cameraCoor.x+3000,900,this->cameraCoor.z+0); 126 this->billboard[3]->setAbsCoor(this->cameraCoor.x+3000,900,this->cameraCoor.z+0); 127 } else { 128 this->billboard[0]->setAbsCoor(3000,900,0); 129 this->billboard[1]->setAbsCoor(3000,900,0); 130 this->billboard[2]->setAbsCoor(3000,900,0); 131 this->billboard[3]->setAbsCoor(3000,900,0); 132 } 133 134 this->flashLight = new Light(); 135 this->flashLight->setDiffuseColor(0,0,0); 136 this->flashLight->setSpecularColor(0,0,0); 137 138 /* 139 this->soundSource = NULL; 140 this->thunderBuffer = NULL; 141 142 this->soundSource.setSourceNode(this); 143 144 //load sound 145 if (this->thunderBuffer != NULL) 146 ResourceManager::getInstance()->unload(this->thunderBuffer); 147 this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/thunder.wav", WAV);*/ 103 // initialize lightening textures 104 this->billboard[0] = new Billboard(NULL); 105 this->billboard[0]->setTexture("maps/lightning_bolt1.png"); 106 this->billboard[0]->setSize(this->width, this->height); 107 this->billboard[0]->setVisibiliy(false); 108 109 this->billboard[1] = new Billboard(NULL); 110 this->billboard[1]->setTexture("maps/lightning_bolt2.png"); 111 this->billboard[1]->setSize(this->width, this->height); 112 this->billboard[1]->setVisibiliy(false); 113 114 this->billboard[2] = new Billboard(NULL); 115 this->billboard[2]->setTexture("maps/lightning_bolt3.png"); 116 this->billboard[2]->setSize(this->width, this->height); 117 this->billboard[2]->setVisibiliy(false); 118 119 this->billboard[3] = new Billboard(NULL); 120 this->billboard[3]->setTexture("maps/lightning_bolt4.png"); 121 this->billboard[3]->setSize(this->width, this->height); 122 this->billboard[3]->setVisibiliy(false); 123 124 if (this->lighteningMove) 125 { 126 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 127 this->billboard[0]->setAbsCoor(this->cameraCoor.x+3000,900,this->cameraCoor.z+0); 128 this->billboard[1]->setAbsCoor(this->cameraCoor.x+3000,900,this->cameraCoor.z+0); 129 this->billboard[2]->setAbsCoor(this->cameraCoor.x+3000,900,this->cameraCoor.z+0); 130 this->billboard[3]->setAbsCoor(this->cameraCoor.x+3000,900,this->cameraCoor.z+0); 131 } 132 else 133 { 134 this->billboard[0]->setAbsCoor(3000,900,0); 135 this->billboard[1]->setAbsCoor(3000,900,0); 136 this->billboard[2]->setAbsCoor(3000,900,0); 137 this->billboard[3]->setAbsCoor(3000,900,0); 138 } 139 140 this->flashLight = new Light(); 141 this->flashLight->setDiffuseColor(0,0,0); 142 this->flashLight->setSpecularColor(0,0,0); 143 144 // this->soundSource = NULL; 145 // this->thunderBuffer = NULL; 146 147 // this->soundSource.setSourceNode(this); 148 149 //load sound 150 if (this->thunderBuffer != NULL) 151 ResourceManager::getInstance()->unload(this->thunderBuffer); 152 this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV); 148 153 149 154 } … … 151 156 void LighteningEffect::coord(float x, float y, float z) 152 157 { 153 if (this->lighteningMove) { 154 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 155 this->billboard[0]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 156 this->billboard[1]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 157 this->billboard[2]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 158 this->billboard[3]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 159 } else { 160 this->billboard[0]->setAbsCoor(x, y, z); 161 this->billboard[1]->setAbsCoor(x, y, z); 162 this->billboard[2]->setAbsCoor(x, y, z); 163 this->billboard[3]->setAbsCoor(x, y, z); 164 } 165 166 this->mainPosX = x; 167 this->mainPosY = y; 168 this->mainPosZ = z; 158 if (this->lighteningMove) 159 { 160 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 161 this->billboard[0]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 162 this->billboard[1]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 163 this->billboard[2]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 164 this->billboard[3]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 165 } 166 else 167 { 168 this->billboard[0]->setAbsCoor(x, y, z); 169 this->billboard[1]->setAbsCoor(x, y, z); 170 this->billboard[2]->setAbsCoor(x, y, z); 171 this->billboard[3]->setAbsCoor(x, y, z); 172 } 173 174 this->mainPosX = x; 175 this->mainPosY = y; 176 this->mainPosZ = z; 169 177 } 170 178 … … 172 180 void LighteningEffect::setFlashSize(float width, float height, float seedWidth, float seedHeight) 173 181 { 174 175 176 177 178 179 180 181 182 182 this->width = width; 183 this->height = height; 184 this->seedWidth = seedWidth; 185 this->seedHeight = seedHeight; 186 187 this->billboard[0]->setSize(this->width, this->height); 188 this->billboard[1]->setSize(this->width, this->height); 189 this->billboard[2]->setSize(this->width, this->height); 190 this->billboard[3]->setSize(this->width, this->height); 183 191 } 184 192 … … 186 194 void LighteningEffect::activate() 187 195 { 188 189 190 191 196 PRINTF(0)( "Activating LighteningEffect\n" ); 197 this->lighteningActivate = true; 198 199 this->time = 0; 192 200 } 193 201 … … 195 203 void LighteningEffect::deactivate() 196 204 { 197 198 199 200 201 202 203 205 PRINTF(0)("Deactivating LighteningEffect\n"); 206 this->lighteningActivate = false; 207 208 this->billboard[0]->setVisibiliy(false); 209 this->billboard[1]->setVisibiliy(false); 210 this->billboard[2]->setVisibiliy(false); 211 this->billboard[3]->setVisibiliy(false); 204 212 } 205 213 206 214 void LighteningEffect::tick (float dt) 207 215 { 208 if(!lighteningActivate) 209 return; 210 211 this->time += dt; 212 213 // TODO: Make random flashing with short light dingsda:) 214 215 if( this->time > this->flashFrequency) { 216 217 this->billboard[0]->setVisibiliy(true); 218 this->time = 0.0f; 219 220 this->flashLight->setAbsCoor(this->billboard[0]->getAbsCoor().x, this->billboard[0]->getAbsCoor().y, this->billboard[0]->getAbsCoor().z); 221 222 // flash environmental lightening 223 this->flashLight->setDiffuseColor(1,1,1); 224 this->flashLight->setSpecularColor(1,1,1); 225 226 //this->soundSource.play(this->thunderBuffer); 227 228 } else if( this->billboard[3]->isVisible() && this->time > this->flashConstTime) { 229 230 this->billboard[3]->setVisibiliy(false); 231 this->time = 0.0f; 232 this->flashLight->setDiffuseColor(0,0,0); 233 this->flashLight->setSpecularColor(0,0,0); 234 this->bNewCoordinate = true; 235 236 } 237 238 if( this->billboard[2]->isVisible() && this->time > this->flashRisingTime) { 239 240 this->billboard[2]->setVisibiliy(false); 241 this->billboard[3]->setVisibiliy(true); 242 // this->flashLight->setDiffuseColor(1,1,1); 243 // this->flashLight->setSpecularColor(1,1,1); 244 245 } else if( this->billboard[1]->isVisible() && this->time > this->flashRisingTime*2/3 ) { 246 247 this->billboard[1]->setVisibiliy(false); 248 this->billboard[2]->setVisibiliy(true); 249 //this->flashLight->setDiffuseColor(0,0,0); 250 //this->flashLight->setSpecularColor(0,0,0); 251 252 } else if( this->billboard[0]->isVisible() && this->time > this->flashRisingTime*1/3 ) { 253 254 this->billboard[0]->setVisibiliy(false); 255 this->billboard[1]->setVisibiliy(true); 256 //this->flashLight->setDiffuseColor(1,1,1); 257 //this->flashLight->setSpecularColor(1,1,1); 258 259 } 260 261 if( this->bNewCoordinate) { 262 float posX, posZ; 263 264 if(this->lighteningMove) { 265 266 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 267 posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX + this->cameraCoor.x; 268 posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX + this->cameraCoor.z; 269 270 } else { 271 272 posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX; 273 posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX; 274 275 } 276 277 this->billboard[0]->setAbsCoor(posX, this->mainPosY, posZ); 278 this->billboard[1]->setAbsCoor(posX, this->mainPosY, posZ); 279 this->billboard[2]->setAbsCoor(posX, this->mainPosY, posZ); 280 this->billboard[3]->setAbsCoor(posX, this->mainPosY, posZ); 281 282 this->flashFrequency = this->mainFrequency + this->seedTime * (float)rand()/(float)RAND_MAX; 283 284 float w = this->width + this->seedWidth * (float)rand()/(float)RAND_MAX; 285 float h = this->height + this->seedHeight * (float)rand()/(float)RAND_MAX; 286 287 this->billboard[0]->setSize(w, h); 288 this->billboard[1]->setSize(w, h); 289 this->billboard[2]->setSize(w, h); 290 this->billboard[3]->setSize(w, h); 291 292 this->bNewCoordinate = false; 293 } 294 } 295 296 void LighteningEffect::draw() const 297 { 298 } 216 if(!lighteningActivate) 217 return; 218 219 this->time += dt; 220 221 float x; 222 x = (float)rand()/(float)RAND_MAX; 223 224 // TODO: Make random flashing with short light dingsda:) 225 226 if( this->time > this->flashFrequency) 227 { 228 // Reset timer 229 this->time = 0.0f; 230 231 // Move billboard to start position 232 this->flashLight->setAbsCoor(this->billboard[0]->getAbsCoor().x, this->billboard[0]->getAbsCoor().y, this->billboard[0]->getAbsCoor().z); 233 234 // Start a flash & lightening cycle 235 this->billboard[0]->setVisibiliy(true); 236 237 // Lighten up environment 238 this->flashLight->setDiffuseColor(1,1,1); 239 this->flashLight->setSpecularColor(1,1,1); 240 241 // Play thunder sound 242 this->soundSource.play(this->thunderBuffer); 243 } 244 245 if( this->billboard[0]->isVisible() && this->time > this->flashRisingTime*1/3 ) 246 { 247 this->billboard[0]->setVisibiliy(false); 248 this->billboard[1]->setVisibiliy(true); 249 } 250 else if( this->billboard[1]->isVisible() && this->time > this->flashRisingTime*2/3 ) 251 { 252 this->billboard[1]->setVisibiliy(false); 253 this->billboard[2]->setVisibiliy(true); 254 255 } 256 else if( this->billboard[2]->isVisible() && this->time > this->flashRisingTime) 257 { 258 this->billboard[2]->setVisibiliy(false); 259 this->billboard[3]->setVisibiliy(true); 260 } 261 262 if( this->billboard[3]->isVisible() && this->time > this->flashConstTime) 263 { 264 this->billboard[3]->setVisibiliy(false); 265 this->time = 0.0f; 266 this->flashLight->setDiffuseColor(0,0,0); 267 this->flashLight->setSpecularColor(0,0,0); 268 this->bNewCoordinate = true; 269 } 270 271 if( this->bNewCoordinate) 272 { 273 float posX, posZ; 274 275 if(this->lighteningMove) 276 { 277 278 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 279 posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX + this->cameraCoor.x; 280 posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX + this->cameraCoor.z; 281 282 } 283 else 284 { 285 286 posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX; 287 posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX; 288 289 } 290 291 this->billboard[0]->setAbsCoor(posX, this->mainPosY, posZ); 292 this->billboard[1]->setAbsCoor(posX, this->mainPosY, posZ); 293 this->billboard[2]->setAbsCoor(posX, this->mainPosY, posZ); 294 this->billboard[3]->setAbsCoor(posX, this->mainPosY, posZ); 295 296 this->flashFrequency = this->mainFrequency + this->seedTime * (float)rand()/(float)RAND_MAX; 297 298 float w = this->width + this->seedWidth * (float)rand()/(float)RAND_MAX; 299 float h = this->height + this->seedHeight * (float)rand()/(float)RAND_MAX; 300 301 this->billboard[0]->setSize(w, h); 302 this->billboard[1]->setSize(w, h); 303 this->billboard[2]->setSize(w, h); 304 this->billboard[3]->setSize(w, h); 305 306 this->bNewCoordinate = false; 307 } 308 } -
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h
r8495 r8700 33 33 inline void deactivateLightening() { this->deactivate(); } 34 34 35 virtual void draw() const;36 35 virtual void tick(float dt); 37 36 … … 77 76 float time; 78 77 79 bool bNewCoordinate; 78 bool flashingActive; 79 bool bNewCoordinate; 80 80 81 float width; 81 82 float height; … … 95 96 Light* flashLight; 96 97 97 //OrxSound::SoundSource soundSource;98 //OrxSound::SoundBuffer* thunderBuffer;98 OrxSound::SoundSource soundSource; 99 OrxSound::SoundBuffer* thunderBuffer; 99 100 100 101 }; -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8521 r8700 1 1 /* 2 orxonox - the future of 3D-vertical-scrollers3 4 Copyright (C) 2004 orx5 6 This program is free software; you can redistribute it and/or modify7 it under the terms of the GNU General Public License as published by8 the Free Software Foundation; either version 2, or (at your option)9 any later version.10 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 11 ### File Specific: 12 main-programmer: hdavid, amaechler12 main-programmer: hdavid, amaechler 13 13 */ 14 14
Note: See TracChangeset
for help on using the changeset viewer.