Changeset 4333 in orxonox.OLD for orxonox/branches/physics/src/subprojects
- Timestamp:
- May 27, 2005, 7:40:46 PM (20 years ago)
- Location:
- orxonox/branches/physics/src/subprojects/particles
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/subprojects/particles/Makefile.am
r4328 r4333 39 39 40 40 particles_SOURCES= framework.cc \ 41 particle_fun.cc \ 41 42 $(MAINSRCDIR)/lib/graphics/particles/particle_engine.cc \ 42 43 $(MAINSRCDIR)/lib/graphics/particles/particle_system.cc \ -
orxonox/branches/physics/src/subprojects/particles/Makefile.in
r4330 r4333 54 54 PROGRAMS = $(bin_PROGRAMS) 55 55 am_particles_OBJECTS = particles-framework.$(OBJEXT) \ 56 particles-particle_fun.$(OBJEXT) \ 56 57 particles-particle_engine.$(OBJEXT) \ 57 58 particles-particle_system.$(OBJEXT) \ … … 87 88 @AMDEP_TRUE@ ./$(DEPDIR)/particles-particle_emitter.Po \ 88 89 @AMDEP_TRUE@ ./$(DEPDIR)/particles-particle_engine.Po \ 90 @AMDEP_TRUE@ ./$(DEPDIR)/particles-particle_fun.Po \ 89 91 @AMDEP_TRUE@ ./$(DEPDIR)/particles-particle_system.Po \ 90 92 @AMDEP_TRUE@ ./$(DEPDIR)/particles-primitive_model.Po \ … … 221 223 particles_CPPFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 222 224 particles_SOURCES = framework.cc \ 225 particle_fun.cc \ 223 226 $(MAINSRCDIR)/lib/graphics/particles/particle_engine.cc \ 224 227 $(MAINSRCDIR)/lib/graphics/particles/particle_system.cc \ … … 323 326 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-particle_emitter.Po@am__quote@ 324 327 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-particle_engine.Po@am__quote@ 328 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-particle_fun.Po@am__quote@ 325 329 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-particle_system.Po@am__quote@ 326 330 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-primitive_model.Po@am__quote@ … … 362 366 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 363 367 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o particles-framework.obj `if test -f 'framework.cc'; then $(CYGPATH_W) 'framework.cc'; else $(CYGPATH_W) '$(srcdir)/framework.cc'; fi` 368 369 particles-particle_fun.o: particle_fun.cc 370 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT particles-particle_fun.o -MD -MP -MF "$(DEPDIR)/particles-particle_fun.Tpo" -c -o particles-particle_fun.o `test -f 'particle_fun.cc' || echo '$(srcdir)/'`particle_fun.cc; \ 371 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/particles-particle_fun.Tpo" "$(DEPDIR)/particles-particle_fun.Po"; else rm -f "$(DEPDIR)/particles-particle_fun.Tpo"; exit 1; fi 372 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='particle_fun.cc' object='particles-particle_fun.o' libtool=no @AMDEPBACKSLASH@ 373 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/particles-particle_fun.Po' tmpdepfile='$(DEPDIR)/particles-particle_fun.TPo' @AMDEPBACKSLASH@ 374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 375 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o particles-particle_fun.o `test -f 'particle_fun.cc' || echo '$(srcdir)/'`particle_fun.cc 376 377 particles-particle_fun.obj: particle_fun.cc 378 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT particles-particle_fun.obj -MD -MP -MF "$(DEPDIR)/particles-particle_fun.Tpo" -c -o particles-particle_fun.obj `if test -f 'particle_fun.cc'; then $(CYGPATH_W) 'particle_fun.cc'; else $(CYGPATH_W) '$(srcdir)/particle_fun.cc'; fi`; \ 379 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/particles-particle_fun.Tpo" "$(DEPDIR)/particles-particle_fun.Po"; else rm -f "$(DEPDIR)/particles-particle_fun.Tpo"; exit 1; fi 380 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='particle_fun.cc' object='particles-particle_fun.obj' libtool=no @AMDEPBACKSLASH@ 381 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/particles-particle_fun.Po' tmpdepfile='$(DEPDIR)/particles-particle_fun.TPo' @AMDEPBACKSLASH@ 382 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 383 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o particles-particle_fun.obj `if test -f 'particle_fun.cc'; then $(CYGPATH_W) 'particle_fun.cc'; else $(CYGPATH_W) '$(srcdir)/particle_fun.cc'; fi` 364 384 365 385 particles-particle_engine.o: $(MAINSRCDIR)/lib/graphics/particles/particle_engine.cc -
orxonox/branches/physics/src/subprojects/particles/framework.cc
r4331 r4333 16 16 #include "framework.h" 17 17 18 #include "physics_engine.h" 19 #include "particle_engine.h" 20 21 #include "gui_gtk.h" 18 22 19 #include "p_node.h" 23 20 #include "null_parent.h" … … 32 29 int verbose; 33 30 34 int quitGui(GtkWidget* widget, void* data);35 36 37 void Framework::initModule()38 {39 // Creating a Test Particle System40 ParticleSystem* system = new ParticleSystem(100000, PARTICLE_SPRITE);41 42 // Creating a Test Particle Emitter43 ParticleEmitter* emitter = new ParticleEmitter(Vector(0 , 1, 0));44 // Add the Flow from the Emitter into the System45 ParticleEngine::getInstance()->addConnection(emitter, system);46 }47 48 31 void* Framework::mainLoop(void* tmp) 49 32 { … … 60 43 float dt = framework->tick(); 61 44 45 NullParent::getInstance()->update(dt); 46 62 47 // Draw the scene 63 48 framework->draw(dt); … … 71 56 glLoadIdentity(); // Reset the view 72 57 73 ParticleEngine::getInstance()->draw(dt);74 58 this->moduleDraw(dt); 59 75 60 camera->apply(); 76 61 … … 85 70 lastFrame = currFrame; 86 71 87 ParticleEngine::getInstance()->tick(dt); 88 89 NullParent::getInstance()->update(dt); 72 this->moduleTick(dt); 73 90 74 return dt; 91 75 } … … 161 145 break; 162 146 case SDLK_i: 163 ParticleEngine::getInstance()->debug();147 // ParticleEngine::getInstance()->debug(); 164 148 break; 165 149 case SDLK_a: … … 231 215 232 216 233 initModule();217 moduleInit(); 234 218 235 219 camera = new Camera(); … … 238 222 239 223 camera->setAbsCoor(Vector(10, 10, 0)); 240 241 224 } 242 225 … … 254 237 PRINT(0)("========================\n"); 255 238 PRINT(0)("h - print thisHelp\n"); 256 PRINT(0)("i - state Information\n\n"); 257 PRINT(0)("\n"); 258 259 260 } 261 262 int emitterChange(GtkWidget* nonInterest, void* widget) 263 { 264 Option* option = (Option*) widget; 265 const char* name = option->getTitle(); 266 char* valueC = option->save(); 267 float value = atof(valueC); 268 269 ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); 270 if (tmpEmit) 271 { 272 if (!strcmp(name, "EmissionRate")) 273 { 274 tmpEmit->setEmissionRate(value); 275 PRINT(3)("EmissionRate set to %f\n", value); 276 } 277 else if (!strcmp(name, "Velocity")) 278 { 279 tmpEmit->setEmissionVelocity(value); 280 PRINT(3)("Velocity set to %f\n", value); 281 } 282 else if(!strcmp(name, "SpreadAngle")) 283 { 284 tmpEmit->setSpread(value); 285 PRINT(3)("SpreadAngle set to %f\n", value); 286 } 287 else if(!strcmp(name, "EmitterType")) 288 { 289 if (!strcmp(valueC, "EMITTER_DOT")) 290 tmpEmit->setType(EMITTER_DOT); 291 else if (!strcmp(valueC, "EMITTER_PLANE")) 292 tmpEmit->setType(EMITTER_PLANE); 293 else if (!strcmp(valueC, "EMITTER_CUBE")) 294 tmpEmit->setType(EMITTER_CUBE); 295 PRINT(3)("EmitterType set to %s\n", valueC); 296 } 297 else if(!strcmp(name, "EmitterSize")) 298 { 299 tmpEmit->setSize(value); 300 PRINT(3)("EmitterSize set to %f\n", value); 301 } 302 } 303 delete valueC; 304 } 305 306 307 int systemChange(GtkWidget* nonInterest, void* widget) 308 { 309 Option* option = (Option*) widget; 310 const char* name = option->getTitle(); 311 char* valueC = option->save(); 312 float value = atof(valueC); 313 314 ParticleSystem* tmpSys = ParticleEngine::getInstance()->getSystemByNumber(1); 315 if (tmpSys) 316 { 317 if (!strcmp(name, "StartRadius")) 318 { 319 tmpSys->setRadius(value, tmpSys->getEndRadius()); 320 PRINT(3)("ParticleStartRadius set to %f\n", value); 321 } 322 else if (!strcmp(name, "EndRadius")) 323 { 324 tmpSys->setRadius( tmpSys->getStartRadius(), value); 325 PRINT(3)("ParticleEndRadius set to %f\n", value); 326 } 327 328 else if (!strcmp(name, "LifeSpan")) 329 { 330 tmpSys->setLifeSpan(value); 331 PRINT(3)("ParticleLifeSpan set to %f\n", value); 332 } 333 334 else if (!strcmp(name, "ConserveFactor")) 335 { 336 tmpSys->setConserve(value); 337 PRINT(3)("ParticleConserveFactor set to %f\n", value); 338 } 339 340 else if (!strcmp(name, "ParticleType")) 341 { 342 if (!strcmp(valueC, "PARTICLE_DOT")) 343 tmpSys->setType(PARTICLE_DOT); 344 else if (!strcmp(valueC, "PARTICLE_SPARK")) 345 tmpSys->setType(PARTICLE_SPARK); 346 else if (!strcmp(valueC, "PARTICLE_SPRITE")) 347 tmpSys->setType(PARTICLE_SPRITE); 348 349 PRINT(3)("ParticleType set to %s\n", valueC); 350 } 351 352 else if (!strcmp(name, "InheritSpeed")) 353 { 354 tmpSys->setInheritSpeed(value); 355 PRINT(3)("ParticleInheritSpeed set to %f\n", value); 356 } 357 358 } 359 delete valueC; 360 } 361 239 240 this->moduleHelp(); 241 242 } 362 243 363 244 int quitGui(GtkWidget* widget, void* data) … … 370 251 } 371 252 372 void* Framework::initGui(void* argv)373 {374 Window* guiMainWindow = NULL;375 376 initGUI(0, NULL);377 378 guiMainWindow = new Window("ParticlesFUN");379 {380 Box* windowBox = new Box('v');381 {382 Frame* emitterFrame = new Frame("emitter-settings");383 {384 Box* emitterBox = new Box('v');385 {386 emitterBox->fill(new Label("EmissionRate"));387 Slider* EmissionRate = new Slider("EmissionRate", 0, 1000);388 EmissionRate->connectSignal("value_changed", (void*)EmissionRate, emitterChange );389 emitterBox->fill(EmissionRate);390 391 emitterBox->fill(new Label("Velocity"));392 Slider* velocity = new Slider("Velocity", 0, 2);393 velocity->setExactness(3);394 velocity->connectSignal("value_changed", (void*)velocity, emitterChange );395 emitterBox->fill(velocity);396 397 emitterBox->fill(new Label("SpreadAngle"));398 Slider* SpreadAngle = new Slider("SpreadAngle", 0, M_PI);399 SpreadAngle->setExactness(3);400 SpreadAngle->connectSignal("value_changed", (void*)SpreadAngle, emitterChange );401 emitterBox->fill(SpreadAngle);402 403 emitterBox->fill(new Label("EmitterType"));404 Menu* EmitterType = new Menu("EmitterType");405 EmitterType->addItem("EMITTER_DOT");406 EmitterType->addItem("EMITTER_PLANE");407 EmitterType->addItem("EMITTER_CUBE");408 EmitterType->connectSignal("changed", (void*)EmitterType, emitterChange );409 emitterBox->fill(EmitterType);410 411 emitterBox->fill(new Label("EmitterSize"));412 Slider* EmitterSize = new Slider("EmitterSize", 0, 100);413 EmitterSize->setExactness(1);414 EmitterSize->connectSignal("value_changed", (void*)EmitterSize, emitterChange );415 emitterBox->fill(EmitterSize);416 }417 emitterFrame->fill(emitterBox);418 }419 windowBox->fill(emitterFrame);420 421 Frame* systemFrame = new Frame("system-settings");422 {423 Box* systemBox = new Box('v');424 {425 systemBox->fill(new Label("StartRadius"));426 Slider* StartRadius = new Slider("StartRadius", 0, 10);427 StartRadius->setExactness(3);428 StartRadius->connectSignal("value_changed", (void*)StartRadius, systemChange );429 systemBox->fill(StartRadius);430 431 systemBox->fill(new Label("EndRadius"));432 Slider* EndRadius = new Slider("EndRadius", 0, 10);433 EndRadius->setExactness(3);434 EndRadius->connectSignal("value_changed", (void*)EndRadius, systemChange );435 systemBox->fill(EndRadius);436 437 systemBox->fill(new Label("LifeSpan"));438 Slider* LifeSpan = new Slider("LifeSpan", 0, 10);439 LifeSpan->setExactness(3);440 LifeSpan->connectSignal("value_changed", (void*)LifeSpan, systemChange );441 systemBox->fill(LifeSpan);442 443 systemBox->fill(new Label("ConserveFactor"));444 Slider* ConserveFactor = new Slider("ConserveFactor", 0, 1);445 ConserveFactor->setExactness(3);446 ConserveFactor->connectSignal("value_changed", (void*)ConserveFactor, systemChange );447 systemBox->fill(ConserveFactor);448 449 systemBox->fill(new Label("ParticleType"));450 Menu* ParticleType = new Menu("ParticleType");451 ParticleType->addItem("PARTICLE_DOT");452 ParticleType->addItem("PARTICLE_SPARK");453 ParticleType->addItem("PARTICLE_SPRITE");454 ParticleType->connectSignal("changed", (void*)ParticleType, systemChange );455 systemBox->fill(ParticleType);456 457 systemBox->fill(new Label("InheritSpeed"));458 Slider* InheritSpeed = new Slider("InheritSpeed", 0, 1);459 InheritSpeed->setExactness(3);460 InheritSpeed->connectSignal("value_changed", (void*)InheritSpeed, systemChange );461 systemBox->fill(InheritSpeed);462 463 464 }465 systemFrame->fill(systemBox);466 }467 windowBox->fill(systemFrame);468 469 Button* quitButton = new Button("quit");470 471 quitButton->connectSignal("clicked", NULL, quitGui);472 // Window::mainWindow->connectSignal("remove", this, GuiExec::quitGui);473 Window::mainWindow->connectSignal("destroy", NULL, quitGui);474 475 windowBox->fill(quitButton);476 }477 guiMainWindow->fill(windowBox);478 }479 Window::mainWindow->showall();480 Window::mainWindow->setSize(300, 500);481 }482 483 void* Framework::mainloopGui(void* tmp)484 {485 mainloopGUI();486 }487 488 489 253 490 254 int main(int argc, char *argv[]) … … 494 258 Framework* framework = Framework::getInstance(); 495 259 496 framework-> initGui((void*)argv);260 framework->moduleInitGui(); 497 261 // framework->mainloopGui(NULL); 498 262 499 263 framework->mainLoop(NULL); 500 501 264 502 265 delete framework; -
orxonox/branches/physics/src/subprojects/particles/framework.h
r4331 r4333 4 4 #include "vector.h" 5 5 #include "glincl.h" 6 7 #include "gui_gtk.h" 6 8 7 9 … … 25 27 Uint32 currFrame; 26 28 27 Uint8* keys; // This variable will be used in the keyboard routine29 Uint8* keys; // This variable will be used in the keyboard routine 28 30 bool mouseDown[MOUSE_BUTTON_COUNT]; 29 31 30 32 public: 31 ~Framework(); 33 ~Framework(); 32 34 33 35 static Framework* getInstance(void); 34 36 35 37 36 void initModule(); 38 void moduleInit(); 39 void* moduleInitGui(void); 40 41 void moduleDraw(float dt); 42 void moduleTick(float dt); 43 44 void moduleHelp(void) const; 45 46 47 37 48 static void* mainLoop(void* tmp); 38 49 bool draw(float dt); … … 41 52 void quit(); 42 53 43 void* initGui(void* argv);44 54 static void* mainloopGui(void* tmp); 45 55 … … 47 57 }; 48 58 59 int quitGui(GtkWidget* widget, void* data); 60 61 49 62 #endif /* _FRAMEWORK_H */
Note: See TracChangeset
for help on using the changeset viewer.