Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 19, 2007, 9:03:23 AM (18 years ago)
Author:
nicolasc
Message:

added a pulsing capability for the billboard ( I need it for the Plasma Projectile)

Location:
branches/vs-enhencements/src/world_entities/effects
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/world_entities/effects/billboard.cc

    r10618 r10633  
    6969
    7070  this->texColor = NULL;
     71
     72  this->pulseMagnitude = .5;
     73  this->bPulse = false;
     74
     75  this->angularSpeed = M_PI; //180;
     76  this->angle = 0;
     77
     78  this->setUpdateFunction((*sinf));
    7179}
    7280
     
    113121void Billboard::tick(float dt)
    114122{
     123  this->angle += dt * this->angularSpeed;
     124  if (this->angle > 2 * M_PI)
     125    this->angle -= 2 * M_PI;
    115126}
    116127
     
    145156  v.normalize();
    146157
    147   v *= sizeX;
    148   h *= sizeY;
     158  float tmp = 1;
     159  if (this->bPulse)
     160    tmp = 1 + this->pulseMagnitude * updatePulse(this->angle);
     161
     162  v *= sizeX * tmp;
     163  h *= sizeY * tmp;
    149164
    150165//v += this->getAbsCoor();
  • branches/vs-enhencements/src/world_entities/effects/billboard.h

    r10433 r10633  
    2626    void colorTexture(const Color col);
    2727
     28    inline void togglePluse () {this->bPulse = !bPulse; };
     29    inline void setPulse () { this->bPulse = true; };
     30    inline void setPulse ( bool state ) {this->bPulse = state; };
     31    inline float getPulse () { return this->bPulse; };
     32
    2833    virtual void tick(float dt);
    2934    virtual void draw() const;
    3035
     36    inline void setUpdateFunction(float (*updateFct)(float value)) { if( updateFct)  this->updatePulse = updateFct;};
     37
    3138  private:
     39
     40    float (*updatePulse)(float value);
     41
    3242    Material*        material;
    3343    Color*           texColor;
    3444    float sizeX;
    3545    float sizeY;
     46
     47    bool bPulse;
     48    float pulseMagnitude;
     49    float angle;
     50    float angularSpeed;
    3651};
    3752
  • branches/vs-enhencements/src/world_entities/effects/wobblegrid.cc

    r10618 r10633  
    1010
    1111### File Specific:
    12    main-programmer: David Hasenfratz
     12   main-programmer: Marc Schärer
    1313*/
    1414
Note: See TracChangeset for help on using the changeset viewer.