00001 #ifndef _BACKDROP_H
00002
00003 #include <stdio.h>
00004 #include <GL/gl.h>
00005 #include <GL/glu.h>
00006 #include <SDL/SDL.h>
00007 #ifdef __APPLE__
00008 #include <SDL_image/SDL_image.h>
00009 #else
00010 #include <SDL/SDL_image.h>
00011 #endif
00012 #include <string>
00013 #include <iostream>
00014 #include <fstream>
00015 #include <cmath>
00016 #include <cassert>
00017
00018 #include "quat.h"
00019 #include "camera.h"
00020 #include "weather.h"
00021 #include "textures.h"
00022 #include "settings.h"
00023
00024 #include "globals.h"
00025
00026
00027
00028 #define EARTH_RADIUS 637800.0
00029
00030 class BACKDROP
00031 {
00032 private:
00033 TEXTURE_HANDLE sun_texture, sun_texture_ref, sky_texture, rain_texture,
00034 cloud_texture, moon_texture, stars_texture;
00035 SDL_Surface * sky_tex_img;
00036 ofstream error_log;
00037 bool volumetricfog;
00038 float fogdensity;
00039 float daytime_cache;
00040 float windx,windz;
00041 int cloudthresh;
00042
00043 void DrawDrop(VERTEX pos, float rndperm, float yscale, float zheight);
00044 bool initdone;
00045
00046 string TEXTURE_PATH;
00047
00048 public:
00049 BACKDROP();
00050 ~BACKDROP();
00051 void Init();
00052 void Draw(VERTEX tersize);
00053 void DrawSky(double daytime, float transparency);
00054 void DrawSkyGradient(double daytime, float transparency, GLdouble *temp_matrix);
00055 void DrawSun(double daytime, float transparency, GLdouble *temp_matrix);
00056 void DrawMoon(double daytime, float transparency, GLdouble *temp_matrix);
00057 void DrawClouds(double daytime, float transparency, GLdouble *temp_matrix);
00058 void DrawStars(double daytime, float transparency, GLdouble *temp_matrix);
00059 void SetFogStrength(float density);
00060 void RefreshFog();
00061 void GetHorizonColor(float * color3);
00062 void GetSkyColor(float * color3);
00063 void SetCloudCover(int newcloudthresh);
00064 void SetWindoffset(float windoffset_x, float windoffset_z);
00065 void DrawRain(float day_time);
00066
00067 float sunpos_lng;
00068 float sunpos_lat;
00069
00070 float moonpos_lng;
00071 float moonpos_lat;
00072
00073 void DeInit();
00074 };
00075
00076 #define _BACKDROP_H
00077 #endif