Changeset 4327 in orxonox.OLD for orxonox/branches/physics/src
- Timestamp:
- May 27, 2005, 3:14:19 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/subprojects/particles/framework.cc
r4325 r4327 364 364 char* valueC = option->save(); 365 365 float value = atof(valueC); 366 delete valueC;367 366 368 367 ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); … … 370 369 { 371 370 if (!strcmp(name, "EmissionRate")) 372 373 tmpEmit->setEmissionRate(value);374 PRINT(3)("EmissionRate set to %f\n", value);375 371 { 372 tmpEmit->setEmissionRate(value); 373 PRINT(3)("EmissionRate set to %f\n", value); 374 } 376 375 else if (!strcmp(name, "Velocity")) 377 { 378 tmpEmit->setEmissionVelocity(value); 379 PRINT(3)("Velocity set to %f\n", value); 380 } 376 { 377 tmpEmit->setEmissionVelocity(value); 378 PRINT(3)("Velocity set to %f\n", value); 379 } 380 else if(!strcmp(name, "SpreadAngle")) 381 { 382 tmpEmit->setSpread(value); 383 PRINT(3)("SpreadAngle set to %f\n", value); 384 } 385 else if(!strcmp(name, "EmitterType")) 386 { 387 if (!strcmp(valueC, "EMITTER_DOT")) 388 tmpEmit->setType(EMITTER_DOT); 389 else if (!strcmp(valueC, "EMITTER_PLANE")) 390 tmpEmit->setType(EMITTER_PLANE); 391 else if (!strcmp(valueC, "EMITTER_CUBE")) 392 tmpEmit->setType(EMITTER_CUBE); 393 PRINT(3)("EmitterType set to %s\n", valueC); 394 } 395 else if(!strcmp(name, "EmitterSize")) 396 { 397 tmpEmit->setSize(value); 398 PRINT(3)("EmitterSize set to %f\n", value); 399 } 381 400 } 382 383 401 402 ParticleSystem* tmpSys = ParticleEngine::getInstance()->getSystemByNumber(1); 403 if (tmpSys) 404 { 405 if (!strcmp(name, "StartRadius")) 406 { 407 tmpSys->setRadius(value, tmpSys->getEndRadius()); 408 PRINT(3)("ParticleStartRadius set to %f\n", value); 409 } 410 else if (!strcmp(name, "EndRadius")) 411 { 412 tmpSys->setRadius( tmpSys->getStartRadius(), value); 413 PRINT(3)("ParticleEndRadius set to %f\n", value); 414 } 415 416 else if (!strcmp(name, "LifeSpan")) 417 { 418 tmpSys->setLifeSpan(value); 419 PRINT(3)("ParticleLifeSpan set to %f\n", value); 420 } 421 422 else if (!strcmp(name, "ConserveFactor")) 423 { 424 tmpSys->setConserve(value); 425 PRINT(3)("ParticleConserveFactor set to %f\n", value); 426 } 427 428 else if (!strcmp(name, "ParticleType")) 429 { 430 if (!strcmp(valueC, "PARTICLE_DOT")) 431 tmpSys->setType(PARTICLE_DOT); 432 else if (!strcmp(valueC, "PARTICLE_SPARK")) 433 tmpSys->setType(PARTICLE_SPARK); 434 else if (!strcmp(valueC, "PARTICLE_SPRITE")) 435 tmpSys->setType(PARTICLE_SPRITE); 436 437 PRINT(3)("ParticleType set to %f\n", valueC); 438 } 439 440 else if (!strcmp(name, "InheritSpeed")) 441 { 442 tmpSys->setInheritSpeed(value); 443 PRINT(3)("ParticleInheritSpeed set to %f\n", value); 444 } 445 446 } 447 448 delete valueC; 384 449 } 385 450 … … 395 460 Box* windowBox = new Box('v'); 396 461 { 397 Slider* EmissionRate = new Slider("EmissionRate", 0, 1000); 398 EmissionRate->connectSignal("value_changed", (void*)EmissionRate, changeOption ); 399 windowBox->fill(EmissionRate); 400 401 Slider* velocity = new Slider("Velocity", 0, 2); 402 velocity->setExactness(3); 403 velocity->connectSignal("value_changed", (void*)velocity, changeOption ); 404 windowBox->fill(velocity); 405 406 Slider* SpreadAngle = new Slider("SpreadAngle", 0, 1000); 407 SpreadAngle->connectSignal("value_changed", (void*)SpreadAngle, changeOption ); 408 windowBox->fill(SpreadAngle); 409 462 Frame* emitterFrame = new Frame("emitter-settings"); 463 { 464 Box* emitterBox = new Box('v'); 465 { 466 emitterBox->fill(new Label("EmissionRate")); 467 Slider* EmissionRate = new Slider("EmissionRate", 0, 1000); 468 EmissionRate->connectSignal("value_changed", (void*)EmissionRate, changeOption ); 469 emitterBox->fill(EmissionRate); 470 471 emitterBox->fill(new Label("Velocity")); 472 Slider* velocity = new Slider("Velocity", 0, 2); 473 velocity->setExactness(3); 474 velocity->connectSignal("value_changed", (void*)velocity, changeOption ); 475 emitterBox->fill(velocity); 476 477 emitterBox->fill(new Label("SpreadAngle")); 478 Slider* SpreadAngle = new Slider("SpreadAngle", 0, M_PI); 479 SpreadAngle->setExactness(3); 480 SpreadAngle->connectSignal("value_changed", (void*)SpreadAngle, changeOption ); 481 emitterBox->fill(SpreadAngle); 482 483 emitterBox->fill(new Label("EmitterType")); 484 Menu* EmitterType = new Menu("EmitterType"); 485 EmitterType->addItem("EMITTER_DOT"); 486 EmitterType->addItem("EMITTER_PLANE"); 487 EmitterType->addItem("EMITTER_CUBE"); 488 EmitterType->connectSignal("changed", (void*)EmitterType, changeOption ); 489 emitterBox->fill(EmitterType); 490 491 emitterBox->fill(new Label("EmitterSize")); 492 Slider* EmitterSize = new Slider("EmitterSize", 0, 100); 493 EmitterSize->setExactness(1); 494 EmitterSize->connectSignal("value_changed", (void*)EmitterSize, changeOption ); 495 emitterBox->fill(EmitterSize); 496 } 497 emitterFrame->fill(emitterBox); 498 } 499 windowBox->fill(emitterFrame); 410 500 411 501 Frame* systemFrame = new Frame("system-settings"); 502 { 503 Box* systemBox = new Box('v'); 504 { 505 systemBox->fill(new Label("StartRadius")); 506 Slider* StartRadius = new Slider("StartRadius", 0, 10); 507 StartRadius->setExactness(3); 508 StartRadius->connectSignal("value_changed", (void*)StartRadius, changeOption ); 509 systemBox->fill(StartRadius); 510 511 systemBox->fill(new Label("EndRadius")); 512 Slider* EndRadius = new Slider("EndRadius", 0, 10); 513 EndRadius->setExactness(3); 514 EndRadius->connectSignal("value_changed", (void*)EndRadius, changeOption ); 515 systemBox->fill(EndRadius); 516 517 systemBox->fill(new Label("LifeSpan")); 518 Slider* LifeSpan = new Slider("LifeSpan", 0, 10); 519 LifeSpan->setExactness(3); 520 LifeSpan->connectSignal("value_changed", (void*)LifeSpan, changeOption ); 521 systemBox->fill(LifeSpan); 522 523 systemBox->fill(new Label("ConserveFactor")); 524 Slider* ConserveFactor = new Slider("ConserveFactor", 0, 1); 525 ConserveFactor->setExactness(3); 526 ConserveFactor->connectSignal("value_changed", (void*)ConserveFactor, changeOption ); 527 systemBox->fill(ConserveFactor); 528 529 systemBox->fill(new Label("ParticleType")); 530 Menu* ParticleType = new Menu("ParticleType"); 531 ParticleType->addItem("PARTICLE_DOT"); 532 ParticleType->addItem("PARTICLE_SPARK"); 533 ParticleType->addItem("PARTICLE_SPRITE"); 534 ParticleType->connectSignal("changed", (void*)ParticleType, changeOption ); 535 systemBox->fill(ParticleType); 536 537 systemBox->fill(new Label("InheritSpeed")); 538 Slider* InheritSpeed = new Slider("InheritSpeed", 0, 1); 539 InheritSpeed->setExactness(3); 540 InheritSpeed->connectSignal("value_changed", (void*)InheritSpeed, changeOption ); 541 systemBox->fill(InheritSpeed); 542 543 544 } 545 systemFrame->fill(systemBox); 546 } 547 windowBox->fill(systemFrame); 548 412 549 Button* quitButton = new Button("quit"); 413 414 550 551 415 552 windowBox->fill(quitButton); 416 553 } … … 418 555 } 419 556 Window::mainWindow->showall(); 557 Window::mainWindow->setSize(300, 500); 420 558 mainloopGUI(); 421 559 }
Note: See TracChangeset
for help on using the changeset viewer.