21 #ifndef _STELPROJECTOR_HPP_ 22 #define _STELPROJECTOR_HPP_ 25 #include "VecMath.hpp" 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;
60 virtual void combine(
const Mat4d&)=0;
61 virtual ModelViewTranformP clone()
const=0;
63 virtual Mat4d getApproximateLinearTransfo()
const=0;
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;
97 : viewportXywh(0, 0, 256, 256)
99 , gravityLabels(
false)
100 , defaultAngleForGravityText(0.f)
104 , viewportCenter(128.f, 128.f)
105 , viewportCenterOffset(0.f, 0.f)
106 , viewportFovDiameter(0.f)
109 , devicePixelsPerPixel(1.f)
110 , widthStretch(1.f) {;}
120 float viewportFovDiameter;
146 virtual bool forward(
Vec3f& v)
const = 0;
148 virtual bool backward(
Vec3d& v)
const = 0;
150 virtual float deltaZoom(
float fov)
const = 0;
173 Vec2f getViewportCenterOffset()
const;
291 : modelViewTransform(amodelViewTransform),
297 oneOverZNearMinusZFar(0.f),
298 viewportFovDiameter(0.f),
300 defaultAngleForGravityText(0.f),
301 devicePixelsPerPixel(1.f),
302 widthStretch(1.0f) {;}
317 ModelViewTranformP modelViewTransform;
319 float flipHorz,flipVert;
322 float zNear, oneOverZNearMinusZFar;
324 Vec2f viewportCenter;
325 Vec2f viewportCenterOffset;
327 float viewportFovDiameter;
329 float defaultAngleForGravityText;
331 float devicePixelsPerPixel;
338 #endif // _STELPROJECTOR_HPP_
bool project(const Vec3d &v, Vec3d &win) const
Project the vector v from the current frame into the viewport.
virtual float deltaZoom(float fov) const =0
Return the small zoom increment to use at the given FOV for nice movements.
int getViewportWidth() const
Get the viewport width in pixels.
Mat4f getProjectionMatrix() const
Get the current projection matrix.
float widthStretch
The number of device pixel per "Device Independent Pixels" (value is usually 1, but 2 for mac retina ...
float defaultAngleForGravityText
the flag to use gravity labels or not
StelProjectorMaskType
Define viewport mask types.
int getViewportPosX() const
Get the horizontal viewport offset in pixels.
Vec2f getViewportCenter() const
Get the center of the viewport relative to the lower left corner of the screen.
A shared pointer on a SphericalRegion.
SphericalRegionP getViewportConvexPolygon(float marginX=0., float marginY=0.) const
Return a convex polygon on the sphere which includes the viewport in the current frame.
A SphericalCap is defined by a direction and an aperture.
bool projectCheck(const Vec3d &v, Vec3d &win) const
Project the vector v from the current frame into the viewport.
virtual ~StelProjector()
Destructor.
Main class for Stellarium core processing.
virtual float fovToViewScalingFactor(float fov) const =0
Convert a Field Of View radius value in radians in ViewScalingFactor (used internally) ...
StelProjectorMaskType maskType
a rotation angle to apply to gravity text (only if gravityLabels is set to false) ...
virtual bool intersectViewportDiscontinuityInternal(const Vec3d &p1, const Vec3d &p2) const =0
Determine whether a great circle connection p1 and p2 intersects with a projection discontinuity...
bool projectInPlace(Vec3d &vd) const
Project the vector v from the current frame into the viewport.
ModelViewTranformP getModelViewTransform() const
Get the current model view matrix.
bool unProject(const Vec3d &win, Vec3d &v) const
Project the vector v from the viewport frame into the current frame.
const Vec4i & getViewport() const
Get the lower left corner of the viewport and the width, height.
float devicePixelsPerPixel
Whether to flip in horizontal or vertical directions.
Vec2f viewportCenterOffset
Viewport center in screen pixel.
bool flipHorz
diameter of the FOV disk in pixel
bool gravityLabels
FOV in degrees.
StelProjector(ModelViewTranformP amodelViewTransform)
Private constructor. Only StelCore can create instances of StelProjector.
float zNear
The current projector mask.
const SphericalCap & getBoundingCap() const
Return a SphericalCap containing the whole viewport.
Provides functions for performing openGL drawing operations.
Provide the main interface to all operations of projecting coordinates from sky to screen...
For disk viewport mode (circular mask to seem like bins/telescope)
virtual QString getDescriptionI18() const
Get a human-readable short description for this projection type.
bool needGlFrontFaceCW() const
Get whether front faces need to be oriented in the clockwise direction.
static StelProjectorMaskType stringToMaskType(const QString &s)
Get a StelProjectorMaskType from a string description.
int getViewportHeight() const
Get the viewport height in pixels.
float getDevicePixelsPerPixel() const
Get the number of device pixels per "Device Independent Pixels" (value is usually 1...
Vec2f viewportCenter
Near and far clipping planes.
float getFov() const
Get the current FOV diameter in degrees.
bool checkInViewport(const Vec3d &pos) const
Check to see if a 2d position is inside the viewport.
virtual bool hasDiscontinuity() const =0
Return whether the projection presents discontinuities. Used for optimization.
QSharedPointer< ModelViewTranform > ModelViewTranformP
Shared pointer on a ModelViewTranform instance (implement reference counting)
Vec3d viewPortIntersect(const Vec3d &p1, const Vec3d &p2) const
Return the position where the 2 2D point p1 and p2 cross the viewport edge P1 must be inside the view...
QString getHtmlSummary() const
Get a HTML version of the short description for this projection type.
virtual void computeBoundingCap()
Initialize the bounding cap.
StelProjectorMaskType getMaskType(void) const
Get the current type of the mask if any.
bool getFlagGravityLabels() const
Get the current state of the flag which decides whether to arrage labels so that they are aligned wit...
Define the StelProjectorP type.
float getPixelPerRadAtCenter() const
Get size of a radian in pixels at the center of the viewport disk.
Contains all the param needed to initialize a StelProjector.
bool intersectViewportDiscontinuity(const Vec3d &p1, const Vec3d &p2) const
Determine whether a great circle connection p1 and p2 intersects with a projection discontinuity...
virtual float getMaxFov() const =0
Get the maximum FOV apperture in degree.
float fov
posX, posY, width, height
virtual QString getNameI18() const =0
Get a human-readable name for this projection type.
Define all SphericalGeometry primitives as well as the SphericalRegionP type.
int getViewportPosY() const
Get the vertical viewport offset in pixels.
virtual float viewScalingFactorToFov(float vsf) const =0
Convert a ViewScalingFactor value (used internally) in Field Of View radius in radians.
bool projectLineCheck(const Vec3d &v1, Vec3d &win1, const Vec3d &v2, Vec3d &win2) const
Project the vectors v1 and v2 from the current frame into the viewport.
static const QString maskTypeToString(StelProjectorMaskType type)
Get a string description of a StelProjectorMaskType.