Changeset 8071 in orxonox.OLD for branches/atmospheric_engine/src
- Timestamp:
- Jun 1, 2006, 3:04:43 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
r8050 r8071 23 23 #include "parser/tinyxml/tinyxml.h" 24 24 25 #include "shell_command.h" 26 27 SHELL_COMMAND(activate, LighteningEffect, activateLightening); 28 SHELL_COMMAND(deactivate, LighteningEffect, deactivateLightening); 29 25 30 using namespace std; 26 31 … … 36 41 this->loadParams(root); 37 42 38 this->activate(); 43 if(this->lighteningActivate) 44 this->activate(); 39 45 } 40 46 … … 47 53 { 48 54 WeatherEffect::loadParams(root); 55 56 LoadParam(root, "coord", this, LighteningEffect, coord); 57 LoadParam(root, "option", this, LighteningEffect, setLighteningOption); 49 58 } 50 59 … … 52 61 bool LighteningEffect::init() 53 62 { 63 lighteningActivate = false; 64 54 65 this->time = 0.0; 55 66 this->flashFrequency = 0.6f; 56 67 this->flashConstTime = 0.07f; 57 68 58 //this->material = new Material(); 59 //this->material->setDiffuseMap("maps/lightning_bolt.png"); 60 //this->offset = Vector(-1440.00, 100.00, 280.00); 61 62 // this->billboard->setAbsCoor(50, 0, 0); 63 this->width = 20.0f; 64 this->height = 5.0f; 69 this->width = 40.0f; 70 this->height = 10.0f; 65 71 this->bNewCoordinate = false; 66 72 67 this->seedX = 20.f;68 this->seedZ = 50.0f;73 this->seedX = 10.f; 74 this->seedZ = 10.0f; 69 75 this->seedTime = 4.0f; 70 76 … … 72 78 this->billboard->setTexture("maps/lightning_bolt.png"); 73 79 this->billboard->setSize(this->width, this->height); 74 this->billboard->setAbsCoor( 50, 0, 0);80 this->billboard->setAbsCoor(0.0f, 50.0f, 0.0f); 75 81 this->billboard->setVisibiliy(false); 76 //this->billboard->setAbsCoor(50, 0, 0);77 //this->billboard->setVisibiliy(true);78 82 79 83 /* … … 89 93 } 90 94 95 void LighteningEffect::coord(float x, float y, float z) 96 { 97 this->billboard->setAbsCoor(x, y, z); 98 this->mainPosX = x; 99 this->mainPosY = y; 100 this->mainPosZ = z; 101 102 } 91 103 92 104 bool LighteningEffect::activate() 93 105 { 94 106 PRINTF(0)( "Activating LighteningEffect\n" ); 95 107 this->billboard->setVisibiliy(true); 108 lighteningActivate = true; 96 109 } 97 110 … … 100 113 { 101 114 PRINTF(0)("Deactivating LighteningEffect\n"); 115 this->billboard->setVisibiliy(false); 116 lighteningActivate = false; 102 117 } 103 118 104 119 void LighteningEffect::tick (float dt) 105 120 { 121 if(!lighteningActivate) 122 return; 123 106 124 this->time += dt; 107 125 … … 121 139 if( this->bNewCoordinate) 122 140 { 123 //this->flashFrequency = this->seedTime * (float)rand()/(float)RAND_MAX + 0.1;124 //this->billboard>setAbsCoor( - 800.0f - this->seedX * (float)rand()/(float)RAND_MAX, 250.00, -200.0f+ this->seedZ * (float)rand()/(float)RAND_MAX);141 this->flashFrequency = this->seedTime * (float)rand()/(float)RAND_MAX + 0.1; 142 this->billboard->setAbsCoor(this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX, this->mainPosY, this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX); 125 143 this->bNewCoordinate = false; 126 144 } -
branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h
r8050 r8071 31 31 32 32 virtual void tick(float dt); 33 34 void coord(float x, float y, float z); 35 36 inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true; 37 /*if (option == "activate") this->snowActivate = true; */} 33 38 39 void activateLightening() { this->activate(); } 40 void deactivateLightening() { this->deactivate(); } 41 34 42 private: 35 43 Billboard* billboard; 44 bool lighteningActivate; 36 45 37 46 float flashFrequency; //!< frequency to activate itself … … 52 61 float seedZ; 53 62 float seedTime; 63 64 float mainPosX; 65 float mainPosY; 66 float mainPosZ; 54 67 55 68 //OrxSound::SoundSource soundSource;
Note: See TracChangeset
for help on using the changeset viewer.