Stellarium 0.15.2
1 /*
2  * Stellarium Scenery3d Plug-in
3  *
4  * Copyright (C) 2011 Simon Parzer, Peter Neubauer, Georg Zotti
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19  */
21 #ifndef _SCENEINFO_HPP_
22 #define _SCENEINFO_HPP_
24 #include "StelLocation.hpp"
25 #include "VecMath.hpp"
27 #include <QMap>
28 #include <QSharedPointer>
30 class QSettings;
34 struct SceneInfo
35 {
37  camNearZ(0.1f),camFarZ(1000.0f),shadowFarZ(1000.0f),shadowSplitWeight(0.5f),location(),lookAt_fov(0.0f,0.0f,25.0f),eyeLevel(0.0),
40  {}
42  bool isValid;
44  QString id;
46  QString fullPath;
48  QString name;
50  QString author;
55  QString description;
57  QString copyright;
59  QString landscapeName;
61  QString modelScenery;
63  QString modelGround;
65  QString vertexOrder;
68  float camNearZ;
70  float camFarZ;
73  float shadowFarZ;
79  QSharedPointer<StelLocation> location;
81  Vec3f lookAt_fov; // (az_deg, alt_deg, fov_deg)
84  double eyeLevel;
86  QString gridName;
117  bool hasLocation() const { return !location.isNull(); }
119  bool hasLookAtFOV() const { return lookAt_fov[2] >= 0; }
124  QString getLocalizedHTMLDescription() const;
127  static const QString SCENES_PATH;
129  static bool loadByID(const QString& id, SceneInfo &info);
131  static bool loadByName(const QString& name, SceneInfo& info);
134  static QString getIDFromName(const QString& name);
136  static QStringList getAllSceneIDs();
138  static QStringList getAllSceneNames();
141  static int metaTypeId;
142 private:
144  static QMap<QString,QString> getNameToIDMap();
145  static int initMetaType();
146 };
148 struct StoredView;
149 typedef QList<StoredView> StoredViewList;
153 {
154  StoredView() : position(0,0,0,0), view_fov(0,0,-1000), isGlobal(false), jd(0.0), jdIsRelevant(false)
155  {}
158  QString label;
160  QString description;
166  bool isGlobal;
168  double jd;
174  static StoredViewList getGlobalViewsForScene(const SceneInfo& scene);
177  static StoredViewList getUserViewsForScene(const SceneInfo& scene);
180  static void saveUserViews(const SceneInfo& scene, const StoredViewList& list);
182  static QSettings* userviews;
183  static const QString USERVIEWS_FILE;
184 private:
185  static void readArray(QSettings& ini,StoredViewList& list, int size, bool isGlobal);
186  static void writeArray(QSettings& ini, const StoredViewList& list);
187  static QSettings* getUserViews();
188 };
192 #endif
bool groundGenerateNormals
Recalculate normals of the ground from face normals? Default false.
Definition: SceneInfo.hpp:114
QString author
Author of the scene.
Definition: SceneInfo.hpp:50
QString modelScenery
The file name of the scenery .obj model.
Definition: SceneInfo.hpp:61
Vec3d modelWorldOffset
Offset of the center of the model in a given grid space.
Definition: SceneInfo.hpp:88
bool isValid
If this is a valid sceneInfo object loaded from file.
Definition: SceneInfo.hpp:42
Vec4d position
Stored grid position + current eye height in 4th component.
Definition: SceneInfo.hpp:162
bool hasLocation() const
Returns true if the location object is valid.
Definition: SceneInfo.hpp:117
float shadowFarZ
An optional shadow far clipping plane, constraining the shadowmaps to a smaller region than is visibl...
Definition: SceneInfo.hpp:73
double eyeLevel
The height at which the observer&#39;s eyes are placed. Default 1.65.
Definition: SceneInfo.hpp:84
Contains all the metadata necessary for a Scenery3d scene, and can be loaded from special ...
Definition: SceneInfo.hpp:34
float camFarZ
Distance to cam far clipping plane. Default 10000.0.
Definition: SceneInfo.hpp:70
bool altitudeFromModel
If true, it indicates that the model file&#39;s bounding box is used for altitude calculation.
Definition: SceneInfo.hpp:94
Mat4d zRotateMatrix
The vertical axis rotation that must be applied to the scene, for meridian convergence.
Definition: SceneInfo.hpp:105
static const QString SCENES_PATH
The folder for scenery is found here.
Definition: SceneInfo.hpp:127
double jd
Julian Date of interest.
Definition: SceneInfo.hpp:168
static int metaTypeId
The meta type ID associated to the SceneInfo type.
Definition: SceneInfo.hpp:141
QString name
Name of the scene.
Definition: SceneInfo.hpp:48
bool groundNullHeightFromModel
If true, it indicates that the model file&#39;s bounding box is used for starting height calculation...
Definition: SceneInfo.hpp:98
QString label
A descriptive label.
Definition: SceneInfo.hpp:158
QString description
A description of the view.
Definition: SceneInfo.hpp:160
QString description
A description, which can be displayed in the GUI - supporting HTML tags! Note that this description...
Definition: SceneInfo.hpp:55
Mat4d obj2gridMatrix
If only a non-georeferenced OBJ can be provided, you can specify a matrix via .ini/[model]/obj_world_...
Definition: SceneInfo.hpp:102
Vec3d relativeStartPosition
Relative start position in model space, calculated from the world offset and start offset with Z rota...
Definition: SceneInfo.hpp:92
Vec3f view_fov
Alt/Az angles in degrees + field of view.
Definition: SceneInfo.hpp:164
static QStringList getAllSceneNames()
Returns all available scene names.
bool jdIsRelevant
Indicate if stored date is potentially relevant.
Definition: SceneInfo.hpp:170
QSharedPointer< StelLocation > location
Optional more accurate location information, which will override the landscape&#39;s position.
Definition: SceneInfo.hpp:79
bool startPositionFromModel
If true, it indicates that the model file&#39;s bounding box is used for starting position calculation...
Definition: SceneInfo.hpp:96
QString fullPath
The full path to the scene&#39;s folder. Other paths (model files) are to be seen relative to this path...
Definition: SceneInfo.hpp:46
static QString getIDFromName(const QString &name)
Returns the ID for the given scene name.
Vec3d startWorldOffset
The world grid space offset where the observer is placed upon loading.
Definition: SceneInfo.hpp:90
QString copyright
Copyright string.
Definition: SceneInfo.hpp:57
Vec3f lookAt_fov
Optional initial look-at vector (azimuth, elevation and FOV in degrees)
Definition: SceneInfo.hpp:81
double groundNullHeight
The height value outside the ground model&#39;s heightmap, or used if no ground model exists...
Definition: SceneInfo.hpp:107
bool isGlobal
True if this is a position stored next to the scene definition (viewpoints.ini). If false...
Definition: SceneInfo.hpp:166
QString modelGround
The file name of the optional seperate ground model (used as a heightmap for walking) ...
Definition: SceneInfo.hpp:63
float transparencyThreshold
Threshold for cutout transparency (no blending). Default is 0.5f.
Definition: SceneInfo.hpp:110
float shadowSplitWeight
Weighting of the shadow frustum splits between uniform (at 0) and logarithmic (at 1) splits When -1...
Definition: SceneInfo.hpp:76
QString getLocalizedHTMLDescription() const
Tries to find a description.
QString landscapeName
The name of the landscape to switch to. The landscape&#39;s position is applied on loading.
Definition: SceneInfo.hpp:59
static bool loadByID(const QString &id, SceneInfo &info)
Loads the scene metadata associated with this ID (directory) into the given object. Returns true on success.
float camNearZ
Distance to cam near clipping plane. Default 0.3.
Definition: SceneInfo.hpp:68
bool hasLookAtFOV() const
Returns true if the lookat_fov is valid.
Definition: SceneInfo.hpp:119
QString vertexOrder
Optional string depicting vertex order of models (XYZ, ZXY, ...)
Definition: SceneInfo.hpp:65
static bool loadByName(const QString &name, SceneInfo &info)
Convenience method that finds the ID for the given name and calls loadByID.
A structure which stores a specific view position, view direction and FOV, together with a textual de...
Definition: SceneInfo.hpp:152
QString id
ID of the scene (relative directory)
Definition: SceneInfo.hpp:44
bool sceneryGenerateNormals
Recalculate normals of the scene from face normals? Default false.
Definition: SceneInfo.hpp:112
static QStringList getAllSceneIDs()
Returns all available scene IDs.
QString gridName
The name of the grid space for displaying the world positon.
Definition: SceneInfo.hpp:86