3
* Copyright (C) 2003 Fabien Chereau
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#ifndef _STEL_ATMOSTPHERE_H_
21
#define _STEL_ATMOSTPHERE_H_
23
#include "Skylight.hpp"
25
#include "Navigator.hpp"
26
#include "Skybright.hpp"
34
//! Compute and display the daylight sky color using openGL.
35
//! The sky brightness is computed with the SkyBright class, the color with the SkyLight
40
virtual ~Atmosphere(void);
41
void compute_color(double JD, Vec3d sunPos, Vec3d moonPos, float moon_phase, ToneReproducer * eye, Projector* prj,
42
float latitude = 45.f, float altitude = 200.f,
43
float temperature = 15.f, float relative_humidity = 40.f);
44
void draw(Projector* prj);
45
void update(double deltaTime) {fader.update((int)(deltaTime*1000));}
47
//! Set fade in/out duration in seconds
48
void setFadeDuration(float duration) {fader.set_duration((int)(duration*1000.f));}
49
//! Get fade in/out duration in seconds
50
float getFadeDuration() {return fader.get_duration()/1000.f;}
52
//! Define whether to display atmosphere
53
void setFlagShow(bool b){fader = b;}
54
//! Get whether atmosphere is displayed
55
bool getFlagShow() const {return fader;}
57
//! Get the actual atmosphere intensity due to eclipses + fader
58
//! @return the display intensity ranging from 0 to 1
59
float getRealDisplayIntensityFactor(void) const {return fader.getInterstate()*eclipseFactor;}
61
// let's you know how far faded in or out the atm is (0-1)
62
float getFadeIntensity(void) const {return fader.getInterstate();}
64
//! Get the average luminance of the atmosphere in cd/m2
65
//! If atmosphere is off, the luminance includes the background starlight + light pollution.
66
//! Otherwise it includes the atmosphere + background starlight + eclipse factor + light pollution.
67
//! @return the last computed average luminance of the atmosphere in cd/m2.
68
float getAverageLuminance(void) const {return averageLuminance;}
70
void setLightPollutionLuminance(float f) { lightPollutionLuminance = f; }
71
float getLightPollutionLuminance() const { return lightPollutionLuminance; }
74
Vector4<GLint> viewport;
77
int sky_resolution_y,sky_resolution_x;
82
GridPoint *grid; // For Atmosphere calculation
84
//! The average luminance of the atmosphere in cd/m2
85
float averageLuminance;
88
float lightPollutionLuminance;
91
#endif // _STEL_ATMOSTPHERE_H_