Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8326 in orxonox.OLD


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

branches/atmospheric_engine

Location:
branches/atmospheric_engine/src/lib/graphics/effects
Files:
2 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);
  • branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h

    r8269 r8326  
    3737    void setFlashSize(float width, float height, float seedWidth, float seedHeight);
    3838   
    39     inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true;}
     39    inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true;
     40                                                                                         if (option == "movelightening") this->lighteningMove = true;}
    4041    inline void setFlashFrequency(float mainFrequency, float seedTime) { this->mainFrequency = mainFrequency;
    4142                                                                                                            this->flashFrequency = mainFrequency;
     
    5556    Billboard* billboard[4];
    5657    bool lighteningActivate;
     58    bool lighteningMove;
    5759
    5860    float flashFrequency;
     
    7678    float mainPosY;
    7779    float mainPosZ;
     80   
     81    Vector cameraCoor;
    7882
    7983    Light* flashLight;
Note: See TracChangeset for help on using the changeset viewer.