00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef L3_WEATHER_INCLUDED
00024 #define L3_WEATHER_INCLUDED
00025
00026 #include "../grinliz/gldebug.h"
00027 #include "../grinliz/glutil.h"
00028 #include "../grinliz/glcolor.h"
00029
00030 namespace lilith3d
00031 {
00032
00033 const float L3_WEATHER_SPEED = 0.2f;
00034
00038 class Weather
00039 {
00040 public:
00041 Weather();
00042
00053 void SmartEnableFog() const;
00054 float Fog() const { return param[FOG]; }
00055 float Rain() const { return param[RAIN]; }
00056 float Haze() const { return param[HAZE]; }
00057
00058 void FogColor( grinliz::Color3F* color ) const;
00059 float FogAtInfinity() const;
00060
00062 void SetFog( float v ) { param[FOG] = grinliz::Clamp( v, 0.0f, 1.0f ); }
00064 void SetRain( float v ) { param[RAIN] = grinliz::Clamp( v, 0.0f, 1.0f ); }
00065
00066 void DoTick( const Weather& target );
00067
00068 #ifdef DEBUG
00069 void Dump();
00070 #endif
00071
00072 private:
00073 enum
00074 {
00075 FOG,
00076
00077 RAIN,
00078 HAZE,
00079 PARAM_COUNT
00080 };
00081
00082 void FogParams( float fog, float* start, float* end ) const;
00083
00084 float param[PARAM_COUNT];
00085 };
00086 };
00087
00088 #endif
00089