Changeset 8251 in orxonox.OLD for branches/atmospheric_engine/src
- Timestamp:
- Jun 8, 2006, 3:15:59 PM (18 years ago)
- Location:
- branches/atmospheric_engine/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.cc
r8223 r8251 74 74 this->flashRisingTime = 0.5f; 75 75 76 this->width = 40.0f; 77 this->height = 10.0f; 76 this->width = 400.0f; 77 this->height = 100.0f; 78 this->seedWidth = 5; 79 this->seedHeight = 5; 78 80 this->bNewCoordinate = false; 79 81 … … 81 83 this->seedZ = 10.0f; 82 84 this->seedTime = 4.0f; 83 84 lightening1 = 1;85 lightening2 = 2;86 lightening3 = 3;87 85 88 86 this->billboard[0] = new Billboard(NULL); … … 130 128 this->mainPosY = y; 131 129 this->mainPosZ = z; 132 133 } 130 } 131 132 133 void LighteningEffect::setFlashSize(float width, float height, float seedWidth, float seedHeight) 134 { 135 this->width = width; 136 this->height = height; 137 this->seedWidth = seedWidth; 138 this->seedHeight = seedHeight; 139 this->billboard[0]->setSize(this->width, this->height); 140 this->billboard[1]->setSize(this->width, this->height); 141 this->billboard[2]->setSize(this->width, this->height); 142 this->billboard[3]->setSize(this->width, this->height); 143 } 144 134 145 135 146 bool LighteningEffect::activate() … … 158 169 this->time += dt; 159 170 171 /*if( flashLight != NULL) 172 { 173 if((int)(100*time)%2) 174 this->flashLight->setDiffuseColor(0,0,0); 175 else 176 this->flashLight->setDiffuseColor(100,100,100); 177 178 //PRINTF(0)("100*time: %f %i\n", 100*time, (int)(100*time)); 179 }*/ 180 160 181 if( this->time > this->flashFrequency) 161 182 { 162 183 this->billboard[0]->setVisibiliy(true); 163 184 this->time = 0.0f; 185 186 this->flashLight = new Light(); 187 this->flashLight->setAbsCoor(this->billboard[0]->getAbsCoor().x, this->billboard[0]->getAbsCoor().y, this->billboard[0]->getAbsCoor().z); 188 this->flashLight->setDiffuseColor(100,100,100); 189 164 190 //this->soundSource.play(this->thunderBuffer); 165 191 } 166 else if( this->billboard[ lightening3]->isVisible() && this->time > this->flashConstTime)167 { 168 this->billboard[ lightening3]->setVisibiliy(false);192 else if( this->billboard[3]->isVisible() && this->time > this->flashConstTime) 193 { 194 this->billboard[3]->setVisibiliy(false); 169 195 this->time = 0.0f; 170 196 this->bNewCoordinate = true; 171 } 172 173 if( this->billboard[lightening2]->isVisible() && this->time > this->flashRisingTime) 174 { 175 this->billboard[lightening2]->setVisibiliy(false); 176 this->billboard[lightening3]->setVisibiliy(true); 177 } 178 else if( this->billboard[lightening1]->isVisible() && this->time > this->flashRisingTime*2/3 ) 179 { 180 this->billboard[lightening1]->setVisibiliy(false); 181 this->billboard[lightening2]->setVisibiliy(true); 197 198 if(flashLight != NULL) 199 { 200 delete this->flashLight; 201 flashLight = NULL; 202 } 203 } 204 205 if( this->billboard[2]->isVisible() && this->time > this->flashRisingTime) 206 { 207 this->billboard[2]->setVisibiliy(false); 208 this->billboard[3]->setVisibiliy(true); 209 //this->flashLight->setDiffuseColor(0,0,0); 210 } 211 else if( this->billboard[1]->isVisible() && this->time > this->flashRisingTime*2/3 ) 212 { 213 this->billboard[1]->setVisibiliy(false); 214 this->billboard[2]->setVisibiliy(true); 215 // this->flashLight->setDiffuseColor(0,0,0); 182 216 } 183 217 else if( this->billboard[0]->isVisible() && this->time > this->flashRisingTime*1/3 ) 184 218 { 185 219 this->billboard[0]->setVisibiliy(false); 186 this->billboard[lightening1]->setVisibiliy(true); 220 this->billboard[1]->setVisibiliy(true); 221 // this->flashLight->setDiffuseColor(100,100,100); 187 222 } 188 223 … … 194 229 this->billboard[1]->setAbsCoor(posX, this->mainPosY, posZ); 195 230 this->billboard[2]->setAbsCoor(posX, this->mainPosY, posZ); 196 this->billboard[3]->setAbsCoor(posX, this->mainPosY, posZ); 231 this->billboard[3]->setAbsCoor(posX, this->mainPosY, posZ); 197 232 this->bNewCoordinate = false; 198 233 } … … 201 236 void LighteningEffect::draw() const 202 237 { 203 /*if(!this->billboard->isVisible()) 204 return; 205 206 LightManager* lightMan = LightManager::getInstance(); 207 208 (new Light())->setAbsCoor(this->billboard->getAbsCoor().x, this->billboard->getAbsCoor().y, this->billboard->getAbsCoor().z); 209 (new Light())->setDiffuseColor(1,1,1); 210 LightManager::getInstance()->draw(); 211 212 delete lightMan;*/ 213 } 238 } -
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h
r8223 r8251 16 16 17 17 class Billboard; 18 class Light; 18 19 19 20 class LighteningEffect : public WeatherEffect … … 34 35 35 36 void coord(float x, float y, float z); 37 void setFlashSize(float width, float height, float seedWidth, float seedHeight); 36 38 37 39 inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true;} … … 39 41 inline void setFlashConstTime(float flashConstTime) { this->flashConstTime = flashConstTime; } 40 42 inline void setFlashRisingTime(float flashRisingTime) { if(flashRisingTime > this->flashConstTime) 41 this->flashRisingTime = this->flashConstTime/2; 42 else 43 this->flashRisingTime = flashRisingTime; } 44 inline void setFlashSize(float width, float height) { this->width = width; 45 this->height = height; } 43 this->flashRisingTime = this->flashConstTime/2; 44 else 45 this->flashRisingTime = flashRisingTime; } 46 46 inline void setFlashSeed(float seedX, float seedZ, float seedTime) { this->seedX = seedX; 47 this->seedZ = seedZ;48 this->seedTime = seedTime; }47 this->seedZ = seedZ; 48 this->seedTime = seedTime; } 49 49 50 50 void activateLightening() { this->activate(); } … … 54 54 Billboard* billboard[4]; 55 55 bool lighteningActivate; 56 int lightening1;57 int lightening2;58 int lightening3;59 56 60 57 float flashFrequency; … … 67 64 float width; 68 65 float height; 66 float seedWidth; 67 float seedHeight; 69 68 70 69 float seedX; … … 76 75 float mainPosZ; 77 76 77 Light* flashLight; 78 78 79 //OrxSound::SoundSource soundSource; 79 80 //OrxSound::SoundBuffer* thunderBuffer; -
branches/atmospheric_engine/src/world_entities/effects/billboard.cc
r8176 r8251 75 75 void Billboard::loadParams(const TiXmlElement* root) 76 76 { 77 LoadParam(root, "texture", this->material, Material, setDiffuseMap)77 /*LoadParam(root, "texture", this->material, Material, setDiffuseMap) 78 78 .describe("the texture-file to load onto the Billboard"); 79 79 80 80 LoadParam(root, "size", this, Billboard, setSize) 81 .describe("the size of the Billboard in Pixels");81 .describe("the size of the Billboard in Pixels");*/ 82 82 } 83 83 … … 91 91 this->sizeX = sizeX; 92 92 this->sizeY = sizeY; 93 94 PRINTF(0)("sizeX: %f sizeY: %f\n", sizeX, sizeY);95 93 } 96 94
Note: See TracChangeset
for help on using the changeset viewer.