Changeset 7649 in orxonox.OLD for branches/atmospheric_engine
- Timestamp:
- May 17, 2006, 2:24:13 PM (19 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.cc
r7628 r7649 24 24 #include "sprite_particles.h" 25 25 #include "plane_emitter.h" 26 #include "shell_command.h" 26 27 27 28 #include "parser/tinyxml/tinyxml.h" 28 29 29 //SHELL_COMMAND(activate, SnowEffect, activateSnow); 30 SHELL_COMMAND(activate, SnowEffect, activateSnow); 31 SHELL_COMMAND(deactivate, SnowEffect, deactivateSnow); 30 32 31 33 using namespace std; … … 37 39 this->setClassID(CL_SNOW_EFFECT, "SnowEffect"); 38 40 41 this->init(); 42 39 43 if (root != NULL) 40 44 this->loadParams(root); 41 45 42 this->init();43 44 46 this->activate(); 45 47 } … … 57 59 WeatherEffect::loadParams(root); 58 60 59 // LoadParam(root, "snow-mode", this, SnowEffect, setSnowMode); 60 // LoadParam(root, "snow-density", this, SnowEffect, setSnowDensity); 61 // LoadParam(root, "snow-color", this, SnowEffect, setSnowColor); 62 63 61 LoadParam(root, "numParticles", this, SnowEffect, numParticles); 62 LoadParam(root, "materialTexture", this, SnowEffect, materialTexture); 63 LoadParam(root, "lifeSpans", this, SnowEffect, lifeSpan); 64 LoadParam(root, "radius", this, SnowEffect, radius); 65 LoadParam(root, "mass", this, SnowEffect, mass); 66 LoadParam(root, "emissionRate", this, SnowEffect, emissionRate); 67 LoadParam(root, "emissionVelocity", this, SnowEffect, emissionVelocity); 68 LoadParam(root, "spread", this, SnowEffect, spread); 69 LoadParam(root, "size", this, SnowEffect, size); 70 LoadParam(root, "coord", this, SnowEffect, coord); 64 71 } 65 72 … … 67 74 { 68 75 this->emitter = new PlaneEmitter(); 76 77 // Default values 78 particles = 10000; 79 texture = "maps/snow_flake_01_32x32.png"; 80 life = 8; 81 randomLife = 2; 82 snowRadius = 3.5; 83 randomRadius = 1; 84 snowMass = 1.0; 85 randomMass = 0.3; 86 rate = 900; 87 velocity = -200; 88 randomVelocity = 0; 89 angle = 0; 90 randomAngle = 0.3; 91 snowSize = Vector2D(1200, 1200); 92 snowCoord = Vector(100, 600, 200); 69 93 } 70 94 … … 75 99 PRINTF(0)("Activating SnowEffect\n"); 76 100 77 SnowEffect::snowParticles = new SpriteParticles( 10000);101 SnowEffect::snowParticles = new SpriteParticles(particles); 78 102 SnowEffect::snowParticles->setName("SnowEffectTrailParticles"); 79 SnowEffect::snowParticles->setMaterialTexture("maps/snow_flake_01_32x32.png"); 80 //SnowEffect::snowParticles->setSize(1); 81 SnowEffect::snowParticles->setLifeSpan(8, 2); 82 SnowEffect::snowParticles->setRadius(0.0, 5.0, 10.0); 83 SnowEffect::snowParticles->setRadius(0.2, 5.0, 10); 84 SnowEffect::snowParticles->setRadius(1.0, 5.0, 10); 85 SnowEffect::snowParticles->setMass(0, 1.0, .3); 103 SnowEffect::snowParticles->setMaterialTexture(texture); 104 SnowEffect::snowParticles->setLifeSpan(life, randomLife); 105 SnowEffect::snowParticles->setRadius(0.0, snowRadius, randomRadius); 106 SnowEffect::snowParticles->setRadius(0.2, snowRadius, randomRadius); 107 SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius); 108 SnowEffect::snowParticles->setMass(0, snowMass, randomMass); 86 109 SnowEffect::snowParticles->setColor(0,1, 1, 1,.5); 87 110 SnowEffect::snowParticles->setColor(.5, .6, .6, .6, .2); … … 92 115 93 116 // this->updateNode(0); 94 this->emitter->setEmissionRate(900); 95 this->emitter->setEmissionVelocity(150, 50); 96 this->emitter->setSpread(0, .3); 97 this->emitter->setSize(1200, 1200); 117 this->emitter->setRelCoor(snowCoord); 118 this->emitter->setEmissionRate(rate); 119 this->emitter->setEmissionVelocity(velocity, randomVelocity); 120 this->emitter->setSpread(angle, randomAngle); 121 this->emitter->setSize(snowSize); 98 122 } 99 123 … … 106 130 } 107 131 132 void SnowEffect::activateSnow() 133 { 134 this->activate(); 135 } 136 137 void SnowEffect::deactivateSnow() 138 { 139 this->deactivate(); 140 } 141 108 142 void SnowEffect::draw() const 109 143 { … … 113 147 { 114 148 } 149 150 void SnowEffect::numParticles(int n) 151 { 152 this->particles = n; 153 } 154 155 void SnowEffect::materialTexture(const std::string& texture) 156 { 157 this->texture = texture; 158 } 159 160 void SnowEffect::lifeSpan(float lifeSpan, float randomLifeSpan) 161 { 162 this->life = lifeSpan; 163 this->randomLife = randomLifeSpan; 164 } 165 166 void SnowEffect::radius(float radius, float randomRadius) 167 { 168 this->snowRadius = radius; 169 this->randomRadius = randomRadius; 170 } 171 172 void SnowEffect::mass(float mass, float randomMass) 173 { 174 this->snowMass = mass; 175 this->randomMass = randomMass; 176 } 177 178 void SnowEffect::emissionRate(float emissionRate) 179 { 180 this->rate = emissionRate; 181 } 182 183 void SnowEffect::emissionVelocity(float velocity, float randomVelocity) 184 { 185 this->velocity = velocity; 186 this->randomVelocity = randomVelocity; 187 } 188 189 void SnowEffect::spread(float angle, float randomAngle) 190 { 191 this->angle = angle; 192 this->randomAngle = randomAngle; 193 } 194 195 void SnowEffect::size(float sizeX, float sizeY) 196 { 197 this->snowSize = Vector2D(sizeX, sizeY); 198 } 199 200 void SnowEffect::coord( float coorX, float coorY, float coorZ) 201 { 202 this->snowCoord = Vector(coorX, coorY, coorZ); 203 } -
branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.h
r7576 r7649 31 31 virtual void draw() const; 32 32 virtual void tick(float dt); 33 34 void activateSnow(); 35 void deactivateSnow(); 33 36 34 void activateSnow(); 37 private: 38 void numParticles(int n); 39 void materialTexture(const std::string& texture); 40 void lifeSpan(float lifeSpan, float randomLifeSpan); 41 void radius(float radius, float randomRadius); 42 void mass(float mass, float randomMass); 43 void emissionRate(float emissionRate); 44 void emissionVelocity(float velocity, float randomVelocity); 45 void spread(float angle, float randomAngle); 46 void size(float sizeX, float sizeY); 47 void coord(float xCoor, float yCoor, float zCoor); 48 49 int particles; 50 std::string texture; 51 float life, randomLife; 52 float snowRadius, randomRadius; 53 float snowMass, randomMass; 54 float rate; 55 float velocity, randomVelocity; 56 float angle, randomAngle; 57 Vector snowCoord; 58 Vector2D snowSize; 35 59 36 // inline void setSnowMode(const std::string& mode) { this->snowMode = this->stringToSnowMode(mode); }37 // inline void setSnowDensity(float density) { this->snowDensity = density; }38 // inline void setSnowRange(float start, float end) { this->snowStart = start; this->snowEnd = end; }39 // inline void setSnowColor(float r, float g, float b) { this->colorVector = Vector(r, g, b); }40 private:41 // GLint snowMode;42 // GLfloat snowDensity;43 // GLfloat snowStart;44 // GLfloat snowEnd;45 // Vector colorVector;46 60 static SpriteParticles* snowParticles; 47 61
Note: See TracChangeset
for help on using the changeset viewer.