00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _LANDSCAPE_HPP_
00021 #define _LANDSCAPE_HPP_
00022
00023 #include <QMap>
00024 #include "VecMath.hpp"
00025 #include "StelToneReproducer.hpp"
00026 #include "StelProjector.hpp"
00027
00028 #include "StelFader.hpp"
00029 #include "StelUtils.hpp"
00030 #include "StelTextureTypes.hpp"
00031 #include "StelLocation.hpp"
00032
00033 class QSettings;
00034 class StelLocation;
00035 class StelCore;
00036 class StelPainter;
00037
00041 class Landscape
00042 {
00043 public:
00044 Landscape(float _radius = 2.f);
00045 virtual ~Landscape();
00046 virtual void load(const QSettings& landscapeIni, const QString& landscapeId) = 0;
00047 virtual void draw(StelCore* core) = 0;
00048 void update(double deltaTime)
00049 {
00050 landFader.update((int)(deltaTime*1000));
00051 fogFader.update((int)(deltaTime*1000));
00052 }
00053
00055 void setBrightness(const float b) {skyBrightness = b;}
00056
00058 void setFlagShow(const bool b) {landFader=b;}
00060 bool getFlagShow() const {return (bool)landFader;}
00062 void setFlagShowFog(const bool b) {fogFader=b;}
00064 bool getFlagShowFog() const {return (bool)fogFader;}
00066 QString getName() const {return name;}
00068 QString getAuthorName() const {return author;}
00070 QString getDescription() const {return description;}
00071
00073 const StelLocation& getLocation() const {return location;}
00075 int getDefaultBortleIndex() const {return defaultBortleIndex;}
00077 int getDefaultFogSetting() const {return defaultFogSetting;}
00079 float getDefaultAtmosphericExtinction() const {return defaultExtinctionCoefficient;}
00081 float getDefaultAtmosphericTemperature() const {return defaultTemperature;}
00084 float getDefaultAtmosphericPressure() const {return defaultPressure;}
00085
00087 void setZRotation(float d) {angleRotateZOffset = d;}
00088
00089 protected:
00093 void loadCommon(const QSettings& landscapeIni, const QString& landscapeId);
00094
00099 const QString getTexturePath(const QString& basename, const QString& landscapeId);
00100 float radius;
00101 QString name;
00102 float skyBrightness;
00103 float nightBrightness;
00104 bool validLandscape;
00105 LinearFader landFader;
00106 LinearFader fogFader;
00107 QString author;
00108 QString description;
00109
00110 int rows;
00111 int cols;
00112 int defaultBortleIndex;
00113 int defaultFogSetting;
00114 double defaultExtinctionCoefficient;
00115 double defaultTemperature;
00116 double defaultPressure;
00117
00118 typedef struct
00119 {
00120 StelTextureSP tex;
00121 float texCoords[4];
00122 } landscapeTexCoord;
00123
00124 StelLocation location;
00125 float angleRotateZ;
00126 float angleRotateZOffset;
00127 };
00128
00129
00130 class LandscapeOldStyle : public Landscape
00131 {
00132 public:
00133 LandscapeOldStyle(float radius = 2.f);
00134 virtual ~LandscapeOldStyle();
00135 virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00136 virtual void draw(StelCore* core);
00137 void create(bool _fullpath, QMap<QString, QString> param);
00138 private:
00139 void drawFog(StelCore* core, StelPainter&) const;
00140 void drawDecor(StelCore* core, StelPainter&) const;
00141 void drawGround(StelCore* core, StelPainter&) const;
00142 QVector<double> groundVertexArr;
00143 QVector<float> groundTexCoordArr;
00144 StelTextureSP* sideTexs;
00145 int nbSideTexs;
00146 int nbSide;
00147 landscapeTexCoord* sides;
00148 StelTextureSP fogTex;
00149 landscapeTexCoord fogTexCoord;
00150 StelTextureSP groundTex;
00151 landscapeTexCoord groundTexCoord;
00152 int nbDecorRepeat;
00153 float fogAltAngle;
00154 float fogAngleShift;
00155 float decorAltAngle;
00156 float decorAngleShift;
00157 float groundAngleShift;
00158 float groundAngleRotateZ;
00159 int drawGroundFirst;
00160 bool tanMode;
00161 bool calibrated;
00162 struct LOSSide
00163 {
00164 StelVertexArray arr;
00165 StelTextureSP tex;
00166 };
00167
00168 QList<LOSSide> precomputedSides;
00169 };
00170
00171 class LandscapeFisheye : public Landscape
00172 {
00173 public:
00174 LandscapeFisheye(float radius = 1.f);
00175 virtual ~LandscapeFisheye();
00176 virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00177 virtual void draw(StelCore* core);
00178 void create(const QString name, const QString& maptex, float texturefov, float angleRotateZ);
00179 private:
00180
00181 StelTextureSP mapTex;
00182 float texFov;
00183 };
00184
00185
00186 class LandscapeSpherical : public Landscape
00187 {
00188 public:
00189 LandscapeSpherical(float radius = 1.f);
00190 virtual ~LandscapeSpherical();
00191 virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00192 virtual void draw(StelCore* core);
00193 void create(const QString name, const QString& maptex, float angleRotateZ);
00194 private:
00195
00196 StelTextureSP mapTex;
00197 };
00198
00199 #endif // _LANDSCAPE_HPP_