00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _ATMOSTPHERE_HPP_
00021 #define _ATMOSTPHERE_HPP_
00022
00023 #include "Skylight.hpp"
00024 #include "VecMath.hpp"
00025 #include "StelNavigator.hpp"
00026 #include "Skybright.hpp"
00027 #include "StelFader.hpp"
00028
00029 #ifdef USE_OPENGL_ES2
00030 #include "GLES2/gl2.h"
00031 #else
00032 #include <QtOpenGL>
00033 #endif
00034
00035 class StelProjector;
00036 class StelToneReproducer;
00037 class StelCore;
00038
00042 class Atmosphere
00043 {
00044 public:
00045 Atmosphere(void);
00046 virtual ~Atmosphere(void);
00047 void computeColor(double JD, Vec3d _sunPos, Vec3d moonPos, float moonPhase, StelCore* core,
00048 float latitude = 45.f, float altitude = 200.f,
00049 float temperature = 15.f, float relativeHumidity = 40.f);
00050 void draw(StelCore* core);
00051 void update(double deltaTime) {fader.update((int)(deltaTime*1000));}
00052
00054 void setFadeDuration(float duration) {fader.setDuration((int)(duration*1000.f));}
00056 float getFadeDuration() {return fader.getDuration()/1000.f;}
00057
00059 void setFlagShow(bool b){fader = b;}
00061 bool getFlagShow() const {return fader;}
00062
00065 float getRealDisplayIntensityFactor(void) const {return fader.getInterstate()*eclipseFactor;}
00066
00067
00068 float getFadeIntensity(void) const {return fader.getInterstate();}
00069
00074 float getAverageLuminance(void) const {return averageLuminance;}
00075
00077 void setLightPollutionLuminance(float f) { lightPollutionLuminance = f; }
00079 float getLightPollutionLuminance() const { return lightPollutionLuminance; }
00080
00081 private:
00082 Vec4i viewport;
00083 Skylight sky;
00084 Skybright skyb;
00085 int skyResolutionY,skyResolutionX;
00086
00087 Vec2f* posGrid;
00088 Vec4f* colorGrid;
00089 unsigned int* indices;
00090
00092 float averageLuminance;
00093 float eclipseFactor;
00094 ParabolicFader fader;
00095 float lightPollutionLuminance;
00096
00098 bool useShader;
00099
00101 class QGLShaderProgram* atmoShaderProgram;
00102 struct {
00103 int alphaWaOverAlphaDa;
00104 int oneOverGamma;
00105 int term2TimesOneOverMaxdLpOneOverGamma;
00106 int brightnessScale;
00107 int sunPos;
00108 int term_x, Ax, Bx, Cx, Dx, Ex;
00109 int term_y, Ay, By, Cy, Dy, Ey;
00110 int projectionMatrix;
00111 int skyVertex;
00112 int skyColor;
00113 } shaderAttribLocations;
00114 };
00115
00116 #endif // _ATMOSTPHERE_HPP_