Landscape.hpp   Landscape.hpp 
skipping to change at line 78 skipping to change at line 78
Vec3d featurePoint; // start of the line: mountain peak, bui lding, ... Vec3d featurePoint; // start of the line: mountain peak, bui lding, ...
Vec3d labelPoint; // end of the line, where the centered l abel best fits. Vec3d labelPoint; // end of the line, where the centered l abel best fits.
} LandscapeLabel; } LandscapeLabel;
Landscape(float _radius = 2.f); Landscape(float _radius = 2.f);
virtual ~Landscape(); virtual ~Landscape();
//! Load landscape. //! Load landscape.
//! @param landscapeIni A reference to an existing 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")
virtual void load(const QSettings& landscapeIni, const QString& land scapeId) = 0; virtual void load(const QSettings& landscapeIni, const QString& land scapeId) = 0;
//! Return approximate memory footprint in bytes (required for cache
cost estimate in LandscapeMgr)
//! The returned value is only approximate, content of QStrings and
other small containers like the horizon polygon are not put in in detail.
//! However, texture image sizes must be computed in subclasses.
//! The value returned is a sum of RAM and texture memory requiremen
ts.
virtual unsigned int getMemorySize() const {return sizeof(Landscape)
;}
virtual void draw(StelCore* core) = 0; virtual void draw(StelCore* core) = 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));
illumFader.update((int)(deltaTime*1000)); illumFader.update((int)(deltaTime*1000));
labelFader.update((int)(deltaTime*1000)); labelFader.update((int)(deltaTime*1000));
} }
//! Set the brightness of the landscape plus brightness of optional add-on night lightscape. //! Set the brightness of the landscape plus brightness of optional add-on night lightscape.
skipping to change at line 127 skipping to change at line 134
bool getFlagShowLabels() const {return (bool)labelFader;} bool getFlagShowLabels() const {return (bool)labelFader;}
//! change font and fontsize for landscape labels //! change font and fontsize for landscape labels
void setLabelFontSize(const int size){fontSize=size;} void setLabelFontSize(const int size){fontSize=size;}
//! 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;}
//! Get landscape id. This is the landscape directory name, used for
cache handling.
QString getId() const {return id;}
//! Return the associated location (may be empty!) //! 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!) //! Return if the location is valid (a valid location has a valid pl anetName!)
bool hasLocation() const {return (!(location.planetName.isEmpty())); } bool hasLocation() const {return (!(location.planetName.isEmpty())); }
//! 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 ch ange) //! Return default atmosperic extinction [mag/airmass], or -1 (no ch ange)
skipping to change at line 204 skipping to change at line 213
//! 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& landscapeId) const; const QString getTexturePath(const QString& basename, const QString& landscapeId) const;
float radius; float radius;
QString name; //! Read from landscape.ini:[landscape]name QString name; //! Read from landscape.ini:[landscape]name
QString author; //! Read from landscape.ini:[landscape]author QString author; //! Read from landscape.ini:[landscape]author
QString description; //! Read from landscape.ini:[landscape]descri ption QString description; //! Read from landscape.ini:[landscape]descri ption
QString id; //! Set during load. Required for consistent caching.
float minBrightness; //! Read from landscape.ini:[landscape]minima l_brightness. Allows minimum visibility that cannot be underpowered. float minBrightness; //! Read from landscape.ini:[landscape]minima l_brightness. Allows minimum visibility that cannot be underpowered.
float landscapeBrightness; //! brightness [0..1] to draw the landsc ape. Computed by the LandscapeMgr. float landscapeBrightness; //! brightness [0..1] to draw the landsc ape. Computed by the LandscapeMgr.
float lightScapeBrightness; //! can be used to draw nightscape textu re (e.g. city light pollution), if available. Computed by the LandscapeMgr. float lightScapeBrightness; //! can be used to draw nightscape textu re (e.g. city light pollution), if available. Computed by the LandscapeMgr.
bool validLandscape; //! was a landscape loaded properly? bool validLandscape; //! was a landscape loaded properly?
LinearFader landFader; //! Used to slowly fade in/out landscape pain ting. LinearFader landFader; //! Used to slowly fade in/out landscape pain ting.
LinearFader fogFader; //! Used to slowly fade in/out fog painting. LinearFader fogFader; //! Used to slowly fade in/out fog painting.
LinearFader illumFader;//! Used to slowly fade in/out illumination p ainting. LinearFader illumFader;//! Used to slowly fade in/out illumination p ainting.
LinearFader labelFader;//! Used to slowly fade in/out landscape feat ure labels. LinearFader labelFader;//! Used to slowly fade in/out landscape feat ure labels.
int rows; //! horizontal rows. May be given in landscape.ini:[lands cape]tesselate_rows. More indicates higher accuracy, but is slower. int rows; //! horizontal rows. May be given in landscape.ini:[lands cape]tesselate_rows. More indicates higher accuracy, but is slower.
skipping to change at line 261 skipping to change at line 271
//! It is more involved to configure, but may still be preferred if you req uire the resolution, e.g. for alignment studies //! 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. //! for archaeoastronomy. In this case, don't forget to set calibrated=true in landscape.ini.
//! Since V0.13.1, also this landscape has a self-luminous (light pollution ) option: Configure light<n> entries with textures overlaid the tex<n> text ures. Only textures with light are necessary! //! Since V0.13.1, also this landscape has a self-luminous (light pollution ) option: Configure light<n> entries with textures overlaid the tex<n> text ures. Only textures with light are necessary!
//! Can be easily made using layers with e.g. Photoshop or Gimp. //! Can be easily made using layers with e.g. Photoshop or Gimp.
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 unsigned int getMemorySize() const {return memorySize;}
virtual void draw(StelCore* core); virtual void draw(StelCore* core);
//void create(bool _fullpath, QMap<QString, QString> param); // stil l not implemented //void create(bool _fullpath, QMap<QString, QString> param); // stil l not implemented
virtual float getOpacity(Vec3d azalt) const; virtual float getOpacity(Vec3d azalt) const;
protected: protected:
typedef struct typedef struct
{ {
StelTextureSP tex; StelTextureSP tex;
StelTextureSP tex_illum; // optional light texture. StelTextureSP tex_illum; // optional light texture.
float texCoords[4]; float texCoords[4];
} landscapeTexCoord; } landscapeTexCoord;
skipping to change at line 304 skipping to change at line 315
bool tanMode; // Whether the angles should be converted us ing tan instead of sin, i.e., for a cylindrical pano bool tanMode; // Whether the angles should be converted us ing tan instead of sin, i.e., for a cylindrical pano
bool calibrated; // if true, the documented altitudes are ind eed correct (the original code is buggy!) bool calibrated; // if true, the documented altitudes are ind eed correct (the original code is buggy!)
struct LOSSide struct LOSSide
{ {
StelVertexArray arr; StelVertexArray arr;
StelTextureSP tex; StelTextureSP tex;
bool light; // GZ NEW: true if texture is self-lighting. bool light; // GZ NEW: true if texture is self-lighting.
}; };
QList<LOSSide> precomputedSides; QList<LOSSide> precomputedSides;
unsigned int memorySize;
}; };
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
/// ///
//! @class LandscapePolygonal //! @class LandscapePolygonal
//! This uses the list of (usually measured) horizon altitudes to define th e horizon. //! This uses the list of (usually measured) horizon altitudes to define th e horizon.
//! Define it with the following names in landscape.ini: //! Define it with the following names in landscape.ini:
//! @param landscape/ground_color use this color below horizon //! @param landscape/ground_color use this color below horizon
//! @param landscape/polygonal_horizon_list filename containing azimuths/al titudes, compatible with Carte du Ciel. //! @param landscape/polygonal_horizon_list filename containing azimuths/al titudes, compatible with Carte du Ciel.
//! @param landscape/polygonal_angle_rotatez offset for the polygonal measu rement //! @param landscape/polygonal_angle_rotatez offset for the polygonal measu rement
//! (different from landscape/angle_rotatez in photo panos, often ph oto and line are not aligned.) //! (different from landscape/angle_rotatez in photo panos, often ph oto and line are not aligned.)
class LandscapePolygonal : public Landscape class LandscapePolygonal : public Landscape
{ {
public: public:
LandscapePolygonal(float radius = 1.f); LandscapePolygonal(float radius = 1.f);
virtual ~LandscapePolygonal(); virtual ~LandscapePolygonal();
virtual void load(const QSettings& landscapeIni, const QString& land scapeId); virtual void load(const QSettings& landscapeIni, const QString& land scapeId);
virtual unsigned int getMemorySize() const {return sizeof(LandscapeP olygonal);}
virtual void draw(StelCore* core); virtual void draw(StelCore* core);
virtual float getOpacity(Vec3d azalt) const; virtual float getOpacity(Vec3d azalt) const;
private: private:
// we have inherited: horizonFileName, horizonPolygon, horizonPolygo nLineColor // we have inherited: horizonFileName, horizonPolygon, horizonPolygo nLineColor
Vec3f groundColor; //! specified in landscape.ini[landscape]ground_c olor. Vec3f groundColor; //! specified in landscape.ini[landscape]ground_c olor.
}; };
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
/// ///
//! @class LandscapeFisheye //! @class LandscapeFisheye
//! This uses a single image in fisheye projection. The image is typically square, ... //! 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. //! @param texFov: field of view (opening angle) of the square texture, ra dians.
//! If @param angleRotateZ==0, the top image border is due south. //! 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 unsigned int getMemorySize() const {return memorySize;}
virtual void draw(StelCore* core); virtual void draw(StelCore* core);
//! Sample landscape texture for transparency/opacity. May be used f or visibility, sunrise etc. //! Sample landscape texture for transparency/opacity. May be used f or visibility, sunrise etc.
//! @param azalt normalized direction in alt-az frame //! @param azalt normalized direction in alt-az frame
virtual float getOpacity(Vec3d azalt) const; virtual float getOpacity(Vec3d azalt) const;
//! create a fisheye landscape from basic parameters (no ini file ne eded). //! create a fisheye landscape from basic parameters (no ini file ne eded).
//! @param name Landscape name //! @param name Landscape name
//! @param maptex the fisheye texture //! @param maptex the fisheye texture
//! @param maptexIllum the fisheye texture that is overlaid in the n ight (streetlights, skyglow, ...) //! @param maptexIllum the fisheye texture that is overlaid in the n ight (streetlights, skyglow, ...)
//! @param texturefov field of view for the photo, degrees //! @param texturefov field of view for the photo, degrees
//! @param angleRotateZ azimuth rotation angle, degrees //! @param angleRotateZ azimuth rotation angle, degrees
skipping to change at line 362 skipping to change at line 376
private: private:
StelTextureSP mapTex; //!< The fisheye image, centered on the z enith. StelTextureSP mapTex; //!< The fisheye image, centered on the z enith.
StelTextureSP mapTexFog; //!< Optional panorama of identical size (create as layer over the mapTex image in your favorite image processor). StelTextureSP mapTexFog; //!< Optional panorama of identical size (create as layer over the mapTex image in your favorite image processor).
//!< can also be smaller, just the textur e is again mapped onto the same geometry. //!< can also be smaller, just the textur e is again mapped onto the same geometry.
StelTextureSP mapTexIllum; //!< Optional fisheye image of identical size (create as layer in your favorite image processor) or at least, propor tions. 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 //!< 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. QImage *mapImage; //!< The same image as mapTex, but stored in-mem for sampling.
float texFov; float texFov;
unsigned int memorySize;
}; };
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
//! @class LandscapeSpherical //! @class LandscapeSpherical
//! This uses a single panorama image in spherical (equirectangular) projec tion. A complete image is rectangular with the horizon forming a //! 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. //! 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. //! 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. //! 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!) //! 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. //! 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! ) //! (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. //! 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 unsigned int getMemorySize() const {return memorySize;}
virtual void draw(StelCore* core); virtual void draw(StelCore* core);
//! Sample landscape texture for transparency/opacity. May be used f or visibility, sunrise etc. //! Sample landscape texture for transparency/opacity. May be used f or visibility, sunrise etc.
//! @param azalt normalized direction in alt-az frame //! @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.) //! @retval alpha (0=fully transparent, 1=fully opaque. Trees, leave s, glass etc may have intermediate values.)
virtual float getOpacity(Vec3d azalt) const; virtual float getOpacity(Vec3d azalt) const;
//! create a spherical landscape from basic parameters (no ini file needed). //! create a spherical landscape from basic parameters (no ini file needed).
//! @param name Landscape name //! @param name Landscape name
//! @param maptex the equirectangular texture //! @param maptex the equirectangular texture
//! @param maptexIllum the equirectangular texture that is overlaid in the night (streetlights, skyglow, ...) //! @param maptexIllum the equirectangular texture that is overlaid in the night (streetlights, skyglow, ...)
//! @param angleRotateZ azimuth rotation angle, degrees [0] //! @param angleRotateZ azimuth rotation angle, degrees [0]
skipping to change at line 416 skipping to change at line 432
//!< To simulate light pollution (skyglow ), street lights, light in windows, ... at night //!< 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°, // 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. // 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 mapTexTop; //!< zenithal top angle of the landscape texture, radians
float mapTexBottom; //!< zenithal bottom angle of the landsca pe texture, radians float mapTexBottom; //!< zenithal bottom angle of the landsca pe texture, radians
float fogTexTop; //!< zenithal top angle of the fog textur e, radians float fogTexTop; //!< zenithal top angle of the fog textur e, radians
float fogTexBottom; //!< zenithal bottom angle of the fog tex ture, radians float fogTexBottom; //!< zenithal bottom angle of the fog tex ture, radians
float illumTexTop; //!< zenithal top angle of the illuminati on texture, radians float illumTexTop; //!< zenithal top angle of the illuminati on texture, radians
float illumTexBottom; //!< zenithal bottom angle of the illumin ation 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. QImage *mapImage; //!< The same image as mapTex, but stored in-mem for opacity sampling.
unsigned int memorySize; //!< holds an approximate value of memory consumption (for cache cost estimate)
}; };
#endif // _LANDSCAPE_HPP_ #endif // _LANDSCAPE_HPP_
 End of changes. 10 change blocks. 
0 lines changed or deleted 22 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/