3350
by matthewg42
refactor: Projector -> StelProjector |
1 |
/*
|
2 |
* Stellarium
|
|
3 |
* Copyright (C) 2003 Fabien Chereau
|
|
5286.1.4
by Matthew Gates
code tidy |
4 |
* Copyright (C) 2012 Matthew Gates
|
3350
by matthewg42
refactor: Projector -> StelProjector |
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
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
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
|
|
5121
by Alexander Wolf
update address of FSF in about window + update address of FSF into source code again (more correct) |
18 |
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
|
3350
by matthewg42
refactor: Projector -> StelProjector |
19 |
*/
|
20 |
||
3379
by matthewg42
refactor: tidy header ifdefs |
21 |
#ifndef _STELPROJECTOR_HPP_
|
22 |
#define _STELPROJECTOR_HPP_
|
|
3350
by matthewg42
refactor: Projector -> StelProjector |
23 |
|
24 |
#include "StelProjectorType.hpp" |
|
3377
by matthewg42
refactor: vecmath -> VecMath |
25 |
#include "VecMath.hpp" |
3364
by matthewg42
refactor: SphereGeometry -> StelSphereGeometry |
26 |
#include "StelSphereGeometry.hpp" |
3350
by matthewg42
refactor: Projector -> StelProjector |
27 |
|
28 |
//! @class StelProjector
|
|
29 |
//! Provide the main interface to all operations of projecting coordinates from sky to screen.
|
|
30 |
//! The StelProjector also defines the viewport size and position.
|
|
6272.1.1
by Fabien Chéreau
Use device-independent pixels for font size. |
31 |
//! All positions in pixels are in real device pixels, which is not the same as device independent pixels. On a mac with
|
32 |
//! retina screen, there are 2 device pixels per pixels.
|
|
3350
by matthewg42
refactor: Projector -> StelProjector |
33 |
//! All methods from this class are threadsafe. The usual usage is to create local instances of StelProjectorP using the
|
34 |
//! getProjection() method from StelCore where needed.
|
|
6195.1.15
by Fabien Chéreau
Reverted 5573, i.e. the OpenGL refactoring from GSOC 2012 |
35 |
//! For performing drawing using a particular projection, refer to the StelPainter class.
|
3387
by xalioth
Doc. |
36 |
//! @sa StelProjectorP
|
3350
by matthewg42
refactor: Projector -> StelProjector |
37 |
class StelProjector |
38 |
{
|
|
39 |
public: |
|
6195.1.15
by Fabien Chéreau
Reverted 5573, i.e. the OpenGL refactoring from GSOC 2012 |
40 |
friend class StelPainter; |
3350
by matthewg42
refactor: Projector -> StelProjector |
41 |
friend class StelCore; |
3715
by xalioth
Doc. |
42 |
|
4821.1.40
by Fabien Chéreau
Completely support atmsophere refraction in the core :) |
43 |
class ModelViewTranform; |
44 |
//! @typedef ModelViewTranformP
|
|
45 |
//! Shared pointer on a ModelViewTranform instance (implement reference counting)
|
|
46 |
typedef QSharedPointer<ModelViewTranform> ModelViewTranformP; |
|
47 |
||
7076.1.2
by georg-zotti
doc typofix |
48 |
//! @class ModelViewTranform
|
4821.1.35
by Fabien Chéreau
Generalized ModelView matrix in ModelViewTransform to allow for generic non linear transformations (e.g. refraction) |
49 |
//! Allows to define non linear operations in addition to the standard linear (Matrix 4d) ModelView transformation.
|
50 |
class ModelViewTranform |
|
4821.1.31
by Fabien Chéreau
Integrates refraction directly into StelProjector. Splitted RefractionExtinction into 2 independent classes. |
51 |
{
|
52 |
public: |
|
4821.1.35
by Fabien Chéreau
Generalized ModelView matrix in ModelViewTransform to allow for generic non linear transformations (e.g. refraction) |
53 |
ModelViewTranform() {;} |
54 |
virtual ~ModelViewTranform() {;} |
|
4821.1.31
by Fabien Chéreau
Integrates refraction directly into StelProjector. Splitted RefractionExtinction into 2 independent classes. |
55 |
virtual void forward(Vec3d&) const =0; |
56 |
virtual void backward(Vec3d&) const =0; |
|
57 |
virtual void forward(Vec3f&) const =0; |
|
58 |
virtual void backward(Vec3f&) const =0; |
|
4821.1.39
by Fabien Chéreau
Security backup in middle of refactoring |
59 |
|
60 |
virtual void combine(const Mat4d&)=0; |
|
4821.1.40
by Fabien Chéreau
Completely support atmsophere refraction in the core :) |
61 |
virtual ModelViewTranformP clone() const=0; |
4821.1.39
by Fabien Chéreau
Security backup in middle of refactoring |
62 |
|
63 |
virtual Mat4d getApproximateLinearTransfo() const=0; |
|
4821.1.31
by Fabien Chéreau
Integrates refraction directly into StelProjector. Splitted RefractionExtinction into 2 independent classes. |
64 |
};
|
65 |
||
4821.1.35
by Fabien Chéreau
Generalized ModelView matrix in ModelViewTransform to allow for generic non linear transformations (e.g. refraction) |
66 |
class Mat4dTransform: public ModelViewTranform |
67 |
{
|
|
68 |
public: |
|
6195.1.15
by Fabien Chéreau
Reverted 5573, i.e. the OpenGL refactoring from GSOC 2012 |
69 |
Mat4dTransform(const Mat4d& m); |
70 |
void forward(Vec3d& v) const; |
|
71 |
void backward(Vec3d& v) const; |
|
72 |
void forward(Vec3f& v) const; |
|
73 |
void backward(Vec3f& v) const; |
|
74 |
void combine(const Mat4d& m); |
|
75 |
Mat4d getApproximateLinearTransfo() const; |
|
76 |
ModelViewTranformP clone() const; |
|
4821.1.35
by Fabien Chéreau
Generalized ModelView matrix in ModelViewTransform to allow for generic non linear transformations (e.g. refraction) |
77 |
|
78 |
private: |
|
79 |
//! transfo matrix and invert
|
|
80 |
Mat4d transfoMat; |
|
81 |
Mat4f transfoMatf; |
|
82 |
};
|
|
83 |
||
3350
by matthewg42
refactor: Projector -> StelProjector |
84 |
//! @enum StelProjectorMaskType
|
85 |
//! Define viewport mask types
|
|
86 |
enum StelProjectorMaskType |
|
87 |
{
|
|
88 |
MaskNone, //!< Regular - no mask. |
|
89 |
MaskDisk //!< For disk viewport mode (circular mask to seem like bins/telescope) |
|
90 |
};
|
|
3715
by xalioth
Doc. |
91 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
92 |
//! @struct StelProjectorParams
|
93 |
//! Contains all the param needed to initialize a StelProjector
|
|
94 |
struct StelProjectorParams |
|
95 |
{
|
|
6740
by Marcos CARDINOT
Unintialized members |
96 |
StelProjectorParams() |
97 |
: viewportXywh(0, 0, 256, 256) |
|
98 |
, fov(60.f) |
|
99 |
, gravityLabels(false) |
|
7959
by georg-zotti
tentative fix for sinusoidal projection. Some open questions remain. |
100 |
, defaultAngleForGravityText(0.f) |
6740
by Marcos CARDINOT
Unintialized members |
101 |
, maskType(MaskNone) |
102 |
, zNear(0.f) |
|
103 |
, zFar(0.f) |
|
104 |
, viewportCenter(128.f, 128.f) |
|
7731.1.1
by georg-zotti
Added viewport center offset. Useful e.g. to shift horizon down to show more of the sky. |
105 |
, viewportCenterOffset(0.f, 0.f) |
6740
by Marcos CARDINOT
Unintialized members |
106 |
, viewportFovDiameter(0.f) |
107 |
, flipHorz(false) |
|
108 |
, flipVert(false) |
|
7620.1.125
by georg-zotti
Allow screen stretch for Cylindrical projection. This is a quick hack for the museum. Currently only supported via scripting, and can be auto-activated via startup.ssc script only. |
109 |
, devicePixelsPerPixel(1.f) |
110 |
, widthStretch(1.f) {;} |
|
6740
by Marcos CARDINOT
Unintialized members |
111 |
|
7959
by georg-zotti
tentative fix for sinusoidal projection. Some open questions remain. |
112 |
Vector4<int> viewportXywh; //! posX, posY, width, height |
113 |
float fov; //! FOV in degrees |
|
114 |
bool gravityLabels; //! the flag to use gravity labels or not |
|
115 |
float defaultAngleForGravityText;//! a rotation angle to apply to gravity text (only if gravityLabels is set to false) |
|
116 |
StelProjectorMaskType maskType; //! The current projector mask |
|
117 |
float zNear, zFar; //! Near and far clipping planes |
|
118 |
Vec2f viewportCenter; //! Viewport center in screen pixel |
|
119 |
Vec2f viewportCenterOffset; //! Viewport center's offset in fractions of screen width/height. Usable e.g. in cylindrical projection to move horizon down. |
|
120 |
//! Currently only Y shift is fully implemented, X shift likely not too meaningful.
|
|
121 |
float viewportFovDiameter; //! diameter of the FOV disk in pixel |
|
122 |
bool flipHorz, flipVert; //! Whether to flip in horizontal or vertical directions |
|
123 |
float devicePixelsPerPixel; //! The number of device pixel per "Device Independent Pixels" (value is usually 1, but 2 for mac retina screens) |
|
7620.1.134
by georg-zotti
Enable ViewportStretch for all projector classes (completion from r7745) |
124 |
float widthStretch; //! A factor to adapt to special installation setups, e.g. multi-projector with edge blending. Allow to stretch/squeeze projected content. Larger than 1 means the image is stretched wider. |
3350
by matthewg42
refactor: Projector -> StelProjector |
125 |
};
|
3715
by xalioth
Doc. |
126 |
|
3405
by xalioth
Added virtual destructor to StelProjector. Fix compiler warning. |
127 |
//! Destructor
|
4821.1.39
by Fabien Chéreau
Security backup in middle of refactoring |
128 |
virtual ~StelProjector() {} |
3715
by xalioth
Doc. |
129 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
130 |
///////////////////////////////////////////////////////////////////////////
|
131 |
// Methods which must be reimplemented by all instance of StelProjector
|
|
132 |
//! Get a human-readable name for this projection type
|
|
133 |
virtual QString getNameI18() const = 0; |
|
134 |
//! Get a human-readable short description for this projection type
|
|
135 |
virtual QString getDescriptionI18() const {return "No description";} |
|
136 |
//! Get a HTML version of the short description for this projection type
|
|
137 |
QString getHtmlSummary() const; |
|
138 |
//! Get the maximum FOV apperture in degree
|
|
4338
by xalioth
Moved some double to float. |
139 |
virtual float getMaxFov() const = 0; |
3350
by matthewg42
refactor: Projector -> StelProjector |
140 |
//! Apply the transformation in the forward direction in place.
|
141 |
//! After transformation v[2] will always contain the length of the original v: sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2])
|
|
142 |
//! regardless of the projection type. This makes it possible to implement depth buffer testing in a way independent of the
|
|
143 |
//! projection type. I would like to return the squared length instead of the length because of performance reasons.
|
|
144 |
//! But then far away objects are not textured any more, perhaps because of a depth buffer overflow although
|
|
145 |
//! the depth test is disabled?
|
|
4599
by xalioth
Moved low resolution projection stuff to float. |
146 |
virtual bool forward(Vec3f& v) const = 0; |
3350
by matthewg42
refactor: Projector -> StelProjector |
147 |
//! Apply the transformation in the backward projection in place.
|
4599
by xalioth
Moved low resolution projection stuff to float. |
148 |
virtual bool backward(Vec3d& v) const = 0; |
3350
by matthewg42
refactor: Projector -> StelProjector |
149 |
//! Return the small zoom increment to use at the given FOV for nice movements
|
4338
by xalioth
Moved some double to float. |
150 |
virtual float deltaZoom(float fov) const = 0; |
3350
by matthewg42
refactor: Projector -> StelProjector |
151 |
|
3525
by xalioth
Final fix to the grid. Fixed the wrap around bug for wide fields. |
152 |
//! Determine whether a great circle connection p1 and p2 intersects with a projection discontinuity.
|
3715
by xalioth
Doc. |
153 |
//! For many projections without discontinuity, this should return always false, but for other like
|
3525
by xalioth
Final fix to the grid. Fixed the wrap around bug for wide fields. |
154 |
//! cylindrical projection it will return true if the line cuts the wrap-around line (i.e. at lon=180 if the observer look at lon=0).
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
155 |
bool intersectViewportDiscontinuity(const Vec3d& p1, const Vec3d& p2) const; |
156 |
bool intersectViewportDiscontinuity(const SphericalCap& cap) const; |
|
3715
by xalioth
Doc. |
157 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
158 |
//! Convert a Field Of View radius value in radians in ViewScalingFactor (used internally)
|
4338
by xalioth
Moved some double to float. |
159 |
virtual float fovToViewScalingFactor(float fov) const = 0; |
3350
by matthewg42
refactor: Projector -> StelProjector |
160 |
//! Convert a ViewScalingFactor value (used internally) in Field Of View radius in radians
|
4338
by xalioth
Moved some double to float. |
161 |
virtual float viewScalingFactorToFov(float vsf) const = 0; |
3715
by xalioth
Doc. |
162 |
|
163 |
//! Get the current state of the flag which decides whether to
|
|
164 |
//! arrage labels so that they are aligned with the bottom of a 2d
|
|
3350
by matthewg42
refactor: Projector -> StelProjector |
165 |
//! screen, or a 3d dome.
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
166 |
bool getFlagGravityLabels() const; |
3350
by matthewg42
refactor: Projector -> StelProjector |
167 |
|
168 |
//! Get the lower left corner of the viewport and the width, height.
|
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
169 |
const Vec4i& getViewport() const; |
3350
by matthewg42
refactor: Projector -> StelProjector |
170 |
|
171 |
//! Get the center of the viewport relative to the lower left corner of the screen.
|
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
172 |
Vec2f getViewportCenter() const; |
8068
by Florian Schaukowitsch
Fix perspective mode with offset viewport in scenery3d. |
173 |
Vec2f getViewportCenterOffset() const; |
3715
by xalioth
Doc. |
174 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
175 |
//! Get the horizontal viewport offset in pixels.
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
176 |
int getViewportPosX() const; |
3350
by matthewg42
refactor: Projector -> StelProjector |
177 |
//! Get the vertical viewport offset in pixels.
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
178 |
int getViewportPosY() const; |
3350
by matthewg42
refactor: Projector -> StelProjector |
179 |
//! Get the viewport width in pixels.
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
180 |
int getViewportWidth() const; |
3350
by matthewg42
refactor: Projector -> StelProjector |
181 |
//! Get the viewport height in pixels.
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
182 |
int getViewportHeight() const; |
3715
by xalioth
Doc. |
183 |
|
6272.1.1
by Fabien Chéreau
Use device-independent pixels for font size. |
184 |
//! Get the number of device pixels per "Device Independent Pixels" (value is usually 1, but 2 for mac retina screens).
|
185 |
float getDevicePixelsPerPixel() const {return devicePixelsPerPixel;} |
|
186 |
||
3350
by matthewg42
refactor: Projector -> StelProjector |
187 |
//! Return a convex polygon on the sphere which includes the viewport in the current frame.
|
3567
by xalioth
Unified getViewportConvexPolygon() method, fixed it to handle strange cases. |
188 |
//! @param marginX an extra margin in pixel which extends the polygon size in the X direction.
|
189 |
//! @param marginY an extra margin in pixel which extends the polygon size in the Y direction.
|
|
3715
by xalioth
Doc. |
190 |
//! @return a SphericalConvexPolygon or the special fullSky region if the viewport cannot be
|
3567
by xalioth
Unified getViewportConvexPolygon() method, fixed it to handle strange cases. |
191 |
//! represented by a convex polygon (e.g. if aperture > 180 deg).
|
4337
by xalioth
Moved some double to float |
192 |
SphericalRegionP getViewportConvexPolygon(float marginX=0., float marginY=0.) const; |
3715
by xalioth
Doc. |
193 |
|
4508
by xalioth
Implemented a first optimization for drawing SphericalRegion boundaries. |
194 |
//! Return a SphericalCap containing the whole viewport
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
195 |
const SphericalCap& getBoundingCap() const; |
3715
by xalioth
Doc. |
196 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
197 |
//! Get size of a radian in pixels at the center of the viewport disk
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
198 |
float getPixelPerRadAtCenter() const; |
3715
by xalioth
Doc. |
199 |
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
200 |
//! Get the current FOV diameter in degrees
|
201 |
float getFov() const; |
|
3715
by xalioth
Doc. |
202 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
203 |
//! Get whether front faces need to be oriented in the clockwise direction
|
6195.1.15
by Fabien Chéreau
Reverted 5573, i.e. the OpenGL refactoring from GSOC 2012 |
204 |
bool needGlFrontFaceCW() const; |
3715
by xalioth
Doc. |
205 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
206 |
///////////////////////////////////////////////////////////////////////////
|
207 |
// Full projection methods
|
|
208 |
//! Check to see if a 2d position is inside the viewport.
|
|
209 |
//! TODO Optimize by storing viewportXywh[1] + viewportXywh[3] and viewportXywh[0] + viewportXywh[2] already computed
|
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
210 |
bool checkInViewport(const Vec3d& pos) const; |
3350
by matthewg42
refactor: Projector -> StelProjector |
211 |
|
4600
by xalioth
Use float instead of double for drawing stars. |
212 |
//! Check to see if a 2d position is inside the viewport.
|
213 |
//! TODO Optimize by storing viewportXywh[1] + viewportXywh[3] and viewportXywh[0] + viewportXywh[2] already computed
|
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
214 |
bool checkInViewport(const Vec3f& pos) const; |
4600
by xalioth
Use float instead of double for drawing stars. |
215 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
216 |
//! Return the position where the 2 2D point p1 and p2 cross the viewport edge
|
217 |
//! P1 must be inside the viewport and P2 outside (check with checkInViewport() before calling this method)
|
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
218 |
Vec3d viewPortIntersect(const Vec3d& p1, const Vec3d& p2) const; |
219 |
||
220 |
//! Project the vector v from the current frame into the viewport.
|
|
221 |
//! @param v the vector in the current frame.
|
|
222 |
//! @param win the projected vector in the viewport 2D frame.
|
|
223 |
//! @return true if the projected coordinate is valid.
|
|
224 |
bool project(const Vec3d& v, Vec3d& win) const; |
|
225 |
||
226 |
//! Project the vector v from the current frame into the viewport.
|
|
227 |
//! @param v the vector in the current frame.
|
|
228 |
//! @param win the projected vector in the viewport 2D frame.
|
|
229 |
//! @return true if the projected coordinate is valid.
|
|
230 |
bool project(const Vec3f& v, Vec3f& win) const; |
|
231 |
||
232 |
virtual void project(int n, const Vec3d* in, Vec3f* out); |
|
233 |
||
234 |
virtual void project(int n, const Vec3f* in, Vec3f* out); |
|
4073
by charlie137
Add a method in StelProjector to project an array of vector |
235 |
|
3778
by xalioth
Added in place projection. |
236 |
//! Project the vector v from the current frame into the viewport.
|
4673
by xalioth
Fixed doxydoc. |
237 |
//! @param vd the vector in the current frame.
|
3778
by xalioth
Added in place projection. |
238 |
//! @return true if the projected coordinate is valid.
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
239 |
bool projectInPlace(Vec3d& vd) const; |
4508
by xalioth
Implemented a first optimization for drawing SphericalRegion boundaries. |
240 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
241 |
//! Project the vector v from the current frame into the viewport.
|
4600
by xalioth
Use float instead of double for drawing stars. |
242 |
//! @param v the vector in the current frame.
|
243 |
//! @return true if the projected coordinate is valid.
|
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
244 |
bool projectInPlace(Vec3f& v) const; |
245 |
||
246 |
//! Project the vector v from the current frame into the viewport.
|
|
247 |
//! @param v the direction vector in the current frame. Does not need to be normalized.
|
|
248 |
//! @param win the projected vector in the viewport 2D frame. win[0] and win[1] are in screen pixels, win[2] is unused.
|
|
249 |
//! @return true if the projected point is inside the viewport.
|
|
250 |
bool projectCheck(const Vec3d& v, Vec3d& win) const; |
|
251 |
||
252 |
//! Project the vector v from the current frame into the viewport.
|
|
253 |
//! @param v the direction vector in the current frame. Does not need to be normalized.
|
|
254 |
//! @param win the projected vector in the viewport 2D frame. win[0] and win[1] are in screen pixels, win[2] is unused.
|
|
255 |
//! @return true if the projected point is inside the viewport.
|
|
256 |
bool projectCheck(const Vec3f& v, Vec3f& win) const; |
|
4600
by xalioth
Use float instead of double for drawing stars. |
257 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
258 |
//! Project the vector v from the viewport frame into the current frame.
|
3715
by xalioth
Doc. |
259 |
//! @param win the vector in the viewport 2D frame. win[0] and win[1] are in screen pixels, win[2] is unused.
|
260 |
//! @param v the unprojected direction vector in the current frame.
|
|
3350
by matthewg42
refactor: Projector -> StelProjector |
261 |
//! @return true if the projected coordinate is valid.
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
262 |
bool unProject(const Vec3d& win, Vec3d& v) const; |
3350
by matthewg42
refactor: Projector -> StelProjector |
263 |
bool unProject(double x, double y, Vec3d& v) const; |
264 |
||
265 |
//! Project the vectors v1 and v2 from the current frame into the viewport.
|
|
266 |
//! @param v1 the first vector in the current frame.
|
|
267 |
//! @param v2 the second vector in the current frame.
|
|
268 |
//! @param win1 the first projected vector in the viewport 2D frame.
|
|
269 |
//! @param win2 the second projected vector in the viewport 2D frame.
|
|
270 |
//! @return true if at least one of the projected vector is within the viewport.
|
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
271 |
bool projectLineCheck(const Vec3d& v1, Vec3d& win1, const Vec3d& v2, Vec3d& win2) const; |
3350
by matthewg42
refactor: Projector -> StelProjector |
272 |
|
273 |
//! Get the current model view matrix.
|
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
274 |
ModelViewTranformP getModelViewTransform() const; |
3715
by xalioth
Doc. |
275 |
|
3955
by xalioth
Avoid using deprecated openGL methods. |
276 |
//! Get the current projection matrix.
|
6195.1.15
by Fabien Chéreau
Reverted 5573, i.e. the OpenGL refactoring from GSOC 2012 |
277 |
Mat4f getProjectionMatrix() const; |
3955
by xalioth
Avoid using deprecated openGL methods. |
278 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
279 |
///////////////////////////////////////////////////////////////////////////
|
280 |
//! Get a string description of a StelProjectorMaskType.
|
|
281 |
static const QString maskTypeToString(StelProjectorMaskType type); |
|
282 |
//! Get a StelProjectorMaskType from a string description.
|
|
283 |
static StelProjectorMaskType stringToMaskType(const QString &s); |
|
3715
by xalioth
Doc. |
284 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
285 |
//! Get the current type of the mask if any.
|
5286.1.2
by Matthew Gates
more code moved from cpp to hpp |
286 |
StelProjectorMaskType getMaskType(void) const; |
3715
by xalioth
Doc. |
287 |
|
3350
by matthewg42
refactor: Projector -> StelProjector |
288 |
protected: |
289 |
//! Private constructor. Only StelCore can create instances of StelProjector.
|
|
6739
by Marcos CARDINOT
Unintialized members |
290 |
StelProjector(ModelViewTranformP amodelViewTransform) |
291 |
: modelViewTransform(amodelViewTransform), |
|
292 |
flipHorz(0.f), |
|
293 |
flipVert(0.f), |
|
294 |
pixelPerRad(0.f), |
|
295 |
maskType(MaskNone), |
|
296 |
zNear(0.f), |
|
297 |
oneOverZNearMinusZFar(0.f), |
|
298 |
viewportFovDiameter(0.f), |
|
299 |
gravityLabels(true), |
|
7107.1.2
by georg-zotti
typofix |
300 |
defaultAngleForGravityText(0.f), |
7620.1.134
by georg-zotti
Enable ViewportStretch for all projector classes (completion from r7745) |
301 |
devicePixelsPerPixel(1.f), |
302 |
widthStretch(1.0f) {;} |
|
4821.1.35
by Fabien Chéreau
Generalized ModelView matrix in ModelViewTransform to allow for generic non linear transformations (e.g. refraction) |
303 |
|
3525
by xalioth
Final fix to the grid. Fixed the wrap around bug for wide fields. |
304 |
//! Return whether the projection presents discontinuities. Used for optimization.
|
305 |
virtual bool hasDiscontinuity() const =0; |
|
306 |
//! Determine whether a great circle connection p1 and p2 intersects with a projection discontinuity.
|
|
3715
by xalioth
Doc. |
307 |
//! For many projections without discontinuity, this should return always false, but for other like
|
3525
by xalioth
Final fix to the grid. Fixed the wrap around bug for wide fields. |
308 |
//! cylindrical projection it will return true if the line cuts the wrap-around line (i.e. at lon=180 if the observer look at lon=0).
|
309 |
virtual bool intersectViewportDiscontinuityInternal(const Vec3d& p1, const Vec3d& p2) const = 0; |
|
3715
by xalioth
Doc. |
310 |
|
4508
by xalioth
Implemented a first optimization for drawing SphericalRegion boundaries. |
311 |
//! Determine whether a cap intersects with a projection discontinuity.
|
312 |
virtual bool intersectViewportDiscontinuityInternal(const Vec3d& capN, double capD) const = 0; |
|
313 |
||
314 |
//! Initialize the bounding cap.
|
|
315 |
virtual void computeBoundingCap(); |
|
316 |
||
8115.1.1317
by Georg Zotti
New attempt at a Coverity issue, and some refactoring (use Q_NULLPTR). |
317 |
ModelViewTranformP modelViewTransform; // Operator to apply (if not Q_NULLPTR) before the modelview projection step |
4821.1.31
by Fabien Chéreau
Integrates refraction directly into StelProjector. Splitted RefractionExtinction into 2 independent classes. |
318 |
|
4508
by xalioth
Implemented a first optimization for drawing SphericalRegion boundaries. |
319 |
float flipHorz,flipVert; // Whether to flip in horizontal or vertical directions |
320 |
float pixelPerRad; // pixel per rad at the center of the viewport disk |
|
321 |
StelProjectorMaskType maskType; // The current projector mask |
|
322 |
float zNear, oneOverZNearMinusZFar; // Near and far clipping planes |
|
323 |
Vec4i viewportXywh; // Viewport parameters |
|
324 |
Vec2f viewportCenter; // Viewport center in screen pixel |
|
7747
by Alexander Wolf
fixed unit test compiling |
325 |
Vec2f viewportCenterOffset; // Viewport center's offset in fractions of screen width/height. Usable e.g. in cylindrical projection to move horizon down. |
326 |
// Currently only Y shift is fully implemented, X shift likely not too meaningful.
|
|
4508
by xalioth
Implemented a first optimization for drawing SphericalRegion boundaries. |
327 |
float viewportFovDiameter; // diameter of the FOV disk in pixel |
328 |
bool gravityLabels; // should label text align with the horizon? |
|
7107.1.2
by georg-zotti
typofix |
329 |
float defaultAngleForGravityText; // a rotation angle to apply to gravity text (only if gravityLabels is set to false) |
4508
by xalioth
Implemented a first optimization for drawing SphericalRegion boundaries. |
330 |
SphericalCap boundingCap; // Bounding cap of the whole viewport |
6272.1.1
by Fabien Chéreau
Use device-independent pixels for font size. |
331 |
float devicePixelsPerPixel; // The number of device pixel per "Device Independent Pixels" (value is usually 1, but 2 for mac retina screens) |
7620.1.134
by georg-zotti
Enable ViewportStretch for all projector classes (completion from r7745) |
332 |
float widthStretch; // A factor to adapt to special installation setups, e.g. multi-projector with edge blending. Allow to stretch/squeeze projected content. Larger than 1 means the image is stretched wider. |
4073
by charlie137
Add a method in StelProjector to project an array of vector |
333 |
private: |
4508
by xalioth
Implemented a first optimization for drawing SphericalRegion boundaries. |
334 |
//! Initialise the StelProjector from a param instance.
|
4073
by charlie137
Add a method in StelProjector to project an array of vector |
335 |
void init(const StelProjectorParams& param); |
3350
by matthewg42
refactor: Projector -> StelProjector |
336 |
};
|
337 |
||
3379
by matthewg42
refactor: tidy header ifdefs |
338 |
#endif // _STELPROJECTOR_HPP_ |