Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

modules/Landscape.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2003 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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.);
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;   // was a landscape loaded properly?
00093     LinearFader landFader;
00094     LinearFader fogFader;
00095     QString author;
00096     QString description;
00097 
00098     typedef struct
00099     {
00100         StelTextureSP tex;
00101         float texCoords[4];
00102     } landscapeTexCoord;
00103 
00104     StelLocation location;
00105     float angleRotateZ;
00106     float angleRotateZOffset;
00107 };
00108 
00109 
00110 class LandscapeOldStyle : public Landscape
00111 {
00112 public:
00113     LandscapeOldStyle(float _radius = 2.);
00114     virtual ~LandscapeOldStyle();
00115     virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00116     virtual void draw(StelCore* core);
00117     void create(bool _fullpath, QMap<QString, QString> param);
00118 private:
00119     void drawFog(StelCore* core, StelPainter&) const;
00120     void drawDecor(StelCore* core, StelPainter&) const;
00121     void drawGround(StelCore* core, StelPainter&) const;
00122     StelTextureSP* sideTexs;
00123     int nbSideTexs;
00124     int nbSide;
00125     landscapeTexCoord* sides;
00126     StelTextureSP fogTex;
00127     landscapeTexCoord fogTexCoord;
00128     StelTextureSP groundTex;
00129     landscapeTexCoord groundTexCoord;
00130     int nbDecorRepeat;
00131     float fogAltAngle;
00132     float fogAngleShift;
00133     float decorAltAngle;
00134     float decorAngleShift;
00135     float groundAngleShift;
00136     float groundAngleRotateZ;
00137     int drawGroundFirst;
00138     bool tanMode;   // Whether the angles should be converted using tan instead of sin
00139 };
00140 
00141 class LandscapeFisheye : public Landscape
00142 {
00143 public:
00144     LandscapeFisheye(float _radius = 1.);
00145     virtual ~LandscapeFisheye();
00146     virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00147     virtual void draw(StelCore* core);
00148     void create(const QString _name, bool _fullpath, const QString& _maptex,
00149                 double _texturefov, double angleRotateZ);
00150 private:
00151 
00152     StelTextureSP mapTex;
00153     float texFov;
00154 };
00155 
00156 
00157 class LandscapeSpherical : public Landscape
00158 {
00159 public:
00160     LandscapeSpherical(float _radius = 1.);
00161     virtual ~LandscapeSpherical();
00162     virtual void load(const QSettings& landscapeIni, const QString& landscapeId);
00163     virtual void draw(StelCore* core);
00164     void create(const QString _name, bool _fullpath,
00165                 const QString& _maptex, double angleRotateZ);
00166 private:
00167 
00168     StelTextureSP mapTex;
00169 };
00170 
00171 #endif // _LANDSCAPE_HPP_

Generated on Mon Mar 22 09:55:38 2010 for Stellarium by  doxygen 1.5.5