StelProjector.cpp   StelProjector.cpp 
skipping to change at line 107 skipping to change at line 107
StelProjector::StelProjectorMaskType StelProjector::stringToMaskType(const QString &s) StelProjector::StelProjectorMaskType StelProjector::stringToMaskType(const QString &s)
{ {
if (s=="disk") if (s=="disk")
return MaskDisk; return MaskDisk;
return MaskNone; return MaskNone;
} }
void StelProjector::init(const StelProjectorParams& params) void StelProjector::init(const StelProjectorParams& params)
{ {
devicePixelsPerPixel = params.devicePixelsPerPixel;
maskType = (StelProjectorMaskType)params.maskType; maskType = (StelProjectorMaskType)params.maskType;
zNear = params.zNear; zNear = params.zNear;
oneOverZNearMinusZFar = 1.f/(zNear-params.zFar); oneOverZNearMinusZFar = 1.f/(zNear-params.zFar);
viewportXywh = params.viewportXywh; viewportXywh = params.viewportXywh;
viewportXywh[0] *= devicePixelsPerPixel;
viewportXywh[1] *= devicePixelsPerPixel;
viewportXywh[2] *= devicePixelsPerPixel;
viewportXywh[3] *= devicePixelsPerPixel;
viewportCenter = params.viewportCenter; viewportCenter = params.viewportCenter;
viewportCenter *= devicePixelsPerPixel;
gravityLabels = params.gravityLabels; gravityLabels = params.gravityLabels;
defautAngleForGravityText = params.defautAngleForGravityText; defautAngleForGravityText = params.defautAngleForGravityText;
flipHorz = params.flipHorz ? -1.f : 1.f; flipHorz = params.flipHorz ? -1.f : 1.f;
flipVert = params.flipVert ? -1.f : 1.f; flipVert = params.flipVert ? -1.f : 1.f;
viewportFovDiameter = params.viewportFovDiameter; viewportFovDiameter = params.viewportFovDiameter * devicePixelsPerPi xel;
pixelPerRad = 0.5f * viewportFovDiameter / fovToViewScalingFactor(pa rams.fov*(M_PI/360.f)); pixelPerRad = 0.5f * viewportFovDiameter / fovToViewScalingFactor(pa rams.fov*(M_PI/360.f));
computeBoundingCap(); computeBoundingCap();
} }
QString StelProjector::getHtmlSummary() const QString StelProjector::getHtmlSummary() const
{ {
return QString("<h3>%1</h3><p>%2</p><b>%3</b>%4").arg(getNameI18()). arg(getDescriptionI18()).arg(q_("Maximum FOV: ")).arg(getMaxFov())+QChar(0x 00B0); return QString("<h3>%1</h3><p>%2</p><b>%3</b>%4").arg(getNameI18()). arg(getDescriptionI18()).arg(q_("Maximum FOV: ")).arg(getMaxFov())+QChar(0x 00B0);
} }
bool StelProjector::intersectViewportDiscontinuity(const Vec3d& p1, const V ec3d& p2) const bool StelProjector::intersectViewportDiscontinuity(const Vec3d& p1, const V ec3d& p2) const
skipping to change at line 203 skipping to change at line 209
if (!ok) if (!ok)
{ {
// Special case for handling degenerated cases, use full sky . // Special case for handling degenerated cases, use full sky .
//qDebug() << "!ok"; //qDebug() << "!ok";
return SphericalRegionP((SphericalRegion*)(new AllSkySpheric alRegion())); return SphericalRegionP((SphericalRegion*)(new AllSkySpheric alRegion()));
} }
e0.normalize(); e0.normalize();
e1.normalize(); e1.normalize();
e2.normalize(); e2.normalize();
e3.normalize(); e3.normalize();
if (flipFrontBackFace()) if (needGlFrontFaceCW())
{ {
Vec3d v = e0; Vec3d v = e0;
e0 = e3; e0 = e3;
e3 = v; e3 = v;
v = e1; v = e1;
e1 = e2; e1 = e2;
e2 = v; e2 = v;
} }
const double d = e3*((e2-e3)^(e1-e3)); const double d = e3*((e2-e3)^(e1-e3));
if (d > 0) if (d > 0)
skipping to change at line 243 skipping to change at line 249
float StelProjector::getPixelPerRadAtCenter() const float StelProjector::getPixelPerRadAtCenter() const
{ {
return pixelPerRad; return pixelPerRad;
} }
//! Get the current FOV diameter in degrees //! Get the current FOV diameter in degrees
float StelProjector::getFov() const { float StelProjector::getFov() const {
return 360.f/M_PI*viewScalingFactorToFov(0.5f*viewportFovDiameter/pi xelPerRad); return 360.f/M_PI*viewScalingFactorToFov(0.5f*viewportFovDiameter/pi xelPerRad);
} }
//! Get whether front faces need to be oriented in the clockwise direction
bool StelProjector::needGlFrontFaceCW() const
{
return (flipHorz*flipVert < 0.f);
}
bool StelProjector::checkInViewport(const Vec3d& pos) const bool StelProjector::checkInViewport(const Vec3d& pos) const
{ {
return (pos[1]>=viewportXywh[1] && pos[0]>=viewportXywh[0] && return (pos[1]>=viewportXywh[1] && pos[0]>=viewportXywh[0] &&
pos[1]<=(viewportXywh[1] + viewportXywh[3]) && pos[0]<=(view portXywh[0] + viewportXywh[2])); pos[1]<=(viewportXywh[1] + viewportXywh[3]) && pos[0]<=(view portXywh[0] + viewportXywh[2]));
} }
//! Check to see if a 2d position is inside the viewport. //! Check to see if a 2d position is inside the viewport.
//! TODO Optimize by storing viewportXywh[1] + viewportXywh[3] and viewport Xywh[0] + viewportXywh[2] already computed //! TODO Optimize by storing viewportXywh[1] + viewportXywh[3] and viewport Xywh[0] + viewportXywh[2] already computed
bool StelProjector::checkInViewport(const Vec3f& pos) const bool StelProjector::checkInViewport(const Vec3f& pos) const
{ {
skipping to change at line 452 skipping to change at line 464
{ {
return project(v1, win1) && project(v2, win2) && (checkInViewport(wi n1) || checkInViewport(win2)); return project(v1, win1) && project(v2, win2) && (checkInViewport(wi n1) || checkInViewport(win2));
} }
//! Get the current model view matrix. //! Get the current model view matrix.
StelProjector::ModelViewTranformP StelProjector::getModelViewTransform() co nst StelProjector::ModelViewTranformP StelProjector::getModelViewTransform() co nst
{ {
return modelViewTransform; return modelViewTransform;
} }
//! Get the current projection matrix.
Mat4f StelProjector::getProjectionMatrix() const
{
return Mat4f(2.f/viewportXywh[2], 0, 0, 0, 0, 2.f/viewportXywh[3], 0
, 0, 0, 0, -1., 0., -(2.f*viewportXywh[0] + viewportXywh[2])/viewportXywh[2
], -(2.f*viewportXywh[1] + viewportXywh[3])/viewportXywh[3], 0, 1);
}
StelProjector::StelProjectorMaskType StelProjector::getMaskType(void) const StelProjector::StelProjectorMaskType StelProjector::getMaskType(void) const
{ {
return maskType; return maskType;
} }
 End of changes. 7 change blocks. 
2 lines changed or deleted 22 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/