Atmosphere.hpp   Atmosphere.hpp 
skipping to change at line 27 skipping to change at line 27
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _ATMOSTPHERE_HPP_ #ifndef _ATMOSTPHERE_HPP_
#define _ATMOSTPHERE_HPP_ #define _ATMOSTPHERE_HPP_
#include "Skylight.hpp" #include "Skylight.hpp"
#include "VecMath.hpp" #include "VecMath.hpp"
#include "renderer/StelIndexBuffer.hpp"
#include "renderer/StelVertexBuffer.hpp"
#include "Skybright.hpp" #include "Skybright.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
#include "StelProjector.hpp"
#ifdef USE_OPENGL_ES2
#include "GLES2/gl2.h"
#else
#include <QtOpenGL>
#endif
class StelProjector; class StelProjector;
class StelToneReproducer; class StelToneReproducer;
class StelCore; class StelCore;
//! Compute and display the daylight sky color using openGL. //! Compute and display the daylight sky color.
//! The sky brightness is computed with the SkyBright class, the color with the SkyLight. //! The sky brightness is computed with the SkyBright class, the color with the SkyLight.
//! Don't use this class directly but use it through the LandscapeMgr. //! Don't use this class directly but use it through the LandscapeMgr.
class Atmosphere class Atmosphere
{ {
public: public:
Atmosphere(void); Atmosphere(void);
virtual ~Atmosphere(void); virtual ~Atmosphere(void);
//! Called on every update to recompute colors of the atmosphere.
//!
//! Must be called at least once after a call to draw(), as vertexGr
id
//! is lazily initialized at the first draw call.
void computeColor(double JD, Vec3d _sunPos, Vec3d moonPos, float moo nPhase, StelCore* core, void computeColor(double JD, Vec3d _sunPos, Vec3d moonPos, float moo nPhase, StelCore* core,
float latitude = 45.f, float altitude = 200.f, float eclipseFac, float latitude =
float temperature = 15.f, float relativeHumidity = 40.f); 45.f, float altitude = 200.f,
void draw(StelCore* core); float temperature = 15.f, float re
lativeHumidity = 40.f);
void draw(StelCore* core, class StelRenderer* renderer);
void update(double deltaTime) {fader.update((int)(deltaTime*1000));} void update(double deltaTime) {fader.update((int)(deltaTime*1000));}
//! Set fade in/out duration in seconds //! Set fade in/out duration in seconds
void setFadeDuration(float duration) {fader.setDuration((int)(durati on*1000.f));} void setFadeDuration(float duration) {fader.setDuration((int)(durati on*1000.f));}
//! Get fade in/out duration in seconds //! Get fade in/out duration in seconds
float getFadeDuration() {return (float)fader.getDuration()/1000.f;} float getFadeDuration() {return (float)fader.getDuration()/1000.f;}
//! Define whether to display atmosphere //! Define whether to display atmosphere
void setFlagShow(bool b){fader = b;} void setFlagShow(bool b){fader = b;}
//! Get whether atmosphere is displayed //! Get whether atmosphere is displayed
skipping to change at line 83 skipping to change at line 85
//! Otherwise it includes the atmosphere + background starlight + ec lipse factor + light pollution. //! Otherwise it includes the atmosphere + background starlight + ec lipse factor + light pollution.
//! @return the last computed average luminance of the atmosphere in cd/m2. //! @return the last computed average luminance of the atmosphere in cd/m2.
float getAverageLuminance(void) const {return averageLuminance;} float getAverageLuminance(void) const {return averageLuminance;}
//! Set the light pollution luminance in cd/m^2 //! Set the light pollution luminance in cd/m^2
void setLightPollutionLuminance(float f) { lightPollutionLuminance = f; } void setLightPollutionLuminance(float f) { lightPollutionLuminance = f; }
//! Get the light pollution luminance in cd/m^2 //! Get the light pollution luminance in cd/m^2
float getLightPollutionLuminance() const { return lightPollutionLumi nance; } float getLightPollutionLuminance() const { return lightPollutionLumi nance; }
private: private:
// Vertex with a 2D position and a color.
struct Vertex
{
Vec2f position;
Vec4f color;
Vertex(const Vec2f position, const Vec4f& color) : position(
position), color(color) {}
VERTEX_ATTRIBUTES(Vec2f Position, Vec4f Color);
};
Vec4i viewport; Vec4i viewport;
Skylight sky; Skylight sky;
Skybright skyb; Skybright skyb;
int skyResolutionY,skyResolutionX; int skyResolutionY, skyResolutionX;
Vec2f* posGrid;
Vec4f* colorGrid;
unsigned int* indices;
//! The average luminance of the atmosphere in cd/m2 //! The average luminance of the atmosphere in cd/m2
float averageLuminance; float averageLuminance;
float eclipseFactor; float eclipseFactor;
LinearFader fader; LinearFader fader;
float lightPollutionLuminance; float lightPollutionLuminance;
//! Whether vertex shader should be used //! Shader used for xyYToRGB computation. If NULL, shader is not use
bool useShader; d.
class StelGLSLShader* shader;
//! Rectangular grid of vertices making up the atmosphere.
StelVertexBuffer<Vertex>* vertexGrid;
//! Index buffers representing triangle strips for each row in the g
rid.
QVector<StelIndexBuffer*> rowIndices;
//! Vertex shader used for xyYToRGB computation //! Renderer used to construct row index buffers at viewport changes
class QGLShaderProgram* atmoShaderProgram; .
struct { //!
int alphaWaOverAlphaDa; //! Lazily initialized - NULL until the first draw call.
int oneOverGamma; class StelRenderer* renderer;
int term2TimesOneOverMaxdLpOneOverGamma;
int brightnessScale; //! Lazily loads the shader used for drawing.
int sunPos; //!
int term_x, Ax, Bx, Cx, Dx, Ex; //! Called at the first call to draw().
int term_y, Ay, By, Cy, Dy, Ey; //!
int projectionMatrix; //! This should only be called if the Renderer supports GLSL.
int skyVertex; //!
int skyColor; //! @return true on success, false on failure (allowing for a shader
} shaderAttribLocations; -less fallback).
bool lazyLoadShader(class StelRenderer* renderer);
//! Update the vertex grid and index buffers.
//!
//! Called by computeColor after the viewport changes.
void updateGrid(const StelProjectorP projector);
}; };
#endif // _ATMOSTPHERE_HPP_ #endif // _ATMOSTPHERE_HPP_
 End of changes. 9 change blocks. 
31 lines changed or deleted 56 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/