Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8071 in orxonox.OLD for branches/atmospheric_engine/src


Ignore:
Timestamp:
Jun 1, 2006, 3:04:43 PM (18 years ago)
Author:
hdavid
Message:

branches/atmospheric_engine: lightening effect

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

    r8050 r8071  
    2323#include "parser/tinyxml/tinyxml.h"
    2424
     25#include "shell_command.h"
     26
     27SHELL_COMMAND(activate, LighteningEffect, activateLightening);
     28SHELL_COMMAND(deactivate, LighteningEffect, deactivateLightening);
     29
    2530using namespace std;
    2631
     
    3641                this->loadParams(root);
    3742
    38         this->activate();
     43  if(this->lighteningActivate)
     44         this->activate();
    3945}
    4046
     
    4753{
    4854        WeatherEffect::loadParams(root);
     55 
     56  LoadParam(root, "coord", this, LighteningEffect, coord);
     57  LoadParam(root, "option", this, LighteningEffect, setLighteningOption);
    4958}
    5059
     
    5261bool LighteningEffect::init()
    5362{
     63  lighteningActivate = false;
     64 
    5465  this->time = 0.0;
    5566  this->flashFrequency = 0.6f;
    5667  this->flashConstTime = 0.07f;
    5768
    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;
     69  this->width = 40.0f;
     70  this->height = 10.0f;
    6571  this->bNewCoordinate = false;
    6672
    67   this->seedX = 20.f;
    68   this->seedZ = 50.0f;
     73  this->seedX = 10.f;
     74  this->seedZ = 10.0f;
    6975  this->seedTime = 4.0f;
    7076
     
    7278  this->billboard->setTexture("maps/lightning_bolt.png");
    7379  this->billboard->setSize(this->width, this->height);
    74   this->billboard->setAbsCoor(50, 0, 0);
     80  this->billboard->setAbsCoor(0.0f, 50.0f, 0.0f);
    7581  this->billboard->setVisibiliy(false);
    76   //this->billboard->setAbsCoor(50, 0, 0);
    77   //this->billboard->setVisibiliy(true);
    7882
    7983/*
     
    8993}
    9094
     95void LighteningEffect::coord(float x, float y, float z)
     96{
     97  this->billboard->setAbsCoor(x, y, z);
     98  this->mainPosX = x;
     99  this->mainPosY = y;
     100  this->mainPosZ = z;
     101 
     102}
    91103
    92104bool LighteningEffect::activate()
    93105{
    94106        PRINTF(0)( "Activating LighteningEffect\n" );
    95 
     107  this->billboard->setVisibiliy(true);
     108  lighteningActivate = true;
    96109}
    97110
     
    100113{
    101114        PRINTF(0)("Deactivating LighteningEffect\n");
     115  this->billboard->setVisibiliy(false);
     116  lighteningActivate = false;
    102117}
    103118
    104119void LighteningEffect::tick (float dt)
    105120{
     121  if(!lighteningActivate)
     122    return;
     123 
    106124  this->time += dt;
    107125
     
    121139  if( this->bNewCoordinate)
    122140  {
    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);
     141    this->flashFrequency = this->seedTime * (float)rand()/(float)RAND_MAX + 0.1;
     142    this->billboard->setAbsCoor(this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX, this->mainPosY, this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX);
    125143    this->bNewCoordinate = false;
    126144  }
  • branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h

    r8050 r8071  
    3131
    3232                virtual void tick(float dt);
     33   
     34    void coord(float x, float y, float z);
     35   
     36    inline void setLighteningOption(const std::string& option) { if (option == "activate") this->lighteningActivate = true;
     37                                                                                  /*if (option == "activate") this->snowActivate = true; */}
    3338
     39    void activateLightening() { this->activate(); }
     40    void deactivateLightening() { this->deactivate(); }
     41   
    3442        private:
    3543    Billboard* billboard;
     44    bool lighteningActivate;
    3645
    3746    float flashFrequency;                   //!< frequency to activate itself
     
    5261    float seedZ;
    5362    float seedTime;
     63   
     64    float mainPosX;
     65    float mainPosY;
     66    float mainPosZ;
    5467
    5568    //OrxSound::SoundSource    soundSource;
Note: See TracChangeset for help on using the changeset viewer.