Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10325 in orxonox.OLD


Ignore:
Timestamp:
Jan 24, 2007, 11:30:09 AM (18 years ago)
Author:
stefalie
Message:
 
Location:
branches/blink/src/world_entities/effects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/blink/src/world_entities/effects/blink.cc

    r10253 r10325  
    1919#include "debug.h"
    2020#include "state.h"
     21
    2122
    2223#include "material.h"
     
    7071  //this->material->setBlendFunc(GL_ZERO,GL_ZERO);
    7172  //this->material->setDiffuseMap("pictures/rblink2.png");
    72   this->material->setDiffuseMap("maps/star.bmp");
     73  this->material->setDiffuseMap("maps/star_alpha.png");
    7374  //this->setAbsCoor(0, 0, 0);d
    7475  //this->setVisibiliy(true);
    7576  // this->setSize(5, 5);
    7677
     78  //srand((unsigned)time(NULL));
     79
     80
     81  /// Standard values
    7782  this->setAbsCoor(0, 0, 0);
    78   this->position = Vector(0, 0, 0); ///remove
     83  this->position = Vector(0, 0, 0); ///remove
     84  this->color = Vector(255, 255, 255);
    7985  this->size = 10;
     86  this->omega = 10;
     87  this->angle = rand() % 1000;
     88  PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle);
     89  this->angle *= 2 * M_PI;
     90  PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle);
    8091}
    8192
     
    91102  LoadParam(root, "position", this, Blink, setPosition);
    92103  LoadParam(root, "size", this, Blink, setSize);
     104  LoadParam(root, "color", this, Blink, setColor);
     105  LoadParam(root, "omega", this, Blink, setOmega);
    93106//   LoadParam(root, "watersize", this, Blink, setWaterSize);
    94107//   LoadParam(root, "wateruv", this, Blink, setWaterUV);
     
    116129void Blink::tick(float dt)
    117130{
     131  this->angle += dt * this->omega;
     132
     133  if (this->angle > 2 * M_PI)
     134    this->angle -= 2 * M_PI;
     135
     136  this->blinkStr = sinf(angle);
    118137}
    119138
     
    125144{
    126145  glPushAttrib(GL_ENABLE_BIT);
    127   glDisable(GL_LIGHTING);
     146  glEnable(GL_LIGHTING); //glDisable(GL_LIGHTING);
    128147  glDisable(GL_FOG);
    129148  glMatrixMode(GL_MODELVIEW);
     
    147166//     glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    148167
    149   glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Set The Blending Function For Translucency
    150   glEnable(GL_BLEND);
    151   glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
     168//   glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Set The Blending Function For Translucency
     169//   glEnable(GL_BLEND);
     170//   glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
     171//   glShadeModel(GL_SMOOTH);
     172
     173
     174  Vector camCoor = State::getCameraNode()->getAbsCoor();
     175  Vector diff = camCoor - this->position;
    152176
    153177  //glTranslatef(position.x + size/2, position.y + size/2, position.z);
     
    164188
    165189
    166   glColor4ub(255, 0, 0, 255);
     190  glColor4ub(this->color.x, this->color.y, this->color.z, 127.5*(this->blinkStr + 1));
    167191  glBegin(GL_QUADS);
    168192    glTexCoord2f(1, 1); glVertex3f(0, 0, 0);
  • branches/blink/src/world_entities/effects/blink.h

    r10253 r10325  
    77
    88#include "world_entity.h"
     9#include "color.h"
    910
    1011class Material;
     
    2324    void setPosition(float x, float y, float z) { this->position = Vector(x, y, z); }
    2425    void setSize(float s) { this->size = s; }
     26    void setOmega(float w) { this->omega = w; }
     27    void setColor(float r, float g, float b) { this->color = Vector(r, g, b); }
    2528    //void setTexture(const std::string& textureFile);
    2629
     
    3134    Material*         material;
    3235    Vector            position;
     36    Vector            color;
     37    float             angle;
     38    float             omega;
     39    float             blinkStr;
    3340    float             size;             //! only one float caus' its quadratical
    3441};
Note: See TracChangeset for help on using the changeset viewer.