Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4297 in orxonox.OLD for orxonox/branches/physics


Ignore:
Timestamp:
May 26, 2005, 1:49:41 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/physics: framework is a class now

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

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/subprojects/particles/Makefile.am

    r4293 r4297  
    4141                  $(MAINSRCDIR)/lib/graphics/particles/particle_emitter.cc \
    4242                  $(MAINSRCDIR)/util/state.cc \
     43                  $(MAINSRCDIR)/world_entities/camera.cc \
    4344                  $(MAINSRCDIR)/lib/graphics/importer/model.cc \
    4445                  $(MAINSRCDIR)/lib/graphics/importer/objModel.cc \
  • orxonox/branches/physics/src/subprojects/particles/Makefile.in

    r4293 r4297  
    5555am_particles_OBJECTS = framework.$(OBJEXT) particle_engine.$(OBJEXT) \
    5656        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) \
    6060        base_object.$(OBJEXT) vector.$(OBJEXT) \
    6161        resource_manager.$(OBJEXT) text_engine.$(OBJEXT) \
     
    6767am__depfiles_maybe = depfiles
    6868@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \
    69 @AMDEP_TRUE@    ./$(DEPDIR)/base_object.Po \
     69@AMDEP_TRUE@    ./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \
    7070@AMDEP_TRUE@    ./$(DEPDIR)/framework.Po \
    7171@AMDEP_TRUE@    ./$(DEPDIR)/graphics_engine.Po \
     
    208208                  $(MAINSRCDIR)/lib/graphics/particles/particle_emitter.cc \
    209209                  $(MAINSRCDIR)/util/state.cc \
     210                  $(MAINSRCDIR)/world_entities/camera.cc \
    210211                  $(MAINSRCDIR)/lib/graphics/importer/model.cc \
    211212                  $(MAINSRCDIR)/lib/graphics/importer/objModel.cc \
     
    291292@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
    292293@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@
     294@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@
    293295@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@
    294296@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@
     
    387389@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    388390@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
     392camera.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
     400camera.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`
    389407
    390408model.o: $(MAINSRCDIR)/lib/graphics/importer/model.cc
  • orxonox/branches/physics/src/subprojects/particles/framework.cc

    r4296 r4297  
    2525#include "graphics_engine.h"
    2626#include "resource_manager.h"
    27 
    28 
     27#include "camera.h"
    2928
    3029int verbose;
    3130
    32 bool mainLoop()
     31bool Framework::mainLoop()
    3332{
    3433  while(true)
    3534    {
     35      // keyhandler returns false if sdl gets quit by some event
    3636      if (!keyHandler())
    3737        return false;
    3838
     39      // tick the scene
    3940      float dt = tick();
     41
    4042      // Draw the scene
    41       draw(dt);
    42      
     43      draw(dt);     
    4344    }
    44 
    45 }
    46 
    47 
    48 bool draw(float dt)
     45}
     46
     47
     48bool Framework::draw(float dt)
    4949{
    5050 
     
    5353  glLoadIdentity(); // Reset the view
    5454 
    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  
    6055  ParticleEngine::getInstance()->draw(dt);
     56
     57  camera->apply();
    6158 
    6259  SDL_GL_SwapBuffers(); // Swap the buffers
    6360
    6461}
    65 float tick()
     62float Framework::tick()
    6663{
    6764  currFrame = SDL_GetTicks();
     
    8279
    8380
    84 bool keyHandler()
     81bool Framework::keyHandler()
    8582{
    8683  // This is the main loop for the entire program and it will run until done==TRUE
     
    213210
    214211
    215 int main(int argc, char *argv[])
    216 {
    217   verbose = 3;
    218 
     212 Framework::Framework()
     213{
    219214
    220215  // Create a new OpenGL window with the title "Cone3D Basecode" at
     
    268263  ParticleSystem* system = new ParticleSystem(100000, PARTICLE_SPRITE);
    269264  system->setLifeSpan(5);
    270   system->setConserve(.8);
     265  system->setConserve(1);
    271266  system->setRadius(4, 3, 1, 2);
    272267  system->setColor(.5,0,0,.5, 1,1,0,1, 0,0,0,0);
    273268
    274269  // 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);
    276271  emitter->setType(EMITTER_DOT  );
    277272  emitter->setSize(0);
     
    281276  ParticleEngine::getInstance()->addConnection(emitter, system);
    282277
    283   PNode* camera = new PNode();
     278  camera = new Camera();
    284279
    285280  State::getInstance()->setCamera(camera, emitter);
     
    287282  camera->setAbsCoor(Vector(10, 10, 0));
    288283
    289   mainLoop();
    290    
     284}
     285
     286Framework::~Framework()
     287{
     288  delete GraphicsEngine::getInstance();
     289
     290}
     291
     292int main(int argc, char *argv[])
     293{
     294  verbose = 3;
     295  Framework* framework =new Framework();
     296  framework->mainLoop();
     297
     298  delete framework;
    291299  // Kill the GL & SDL screens
    292   delete GraphicsEngine::getInstance();
    293300  // And quit
    294301  return 0;
  • orxonox/branches/physics/src/subprojects/particles/framework.h

    r4295 r4297  
    55#include "glincl.h"
    66
     7
    78#define DATA_DIRECTORY "~/svn/data/"
    89
    9 float rotatorP;
    10 float rotatorV;
     10class Camera;
    1111
    12 float dist;
    13 float zoomTo;
     12class 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;
    1439
    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};
    3949#endif /* _FRAMEWORK_H */
Note: See TracChangeset for help on using the changeset viewer.