LandscapeMgr.hpp   LandscapeMgr.hpp 
skipping to change at line 31 skipping to change at line 31
#ifndef _LANDSCAPEMGR_HPP_ #ifndef _LANDSCAPEMGR_HPP_
#define _LANDSCAPEMGR_HPP_ #define _LANDSCAPEMGR_HPP_
#include "StelModule.hpp" #include "StelModule.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "Landscape.hpp" #include "Landscape.hpp"
#include <QMap> #include <QMap>
#include <QStringList> #include <QStringList>
#include <QCache>
class Atmosphere; class Atmosphere;
class Cardinals; class Cardinals;
class QSettings; class QSettings;
//! @class LandscapeMgr //! @class LandscapeMgr
//! Manages all the rendering at the level of the observer's surroundings. //! Manages all the rendering at the level of the observer's surroundings.
//! This includes landscape textures, fog, atmosphere and cardinal points. //! This includes landscape textures, fog, atmosphere and cardinal points.
//! I decided to put all these elements together in a single class because they are //! I decided to put all these elements together in a single class because they are
//! inherently linked, especially when we start moving the observer in alti tude. //! inherently linked, especially when we start moving the observer in alti tude.
//! \note //! \note
//! The Bortle scale index setting was removed from this class, because it was duplicated //! The Bortle scale index setting was removed from this class, because it was duplicated
//! from StelSkyDrawer, complicating code that changes it. //! from StelSkyDrawer, complicating code that changes it.
//! It is now only in StelSkyDrawer and can be accessed with //! It is now only in StelSkyDrawer and can be accessed
//! with \link StelSkyDrawer::getBortleScaleIndex getBortleScaleIndex \endl ink //! with \link StelSkyDrawer::getBortleScaleIndex getBortleScaleIndex \endl ink
//! and \link StelSkyDrawer::setBortleScaleIndex setBortleScaleIndex \endli nk. //! and \link StelSkyDrawer::setBortleScaleIndex setBortleScaleIndex \endli nk.
//! Slots setAtmosphereBortleLightPollution and getAtmosphereBortleLightPol lution //! Slots setAtmosphereBortleLightPollution and getAtmosphereBortleLightPol lution
//! in this class have been removed/made private. //! in this class have been removed/made private.
//! If script access is desired, use //! If script access is desired, use
//! \link StelMainScriptAPI::getBortleScaleIndex StelMainScriptAPI::get \en dlink/\link StelMainScriptAPI::setBortleScaleIndex setBortleScaleIndex \end link //! \link StelMainScriptAPI::getBortleScaleIndex StelMainScriptAPI::get \en dlink/\link StelMainScriptAPI::setBortleScaleIndex setBortleScaleIndex \end link
class LandscapeMgr : public StelModule class LandscapeMgr : public StelModule
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool atmosphereDisplayed Q_PROPERTY(bool atmosphereDisplayed
skipping to change at line 82 skipping to change at line 83
WRITE setFlagLandscape WRITE setFlagLandscape
NOTIFY landscapeDisplayedChanged) NOTIFY landscapeDisplayedChanged)
Q_PROPERTY(bool illuminationDisplayed Q_PROPERTY(bool illuminationDisplayed
READ getFlagIllumination READ getFlagIllumination
WRITE setFlagIllumination WRITE setFlagIllumination
NOTIFY illuminationDisplayedChanged) NOTIFY illuminationDisplayedChanged)
Q_PROPERTY(bool labelsDisplayed Q_PROPERTY(bool labelsDisplayed
READ getFlagLabels READ getFlagLabels
WRITE setFlagLabels WRITE setFlagLabels
NOTIFY labelsDisplayedChanged) NOTIFY labelsDisplayedChanged)
Q_PROPERTY(bool databaseUsage Q_PROPERTY(bool flagUseLightPollutionFromDatabase // was databaseUsa ge
READ getFlagUseLightPollutionFromDatabase READ getFlagUseLightPollutionFromDatabase
WRITE setFlagUseLightPollutionFromDatabase WRITE setFlagUseLightPollutionFromDatabase
NOTIFY lightPollutionUsageChanged) NOTIFY flagUseLightPollutionFromDatabaseChanged)
Q_PROPERTY(bool flagLandscapeAutoSelection Q_PROPERTY(bool flagLandscapeAutoSelection
READ getFlagLandscapeAutoSelection READ getFlagLandscapeAutoSelection
WRITE setFlagLandscapeAutoSelection WRITE setFlagLandscapeAutoSelection
NOTIFY flagLandscapeAutoSelectionChanged) NOTIFY flagLandscapeAutoSelectionChanged)
Q_PROPERTY(bool flagLandscapeSetsLocation Q_PROPERTY(bool flagLandscapeSetsLocation
READ getFlagLandscapeSetsLocation READ getFlagLandscapeSetsLocation
WRITE setFlagLandscapeSetsLocation WRITE setFlagLandscapeSetsLocation
NOTIFY flagLandscapeSetsLocationChanged) NOTIFY flagLandscapeSetsLocationChanged)
Q_PROPERTY(bool flagLandscapeUseMinimalBrightness Q_PROPERTY(bool flagLandscapeUseMinimalBrightness
READ getFlagLandscapeUseMinimalBrightness READ getFlagLandscapeUseMinimalBrightness
skipping to change at line 144 skipping to change at line 145
//! - updates adaptation luminescence based on visible bright object s. //! - updates adaptation luminescence based on visible bright object s.
//! - Landscape and lightscape brightness computations based on sun position and whether atmosphere is on or off. //! - Landscape and lightscape brightness computations based on sun position and whether atmosphere is on or off.
virtual void update(double deltaTime); virtual void update(double deltaTime);
//! Get the order in which this module will draw its objects relativ e to other modules. //! Get the order in which this module will draw its objects relativ e to other modules.
virtual double getCallOrder(StelModuleActionName actionName) const; virtual double getCallOrder(StelModuleActionName actionName) const;
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods specific to the landscape manager // Methods specific to the landscape manager
//! Load a landscape based on a hash of parameters mirroring the lan // Load a landscape based on a hash of parameters mirroring the land
dscape.ini scape.ini
//! file and make it the current landscape. // file and make it the current landscape.
bool loadLandscape(QMap<QString, QString>& param); // GZ: This was declared, but not implemented(?)
//bool loadLandscape(QMap<QString, QString>& param);
//! Create a new landscape from the files which describe it. //! Create a new landscape from the files which describe it.
//! Reads a landscape.ini file which is passed as the first paramete r, determines //! Reads a landscape.ini file which is passed as the first paramete r, determines
//! the landscape type, and creates a new object for the landscape o f the proper //! the landscape type, and creates a new object for the landscape o f the proper
//! type. The load member is then called, passing both parameters. //! type. The load member is then called, passing both parameters.
//! @param landscapeFile This is the path to a landscape.ini file. //! @param landscapeFile This is the path to a landscape.ini file.
//! @param landscapeId This is the landscape ID, which is also the n ame of the //! @param landscapeId This is the landscape ID, which is also the n ame of the
//! directory in which the files (textures and so on) for the landsc ape reside. //! directory in which the files (textures and so on) for the landsc ape reside.
//! @return A pointer to the newly created landscape object. //! @return A pointer to the newly created landscape object.
Landscape* createFromFile(const QString& landscapeFile, const QStrin g& landscapeId); Landscape* createFromFile(const QString& landscapeFile, const QStrin g& landscapeId);
skipping to change at line 180 skipping to change at line 182
float getAtmosphereAverageLuminance() const; float getAtmosphereAverageLuminance() const;
//! Override autocomputed value and set average luminance [cd/m^2] o f atmosphere. This is around 10 at sunset, 6400 in daylight, >0 in dark ni ght. //! Override autocomputed value and set average luminance [cd/m^2] o f atmosphere. This is around 10 at sunset, 6400 in daylight, >0 in dark ni ght.
//! Usually there is no need to call this, the luminance is properly computed. This is a function which can be //! Usually there is no need to call this, the luminance is properly computed. This is a function which can be
//! useful in rare cases, e.g. in scripts when you want to create im ages of adjacent sky regions with the same brightness setting, //! useful in rare cases, e.g. in scripts when you want to create im ages of adjacent sky regions with the same brightness setting,
//! or for creation of a virtual camera which can deliberately show over- or underexposure. //! or for creation of a virtual camera which can deliberately show over- or underexposure.
//! For these cases, it is advisable to first center the brightest l uminary (sun or moon), call getAtmosphereAverageLuminance() and then set //! For these cases, it is advisable to first center the brightest l uminary (sun or moon), call getAtmosphereAverageLuminance() and then set
//! this value explicitly to freeze it during image export. To unfre eze, call this again with any negative value. //! this value explicitly to freeze it during image export. To unfre eze, call this again with any negative value.
void setAtmosphereAverageLuminance(const float overrideLuminance); void setAtmosphereAverageLuminance(const float overrideLuminance);
//! Return a map of landscape name to landscape ID (directory name). //! Return a map of landscape names to landscape IDs (directory name s).
QMap<QString,QString> getNameToDirMap() const; QMap<QString,QString> getNameToDirMap() const;
//! Retrieve a list of the names of all the available landscapes in //! Retrieve a list of the names of all the available landscapes in
//! the file search path sub-directories of the landscape area //! the file search path sub-directories of the landscape area
//! @return the names of the landscapes, which are the values of the name parameter in the landscape.ini files //! @return the names of the landscapes, which are the values of the name parameter in the landscape.ini files
QStringList getAllLandscapeNames() const; QStringList getAllLandscapeNames() const;
//! Retrieve a list of the identifiers of all the available landscap es in //! Retrieve a list of the identifiers of all the available landscap es in
//! the file search path sub-directories of the landscape area //! the file search path sub-directories of the landscape area
//! @return the identifiers of the landscapes, which are the names o f the directories containing the landscapes' files //! @return the identifiers of the landscapes, which are the names o f the directories containing the landscapes' files
skipping to change at line 215 skipping to change at line 217
bool setCurrentLandscapeID(const QString& id, const double changeLoc ationDuration = 1.0); bool setCurrentLandscapeID(const QString& id, const double changeLoc ationDuration = 1.0);
//! Get the current landscape name. //! Get the current landscape name.
QString getCurrentLandscapeName() const; QString getCurrentLandscapeName() const;
//! Change the current landscape to the landscape with the name spec ified. //! Change the current landscape to the landscape with the name spec ified.
//! Emits currentLandscapeChanged() if the landscape changed (true r eturned) //! Emits currentLandscapeChanged() if the landscape changed (true r eturned)
//! @param name the name of the new landscape, as found in the lands cape:name key of the landscape.ini file. //! @param name the name of the new landscape, as found in the lands cape:name key of the landscape.ini file.
//! @param changeLocationDuration the duration of the transition ani mation //! @param changeLocationDuration the duration of the transition ani mation
bool setCurrentLandscapeName(const QString& name, const double chang eLocationDuration = 1.0); bool setCurrentLandscapeName(const QString& name, const double chang eLocationDuration = 1.0);
//! Get the current landscape or lightscape brightness (0..1)
//! @param light true to retrieve the light layer brightness value.
float getCurrentLandscapeBrightness(const bool light=false) const {r
eturn (light? landscape->getLightscapeBrightness() : landscape->getBrightne
ss());}
//! Preload a landscape into cache.
//! @param id the ID of a landscape
//! @param replace true if existing landscape entry should be replac
ed (useful during development to reload after edit)
//! @return false if landscape could not be found, or if it already
existed in cache and replace was false.
bool precacheLandscape(const QString& id, const bool replace=true);
//! Remove a landscape from the cache of landscapes.
//! @param id the ID of a landscape
//! @return false if landscape could not be found
bool removeCachedLandscape(const QString& id);
//! Set size of the landscape cache, in MB.
//! Default size is 100MB, or configured as [landscape/cache_size_mb
] from config.ini.
//! The landscape sizes returned in Landscape::getMemorySize() are o
nly approximate, but include image and texture sizes.
//! A big landscape may well take 150MB or more.
//! On a 32bit system, keep this rather small. On 64bit with 16GB RA
M and no other tasks, 4GB is no problem.
//! Modern GPUs may have 4 or even 8GB of dedicated texture memory.
Most of this may be filled with landscape textures.
//! Example: a museum installation with 20 large (16384x2048) old_st
ype landscapes can require up to 3.5GB. Allow 4GB cache,
//! and the system will never have to load a landscape during the sh
ow when all have been preloaded.
void setCacheSize(int mb) { landscapeCache.setMaxCost(mb);}
//! Retrieve total size of cache (MB).
int getCacheSize() const {return landscapeCache.maxCost();}
//! Retrieve sum of currently used memory in cache (MB, approximate)
int getCacheFilledSize() const {return landscapeCache.totalCost();}
//! Return number of landscapes already in the cache.
int getCacheCount() const {return landscapeCache.count();}
//! Get the current landscape object. //! Get the current landscape object.
Landscape* getCurrentLandscape() const { return landscape; } Landscape* getCurrentLandscape() const { return landscape; }
//! Get the default landscape ID. //! Get the default landscape ID.
const QString getDefaultLandscapeID() const {return defaultLandscape ID;} const QString getDefaultLandscapeID() const {return defaultLandscape ID;}
//! Change the default landscape to the landscape with the ID specif ied. //! Change the default landscape to the landscape with the ID specif ied.
//! @param id the ID of the landscape to use by default //! @param id the ID of the landscape to use by default
//! @return false if the new landscape could not be set (e.g. no lan dscape of that ID was found). True on success. //! @return false if the new landscape could not be set (e.g. no lan dscape of that ID was found). True on success.
bool setDefaultLandscapeID(const QString& id); bool setDefaultLandscapeID(const QString& id);
skipping to change at line 416 skipping to change at line 447
} }
signals: signals:
void atmosphereDisplayedChanged(const bool displayed); void atmosphereDisplayedChanged(const bool displayed);
void cardinalsPointsDisplayedChanged(const bool displayed); void cardinalsPointsDisplayedChanged(const bool displayed);
void cardinalsPointsColorChanged(const Vec3f & newColor) const; void cardinalsPointsColorChanged(const Vec3f & newColor) const;
void fogDisplayedChanged(const bool displayed); void fogDisplayedChanged(const bool displayed);
void landscapeDisplayedChanged(const bool displayed); void landscapeDisplayedChanged(const bool displayed);
void illuminationDisplayedChanged(const bool displayed); void illuminationDisplayedChanged(const bool displayed);
void labelsDisplayedChanged(const bool displayed); void labelsDisplayedChanged(const bool displayed);
void lightPollutionUsageChanged(const bool usage); void flagUseLightPollutionFromDatabaseChanged(const bool usage);
void flagLandscapeAutoSelectionChanged(const bool value); void flagLandscapeAutoSelectionChanged(const bool value);
void flagLandscapeSetsLocationChanged(const bool value); void flagLandscapeSetsLocationChanged(const bool value);
void flagLandscapeUseMinimalBrightnessChanged(const bool value); void flagLandscapeUseMinimalBrightnessChanged(const bool value);
void flagLandscapeSetsMinimalBrightnessChanged(const bool value); void flagLandscapeSetsMinimalBrightnessChanged(const bool value);
void defaultMinimalBrightnessChanged(const double value); void defaultMinimalBrightnessChanged(const double value);
void setFlagAtmosphereAutoEnableChanged(const bool enabled); void setFlagAtmosphereAutoEnableChanged(const bool enabled);
//! Emitted whenever the default landscape is changed //! Emitted whenever the default landscape is changed
//! @param id the landscape id of the new default landscape //! @param id the landscape id of the new default landscape
void defaultLandscapeChanged(const QString& id); void defaultLandscapeChanged(const QString& id);
skipping to change at line 507 skipping to change at line 538
//! Indicate use of the default minimal brightness value specified i n config.ini. //! Indicate use of the default minimal brightness value specified i n config.ini.
bool flagLandscapeUseMinimalBrightness; bool flagLandscapeUseMinimalBrightness;
//! A minimal brightness value to keep landscape visible. //! A minimal brightness value to keep landscape visible.
double defaultMinimalBrightness; double defaultMinimalBrightness;
//! Indicate use of the minimal brightness value specified in the cu rrent landscape.ini, if present. //! Indicate use of the minimal brightness value specified in the cu rrent landscape.ini, if present.
bool flagLandscapeSetsMinimalBrightness; bool flagLandscapeSetsMinimalBrightness;
//! Indicate auto-enable atmosphere for planets with atmospheres in location window //! Indicate auto-enable atmosphere for planets with atmospheres in location window
bool flagAtmosphereAutoEnabling; bool flagAtmosphereAutoEnabling;
// The ID of the currently loaded landscape //! The ID of the currently loaded landscape
QString currentLandscapeID; QString currentLandscapeID;
// The ID of the default landscape //! The ID of the default landscape
QString defaultLandscapeID; QString defaultLandscapeID;
//! List of the IDs of the landscapes packaged by default with Stell arium. //! List of the IDs of the landscapes packaged by default with Stell arium.
//! (So that they can't be removed.) //! (So that they can't be removed.)
QStringList packagedLandscapeIDs; QStringList packagedLandscapeIDs;
//! QCache of landscapes kept in memory for faster access, esp. when
frequently switching between several big landscapes.
//! Example: a 16384-size old_style landscape takes about 10 seconds
to load. Kept in cache, it is back instantly.
//! Of course, this requires lots of RAM and GPU texture memory, but
in the age of 64bit CPUs and 4GB and more GPU
//! texture memory, it is no problem to keep even 20 or more landsca
pes.
//! This is esp. useful in a context of automated setup (museum show
or such) where a list of landscapes is preloaded
//! at system start (e.g. in the startup.ssc script) and then retrie
ved while script is running.
//! The key is just the LandscapeID.
QCache<QString,Landscape> landscapeCache;
}; };
#endif // _LANDSCAPEMGR_HPP_ #endif // _LANDSCAPEMGR_HPP_
 End of changes. 11 change blocks. 
11 lines changed or deleted 66 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/