Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8702 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics


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

branches/atmospheric_engine: cleanup

Location:
branches/atmospheric_engine/src/lib/graphics/effects
Files:
5 edited

Legend:

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

    r8700 r8702  
    122122
    123123    // If Fog Fade
    124     if ( this->fogFadeInActivate || this->fogFadeOutActivate )
    125         glFogf(GL_FOG_DENSITY, this->fogFadeDensity);
    126 
     124    if ( this->fogFadeInActivate || this->fogFadeOutActivate ) {
     125      glDisable(GL_FOG);
     126      glFogf(GL_FOG_DENSITY, this->fogFadeDensity);
     127      glEnable(GL_FOG);
     128    }
    127129}
    128130
  • 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}
  • branches/atmospheric_engine/src/lib/graphics/effects/lightening_effect.h

    r8700 r8702  
    3434
    3535                virtual void tick(float dt);
    36                
     36
    3737                void coord(float x, float y, float z);
    3838                void setFlashSize(float width, float height, float seedWidth, float seedHeight);
    39                
     39
    4040                inline void setLighteningOption(const std::string& option) {
    4141                        if (option == "activate") this->lighteningActivate = true;
     
    4343                }
    4444
    45                 inline void setFlashFrequency(float mainFrequency, float seedTime) {
    46                         this->mainFrequency = mainFrequency;
    47                         this->flashFrequency = mainFrequency;
    48                         this->seedTime = seedTime;
     45                inline void setFlashFrequency(float baseFrequency, float seedTime) {
     46                        this->flashFrequencyBase = baseFrequency;
     47                        this->flashFrequency = baseFrequency;
     48                        this->flashFrequencySeed = seedTime;
    4949                }
    50                
    51                 inline void setFlashConstTime(float flashConstTime) { this->flashConstTime = flashConstTime; }
     50
     51                inline void setFlashConstTime(float holdTime) { this->flashHoldTime = holdTime; }
    5252
    5353                inline void setFlashRisingTime(float flashRisingTime) {
    54                         if(flashRisingTime > this->flashConstTime)
    55                                 this->flashRisingTime = this->flashConstTime/2;
     54                        if(flashRisingTime > this->flashHoldTime)
     55                                this->flashRisingTime = this->flashHoldTime * 0.5;
    5656                        else
    5757                                this->flashRisingTime = flashRisingTime;
    5858                }
    59                
     59
    6060                inline void setFlashSeed(float seedX, float seedZ) {
    6161                        this->seedX = seedX;
    6262                        this->seedZ = seedZ;
    6363                }
    64                
     64
    6565
    6666        private:
     
    6868                bool lighteningActivate;
    6969                bool lighteningMove;
    70                
     70
    7171                float flashFrequency;
    72                 float mainFrequency;
    73                 float flashConstTime;
     72                float flashFrequencyBase;
     73                float flashHoldTime;
    7474                float flashRisingTime;
    75                
     75
    7676                float time;
    77                
    78     bool  flashingActive;
    79     bool bNewCoordinate;
    8077
    8178                float width;
     
    8380                float seedWidth;
    8481                float seedHeight;
    85                
     82
    8683                float seedX;
    8784                float seedZ;
    88                 float seedTime;
    89                
     85                float flashFrequencySeed;
     86
    9087                float mainPosX;
    9188                float mainPosY;
    9289                float mainPosZ;
    93                
     90
     91    void newCoordinates();
     92
    9493                Vector cameraCoor;
    95                
     94
    9695                Light* flashLight;
    97                
     96
    9897                OrxSound::SoundSource    soundSource;
    9998                OrxSound::SoundBuffer*   thunderBuffer;
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_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
     
    5757    if (this->rainBuffer != NULL)
    5858        ResourceManager::getInstance()->unload(this->rainBuffer);
    59     this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.wav", WAV);
     59    this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.ogg", OGG);
    6060
    6161    //load wind sound
     
    6363        if (this->windBuffer != NULL)
    6464            ResourceManager::getInstance()->unload(this->windBuffer);
    65         this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
     65        this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.ogg", OGG);
    6666    }
    6767
  • branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.cc

    r8495 r8702  
    5050                if (this->windBuffer != NULL)
    5151                        ResourceManager::getInstance()->unload(this->windBuffer);
    52                         this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
     52                        this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.ogg", OGG);
    5353        }
    5454
     
    5656                this->activate();
    5757    SnowEffect::snowParticles->precache((int) this->snowLife);
    58   } 
     58  }
    5959}
    6060
     
    143143  if (this->snowWindForce != 0)
    144144    this->soundSource.play(this->windBuffer, 0.1f * this->snowWindForce, true);
    145  
     145
    146146}
    147147
Note: See TracChangeset for help on using the changeset viewer.