Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 5, 2006, 10:40:50 AM (18 years ago)
Author:
hdavid
Message:

fog effect

File:
1 edited

Legend:

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

    r9182 r9205  
    2020#include "shell_command.h"
    2121#include "script_class.h"
     22#include "cloud_effect.h"
    2223
    2324// Define shell commands
     
    8485  this->fogFadeInActivate = false;
    8586  this->fogFadeOutActivate = false;
     87 
     88  this->cloudColor = Vector(0.2f, 0.3f, 0.3f);
     89  this->skyColor = Vector(0.2f, 0.3f, 0.3f);
    8690}
    8791
     
    9397    WeatherEffect::loadParams(root);
    9498
    95     LoadParam(root, "mode", this, FogEffect, setFogMode).describe("fog mode (linear, exponential)");;
    96     LoadParam(root, "density", this, FogEffect, setFogDensity).describe("fog density if exp. fog");;
    97     LoadParam(root, "range", this, FogEffect, setFogRange).describe("fog range: start, end");;
    98     LoadParam(root, "color", this, FogEffect, setFogColor).describe("fog color: r,g,b");;
    99     LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn).describe("duration of the fade in");;
    100     LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut).describe("duration of the fade out");;
    101 
     99    LoadParam(root, "mode", this, FogEffect, setFogMode).describe("fog mode (linear, exponential)");
     100    LoadParam(root, "density", this, FogEffect, setFogDensity).describe("fog density if exp. fog");
     101    LoadParam(root, "range", this, FogEffect, setFogRange).describe("fog range: start, end");
     102    LoadParam(root, "color", this, FogEffect, setFogColor).describe("fog color: r,g,b");
     103    LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn).describe("duration of the fade in");
     104    LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut).describe("duration of the fade out");
     105    LoadParam(root, "cloudcolor", this, FogEffect, setCloudColor);
     106    LoadParam(root, "skycolor", this, FogEffect, setSkyColor);
     107   
    102108    LOAD_PARAM_START_CYCLE(root, element);
    103109    {
    104       LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate");;
     110      LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate");
    105111    }
    106112    LOAD_PARAM_END_CYCLE(element);
     
    125131
    126132    glEnable(GL_FOG);
     133   
     134    // Store cloud- and sky color before the snow
     135    this->oldCloudColor = CloudEffect::cloudColor;
     136    this->oldSkyColor   = CloudEffect::skyColor;
     137   
     138    // Change the colors
     139    CloudEffect::changeCloudColor(this->cloudColor, this->fogFadeInDuration);
     140    CloudEffect::changeSkyColor(this->skyColor, this->fogFadeInDuration);
    127141}
    128142
     
    207221    // If no manual FadeIn value was set, set a default value
    208222    if (!this->fogFadeInDuration > 0)
    209         this->fogFadeInDuration = 20;
     223        this->fogFadeInDuration = 10;
    210224
    211225    // Reset local timer
     
    227241    this->fogFadeInActivate = false;
    228242
     243   
    229244    // If Fog is off, turn it on first
    230245    if (!this->fogActivate)
     
    233248    // If no manual FadeOut value was set, set a default value
    234249    if (!this->fogFadeOutDuration > 0)
    235         this->fogFadeOutDuration = 20;
     250        this->fogFadeOutDuration = 10;
    236251
    237252    // set FogFadeOut activate
     
    240255    // Reset local timer
    241256    this->localTimer = 0;
    242 }
    243 
     257
     258    // Restore the old cloud- and sky color
     259    CloudEffect::changeCloudColor(this->oldCloudColor, this->fogFadeOutDuration);
     260    CloudEffect::changeSkyColor(this->oldSkyColor, this->fogFadeOutDuration);
     261}
     262
Note: See TracChangeset for help on using the changeset viewer.