Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8050 in orxonox.OLD for branches/atmospheric_engine


Ignore:
Timestamp:
May 31, 2006, 11:45:41 PM (19 years ago)
Author:
hdavid
Message:

branches/atmospheric_engine: basic lightening effect with billboard works

Location:
branches/atmospheric_engine/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.cc

    r8026 r8050  
    3131        this->setClassID(CL_LIGHTENING_EFFECT, "LighteningEffect");
    3232 
    33  
    34   billboard = new Billboard(NULL);
    35   billboard->setTexture("maps/lightning_bolt.png");
    36   billboard->setSize(10, 20);
    37   //billboard->setAbsCoor2D(10,10);
    38   //billboard->setVisibility(true);
    39  
    40  
    4133        this->init();
    4234
     
    6052bool LighteningEffect::init()
    6153{
    62         //Default values
     54  this->time = 0.0;
     55  this->flashFrequency = 0.6f;
     56  this->flashConstTime = 0.07f;
     57
     58  //this->material = new Material();
     59  //this->material->setDiffuseMap("maps/lightning_bolt.png");
     60  //this->offset = Vector(-1440.00, 100.00, 280.00);
     61
     62//  this->billboard->setAbsCoor(50, 0, 0);
     63  this->width = 20.0f;
     64  this->height = 5.0f;
     65  this->bNewCoordinate = false;
     66
     67  this->seedX = 20.f;
     68  this->seedZ = 50.0f;
     69  this->seedTime = 4.0f;
     70
     71  this->billboard = new Billboard(NULL);
     72  this->billboard->setTexture("maps/lightning_bolt.png");
     73  this->billboard->setSize(this->width, this->height);
     74  this->billboard->setAbsCoor(50, 0, 0);
     75  this->billboard->setVisibiliy(false);
     76  //this->billboard->setAbsCoor(50, 0, 0);
     77  //this->billboard->setVisibiliy(true);
     78
     79/*
     80  this->soundSource = NULL;
     81  this->thunderBuffer = NULL;
     82
     83  this->soundSource.setSourceNode(this);
     84
     85  //load sound
     86  if (this->thunderBuffer != NULL)
     87    ResourceManager::getInstance()->unload(this->thunderBuffer);
     88  this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/thunder.wav", WAV);*/
    6389}
    6490
     
    78104void LighteningEffect::tick (float dt)
    79105{
     106  this->time += dt;
    80107
     108  if( this->time > this->flashFrequency)
     109  {
     110    this->billboard->setVisibiliy(true);
     111    this->time = 0.0f;
     112    //this->soundSource.play(this->thunderBuffer);
     113  }
     114  else if( this->billboard->isVisible() && this->time > this->flashConstTime)
     115  {
     116    this->billboard->setVisibiliy(false);
     117    this->time = 0.0f;
     118    this->bNewCoordinate = true;
     119  }
     120
     121  if( this->bNewCoordinate)
     122  {
     123    //this->flashFrequency = this->seedTime * (float)rand()/(float)RAND_MAX + 0.1;
     124    //this->billboard>setAbsCoor( - 800.0f - this->seedX * (float)rand()/(float)RAND_MAX, 250.00, -200.0f + this->seedZ * (float)rand()/(float)RAND_MAX);
     125    this->bNewCoordinate = false;
     126  }
    81127}
  • branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h

    r7951 r8050  
    3535    Billboard* billboard;
    3636
     37    float flashFrequency;                   //!< frequency to activate itself
     38    float flashRisingTime;                  //!< time to rise
     39    float flashConstTime;                   //!< time to be drawn
     40    float flashFallTime;                    //!< time to fall
     41
     42    float time;                             //!< time
     43
     44    //bool  bRender;
     45    bool  bNewCoordinate;
     46    //Material*      material;
     47    //Vector         offset;
     48    float width;
     49    float height;
     50
     51    float seedX;
     52    float seedZ;
     53    float seedTime;
     54
     55    //OrxSound::SoundSource    soundSource;
     56    //OrxSound::SoundBuffer*   thunderBuffer;
     57
    3758};
    3859
  • branches/atmospheric_engine/src/world_entities/effects/billboard.cc

    r8026 r8050  
    6464  this->material = new Material();
    6565  this->setAbsCoor(0, 0, 0);
    66   this->setVisibiliy(true);
     66  //this->setVisibiliy(true);
    6767  this->setSize(5, 5);
    6868}
     
    140140  v.normalize();
    141141 
    142   float radius = 5;
    143   v *= .5 * sizeX;
    144   h *= .5 * sizeY;
    145  
     142  v *= sizeX;
     143  h *= sizeY;
     144
     145//v += this->getAbsCoor();
     146    //PRINTF(0)("sizeX: %f sizeY: %f\n", sizeX, sizeY);
    146147  glBegin(GL_QUADS);
    147148  glTexCoord2f(0.0f, 0.0f);
Note: See TracChangeset for help on using the changeset viewer.