Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 22, 2006, 11:12:05 AM (18 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: cleanup

File:
1 edited

Legend:

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

    r8700 r8702  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2004 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111### File Specific:
    1212   main-programmer: hdavid, amaechler
     
    3535
    3636CREATE_FACTORY(LighteningEffect, CL_LIGHTENING_EFFECT);
    37 
    38 // TODO: FIx Lightening with Fog enabled
    3937
    4038LighteningEffect::LighteningEffect(const TiXmlElement* root)
     
    8078  this->lighteningActivate = false;
    8179
    82   this->time = 0.0;
    83   this->flashFrequency = 4.0f;
    84   this->mainFrequency = 4.0f;
    85   this->flashConstTime = 0.1f;
     80  this->flashFrequencyBase = 2.0f;
     81  this->flashFrequencySeed = 4.0f;
     82
     83  this->flashHoldTime = 0.1f;
    8684  this->flashRisingTime = 0.03f;
     85
     86  this->seedX = 500.f;
     87  this->seedZ = 1000.0f;
    8788
    8889  this->width = 700.0f;
     
    9091  this->seedWidth = 50.0f;
    9192  this->seedHeight = 50.0f;
    92   this->bNewCoordinate = false;
     93
    9394  this->lighteningMove = false;
    9495
    95   this->seedX = 500.f;
    96   this->seedZ = 1000.0f;
    97   this->seedTime = 2.0f;
    98 
    99   this->mainPosX = 3000;
     96  this->mainPosX = 2000;
    10097  this->mainPosY = 900;
    10198  this->mainPosZ = 0;
     99
     100  this->time = 0.0;
    102101
    103102  // initialize lightening textures
     
    142141  this->flashLight->setSpecularColor(0,0,0);
    143142
    144   // this->soundSource = NULL;
    145   // this->thunderBuffer = NULL;
    146 
    147   // this->soundSource.setSourceNode(this);
    148 
    149143  //load sound
    150144  if (this->thunderBuffer != NULL)
    151145    ResourceManager::getInstance()->unload(this->thunderBuffer);
    152   this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV);
     146  this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.ogg", OGG);
    153147
    154148}
     
    252246    this->billboard[1]->setVisibiliy(false);
    253247    this->billboard[2]->setVisibiliy(true);
    254    
     248
    255249  }
    256250  else if( this->billboard[2]->isVisible() && this->time > this->flashRisingTime)
     
    260254  }
    261255
    262   if( this->billboard[3]->isVisible() && this->time > this->flashConstTime)
     256  if( this->billboard[3]->isVisible() && this->time > this->flashHoldTime)
    263257  {
    264258    this->billboard[3]->setVisibiliy(false);
     
    266260    this->flashLight->setDiffuseColor(0,0,0);
    267261    this->flashLight->setSpecularColor(0,0,0);
    268     this->bNewCoordinate = true;
    269   }
    270 
    271   if( this->bNewCoordinate)
    272   {
     262
     263    this->newCoordinates();
     264  }
     265}
     266
     267void LighteningEffect::newCoordinates() {
     268
    273269    float posX, posZ;
    274270
     
    294290    this->billboard[3]->setAbsCoor(posX, this->mainPosY, posZ);
    295291
    296     this->flashFrequency = this->mainFrequency + this->seedTime * (float)rand()/(float)RAND_MAX;
     292    this->flashFrequency = this->flashFrequencyBase + this->flashFrequencySeed * (float)rand()/(float)RAND_MAX;
    297293
    298294    float w = this->width + this->seedWidth * (float)rand()/(float)RAND_MAX;
     
    303299    this->billboard[2]->setSize(w, h);
    304300    this->billboard[3]->setSize(w, h);
    305 
    306     this->bNewCoordinate = false;
    307   }
    308 }
     301}
Note: See TracChangeset for help on using the changeset viewer.