Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4294 in orxonox.OLD


Ignore:
Timestamp:
May 26, 2005, 10:51:11 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: one is seeing particles

Location:
orxonox/branches/physics/src/subprojects/particles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/subprojects/particles/framework.cc

    r4293 r4294  
    1919#include "particle_engine.h"
    2020
     21#include "p_node.h"
     22#include "null_parent.h"
     23#include "state.h"
    2124#include "debug.h"
    2225#include "graphics_engine.h"
     
    3336        return false;
    3437
     38      float dt = tick();
    3539      // Draw the scene
    36       draw();
     40      draw(dt);
    3741     
    3842    }
     
    4145
    4246
    43 bool draw()
     47bool draw(float dt)
    4448{
    4549 
     
    5155  glLoadIdentity();     
    5256  gluPerspective(45.0f,500/375,0.1f,dist * 5.0f);
    53     gluLookAt (0, dist , dist, 0,0,0, up.x,up.y,up.z);
    54 
    55 
    56 
     57  gluLookAt (0, dist , dist, 0,0,0, up.x,up.y,up.z);
     58 
     59  ParticleEngine::getInstance()->draw(dt);
     60 
    5761  SDL_GL_SwapBuffers(); // Swap the buffers
    5862
    5963}
    60 bool tick()
     64float tick()
    6165{
    6266  currFrame = SDL_GetTicks();
     
    7175
    7276  lastFrame = currFrame;
    73  
     77
     78  NullParent::getInstance()->update(dt);
     79  return dt;
    7480}
    7581
     
    253259  mouse1Down = false;
    254260
     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
    255284  mainLoop();
    256285   
    257286  // Kill the GL & SDL screens
    258 
    259287  delete GraphicsEngine::getInstance();
    260288  // And quit
  • orxonox/branches/physics/src/subprojects/particles/framework.h

    r4293 r4294  
    3131
    3232bool mainLoop();
    33 bool draw();
    34 bool tick();
     33bool draw(float dt);
     34float tick();
    3535bool keyHandler();
    3636
Note: See TracChangeset for help on using the changeset viewer.