Changeset 8326 in orxonox.OLD for branches/atmospheric_engine/src/lib
- Timestamp:
- Jun 12, 2006, 3:50:16 PM (18 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.cc
r8281 r8326 56 56 57 57 LoadParam(root, "coord", this, LighteningEffect, coord); 58 LoadParam(root, "option", this, LighteningEffect, setLighteningOption);59 58 LoadParam(root, "frequency", this, LighteningEffect, setFlashFrequency); 60 59 LoadParam(root, "const-time", this, LighteningEffect, setFlashConstTime); … … 62 61 LoadParam(root, "size", this, LighteningEffect, setFlashSize); 63 62 LoadParam(root, "seed", this, LighteningEffect, setFlashSeed); 63 64 LOAD_PARAM_START_CYCLE(root, element); 65 { 66 LoadParam_CYCLE(element, "option", this, LighteningEffect, setLighteningOption); 67 } 68 LOAD_PARAM_END_CYCLE(element); 64 69 } 65 70 … … 88 93 this->billboard[0]->setTexture("maps/lightning_bolt1.png"); 89 94 this->billboard[0]->setSize(this->width, this->height); 90 this->billboard[0]->setAbsCoor(3000,850,0);91 95 this->billboard[0]->setVisibiliy(false); 92 96 … … 94 98 this->billboard[1]->setTexture("maps/lightning_bolt2.png"); 95 99 this->billboard[1]->setSize(this->width, this->height); 96 this->billboard[1]->setAbsCoor(3000,850,0);97 100 this->billboard[1]->setVisibiliy(false); 98 101 … … 100 103 this->billboard[2]->setTexture("maps/lightning_bolt3.png"); 101 104 this->billboard[2]->setSize(this->width, this->height); 102 this->billboard[2]->setAbsCoor(3000,850,0);103 105 this->billboard[2]->setVisibiliy(false); 104 106 … … 106 108 this->billboard[3]->setTexture("maps/lightning_bolt4.png"); 107 109 this->billboard[3]->setSize(this->width, this->height); 108 this->billboard[3]->setAbsCoor(3000,850,0);109 110 this->billboard[3]->setVisibiliy(false); 111 112 if (this->lighteningMove) 113 { 114 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 115 this->billboard[0]->setAbsCoor(this->cameraCoor.x+3000,850,this->cameraCoor.z+0); 116 this->billboard[1]->setAbsCoor(this->cameraCoor.x+3000,850,this->cameraCoor.z+0); 117 this->billboard[2]->setAbsCoor(this->cameraCoor.x+3000,850,this->cameraCoor.z+0); 118 this->billboard[3]->setAbsCoor(this->cameraCoor.x+3000,850,this->cameraCoor.z+0); 119 } 120 else 121 { 122 this->billboard[0]->setAbsCoor(3000,850,0); 123 this->billboard[1]->setAbsCoor(3000,850,0); 124 this->billboard[2]->setAbsCoor(3000,850,0); 125 this->billboard[3]->setAbsCoor(3000,850,0); 126 } 110 127 111 128 this->flashLight = new Light(); … … 127 144 void LighteningEffect::coord(float x, float y, float z) 128 145 { 129 this->billboard[0]->setAbsCoor(x, y, z); 130 this->billboard[1]->setAbsCoor(x, y, z); 131 this->billboard[2]->setAbsCoor(x, y, z); 132 this->billboard[3]->setAbsCoor(x, y, z); 146 if (this->lighteningMove) 147 { 148 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 149 this->billboard[0]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 150 this->billboard[1]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 151 this->billboard[2]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 152 this->billboard[3]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z); 153 } 154 else 155 { 156 this->billboard[0]->setAbsCoor(x, y, z); 157 this->billboard[1]->setAbsCoor(x, y, z); 158 this->billboard[2]->setAbsCoor(x, y, z); 159 this->billboard[3]->setAbsCoor(x, y, z); 160 } 133 161 this->mainPosX = x; 134 162 this->mainPosY = y; … … 219 247 if( this->bNewCoordinate) 220 248 { 221 float posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX; 222 float posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX; 249 float posX, posZ; 250 if(this->lighteningMove) 251 { 252 this->cameraCoor = State::getCameraNode()->getAbsCoor(); 253 posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX + this->cameraCoor.x; 254 posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX + this->cameraCoor.z; 255 } 256 else 257 { 258 posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX; 259 posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX; 260 } 261 223 262 this->billboard[0]->setAbsCoor(posX, this->mainPosY, posZ); 224 263 this->billboard[1]->setAbsCoor(posX, this->mainPosY, posZ); -
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h
r8269 r8326 37 37 void setFlashSize(float width, float height, float seedWidth, float seedHeight); 38 38 39 inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true;} 39 inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true; 40 if (option == "movelightening") this->lighteningMove = true;} 40 41 inline void setFlashFrequency(float mainFrequency, float seedTime) { this->mainFrequency = mainFrequency; 41 42 this->flashFrequency = mainFrequency; … … 55 56 Billboard* billboard[4]; 56 57 bool lighteningActivate; 58 bool lighteningMove; 57 59 58 60 float flashFrequency; … … 76 78 float mainPosY; 77 79 float mainPosZ; 80 81 Vector cameraCoor; 78 82 79 83 Light* flashLight;
Note: See TracChangeset
for help on using the changeset viewer.