Changeset 4294 in orxonox.OLD for orxonox/branches
- Timestamp:
- May 26, 2005, 10:51:11 AM (20 years ago)
- Location:
- orxonox/branches/physics/src/subprojects/particles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/subprojects/particles/framework.cc
r4293 r4294 19 19 #include "particle_engine.h" 20 20 21 #include "p_node.h" 22 #include "null_parent.h" 23 #include "state.h" 21 24 #include "debug.h" 22 25 #include "graphics_engine.h" … … 33 36 return false; 34 37 38 float dt = tick(); 35 39 // Draw the scene 36 draw( );40 draw(dt); 37 41 38 42 } … … 41 45 42 46 43 bool draw( )47 bool draw(float dt) 44 48 { 45 49 … … 51 55 glLoadIdentity(); 52 56 gluPerspective(45.0f,500/375,0.1f,dist * 5.0f); 53 54 55 56 57 gluLookAt (0, dist , dist, 0,0,0, up.x,up.y,up.z); 58 59 ParticleEngine::getInstance()->draw(dt); 60 57 61 SDL_GL_SwapBuffers(); // Swap the buffers 58 62 59 63 } 60 booltick()64 float tick() 61 65 { 62 66 currFrame = SDL_GetTicks(); … … 71 75 72 76 lastFrame = currFrame; 73 77 78 NullParent::getInstance()->update(dt); 79 return dt; 74 80 } 75 81 … … 253 259 mouse1Down = false; 254 260 261 262 // Creating a Test Particle System 263 ParticleSystem* system = new ParticleSystem(100000, PARTICLE_SPRITE); 264 system->setLifeSpan(1); 265 system->setConserve(.8); 266 system->setRadius(4, 3, 1, 2); 267 system->setColor(.5,0,0,.5, 1,1,0,1, 0,0,0,0); 268 269 // Creating a Test Particle Emitter 270 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 400, .5); 271 emitter->setType(EMITTER_CUBE); 272 emitter->setSize(20); 273 emitter->setRelCoor(Vector(0,0,0)); 274 275 // Add the Flow from the Emitter into the System 276 ParticleEngine::getInstance()->addConnection(emitter, system); 277 278 PNode* camera = new PNode(); 279 280 State::getInstance()->setCamera(camera, emitter); 281 282 camera->setAbsCoor(Vector(10, 10, 0)); 283 255 284 mainLoop(); 256 285 257 286 // Kill the GL & SDL screens 258 259 287 delete GraphicsEngine::getInstance(); 260 288 // And quit -
orxonox/branches/physics/src/subprojects/particles/framework.h
r4293 r4294 31 31 32 32 bool mainLoop(); 33 bool draw( );34 booltick();33 bool draw(float dt); 34 float tick(); 35 35 bool keyHandler(); 36 36
Note: See TracChangeset
for help on using the changeset viewer.