Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 12, 2006, 3:50:16 PM (18 years ago)
Author:
hdavid
Message:

branches/atmospheric_engine

File:
1 edited

Legend:

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

    r8281 r8326  
    5656 
    5757  LoadParam(root, "coord", this, LighteningEffect, coord);
    58   LoadParam(root, "option", this, LighteningEffect, setLighteningOption);
    5958  LoadParam(root, "frequency", this, LighteningEffect, setFlashFrequency);
    6059  LoadParam(root, "const-time", this, LighteningEffect, setFlashConstTime);
     
    6261  LoadParam(root, "size", this, LighteningEffect, setFlashSize);
    6362  LoadParam(root, "seed", this, LighteningEffect, setFlashSeed);
     63 
     64  LOAD_PARAM_START_CYCLE(root, element);
     65  {
     66    LoadParam_CYCLE(element, "option", this, LighteningEffect, setLighteningOption);
     67  }
     68  LOAD_PARAM_END_CYCLE(element);
    6469}
    6570
     
    8893  this->billboard[0]->setTexture("maps/lightning_bolt1.png");
    8994  this->billboard[0]->setSize(this->width, this->height);
    90   this->billboard[0]->setAbsCoor(3000,850,0);
    9195  this->billboard[0]->setVisibiliy(false);
    9296
     
    9498  this->billboard[1]->setTexture("maps/lightning_bolt2.png");
    9599  this->billboard[1]->setSize(this->width, this->height);
    96   this->billboard[1]->setAbsCoor(3000,850,0);
    97100  this->billboard[1]->setVisibiliy(false);
    98101
     
    100103  this->billboard[2]->setTexture("maps/lightning_bolt3.png");
    101104  this->billboard[2]->setSize(this->width, this->height);
    102   this->billboard[2]->setAbsCoor(3000,850,0);
    103105  this->billboard[2]->setVisibiliy(false);
    104106
     
    106108  this->billboard[3]->setTexture("maps/lightning_bolt4.png");
    107109  this->billboard[3]->setSize(this->width, this->height);
    108   this->billboard[3]->setAbsCoor(3000,850,0);
    109110  this->billboard[3]->setVisibiliy(false);
     111 
     112  if (this->lighteningMove)
     113  {
     114    this->cameraCoor = State::getCameraNode()->getAbsCoor();
     115    this->billboard[0]->setAbsCoor(this->cameraCoor.x+3000,850,this->cameraCoor.z+0);
     116    this->billboard[1]->setAbsCoor(this->cameraCoor.x+3000,850,this->cameraCoor.z+0);
     117    this->billboard[2]->setAbsCoor(this->cameraCoor.x+3000,850,this->cameraCoor.z+0);
     118    this->billboard[3]->setAbsCoor(this->cameraCoor.x+3000,850,this->cameraCoor.z+0);
     119  }
     120  else
     121  {
     122    this->billboard[0]->setAbsCoor(3000,850,0);
     123    this->billboard[1]->setAbsCoor(3000,850,0);
     124    this->billboard[2]->setAbsCoor(3000,850,0);
     125    this->billboard[3]->setAbsCoor(3000,850,0);
     126  }
    110127 
    111128  this->flashLight = new Light();
     
    127144void LighteningEffect::coord(float x, float y, float z)
    128145{
    129   this->billboard[0]->setAbsCoor(x, y, z);
    130   this->billboard[1]->setAbsCoor(x, y, z);
    131   this->billboard[2]->setAbsCoor(x, y, z);
    132   this->billboard[3]->setAbsCoor(x, y, z);
     146  if (this->lighteningMove)
     147  {
     148    this->cameraCoor = State::getCameraNode()->getAbsCoor();
     149    this->billboard[0]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
     150    this->billboard[1]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
     151    this->billboard[2]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
     152    this->billboard[3]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
     153  }
     154  else
     155  {
     156    this->billboard[0]->setAbsCoor(x, y, z);
     157    this->billboard[1]->setAbsCoor(x, y, z);
     158    this->billboard[2]->setAbsCoor(x, y, z);
     159    this->billboard[3]->setAbsCoor(x, y, z);
     160  }
    133161  this->mainPosX = x;
    134162  this->mainPosY = y;
     
    219247  if( this->bNewCoordinate)
    220248  {
    221     float posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX;
    222     float posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX;
     249    float posX, posZ;
     250    if(this->lighteningMove)
     251    {
     252    this->cameraCoor = State::getCameraNode()->getAbsCoor();
     253    posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX + this->cameraCoor.x;
     254    posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX + this->cameraCoor.z;
     255    }
     256    else
     257    {
     258      posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX;
     259      posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX;
     260    }
     261   
    223262    this->billboard[0]->setAbsCoor(posX, this->mainPosY, posZ);
    224263    this->billboard[1]->setAbsCoor(posX, this->mainPosY, posZ);
Note: See TracChangeset for help on using the changeset viewer.