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 #include "StelNavigator.hpp"
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(float b) {skyBrightness = b;}
00056
00058 void setFlagShow(bool b) {landFader=b;}
00060 bool getFlagShow() const {return (bool)landFader;}
00062 void setFlagShowFog(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;}
00074
00076 void setZRotation(float d) {angleRotateZOffset = d;}
00077
00078 protected:
00082 void loadCommon(const QSettings& landscapeIni, const QString& landscapeId);
00083
00088 const QString getTexturePath(const QString& basename, const QString& landscapeId);
00089 float radius;
00090 QString name;
00091 float skyBrightness;
00092 bool validLandscape;
00093 LinearFader landFader;
00094 LinearFader fogFader;
00095 QString author;
00096 QString description;
00097
00098 int rows;
00099 int cols;
00100
00101 typedef struct
00102 {
00103 StelTextureSP tex;
00104 float texCoords[4];
00105 } landscapeTexCoord;
00106
00107 StelLocation location;
00108 float angleRotateZ;
00109 float angleRotateZOffset;
00110 };
00111
00112
00113 class LandscapeOldStyle : public Landscape
00114 {
00115 public:
00116 LandscapeOldStyle(float radius = 2.f);
00117 virtual ~LandscapeOldStyle();
00118 virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00119 virtual void draw(StelCore* core);
00120 void create(bool _fullpath, QMap<QString, QString> param);
00121 private:
00122 void drawFog(StelCore* core, StelPainter&) const;
00123 void drawDecor(StelCore* core, StelPainter&) const;
00124 void drawGround(StelCore* core, StelPainter&) const;
00125 QVector<double> groundVertexArr;
00126 QVector<float> groundTexCoordArr;
00127 StelTextureSP* sideTexs;
00128 int nbSideTexs;
00129 int nbSide;
00130 landscapeTexCoord* sides;
00131 StelTextureSP fogTex;
00132 landscapeTexCoord fogTexCoord;
00133 StelTextureSP groundTex;
00134 landscapeTexCoord groundTexCoord;
00135 int nbDecorRepeat;
00136 float fogAltAngle;
00137 float fogAngleShift;
00138 float decorAltAngle;
00139 float decorAngleShift;
00140 float groundAngleShift;
00141 float groundAngleRotateZ;
00142 int drawGroundFirst;
00143 bool tanMode;
00144 bool calibrated;
00145 struct LOSSide
00146 {
00147 StelVertexArray arr;
00148 StelTextureSP tex;
00149 };
00150
00151 QList<LOSSide> precomputedSides;
00152 };
00153
00154 class LandscapeFisheye : public Landscape
00155 {
00156 public:
00157 LandscapeFisheye(float radius = 1.f);
00158 virtual ~LandscapeFisheye();
00159 virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00160 virtual void draw(StelCore* core);
00161 void create(const QString name, const QString& maptex, float texturefov, float angleRotateZ);
00162 private:
00163
00164 StelTextureSP mapTex;
00165 float texFov;
00166 };
00167
00168
00169 class LandscapeSpherical : public Landscape
00170 {
00171 public:
00172 LandscapeSpherical(float radius = 1.f);
00173 virtual ~LandscapeSpherical();
00174 virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00175 virtual void draw(StelCore* core);
00176 void create(const QString name, const QString& maptex, float angleRotateZ);
00177 private:
00178
00179 StelTextureSP mapTex;
00180 };
00181
00182 #endif // _LANDSCAPE_HPP_