weather.h

00001 /*--License:
00002         Lilith 3D Engine
00003         Copyright Lee Thomason (Grinning Lizard Software) 2002-2004
00004         www.grinninglizard.com/lilith
00005 
00006         This program is free software; you can redistribute it and/or
00007         modify it under the terms of the GNU General Public License
00008         as published by the Free Software Foundation; either version 2
00009         of the License, or (at your option) any later version.
00010 
00011         This program is distributed in the hope that it will be useful,
00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014         GNU General Public License for more details.
00015 
00016         You should have received a copy of the GNU General Public License
00017         along with this program; if not, write to the Free Software
00018         Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020         The full text of the license can be found in license.txt
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,            // the amount of fog. 0 is a clear day, 1 is whiteout.
00076 //              COVERDARK,      // darkness caused by high cloud cover. 0 is no high cloud cover, 1 is very dark.
00077                 RAIN,           // the amount of rain.
00078                 HAZE,           // the amount of ground 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 

Generated on Fri Mar 23 19:36:22 2007 for Lilith3D by  doxygen 1.5.1-p1