Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4558 in orxonox.OLD


Ignore:
Timestamp:
Jun 8, 2005, 9:02:12 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: PhysicsEngine looks better (it speeds up things… but i do not exactly know if it works

Location:
orxonox/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/orxonox.kdevelop

    r4555 r4558  
    2222      <directoryradio>executable</directoryradio>
    2323      <customdirectory>/</customdirectory>
    24       <programargs/>
     24      <programargs></programargs>
    2525      <terminal>false</terminal>
    2626      <autocompile>true</autocompile>
     
    4444        <envvars/>
    4545      </debug>
     46      <default>
     47        <envvars/>
     48      </default>
    4649    </configurations>
    4750    <make>
     
    135138      <includeTypes>true</includeTypes>
    136139      <includeEnums>true</includeEnums>
    137       <includeTypedefs>false</includeTypedefs>
     140      <includeTypedefs>true</includeTypedefs>
    138141      <automaticCodeCompletion>true</automaticCodeCompletion>
    139142      <automaticArgumentsHint>true</automaticArgumentsHint>
     
    159162  <kdevdocumentation>
    160163    <projectdoc>
    161       <docsystem/>
    162       <docurl/>
    163       <usermanualurl/>
     164      <docsystem></docsystem>
     165      <docurl></docurl>
     166      <usermanualurl></usermanualurl>
    164167    </projectdoc>
    165168  </kdevdocumentation>
  • orxonox/trunk/scripts/data.genlist.pl

    r4103 r4558  
    11#!/usr/bin/perl
    2 ########################################################################## 
    3 #   orxonox - the future of 3D-vertical-scrollers                        #
    4 #                                                                        #
    5 #   Copyright (C) 2004 orx                                              #
    6 #                                                                        #
     2##########################################################################
     3#   orxonox - the future of 3D-vertical-scrollers                        #
     4#                                                                        #
     5#   Copyright (C) 2004 orx                                              #
     6#                                                                        #
    77#   This program is free software; you can redistribute it and/or modify #
    88#   it under the terms of the GNU General Public License as published by #
    99#   the Free Software Foundation; either version 2, or (at your option)  #
    10 #   any later version.                                                  #
    11 #                                                                        #
    12 #   ### File Specific:                                                  #
    13 #   main-programmer: Benjamin Grauer                                    #
    14 #   co-programmer: ...                                                  #
    15 #                                                                        #
     10#   any later version.                                                  #
     11#                                                                        #
     12#   ### File Specific:                                                  #
     13#   main-programmer: Benjamin Grauer                                    #
     14#   co-programmer: ...                                                  #
     15#                                                                        #
    1616#   This is a simple perl script, that generates a List of all files     #
    1717#   contained in a Folder checked out with SVN and writes into an output #
     
    5252     {
    5353       if ($inputFile eq "." || $inputFile eq "..")
    54         {
     54        {
    5555
    56         }
     56        }
    5757       chomp($inputFile);
    5858       $fullName = "$folderName/$inputFile";
     
    6262       print FD "$printFile\n";
    6363       if (-d $fullName )
    64         {
    65            &createFileList($fullName);
    66         }
     64        {
     65           &createFileList($fullName);
     66        }
    6767     }
    6868 }
  • orxonox/trunk/src/lib/physics/physics_engine.cc

    r4519 r4558  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    2828   \brief standard constructor
    2929*/
    30 PhysicsEngine::PhysicsEngine() 
     30PhysicsEngine::PhysicsEngine()
    3131{
    3232   this->setClassName ("PhysicsEngine");
     
    4646
    4747*/
    48 PhysicsEngine::~PhysicsEngine () 
     48PhysicsEngine::~PhysicsEngine ()
    4949{
    5050  PhysicsEngine::singletonRef = NULL;
     
    7171void PhysicsEngine::removePhysicsInterface(PhysicsInterface* physicsInterface)
    7272{
    73   this->interfaces->remove(physicsInterface); 
     73  this->interfaces->remove(physicsInterface);
    7474}
    7575
     
    9999   \brief adds A Physical Connection to the List of Connections
    100100   \param connection the Connection to add
    101    
     101
    102102   Usually this is done through the constructor of PhysicshConnections
    103103*/
     
    110110   \brief removes A Physical Connection from the List of Connections
    111111   \param connection the Connection to remove
    112    
     112
    113113   Usually this is done through the destructor of PhysicsConnections
    114114*/
     
    130130void PhysicsEngine::tick(float dt)
    131131{
     132  /* go through all the PhysicsInterface(s) and tick them,
     133  meaning let the fields work */
    132134  tIterator<PhysicsConnection>* itPC = this->connections->getIterator();
    133135  PhysicsConnection* enumPC = itPC->nextElement();
     
    135137    {
    136138      enumPC->apply();
     139
    137140      enumPC = itPC->nextElement();
    138141    }
    139142  delete itPC;
    140143
    141 
     144  /* actually tick all the PhysicsInterfaces. Move the objects around */
    142145  tIterator<PhysicsInterface>* itPI = this->interfaces->getIterator();
    143146  PhysicsInterface* enumPI = itPI->nextElement();
     
    145148    {
    146149      enumPI->tickPhys(dt);
     150
    147151      enumPI = itPI->nextElement();
    148152    }
  • orxonox/trunk/src/lib/physics/physics_engine.h

    r4519 r4558  
    1 /*! 
     1/*!
    22    \file physics_engine.h
    3     \brief Definition of the ... singleton Class
    4    
     3    \brief Definition of the PhysicsEngine-singleton Class
     4
    55*/
    66
     
    1818
    1919
    20 //! A default singleton class.
     20//! A class, that brings things into motion through Physics.
    2121class PhysicsEngine : public BaseObject {
    2222
     
    4141 private:
    4242  PhysicsEngine(void);
    43   static PhysicsEngine* singletonRef;      //!< the singleton reference of the PhysicsEngine
    4443
    45   tList<PhysicsInterface>* interfaces;     //!< a list of physically based objects
    46   tList<Field>* fields;                    //!< a list of physicsl fields.
    47   tList<PhysicsConnection>* connections;   //!< a list of physical connections
     44 private:
     45  static PhysicsEngine*         singletonRef;         //!< the singleton reference of the PhysicsEngine
     46
     47  tList<PhysicsInterface>*      interfaces;           //!< a list of physically based objects
     48  tList<Field>*                 fields;               //!< a list of physicsl fields.
     49  tList<PhysicsConnection>*     connections;          //!< a list of physical connections
    4850};
    4951
  • orxonox/trunk/src/lib/physics/physics_interface.cc

    r4555 r4558  
    4444   this->massChildren = 0;
    4545   this->forceSum = Vector(0, 0, 0);
     46   this->bForceApplied = false;
    4647
    4748   PhysicsEngine::getInstance()->addPhysicsInterface(this);
     
    9798  PNode* tmp = (PNode*) objectPointer;
    9899  this->forceSum += field->calcForce(tmp->getAbsCoor());
     100  this->bForceApplied = true;
    99101}
    100102
     
    107109  //  Vector acc = this->forceSum / ( this->massChildren + this->mass );
    108110  PNode* coorTick =  (PNode*)(this->objectPointer);
    109   if (coorTick)
    110     coorTick->setRelCoor(coorTick->getRelCoor() + this->forceSum/this->mass * dt);
     111  if (this->bForceApplied && coorTick)
     112  {
     113    coorTick->shiftCoor((coorTick->getVelocity()+ this->forceSum/this->mass * dt)*dt);
     114
     115    this->bForceApplied = false;
     116  }
    111117  this->forceSum = Vector(0,0,0);
    112   // todo: introduce kinematics
    113118}
  • orxonox/trunk/src/lib/physics/physics_interface.h

    r4555 r4558  
    4848 private:
    4949  void*          objectPointer;         //!< A Pointer to the object we handel (actually should be this)
     50
     51
    5052  float          mass;                  //!< Mass of this object
    5153  float          massChildren;          //!< Sum of the masses of the children nodes
     54
    5255  Vector         forceSum;              //!< Total central force for this tick
    5356  Quaternion     momentumSum;           //!< Total momentum in this tick
     57  bool           bForceApplied;         //!< If a force was applied to this object.
    5458};
    5559
  • orxonox/trunk/src/story_entities/world.cc

    r4555 r4558  
    214214  this->debugWorldNr = worldID;
    215215  this->entities = new tList<WorldEntity>();
     216  this->cycle = 0;
    216217}
    217218
     
    498499  Field* gravity = new Gravity();
    499500  gravity->setMagnitude(10.0);
    500   //  gravity->setParent(this->localCamera->getTarget());
     501  gravity->setParent(this->localCamera->getTarget());
    501502
    502503  // Add the Flow from the Emitter into the System
     
    958959  while( !this->bQuitOrxonox && !this->bQuitCurrentGame) /* \todo implement pause */
    959960    {
     961      ++this->cycle;
    960962      PRINTF(3)("World::mainloop() - number of entities: %i\n", this->entities->getSize());
    961963      // Network
     
    10581060      this->trackManager->tick(this->dt);
    10591061      this->localCamera->tick(this->dt);
     1062      // tick the engines
    10601063      AnimationPlayer::getInstance()->tick(this->dtS);
    1061       PhysicsEngine::getInstance()->tick(this->dtS);
    1062 
    1063 
    1064       particleEngine->tick(this->dtS);
    1065       this->garbageCollector->tick(this->dtS);
    1066 
    1067       /* actualy the Graphics Engine should tick the world not the other way around...
     1064      if (this->cycle > 5)
     1065        PhysicsEngine::getInstance()->tick(this->dtS);
     1066
     1067      ParticleEngine::getInstance()->tick(this->dtS);
     1068      GarbageCollector::getInstance()->tick(this->dtS);
     1069
     1070      /** actualy the Graphics Engine should tick the world not the other way around...
    10681071         but since we like the things not too complicated we got it this way around
    10691072         until there is need or time to do it the other way around.
  • orxonox/trunk/src/story_entities/world.h

    r4409 r4558  
    1 /*! 
     1/*!
    22    \file world.h
    33    \brief Holds and manages all game data
    4 */ 
     4*/
    55
    66#ifndef _WORLD_H
     
    8181  virtual void displayLoadScreen();
    8282  virtual void releaseLoadScreen();
    83  
     83
    8484  /* command node functions */
    8585  bool command (Command* cmd);
     
    9090  void spawn (WorldEntity* entity);
    9191  void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir);
    92   void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, 
    93              int parentingMode);
     92  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir,
     93             int parentingMode);
    9494
    9595  const char* getPath();
     
    102102
    103103  Uint32 lastFrame;                   //!< last time of frame
     104  Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
    104105  Uint32 dt;                          //!< time needed to calculate this frame
    105106  float dtS;                          //!< The time needed for caluculations in seconds
Note: See TracChangeset for help on using the changeset viewer.