Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10431 in orxonox.OLD for branches


Ignore:
Timestamp:
Jan 28, 2007, 2:08:47 AM (18 years ago)
Author:
stefalie
Message:

blink: another small cleanup commit

Location:
branches/blink/src/world_entities/effects
Files:
3 edited

Legend:

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

    r10426 r10431  
    152152  // changes the color of the texture (if any is set)
    153153  if(this->texColor != NULL)
    154     glColor4ub((GLubyte)this->texColor->r()*255, (GLubyte)this->texColor->g()*255, (GLubyte)this->texColor->b()*255, 255);
     154    glColor4ub((GLubyte)this->texColor->r()*255, (GLubyte)this->texColor->g()*255, (GLubyte)this->texColor->b()*255, (GLubyte)(this->texColor->a()*255));
    155155
    156156  glBegin(GL_QUADS);
  • branches/blink/src/world_entities/effects/blink.cc

    r10429 r10431  
    99
    1010### File Specific:
    11    main-programmer:
     11   main-programmer: Lieni
    1212*/
    1313
     
    1919#include "state.h"
    2020#include "effects/billboard.h"
    21 
    22 #include "material.h"
    23 
    24 
    2521
    2622
     
    3733  this->init();
    3834
    39   if( root)
     35  if(root)
    4036    this->loadParams(root);
    41 
    42 //   this->bBoard->setSize(this->size, this->size);
    4337}
    4438
     
    4943Blink::~Blink ()
    5044{
    51 //  if (this->material)
    52   //  delete this->material;
     45  if(bBoard)
     46    delete bBoard;
    5347}
    5448
     
    6761  this->bBoard->setVisibiliy(true);
    6862  this->bBoard->setTexture("maps/star_alpha.png");
    69   this->bBoard->setAbsCoor(0, 0, 0);
    70 
    7163
    7264  /// Standard values
    73   this->setAbsCoor(0, 0, 0);
    74   // red if not defined in xml
     65  this->bBoard->setAbsCoor(0, 0, 0);
     66  // default position if not set in xml
    7567  this->color = Color(1, 0, 0);
    7668  // 10x10 pxl if not defined in xml
    7769  this->size = 10;
     70  // default angular rate
    7871  this->omega = 10;
    79   this->angle = rand() % 1000;
    80   PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle);
    81   this->angle *= 2 * M_PI;
    82   PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle);
     72
     73  // random start angle, blinkies shouldn't blink synchronous
     74  this->angle = (float)rand()/(float)RAND_MAX * 2 * M_PI;
    8375}
    8476
     
    10799  this->angle += dt * this->omega;
    108100
    109   if (this->angle > 2 * M_PI)
     101  while (this->angle > 2 * M_PI)
    110102    this->angle -= 2 * M_PI;
    111103
    112   this->blinkStr = sinf(angle);
     104  // blinkStr should be element of [0, 1]
     105  this->blinkStr = (sinf(angle) + 1) / 2;
    113106
    114   this->bBoard->colorTexture(Color(color.r(), color.g(), color.b(), 1));
     107  this->bBoard->colorTexture(Color(color.r(), color.g(), color.b(), this->blinkStr));
    115108}
    116109
  • branches/blink/src/world_entities/effects/blink.h

    r10429 r10431  
    3434  private:
    3535    Billboard*        bBoard;
    36     //Vector            position;
    3736    Color             color;
    3837    float             angle;
Note: See TracChangeset for help on using the changeset viewer.