Landscape.hpp   Landscape.hpp 
skipping to change at line 23 skipping to change at line 23
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* 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 _LANDSCAPE_HPP_ #ifndef _LANDSCAPE_HPP_
#define _LANDSCAPE_HPP_ #define _LANDSCAPE_HPP_
#include <QMap>
#include "VecMath.hpp" #include "VecMath.hpp"
#include "StelToneReproducer.hpp" #include "StelToneReproducer.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "renderer/GenericVertexTypes.hpp" #include "StelTextureTypes.hpp"
#include "renderer/StelIndexBuffer.hpp"
#include "renderer/StelVertexBuffer.hpp"
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include <QMap>
#include <QImage>
class QSettings; class QSettings;
class StelLocation; class StelLocation;
class StelCore; class StelCore;
class StelPainter;
//! @class Landscape //! @class Landscape
//! Store and manages the displaying of the Landscape. //! Store and manages the displaying of the Landscape.
//! Don't use this class direcly, use the LandscapeMgr. //! Don't use this class directly, use the LandscapeMgr.
//! A landscape's most important element is a photo panorama.
//! Optional components include:
//! - A fog texture that is displayed with the Fog [F] command.
//! - A location. It is possible to auto-move to the location when loading
.
//! - Atmospheric conditions: temperature/pressure/extinction coefficients
.
//! - Light pollution information (Bortle index)
//! - A night texture that gets blended over the dimmed daylight panorama.
(Spherical and Fisheye only)
//! - A polygonal horizon line (required for PolygonalLandscape). If prese
nt, defines a measured horizon line, which can be plotted or queried for ri
se/set predictions.
//! - You can set a minimum brightness level to prevent too dark landscape
. There is
//! a global activation setting (config.ini[landscape]flag_minimal_brigh
tness),
//! a global value (config.ini[landscape]minimal_brightness),
//! and, if config.ini[landscape]flag_landscape_sets_minimal_brightness=
true,
//! optional individual values given in landscape.ini[landscape]minimal_
brightness are used.
//!
//! We discern:
//! @param LandscapeId: The directory name of the landscape.
//! @param name: The landscape name as specified in the LandscapeIni (may
contain spaces, UTF8, ...)
class Landscape class Landscape
{ {
public: public:
Landscape(float _radius = 2.f); Landscape(float _radius = 2.f);
virtual ~Landscape(); virtual ~Landscape();
//! Load landscape.
//! @param landscapeIni A reference to an existing QSettings object
which describes the landscape
//! @param landscapeId The name of the directory for the landscape f
iles (e.g. "ocean")
virtual void load(const QSettings& landscapeIni, const QString& land scapeId) = 0; virtual void load(const QSettings& landscapeIni, const QString& land scapeId) = 0;
virtual void draw(StelCore* core) = 0;
//! Draw the landscape.
//!
//! @param core The StelCore object.
//! @param renderer The renderer to draw with.
virtual void draw(StelCore* core, class StelRenderer* renderer) = 0;
void update(double deltaTime) void update(double deltaTime)
{ {
landFader.update((int)(deltaTime*1000)); landFader.update((int)(deltaTime*1000));
fogFader.update((int)(deltaTime*1000)); fogFader.update((int)(deltaTime*1000));
} }
//! Set the brightness of the landscape //! Set the brightness of the landscape plus brightness of optional
void setBrightness(const float b) {skyBrightness = b;} add-on night lightscape.
//! This is called in each draw().
void setBrightness(const float b, const float pollutionBrightness=0.
0f) {landscapeBrightness = b; lightScapeBrightness=pollutionBrightness; }
//! Set whether landscape is displayed (does not concern fog) //! Set whether landscape is displayed (does not concern fog)
void setFlagShow(const bool b) {landFader=b;} void setFlagShow(const bool b) {landFader=b;}
//! Get whether landscape is displayed (does not concern fog) //! Get whether landscape is displayed (does not concern fog)
bool getFlagShow() const {return (bool)landFader;} bool getFlagShow() const {return (bool)landFader;}
//! Set whether fog is displayed //! Set whether fog is displayed
void setFlagShowFog(const bool b) {fogFader=b;} void setFlagShowFog(const bool b) {fogFader=b;}
//! Get whether fog is displayed //! Get whether fog is displayed
bool getFlagShowFog() const {return (bool)fogFader;} bool getFlagShowFog() const {return (bool)fogFader;}
//! Get landscape name //! Get landscape name
QString getName() const {return name;} QString getName() const {return name;}
//! Get landscape author name //! Get landscape author name
QString getAuthorName() const {return author;} QString getAuthorName() const {return author;}
//! Get landscape description //! Get landscape description
QString getDescription() const {return description;} QString getDescription() const {return description;}
//! Return the associated location or NULL //! Return the associated location (may be empty!)
const StelLocation& getLocation() const {return location;} const StelLocation& getLocation() const {return location;}
//! Return if the location is valid (a valid location has a valid pl
anetName!)
bool hasLocation() const {return (location.planetName.length() > 0);
}
//! Return default Bortle index (light pollution value) or -1 (unkno wn/no change) //! Return default Bortle index (light pollution value) or -1 (unkno wn/no change)
int getDefaultBortleIndex() const {return defaultBortleIndex;} int getDefaultBortleIndex() const {return defaultBortleIndex;}
//! Return default fog setting (0/1) or -1 (no change) //! Return default fog setting (0/1) or -1 (no change)
int getDefaultFogSetting() const {return defaultFogSetting;} int getDefaultFogSetting() const {return defaultFogSetting;}
//! Return default atmosperic extinction, mag/airmass, or -1 (no cha nge) //! Return default atmosperic extinction [mag/airmass], or -1 (no ch ange)
float getDefaultAtmosphericExtinction() const {return defaultExtinct ionCoefficient;} float getDefaultAtmosphericExtinction() const {return defaultExtinct ionCoefficient;}
//! Return default atmospheric temperature, for refraction computati on, or -1000 for "unknown/no change". //! Return configured atmospheric temperature [degrees Celsius], for refraction computation, or -1000 for "unknown/no change".
float getDefaultAtmosphericTemperature() const {return defaultTemper ature;} float getDefaultAtmosphericTemperature() const {return defaultTemper ature;}
//! Return default atmospheric temperature, for refraction computati //! Return configured atmospheric pressure [mbar], for refraction co
on. mputation.
//! returns -1 to signal "standard conditions", or -2 for "unknown/i //! returns -1 to signal "standard conditions" [compute from altitud
nvalid/no change" e], or -2 for "unknown/invalid/no change"
float getDefaultAtmosphericPressure() const {return defaultPressure; } float getDefaultAtmosphericPressure() const {return defaultPressure; }
//! Return default brightness for landscape //! Return minimal brightness for landscape
//! returns -1 to signal "standard conditions" (use default value fr om config.ini) //! returns -1 to signal "standard conditions" (use default value fr om config.ini)
float getLandscapeNightBrightness() const {return defaultBrightness; } float getLandscapeMinimalBrightness() const {return minBrightness;}
//! Set the z-axis rotation (offset from original value when rotated //! Set an additional z-axis (azimuth) rotation after landscape has
void setZRotation(float d) {angleRotateZOffset = d;} been loaded.
//! This is intended for special uses such as when the landscape con
sists of
//! a vehicle which might change orientation over time (e.g. a ship)
. It is called
//! e.g. by the LandscapeMgr. Contrary to that, the purpose of the a
zimuth rotation
//! (landscape/[decor_]angle_rotatez) in landscape.ini is to orient
the pano.
//! @param d the rotation angle in degrees.
void setZRotation(float d) {angleRotateZOffset = d * M_PI/180.0f;}
//! Get whether the landscape is currently fully visible (i.e. opaqu
e).
bool getIsFullyVisible() const {return landFader.getInterstate() >=
0.999f;}
// GZ: NEW FUNCTION:
//! can be used to find sunrise or visibility questions on the real-
world landscape horizon.
//! Default implementation indicates the horizon equals math horizon
.
virtual float getOpacity(Vec3d azalt) const {return (azalt[2]<0 ? 1.
0f : 0.0f); }
//! The list of azimuths and altitudes can come in various formats.
We read the first two elements, which can be of formats:
enum horizonListMode {
azDeg_altDeg = 0, //! azimuth[degrees] altitude[degrees]
azDeg_zdDeg = 1, //! azimuth[degrees] zenithDistance[degr
ees]
azRad_altRad = 2, //! azimuth[radians] altitude[radians]
azRad_zdRad = 3, //! azimuth[radians] zenithDistance[radi
ans]
azGrad_altGrad = 4, //! azimuth[new_degrees] altitude[new_de
grees] (may be found on theodolites)
azGrad_zdGrad = 5 //! azimuth[new_degrees] zenithDistance[
new_degrees] (may be found on theodolites)
};
protected: protected:
//! Load attributes common to all landscapes //! Load attributes common to all landscapes
//! @param landscapeIni A reference to an existant QSettings object which describes the landscape //! @param landscapeIni A reference to an existing QSettings object which describes the landscape
//! @param landscapeId The name of the directory for the landscape f iles (e.g. "ocean") //! @param landscapeId The name of the directory for the landscape f iles (e.g. "ocean")
void loadCommon(const QSettings& landscapeIni, const QString& landsc apeId); void loadCommon(const QSettings& landscapeIni, const QString& landsc apeId);
//! Create a StelSphericalPolygon that describes a measured horizon
line. If present, this can be used to draw a horizon line
//! or simplify the functionality to discern if an object is below t
he horizon.
//! @param _lineFileName A text file with lines that are either empt
y or comment lines starting with # or azimuth altitude [degrees]
//! @param _polyAngleRotateZ possibility to set some final calibrati
on offset like meridian convergence correction.
void createPolygonalHorizon(const QString& lineFileName, const float
polyAngleRotateZ=0.0f, const QString &listMode="azDeg_altDeg");
//! search for a texture in landscape directory, else global texture s directory //! search for a texture in landscape directory, else global texture s directory
//! @param basename The name of a texture file, e.g. "fog.png" //! @param basename The name of a texture file, e.g. "fog.png"
//! @param landscapeId The landscape ID (directory name) to which th e texture belongs //! @param landscapeId The landscape ID (directory name) to which th e texture belongs
//! @exception misc possibility of throwing "file not found" excepti ons //! @exception misc possibility of throwing "file not found" excepti ons
const QString getTexturePath(const QString& basename, const QString& const QString getTexturePath(const QString& basename, const QString&
landscapeId); landscapeId) const;
const float radius; float radius;
QString name; QString name; //! Read from landscape.ini:[landscape]name
float skyBrightness; QString author; //! Read from landscape.ini:[landscape]author
float nightBrightness; QString description; //! Read from landscape.ini:[landscape]descri
float defaultBrightness; ption
bool validLandscape; // was a landscape loaded properly? //float nightBrightness;
LinearFader landFader; float minBrightness; //! Read from landscape.ini:[landscape]minima
LinearFader fogFader; l_brightness. Allows minimum visibility that cannot be underpowered.
QString author; float landscapeBrightness; //! brightness [0..1] to draw the landsc
QString description; ape. Computed by the LandscapeMgr.
float lightScapeBrightness; //! can be used to draw nightscape textu
// Currently, rows and cols do not change after initialization. re (e.g. city light pollution), if available. Computed by the LandscapeMgr.
// If, in future, these values can be modified, cached vertex/index bool validLandscape; //! was a landscape loaded properly?
buffers LinearFader landFader; //! Used to slowly fade in/out landscape pain
// will have to be regenerated after the change. ting.
// GZ patched, these can now be set in landscape.ini: LinearFader fogFader; //! Used to slowly fade in/out fog painting.
int rows; // horizontal rows int rows; //! horizontal rows. May be given in landscape.ini:[lands
int cols; // vertical columns cape]tesselate_rows. More indicates higher accuracy, but is slower.
int defaultBortleIndex; // light pollution from landscape.ini, or -1 int cols; //! vertical columns. May be given in landscape.ini:[lands
(no change) cape]tesselate_cols. More indicates higher accuracy, but is slower.
int defaultFogSetting; // fog flag setting from landscape.ini: -1(no float angleRotateZ; //! [radians] if pano does not have its left
change), 0(off), 1(on) border in the east, rotate in azimuth. Configured in landscape.ini[landscap
double defaultExtinctionCoefficient; // atmospheric_extinction_coeff e]angle_rotatez (or decor_angle_rotatez for old_style landscapes)
icient from landscape.ini or -1 float angleRotateZOffset; //! [radians] This is a rotation changeabl
double defaultTemperature; // atmospheric_temperature from landscape e at runtime via setZRotation (called by LandscapeMgr::setZRotation).
.ini or -1000.0 //! Not in landsca
double defaultPressure; // atmospheric_pressure from landscape.ini o pe.ini: Used in special cases where the horizon may rotate, e.g. on a ship.
r -1.0
StelLocation location; //! OPTIONAL. If present, can be used to set
typedef struct location.
{ int defaultBortleIndex; //! May be given in landscape.ini:[location]
class StelTextureNew* tex; light_pollution. Default: -1 (no change).
float texCoords[4]; int defaultFogSetting; //! May be given in landscape.ini:[location]
} landscapeTexCoord; display_fog: -1(no change), 0(off), 1(on). Default: -1.
float defaultExtinctionCoefficient; //! May be given in landscape.in
StelLocation location; i:[location]atmospheric_extinction_coefficient. Default -1 (no change).
float angleRotateZ; float defaultTemperature; //! [Celsius] May be given in landscape.in
float angleRotateZOffset; i:[location]atmospheric_temperature. default: -1000.0 (no change)
float defaultPressure; //! [mbar] May be given in landscape.in
i:[location]atmospheric_pressure. Default -1.0 (compute from [location]/alt
itude), use -2 to indicate "no change".
// Optional elements which, if present, describe a horizon polygon.
They can be used to render a line or a filled region, esp. in LandscapePoly
gonal
SphericalRegionP horizonPolygon; //! Optional element describing t
he horizon line.
/
/! Data shall be read from the file given as landscape.ini[landscape]polygo
nal_horizon_list
/
/! For LandscapePolygonal, this is the only horizon data item.
Vec3f horizonPolygonLineColor ; //! for all horizon types, the ho
rizonPolygon line, if specified, will be drawn in this color
/
/! specified in landscape.ini[landscape]horizon_line_color. Negative red (d
efault) indicated "don't draw".
}; };
//! @class LandscapeOldStyle
//! This was the original landscape, introduced for decorative purposes. It
segments the horizon in several tiles
//! (usually 4 or 8), therefore allowing very high resolution horizons also
on limited hardware,
//! and closes the ground with a separate bottom piece. (You may want to co
nfigure a map with pointers to surrounding mountains or a compass rose inst
ead!)
//! You can use panoramas created in equirectangular or cylindrical coordin
ates, for the latter case set
//! [landscape]tan_mode=true.
//! Until V0.10.5 there was an undetected bug involving vertical positionin
g. For historical reasons (many landscapes
//! were already configured and published), it was decided to keep this bug
as feature, but a fix for new landscapes is
//! available: [landscape]calibrated=true.
//! As of 0.10.6, the fix is only valid for equirectangular panoramas.
//! As of V0.13, [landscape]calibrated=true and [landscape]tan_mode=true go
together for cylindrical panoramas.
//! It is more involved to configure, but may still be preferred if you req
uire the resolution, e.g. for alignment studies
//! for archaeoastronomy. In this case, don't forget to set calibrated=true
in landscape.ini.
class LandscapeOldStyle : public Landscape class LandscapeOldStyle : public Landscape
{ {
public: public:
LandscapeOldStyle(float radius = 2.f); LandscapeOldStyle(float radius = 2.f);
virtual ~LandscapeOldStyle(); virtual ~LandscapeOldStyle();
virtual void load(const QSettings& landscapeIni, const QString& land scapeId); virtual void load(const QSettings& landscapeIni, const QString& land scapeId);
virtual void draw(StelCore* core, class StelRenderer* renderer); virtual void draw(StelCore* core);
void create(bool _fullpath, QMap<QString, QString> param); //void create(bool _fullpath, QMap<QString, QString> param); // stil
l not implemented
private: virtual float getOpacity(Vec3d azalt) const;
//! Draw the fog around the landscape. protected:
//! typedef struct
//! @param core The StelCore object.
//! @param renderer Renderer to draw with.
void drawFog(StelCore* core, class StelRenderer* renderer);
//! Draw the landscape decoration.
//!
//! @param core The StelCore object.
//! @param renderer Renderer to draw with.
void drawDecor(StelCore* core, class StelRenderer* renderer);
//! Draw the ground.
//!
//! @param core The StelCore object.
//! @param renderer Renderer to draw with.
void drawGround(StelCore* core, class StelRenderer* renderer);
//! Generate groundFanDisk and groundFanDiskIndices.
//!
//! Called lazily, once needed.
//!
//! @param renderer Renderer used to create the vertex/index buffers
.
void generateGroundFanDisk(class StelRenderer* renderer);
//! Used to lazily initialize textures at the first draw.
//!
//! @param renderer Renderer used to create the textures.
void lazyInitTextures(class StelRenderer* renderer);
//! Generate precomputedSides.
//!
//! Called lazily, once needed.
//!
//! @param renderer Renderer used to create the vertex/index buffers
.
void generatePrecomputedSides(class StelRenderer* renderer);
struct SideTexture
{ {
QString path; StelTextureSP tex;
class StelTextureNew* texture; float texCoords[4];
}; } landscapeTexCoord;
SideTexture* sideTexs; private:
bool texturesInitialized; void drawFog(StelCore* core, StelPainter&) const;
void drawDecor(StelCore* core, StelPainter&) const;
void drawGround(StelCore* core, StelPainter&) const;
QVector<double> groundVertexArr;
QVector<float> groundTexCoordArr;
StelTextureSP* sideTexs;
int nbSideTexs; int nbSideTexs;
int nbSide; int nbSide;
landscapeTexCoord* sides; landscapeTexCoord* sides;
class StelTextureNew* fogTex; StelTextureSP fogTex;
QString fogTexPath; //landscapeTexCoord fogTexCoord; // GZ: UNUSED!
landscapeTexCoord fogTexCoord; StelTextureSP groundTex;
class StelTextureNew* groundTex; QVector<QImage*> sidesImages; // GZ: Required for opacity lookup
QString groundTexPath; //landscapeTexCoord groundTexCoord; // GZ: UNUSED!
landscapeTexCoord groundTexCoord;
int nbDecorRepeat; int nbDecorRepeat;
float fogAltAngle; float fogAltAngle;
float fogAngleShift; float fogAngleShift;
float decorAltAngle; float decorAltAngle; // vertical extent of the side panels
float decorAngleShift; float decorAngleShift;
float groundAngleShift; float groundAngleShift; //! [radians]: altitude of the bottom plane.
float groundAngleRotateZ; Usually negative and equal to decorAngleShift
float groundAngleRotateZ; //! [radians]
int drawGroundFirst; int drawGroundFirst;
bool tanMode; // Whether the angles should be converted us bool tanMode; // Whether the angles should be converted us
ing tan instead of sin ing tan instead of sin, i.e., for a cylindrical pano
bool calibrated; // if true, the documented altitudes are ind bool calibrated; // if true, the documented altitudes are ind
ed correct (the original code is buggy!) eed correct (the original code is buggy!)
//! Side of a LandscapeOldStyle decoration.
struct LOSSide struct LOSSide
{ {
//! Vertex buffer (triangles) to draw the side. StelVertexArray arr;
StelVertexBuffer<VertexP3T2>* vertices; StelTextureSP tex;
//! Index buffer specifying triangles to draw.
StelIndexBuffer* indices;
//! Texture of the decoration.
class StelTextureNew* tex;
}; };
QList<LOSSide> precomputedSides; QList<LOSSide> precomputedSides;
};
//! This seems to map sides to their textures in sideTexs. /////////////////////////////////////////////////////////
//! ///
//! This should probably be replaced by something that makes more se //! @class LandscapePolygonal
nse. //! This uses the list of (usually measured) horizon altitudes to define th
QMap<int, int> texToSide; e horizon.
//! Define it with the following names in landscape.ini:
//! Used to draw the fog cylinder. //! @param landscape/ground_color use this color below horizon
StelVertexBuffer<VertexP3T2>* fogCylinderBuffer; //! @param landscape/polygonal_horizon_list filename containing azimuths/al
titudes, compatible with Carte du Ciel.
//! Height of the for cylinder on previous draw. //! @param landscape/polygonal_angle_rotatez offset for the polygonal measu
float previousFogHeight; rement
//! (different from landscape/angle_rotatez in photo panos, often ph
//! Disk used to draw the ground. oto and line are not aligned.)
StelVertexBuffer<VertexP3T2>* groundFanDisk; class LandscapePolygonal : public Landscape
{
//! Index buffer used to draw groundFanDisk. public:
StelIndexBuffer* groundFanDiskIndices; LandscapePolygonal(float radius = 1.f);
virtual ~LandscapePolygonal();
virtual void load(const QSettings& landscapeIni, const QString& land
scapeId);
virtual void draw(StelCore* core);
virtual float getOpacity(Vec3d azalt) const;
private:
// we have inherited: horizonFileName, horizonPolygon, horizonPolygo
nLineColor
Vec3f groundColor; //! specified in landscape.ini[landscape]ground_c
olor.
}; };
///////////////////////////////////////////////////////////////
///
//! @class LandscapeFisheye
//! This uses a single image in fisheye projection. The image is typically
square, ...
//! @param texFov: field of view (opening angle) of the square texture, ra
dians.
//! If @param angleRotateZ==0, the top image border is due south.
class LandscapeFisheye : public Landscape class LandscapeFisheye : public Landscape
{ {
public: public:
LandscapeFisheye(float radius = 1.f); LandscapeFisheye(float radius = 1.f);
virtual ~LandscapeFisheye(); virtual ~LandscapeFisheye();
virtual void load(const QSettings& landscapeIni, const QString& land scapeId); virtual void load(const QSettings& landscapeIni, const QString& land scapeId);
virtual void draw(StelCore* core, class StelRenderer* renderer); virtual void draw(StelCore* core);
//! Sample landscape texture for transparency/opacity. May be used f
or visibility, sunrise etc.
//! @param azalt normalized direction in alt-az frame
virtual float getOpacity(Vec3d azalt) const;
//! create a fisheye landscape from basic parameters (no ini file ne
eded).
//! @param name Landscape name
//! @param maptex the fisheye texture
//! @param maptexIllum the fisheye texture that is overlaid in the n
ight (streetlights, skyglow, ...)
//! @param texturefov field of view for the photo, degrees
//! @param angleRotateZ azimuth rotation angle, degrees
void create(const QString name, const QString& maptex, float texture fov, float angleRotateZ); void create(const QString name, const QString& maptex, float texture fov, float angleRotateZ);
void create(const QString name, float texturefov, const QString& map tex, const QString &_maptexFog="", const QString& _maptexIllum="", const fl oat angleRotateZ=0.0f);
private: private:
class StelTextureNew* mapTex; StelTextureSP mapTex; //!< The fisheye image, centered on the z
QString mapTexPath; enith.
// Currently, this does not change after initialization. StelTextureSP mapTexFog; //!< Optional panorama of identical size
// If, in future, this value can be modified, cached vertex/index bu (create as layer over the mapTex image in your favorite image processor).
ffers //!< can also be
// will have to be regenerated after the change. smaller, just the texture is again mapped onto the same geometry.
float texFov; StelTextureSP mapTexIllum; //!< Optional fisheye image of identical
size (create as layer in your favorite image processor) or at least, propor
tions.
//!< To simulate
light pollution (skyglow), street lights, light in windows, ... at night
QImage *mapImage; //!< The same image as mapTex, but stored
in-mem for sampling.
//! Sphere used to draw the landscape. float texFov;
class StelGeometrySphere* fisheyeSphere;
}; };
//////////////////////////////////////////////////////////////////////////
//! @class LandscapeSpherical
//! This uses a single panorama image in spherical (equirectangular) projec
tion. A complete image is rectangular with the horizon forming a
//! horizontal line centered vertically, and vertical altitude angles linea
rly mapped in image height.
//! Since 0.13 and Qt5, large images of 8192x4096 pixels are available, but
they still may not work on every hardware.
//! If @param angleRotateZ==0, the left/right image border is due east.
//! It is possible to remove empty top or bottom parts of the textures (mai
n texture: only top part should meaningfully be cut away!)
//! The textures should still be power-of-two, so maybe 8192x1024 for the f
og, or 8192x2048 for the light pollution.
//! (It's OK to stretch the textures. They just have to fit, geometrically!
)
//! TODO: Allow a horizontal split for 2 or even 4 parts, i.e. super-large,
super-accurate panos.
class LandscapeSpherical : public Landscape class LandscapeSpherical : public Landscape
{ {
public: public:
LandscapeSpherical(float radius = 1.f); LandscapeSpherical(float radius = 1.f);
virtual ~LandscapeSpherical(); virtual ~LandscapeSpherical();
virtual void load(const QSettings& landscapeIni, const QString& land scapeId); virtual void load(const QSettings& landscapeIni, const QString& land scapeId);
virtual void draw(StelCore* core, class StelRenderer* renderer); virtual void draw(StelCore* core);
void create(const QString name, const QString& maptex, float angleRo //! Sample landscape texture for transparency/opacity. May be used f
tateZ); or visibility, sunrise etc.
//! @param azalt normalized direction in alt-az frame
//! @retval alpha (0=fully transparent, 1=fully opaque. Trees, leave
s, glass etc may have intermediate values.)
virtual float getOpacity(Vec3d azalt) const;
//! create a spherical landscape from basic parameters (no ini file
needed).
//! @param name Landscape name
//! @param maptex the equirectangular texture
//! @param maptexIllum the equirectangular texture that is overlaid
in the night (streetlights, skyglow, ...)
//! @param angleRotateZ azimuth rotation angle, degrees [0]
//! @param _mapTexTop altitude angle of top edge of texture, degrees
[90]
//! @param _mapTexBottom altitude angle of bottom edge of texture, d
egrees [-90]
//! @param _fogTexTop altitude angle of top edge of fog texture, deg
rees [90]
//! @param _fogTexBottom altitude angle of bottom edge of fog textur
e, degrees [-90]
//! @param _illumTexTop altitude angle of top edge of light pollutio
n texture, degrees [90]
//! @param _illumTexBottom altitude angle of bottom edge of light po
llution texture, degrees [-90]
void create(const QString name, const QString& maptex, const QString
&_maptexFog="", const QString& _maptexIllum="", const float _angleRotateZ=
0.0f,
const float _mapTexTop=90.0f, const float _m
apTexBottom=-90.0f,
const float _fogTexTop=90.0f, const float _f
ogTexBottom=-90.0f,
const float _illumTexTop=90.0f, const float
_illumTexBottom=-90.0f);
private: private:
class StelTextureNew* mapTex; StelTextureSP mapTex; //!< The equirectangular panorama texture
QString mapTexPath; StelTextureSP mapTexFog; //!< Optional panorama of identical size
(create as layer over the mapTex image in your favorite image processor).
//! Sphere used to draw the landscape. //!< can also be
class StelGeometrySphere* landscapeSphere; smaller, just the texture is again mapped onto the same geometry.
StelTextureSP mapTexIllum; //!< Optional panorama of identical size
(create as layer over the mapTex image in your favorite image processor).
//!< To simulate
light pollution (skyglow), street lights, light in windows, ... at night
// These vars are here to conserve texture memory. They must be allo
wed to be different: a landscape may have its highest elevations at 15°, fo
g may reach from -25 to +15°,
// light pollution may cover -5° (street lamps slightly below) plus
parts of or even the whole sky. All have default values to simplify life.
float mapTexTop; //!< zenithal top angle of the landscape
texture, radians
float mapTexBottom; //!< zenithal bottom angle of the
landscape texture, radians
float fogTexTop; //!< zenithal top angle of the fo
g texture, radians
float fogTexBottom; //!< zenithal bottom angle of the
fog texture, radians
float illumTexTop; //!< zenithal top angle of the il
lumination texture, radians
float illumTexBottom; //!< zenithal bottom angle of the illumin
ation texture, radians
QImage *mapImage; //!< The same image as mapTex, but stored
in-mem for opacity sampling.
}; };
#endif // _LANDSCAPE_HPP_ #endif // _LANDSCAPE_HPP_
 End of changes. 38 change blocks. 
171 lines changed or deleted 364 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/