Stellarium  0.16.1
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"
26 #include "StelOBJ.hpp"
28 #include <QMap>
29 #include <QSharedPointer>
33 class QSettings;
37 struct SceneInfo
38 {
39  SceneInfo() : isValid(false),id(),fullPath(),name(),author(),description(),copyright(),landscapeName(),modelScenery(),modelGround(),vertexOrder(),vertexOrderEnum(StelOBJ::XYZ),
40  camNearZ(0.1f),camFarZ(1000.0f),shadowFarZ(1000.0f),shadowSplitWeight(0.5f),location(),lookAt_fov(0.0f,0.0f,25.0f),eyeLevel(0.0),
41  altitudeFromModel(false),startPositionFromModel(false),groundNullHeightFromModel(false),groundNullHeight(0.0),
42  transparencyThreshold(0.0f),sceneryGenerateNormals(false),groundGenerateNormals(false)
43  {}
45  bool isValid;
47  QString id;
49  QString fullPath;
51  QString name;
53  QString author;
58  QString description;
60  QString copyright;
62  QString landscapeName;
64  QString modelScenery;
66  QString modelGround;
68  QString vertexOrder;
74  float camNearZ;
76  float camFarZ;
79  float shadowFarZ;
85  QSharedPointer<StelLocation> location;
87  Vec3f lookAt_fov; // (az_deg, alt_deg, fov_deg)
90  double eyeLevel;
92  QString gridName;
123  bool hasLocation() const { return !location.isNull(); }
125  bool hasLookAtFOV() const { return lookAt_fov[2] >= 0; }
130  QString getLocalizedHTMLDescription() const;
133  static const QString SCENES_PATH;
135  static bool loadByID(const QString& id, SceneInfo &info);
137  static bool loadByName(const QString& name, SceneInfo& info);
140  static QString getIDFromName(const QString& name);
142  static QStringList getAllSceneIDs();
144  static QStringList getAllSceneNames();
146  static QMap<QString,QString> getNameToIDMap();
148 private:
150  static int metaTypeId;
151 };
154 struct StoredView;
155 typedef QList<StoredView> StoredViewList;
158 struct StoredView
159 {
160  StoredView() : position(0,0,0,0), view_fov(0,0,-1000), isGlobal(false), jd(0.0), jdIsRelevant(false)
161  {}
164  QString label;
166  QString description;
172  bool isGlobal;
174  double jd;
180  static StoredViewList getGlobalViewsForScene(const SceneInfo& scene);
183  static StoredViewList getUserViewsForScene(const SceneInfo& scene);
186  static void saveUserViews(const SceneInfo& scene, const StoredViewList& list);
188  static QSettings* userviews;
189  static const QString USERVIEWS_FILE;
190 private:
191  static void readArray(QSettings& ini,StoredViewList& list, int size, bool isGlobal);
192  static void writeArray(QSettings& ini, const StoredViewList& list);
193  static QSettings* getUserViews();
194 };
198 #endif
bool groundGenerateNormals
Recalculate normals of the ground from face normals? Default false.
Definition: SceneInfo.hpp:120
QString author
Author of the scene.
Definition: SceneInfo.hpp:53
QString modelScenery
The file name of the scenery .obj model.
Definition: SceneInfo.hpp:64
Vec3d modelWorldOffset
Offset of the center of the model in a given grid space.
Definition: SceneInfo.hpp:94
bool isValid
If this is a valid sceneInfo object loaded from file.
Definition: SceneInfo.hpp:45
Vec4d position
Stored grid position + current eye height in 4th component.
Definition: SceneInfo.hpp:168
bool hasLocation() const
Returns true if the location object is valid.
Definition: SceneInfo.hpp:123
float shadowFarZ
An optional shadow far clipping plane, constraining the shadowmaps to a smaller region than is visibl...
Definition: SceneInfo.hpp:79
double eyeLevel
The height at which the observer&#39;s eyes are placed. Default 1.65.
Definition: SceneInfo.hpp:90
Contains all the metadata necessary for a Scenery3d scene, and can be loaded from special ...
Definition: SceneInfo.hpp:37
float camFarZ
Distance to cam far clipping plane. Default 10000.0.
Definition: SceneInfo.hpp:76
bool altitudeFromModel
If true, it indicates that the model file&#39;s bounding box is used for altitude calculation.
Definition: SceneInfo.hpp:100
Mat4d zRotateMatrix
The vertical axis rotation that must be applied to the scene, for meridian convergence.
Definition: SceneInfo.hpp:111
StelOBJ::VertexOrder vertexOrderEnum
The vertex order of the corresponding OBJ file.
Definition: SceneInfo.hpp:71
static const QString SCENES_PATH
The folder for scenery is found here.
Definition: SceneInfo.hpp:133
double jd
Julian Date of interest.
Definition: SceneInfo.hpp:174
QString name
Name of the scene.
Definition: SceneInfo.hpp:51
bool groundNullHeightFromModel
If true, it indicates that the model file&#39;s bounding box is used for starting height calculation...
Definition: SceneInfo.hpp:104
QString label
A descriptive label.
Definition: SceneInfo.hpp:164
QString description
A description of the view.
Definition: SceneInfo.hpp:166
QString description
A description, which can be displayed in the GUI - supporting HTML tags! Note that this description...
Definition: SceneInfo.hpp:58
Mat4d obj2gridMatrix
If only a non-georeferenced OBJ can be provided, you can specify a matrix via .ini/[model]/obj_world_...
Definition: SceneInfo.hpp:108
Vec3d relativeStartPosition
Relative start position in model space, calculated from the world offset and start offset with Z rota...
Definition: SceneInfo.hpp:98
Vec3f view_fov
Alt/Az angles in degrees + field of view.
Definition: SceneInfo.hpp:170
bool jdIsRelevant
Indicate if stored date is potentially relevant.
Definition: SceneInfo.hpp:176
QSharedPointer< StelLocation > location
Optional more accurate location information, which will override the landscape&#39;s position.
Definition: SceneInfo.hpp:85
bool startPositionFromModel
If true, it indicates that the model file&#39;s bounding box is used for starting position calculation...
Definition: SceneInfo.hpp:102
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:49
Vec3d startWorldOffset
The world grid space offset where the observer is placed upon loading.
Definition: SceneInfo.hpp:96
QString copyright
Copyright string.
Definition: SceneInfo.hpp:60
Vec3f lookAt_fov
Optional initial look-at vector (azimuth, elevation and FOV in degrees)
Definition: SceneInfo.hpp:87
double groundNullHeight
The height value outside the ground model&#39;s heightmap, or used if no ground model exists...
Definition: SceneInfo.hpp:113
bool isGlobal
True if this is a position stored next to the scene definition (viewpoints.ini). If false...
Definition: SceneInfo.hpp:172
QString modelGround
The file name of the optional seperate ground model (used as a heightmap for walking) ...
Definition: SceneInfo.hpp:66
float transparencyThreshold
Threshold for cutout transparency (no blending). Default is 0.5f.
Definition: SceneInfo.hpp:116
float shadowSplitWeight
Weighting of the shadow frustum splits between uniform (at 0) and logarithmic (at 1) splits When -1...
Definition: SceneInfo.hpp:82
QString landscapeName
The name of the landscape to switch to. The landscape&#39;s position is applied on loading.
Definition: SceneInfo.hpp:62
float camNearZ
Distance to cam near clipping plane. Default 0.3.
Definition: SceneInfo.hpp:74
bool hasLookAtFOV() const
Returns true if the lookat_fov is valid.
Definition: SceneInfo.hpp:125
QString vertexOrder
Optional string depicting vertex order of models (XYZ, ZXY, ...)
Definition: SceneInfo.hpp:68
A structure which stores a specific view position, view direction and FOV, together with a textual de...
Definition: SceneInfo.hpp:158
QString id
ID of the scene (relative directory)
Definition: SceneInfo.hpp:47
bool sceneryGenerateNormals
Recalculate normals of the scene from face normals? Default false.
Definition: SceneInfo.hpp:118
QString gridName
The name of the grid space for displaying the world positon.
Definition: SceneInfo.hpp:92
Possible vertex orderings with load()
Definition: StelOBJ.hpp:41