Changeset 4351 in orxonox.OLD for orxonox/trunk/src/subprojects/particles
- Timestamp:
- May 28, 2005, 12:45:10 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/subprojects/particles/particle_fun.cc
r4349 r4351 21 21 #include "particle_engine.h" 22 22 23 #define PINIT_EMISSION_RATE 50 24 #define PINIT_EMISSION_VELOCITY 5.0 25 #define PINIT_SPREAD_ANGLE 0.1 26 #define PINIT_EMITTER_TYPE EMITTER_DOT 27 #define PINIT_EMITTER_SIZE 1.0 28 #define PINIT_START_RADIUS 5.0 29 #define PINIT_END_RADIUS 0.0 30 #define PINIT_LIFESPAN 1.0 31 #define PINIT_CONSERVE_FACTOR 1.0 32 #define PINIT_PARTICLE_TYPE PARTICLE_SPRITE 33 #define PINIT_INHERIT_SPEED 0.0 34 23 35 24 36 void Framework::moduleInit(int argc, char** argv) 25 37 { 26 38 // Creating a Test Particle System 27 ParticleSystem* system = new ParticleSystem(100000, P ARTICLE_SPRITE);28 system->setRadius( 0,0,0,0);29 system->setLifeSpan( 0);30 system->setConserve( 1.0);39 ParticleSystem* system = new ParticleSystem(100000, PINIT_PARTICLE_TYPE); 40 system->setRadius(PINIT_START_RADIUS, PINIT_END_RADIUS ,0 ,0); 41 system->setLifeSpan(PINIT_LIFESPAN); 42 system->setConserve(PINIT_CONSERVE_FACTOR); 31 43 32 44 // Creating a Test Particle Emitter 33 45 ParticleEmitter* emitter = new ParticleEmitter(Vector(0 , 1, 0)); 34 emitter->setEmissionRate( 0);35 emitter->setEmissionVelocity( 0,0);36 emitter->setSpread( 0,0);37 emitter->setType( EMITTER_DOT);38 emitter->setSize( 0);46 emitter->setEmissionRate(PINIT_EMISSION_RATE); 47 emitter->setEmissionVelocity(PINIT_EMISSION_VELOCITY ,0); 48 emitter->setSpread(PINIT_SPREAD_ANGLE ,0); 49 emitter->setType(PINIT_EMITTER_TYPE); 50 emitter->setSize(PINIT_EMITTER_SIZE); 39 51 // Add the Flow from the Emitter into the System 40 52 ParticleEngine::getInstance()->addConnection(emitter, system); … … 123 135 const char* name = option->getTitle(); 124 136 char* value = option->save(); 125 printf("%s\n", value);126 137 127 138 ParticleSystem* tmpSys = ParticleEngine::getInstance()->getSystemByNumber(1); … … 168 179 PRINT(3)("ParticleInheritSpeed set to %f\n", atof(value)); 169 180 } 170 181 else if (!strcmp(name, "RandomColor")) 182 { 183 tmpSys->setColor((float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, 1, 184 (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, .5, 185 (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, 0); 186 } 171 187 } 172 188 delete value; … … 191 207 Slider* EmissionRate = new Slider("EmissionRate", 0, 1000); 192 208 EmissionRate->connectSignal("value_changed", (void*)EmissionRate, emitterChange ); 209 EmissionRate->setValue(PINIT_EMISSION_RATE); 210 EmissionRate->redraw(); 193 211 emitterBox->fill(EmissionRate); 194 212 … … 197 215 velocity->setExactness(2); 198 216 velocity->connectSignal("value_changed", (void*)velocity, emitterChange ); 217 velocity->setValue(PINIT_EMISSION_VELOCITY); 218 velocity->redraw(); 199 219 emitterBox->fill(velocity); 200 220 … … 203 223 SpreadAngle->setExactness(3); 204 224 SpreadAngle->connectSignal("value_changed", (void*)SpreadAngle, emitterChange ); 225 SpreadAngle->setValue(PINIT_SPREAD_ANGLE); 226 SpreadAngle->redraw(); 205 227 emitterBox->fill(SpreadAngle); 206 228 … … 210 232 EmitterType->addItem("EMITTER_PLANE"); 211 233 EmitterType->addItem("EMITTER_CUBE"); 234 EmitterType->connectSignal("changed", (void*)EmitterType, emitterChange ); 212 235 EmitterType->load("EMITTER_DOT"); 213 EmitterType->connectSignal("changed", (void*)EmitterType, emitterChange );214 236 emitterBox->fill(EmitterType); 215 237 … … 218 240 EmitterSize->setExactness(1); 219 241 EmitterSize->connectSignal("value_changed", (void*)EmitterSize, emitterChange ); 242 EmitterSize->setValue(PINIT_EMITTER_SIZE); 243 EmitterSize->redraw(); 220 244 emitterBox->fill(EmitterSize); 221 245 } … … 232 256 StartRadius->setExactness(3); 233 257 StartRadius->connectSignal("value_changed", (void*)StartRadius, systemChange ); 258 StartRadius->setValue(PINIT_START_RADIUS); 259 StartRadius->redraw(); 234 260 systemBox->fill(StartRadius); 235 261 … … 238 264 EndRadius->setExactness(3); 239 265 EndRadius->connectSignal("value_changed", (void*)EndRadius, systemChange ); 266 EndRadius->setValue(PINIT_END_RADIUS); 267 EndRadius->redraw(); 240 268 systemBox->fill(EndRadius); 241 269 … … 244 272 LifeSpan->setExactness(3); 245 273 LifeSpan->connectSignal("value_changed", (void*)LifeSpan, systemChange ); 274 LifeSpan->setValue(PINIT_LIFESPAN); 275 LifeSpan->redraw(); 246 276 systemBox->fill(LifeSpan); 247 277 … … 249 279 Slider* ConserveFactor = new Slider("ConserveFactor", 0, 1); 250 280 ConserveFactor->setExactness(3); 251 ConserveFactor->load("1.0");252 281 ConserveFactor->connectSignal("value_changed", (void*)ConserveFactor, systemChange ); 282 ConserveFactor->setValue(PINIT_CONSERVE_FACTOR); 283 ConserveFactor->redraw(); 253 284 systemBox->fill(ConserveFactor); 254 285 … … 258 289 ParticleType->addItem("PARTICLE_SPARK"); 259 290 ParticleType->addItem("PARTICLE_SPRITE"); 291 ParticleType->connectSignal("changed", (void*)ParticleType, systemChange ); 260 292 ParticleType->load("PARTICLE_SPRITE"); 261 ParticleType->connectSignal("changed", (void*)ParticleType, systemChange );262 293 systemBox->fill(ParticleType); 263 294 … … 268 299 systemBox->fill(InheritSpeed); 269 300 301 Button* RandomColor = new Button("RandomColor"); 302 RandomColor->connectSignal("released", (void*)RandomColor, systemChange); 303 systemBox->fill(RandomColor); 270 304 271 305 }
Note: See TracChangeset
for help on using the changeset viewer.