Changeset 4297 in orxonox.OLD for orxonox/branches/physics
- Timestamp:
- May 26, 2005, 1:49:41 PM (20 years ago)
- Location:
- orxonox/branches/physics/src/subprojects/particles
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/subprojects/particles/Makefile.am
r4293 r4297 41 41 $(MAINSRCDIR)/lib/graphics/particles/particle_emitter.cc \ 42 42 $(MAINSRCDIR)/util/state.cc \ 43 $(MAINSRCDIR)/world_entities/camera.cc \ 43 44 $(MAINSRCDIR)/lib/graphics/importer/model.cc \ 44 45 $(MAINSRCDIR)/lib/graphics/importer/objModel.cc \ -
orxonox/branches/physics/src/subprojects/particles/Makefile.in
r4293 r4297 55 55 am_particles_OBJECTS = framework.$(OBJEXT) particle_engine.$(OBJEXT) \ 56 56 particle_system.$(OBJEXT) particle_emitter.$(OBJEXT) \ 57 state.$(OBJEXT) model.$(OBJEXT) objModel.$(OBJEXT) \58 primitive_model.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \59 texture.$(OBJEXT) graphics_engine.$(OBJEXT) \57 state.$(OBJEXT) camera.$(OBJEXT) model.$(OBJEXT) \ 58 objModel.$(OBJEXT) primitive_model.$(OBJEXT) array.$(OBJEXT) \ 59 material.$(OBJEXT) texture.$(OBJEXT) graphics_engine.$(OBJEXT) \ 60 60 base_object.$(OBJEXT) vector.$(OBJEXT) \ 61 61 resource_manager.$(OBJEXT) text_engine.$(OBJEXT) \ … … 67 67 am__depfiles_maybe = depfiles 68 68 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \ 69 @AMDEP_TRUE@ ./$(DEPDIR)/base_object.Po \69 @AMDEP_TRUE@ ./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \ 70 70 @AMDEP_TRUE@ ./$(DEPDIR)/framework.Po \ 71 71 @AMDEP_TRUE@ ./$(DEPDIR)/graphics_engine.Po \ … … 208 208 $(MAINSRCDIR)/lib/graphics/particles/particle_emitter.cc \ 209 209 $(MAINSRCDIR)/util/state.cc \ 210 $(MAINSRCDIR)/world_entities/camera.cc \ 210 211 $(MAINSRCDIR)/lib/graphics/importer/model.cc \ 211 212 $(MAINSRCDIR)/lib/graphics/importer/objModel.cc \ … … 291 292 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ 292 293 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@ 294 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@ 293 295 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@ 294 296 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@ … … 387 389 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 388 390 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o state.obj `if test -f '$(MAINSRCDIR)/util/state.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/util/state.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/util/state.cc'; fi` 391 392 camera.o: $(MAINSRCDIR)/world_entities/camera.cc 393 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera.o -MD -MP -MF "$(DEPDIR)/camera.Tpo" -c -o camera.o `test -f '$(MAINSRCDIR)/world_entities/camera.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/world_entities/camera.cc; \ 394 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/camera.Tpo" "$(DEPDIR)/camera.Po"; else rm -f "$(DEPDIR)/camera.Tpo"; exit 1; fi 395 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/world_entities/camera.cc' object='camera.o' libtool=no @AMDEPBACKSLASH@ 396 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/camera.Po' tmpdepfile='$(DEPDIR)/camera.TPo' @AMDEPBACKSLASH@ 397 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 398 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o camera.o `test -f '$(MAINSRCDIR)/world_entities/camera.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/world_entities/camera.cc 399 400 camera.obj: $(MAINSRCDIR)/world_entities/camera.cc 401 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT camera.obj -MD -MP -MF "$(DEPDIR)/camera.Tpo" -c -o camera.obj `if test -f '$(MAINSRCDIR)/world_entities/camera.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/world_entities/camera.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/world_entities/camera.cc'; fi`; \ 402 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/camera.Tpo" "$(DEPDIR)/camera.Po"; else rm -f "$(DEPDIR)/camera.Tpo"; exit 1; fi 403 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/world_entities/camera.cc' object='camera.obj' libtool=no @AMDEPBACKSLASH@ 404 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/camera.Po' tmpdepfile='$(DEPDIR)/camera.TPo' @AMDEPBACKSLASH@ 405 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 406 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o camera.obj `if test -f '$(MAINSRCDIR)/world_entities/camera.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/world_entities/camera.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/world_entities/camera.cc'; fi` 389 407 390 408 model.o: $(MAINSRCDIR)/lib/graphics/importer/model.cc -
orxonox/branches/physics/src/subprojects/particles/framework.cc
r4296 r4297 25 25 #include "graphics_engine.h" 26 26 #include "resource_manager.h" 27 28 27 #include "camera.h" 29 28 30 29 int verbose; 31 30 32 bool mainLoop()31 bool Framework::mainLoop() 33 32 { 34 33 while(true) 35 34 { 35 // keyhandler returns false if sdl gets quit by some event 36 36 if (!keyHandler()) 37 37 return false; 38 38 39 // tick the scene 39 40 float dt = tick(); 41 40 42 // Draw the scene 41 draw(dt); 42 43 draw(dt); 43 44 } 44 45 } 46 47 48 bool draw(float dt) 45 } 46 47 48 bool Framework::draw(float dt) 49 49 { 50 50 … … 53 53 glLoadIdentity(); // Reset the view 54 54 55 glMatrixMode(GL_PROJECTION);56 glLoadIdentity();57 gluPerspective(45.0f,500/375,0.1f,dist * 5.0f);58 gluLookAt (0, dist , dist, 0,0,0, up.x,up.y,up.z);59 60 55 ParticleEngine::getInstance()->draw(dt); 56 57 camera->apply(); 61 58 62 59 SDL_GL_SwapBuffers(); // Swap the buffers 63 60 64 61 } 65 float tick()62 float Framework::tick() 66 63 { 67 64 currFrame = SDL_GetTicks(); … … 82 79 83 80 84 bool keyHandler()81 bool Framework::keyHandler() 85 82 { 86 83 // This is the main loop for the entire program and it will run until done==TRUE … … 213 210 214 211 215 int main(int argc, char *argv[]) 216 { 217 verbose = 3; 218 212 Framework::Framework() 213 { 219 214 220 215 // Create a new OpenGL window with the title "Cone3D Basecode" at … … 268 263 ParticleSystem* system = new ParticleSystem(100000, PARTICLE_SPRITE); 269 264 system->setLifeSpan(5); 270 system->setConserve( .8);265 system->setConserve(1); 271 266 system->setRadius(4, 3, 1, 2); 272 267 system->setColor(.5,0,0,.5, 1,1,0,1, 0,0,0,0); 273 268 274 269 // Creating a Test Particle Emitter 275 ParticleEmitter* emitter = new ParticleEmitter(Vector(0 , 0, -1), 0, 100,1);270 ParticleEmitter* emitter = new ParticleEmitter(Vector(0 , 1, 0), 0, 100, .01); 276 271 emitter->setType(EMITTER_DOT ); 277 272 emitter->setSize(0); … … 281 276 ParticleEngine::getInstance()->addConnection(emitter, system); 282 277 283 PNode* camera = new PNode();278 camera = new Camera(); 284 279 285 280 State::getInstance()->setCamera(camera, emitter); … … 287 282 camera->setAbsCoor(Vector(10, 10, 0)); 288 283 289 mainLoop(); 290 284 } 285 286 Framework::~Framework() 287 { 288 delete GraphicsEngine::getInstance(); 289 290 } 291 292 int main(int argc, char *argv[]) 293 { 294 verbose = 3; 295 Framework* framework =new Framework(); 296 framework->mainLoop(); 297 298 delete framework; 291 299 // Kill the GL & SDL screens 292 delete GraphicsEngine::getInstance();293 300 // And quit 294 301 return 0; -
orxonox/branches/physics/src/subprojects/particles/framework.h
r4295 r4297 5 5 #include "glincl.h" 6 6 7 7 8 #define DATA_DIRECTORY "~/svn/data/" 8 9 9 float rotatorP; 10 float rotatorV; 10 class Camera; 11 11 12 float dist; 13 float zoomTo; 12 class Framework { 13 private: 14 Camera* camera; 15 float rotatorP; 16 float rotatorV; 17 18 float dist; 19 float zoomTo; 20 21 Uint32 lastFrame; 22 Uint32 currFrame; 23 24 Vector dir; 25 Vector up; 26 27 float matQ[4][4]; 28 29 Vector M; 30 Vector p1; 31 Vector p2; 32 Vector rotAxis; 33 float rotAngle; 34 Quaternion rotQ; 35 Quaternion rotQlast; 36 37 Uint8* keys; // This variable will be used in the keyboard routine 38 bool mouse1Down; 14 39 15 Uint32 lastFrame; 16 Uint32 currFrame; 17 18 Vector dir; 19 Vector up; 20 21 float matQ[4][4]; 22 23 Vector M; 24 Vector p1; 25 Vector p2; 26 Vector rotAxis; 27 float rotAngle; 28 Quaternion rotQ; 29 Quaternion rotQlast; 30 31 Uint8* keys; // This variable will be used in the keyboard routine 32 bool mouse1Down; 33 34 bool mainLoop(); 35 bool draw(float dt); 36 float tick(); 37 bool keyHandler(); 38 40 public: 41 Framework(); 42 ~Framework(); 43 44 bool mainLoop(); 45 bool draw(float dt); 46 float tick(); 47 bool keyHandler(); 48 }; 39 49 #endif /* _FRAMEWORK_H */
Note: See TracChangeset
for help on using the changeset viewer.