Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4395 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
May 30, 2005, 2:19:41 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: fields are now time-independant

Location:
orxonox/trunk/src/lib
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/particles/particle_system.cc

    r4385 r4395  
    243243      // applying force to the System.
    244244      if (likely (tickPart->mass > 0.0))
    245         tickPart->velocity += tickPart->extForce / tickPart->mass;
     245        tickPart->velocity += tickPart->extForce / tickPart->mass * dt;
    246246
    247247      // rendering new position.
     
    305305    \param dt The time over which the field gets applied
    306306 */
    307 void ParticleSystem::applyField(Field* field, float dt)
     307void ParticleSystem::applyField(Field* field)
    308308{
    309309  Particle* tickPart = particles;
    310310  while (tickPart)
    311311    {
    312       tickPart->extForce += field->calcForce(dt, tickPart->position);
     312      tickPart->extForce += field->calcForce(tickPart->position);
    313313      tickPart = tickPart->next;
    314314    }
  • orxonox/trunk/src/lib/graphics/particles/particle_system.h

    r4394 r4395  
    5959//! A class to handle ParticleSystems
    6060class ParticleSystem : public PhysicsInterface {
    61 
     61  friend class ParticleEmitter;
     62 
    6263 public:
    6364  ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT,
     
    9798  inline float getMass(void) const { return this->initialMass; };
    9899
    99   virtual void applyField(Field* field, float dt);
     100  virtual void applyField(Field* field);
    100101
    101102  void addParticle(const Vector& position, const Vector& velocity, unsigned int data = 0);
  • orxonox/trunk/src/lib/physics/fields/field.h

    r4338 r4395  
    4343      \returns The Force Vector
    4444  */
    45   virtual Vector calcForce(float dt, const Vector& data) const = 0;
     45  virtual Vector calcForce(const Vector& data) const = 0;
    4646
    4747  void setMagnitude(const float& magnitude);
  • orxonox/trunk/src/lib/physics/fields/gravity.cc

    r4338 r4395  
    4545   \returns The force.
    4646*/
    47 Vector Gravity::calcForce(float dt, const Vector& data) const
     47Vector Gravity::calcForce(const Vector& data) const
    4848{
    49   return /*(this->getAbsDir().apply(Vector(0,1,0)))*/ Vector(0,-1,0) * this->getMagnitude() * dt;
     49  return /*(this->getAbsDir().apply(Vector(0,1,0)))*/ Vector(0,-1,0) * this->getMagnitude();
    5050}
    5151
  • orxonox/trunk/src/lib/physics/fields/gravity.h

    r4338 r4395  
    2121  virtual ~Gravity();
    2222
    23   virtual Vector calcForce(float dt, const Vector& data) const;
     23  virtual Vector calcForce(const Vector& data) const;
    2424
    2525 private:
  • orxonox/trunk/src/lib/physics/fields/point_gravity.cc

    r4338 r4395  
    4545   \returns The force.
    4646*/
    47 Vector PointGravity::calcForce(float dt, const Vector& data) const
     47Vector PointGravity::calcForce(const Vector& data) const
    4848{
    49   return (this->getAbsCoor() - data) * this->getMagnitude() * dt;
     49  return (this->getAbsCoor() - data) * this->getMagnitude();
    5050}
    5151
  • orxonox/trunk/src/lib/physics/fields/point_gravity.h

    r4338 r4395  
    2121  virtual ~PointGravity();
    2222
    23   virtual Vector calcForce(float dt, const Vector& data) const;
     23  virtual Vector calcForce(const Vector& data) const;
    2424
    2525 private:
  • orxonox/trunk/src/lib/physics/fields/twirl.cc

    r4338 r4395  
    4545   \returns The force.
    4646*/
    47 Vector Twirl::calcForce(float dt, const Vector& data) const
     47Vector Twirl::calcForce(const Vector& data) const
    4848{
    4949  return /*this->getAbsDir()*/ Vector(0,1,0).cross(this->getAbsCoor() - data)
    50     * this->getMagnitude() * dt;
     50    * this->getMagnitude();
    5151}
    5252
  • orxonox/trunk/src/lib/physics/fields/twirl.h

    r4338 r4395  
    2121  virtual ~Twirl();
    2222
    23   virtual Vector calcForce(float dt, const Vector& data) const;
     23  virtual Vector calcForce(const Vector& data) const;
    2424
    2525 private:
  • orxonox/trunk/src/lib/physics/physics_connection.cc

    r4384 r4395  
    4949    \param dt The time to apply in Seconds
    5050*/
    51 void PhysicsConnection::apply(const float& dt) const
     51void PhysicsConnection::apply(void) const
    5252{
    5353  if (likely(this->type == PCON_PhysIField && this->field->getMagnitude() != 0.0))
    54       this->subject->applyField(this->field, dt);
     54      this->subject->applyField(this->field);
    5555  else ;
    5656}
  • orxonox/trunk/src/lib/physics/physics_connection.h

    r4394 r4395  
    3030  virtual ~PhysicsConnection();
    3131
    32   void apply(const float& dt) const;
     32  void apply(void) const;
    3333
    3434 private:
  • orxonox/trunk/src/lib/physics/physics_engine.cc

    r4394 r4395  
    144144  while (enumConn)
    145145    {
    146       enumConn->apply(dt);
     146      enumConn->apply();
    147147      enumConn = iterator->nextElement();
    148148    }
  • orxonox/trunk/src/lib/physics/physics_interface.cc

    r4392 r4395  
    8888       
    8989       
    90 void PhysicsInterface::applyField(Field* field, float dt)
     90void PhysicsInterface::applyField(Field* field)
    9191{
    9292  //  this->forceSum += force;
  • orxonox/trunk/src/lib/physics/physics_interface.h

    r4382 r4395  
    1515//! A Physics interface
    1616/**
    17    here can be some longer description of this class
     17   The PhysicsInterface is an extension to Any other object,
     18   that can be used to turn it to be Physcally animated.
     19   Still you have to connect fields.
     20   IMPORTANT is, that when using PNodes this baseclass is ok.
     21   BUT, when using any other class that does not by itself implement
     22   PNode you __MUST__ implement all the virtual functions by your own
    1823*/
    1924class PhysicsInterface : virtual public BaseObject
     
    3035  inline float getTotalMass( void ) const { return mass + massChildren; };
    3136
    32   virtual void applyField(Field* field, float dt);
     37  virtual void applyField(Field* field);
    3338  virtual void tickPhys( float dt );
    3439
    3540 protected:
    36   void recalcMass();
     41  virtual void recalcMass();
    3742
    3843 
Note: See TracChangeset for help on using the changeset viewer.