Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10157 in orxonox.OLD


Ignore:
Timestamp:
Jan 1, 2007, 10:12:43 PM (17 years ago)
Author:
marcscha
Message:

replacement of wobble upgrade function through function pointer approach

Location:
branches/playability/src/world_entities/effects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/effects/wobblegrid.cc

    r10156 r10157  
    9191  this->angularSpeed = M_PI; //180;
    9292  this->setModel(this->grid);
     93
     94  this->setUpdateFunction((*sinf));
    9395}
    9496
     
    139141
    140142      Vector2D& vec = this->grid->texCoord(z*this->subdivision + x);
    141       vec.y  = (x * fac + sgn(x-2)*sinf(angle)*fac/2.0);
    142       vec.x  = (z * fac + sgn(z-2)*sinf(angle)*fac/2.0);
     143      vec.y  = (x * fac + sgn(x-2)*updateWobble(angle)*fac/2.0);
     144      vec.x  = (z * fac + sgn(z-2)*updateWobble(angle)*fac/2.0);
    143145    }
    144146  }
    145147  //this->grid->finalize();
    146 
    147   Vector view = this->getAbsCoor() - State::getCameraNode()->getAbsCoor();
    148   view.normalize();
    149 
    150   Vector up = Vector(0, 1, 0);
    151   Vector h = up.cross(view);
    152   up = h.cross(view);
    153 
    154   Quaternion dir = Quaternion::lookAt( this->getAbsCoor(), this->getAbsCoor() + up, view);
    155   this->setAbsDir(dir);
    156 
     148  this->orient();
    157149}
    158150
     
    200192  glPopAttrib();
    201193}
     194
     195void Wobblegrid::orient()
     196{
     197
     198  Vector view = this->getAbsCoor() - State::getCameraNode()->getAbsCoor();
     199  view.normalize();
     200
     201  Vector up = Vector(0, 1, 0);
     202  Vector h = up.cross(view);
     203  up = h.cross(view);
     204
     205  Quaternion dir = Quaternion::lookAt( this->getAbsCoor(), this->getAbsCoor() + up, view);
     206  this->setAbsDir(dir);
     207}
  • branches/playability/src/world_entities/effects/wobblegrid.h

    r10154 r10157  
    2929    virtual void draw() const;
    3030
     31    inline void setUpdateFunction(float (*updateFct)(float value)) { if( updateFct)  this->updateWobble = updateFct;};
     32
    3133  private:
     34    float (*updateWobble)(float value);
     35
     36    void orient();
     37
    3238    Material*        material;
    3339    Grid*            grid;      //!< current projected positions transformed into billboard state
Note: See TracChangeset for help on using the changeset viewer.