本文整理汇总了C++中StelProjectorP::getBoundingCap方法的典型用法代码示例。如果您正苦于以下问题:C++ StelProjectorP::getBoundingCap方法的具体用法?C++ StelProjectorP::getBoundingCap怎么用?C++ StelProjectorP::getBoundingCap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StelProjectorP
的用法示例。
在下文中一共展示了StelProjectorP::getBoundingCap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawLines
// Draw constellations lines
void ConstellationMgr::drawLines(StelRenderer* renderer, StelProjectorP projector, const StelCore* core) const
{
renderer->setBlendMode(BlendMode_Alpha);
const SphericalCap& viewportHalfspace = projector->getBoundingCap();
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
{
(*iter)->drawOptim(renderer, projector, core, viewportHalfspace);
}
}
示例2: drawBoundaryOptim
void Constellation::drawBoundaryOptim(StelRenderer* renderer, StelProjectorP projector) const
{
if (boundaryFader.getInterstate() < 0.001)
{
return;
}
renderer->setBlendMode(BlendMode_Alpha);
renderer->setGlobalColor(boundaryColor[0], boundaryColor[1],
boundaryColor[2], boundaryFader.getInterstate());
int size = singleSelected ? isolatedBoundarySegments.size()
: sharedBoundarySegments.size();
const SphericalCap& viewportHalfspace = projector->getBoundingCap();
for (int i = 0; i < size; i++)
{
std::vector<Vec3f>* points = singleSelected ? isolatedBoundarySegments[i]
: sharedBoundarySegments[i];
for (int j = 0; j < static_cast<int>(points->size()) - 1; j++)
{
const Vec3f pt1 = points->at(j) ;
const Vec3f pt2 = points->at(j +1);
if (pt1 * pt2 > 0.9999999f)
{
continue;
}
const Vec3d ptd1(pt1[0], pt1[1], pt1[2]);
const Vec3d ptd2(pt2[0], pt2[1], pt2[2]);
StelCircleArcRenderer(renderer, projector)
.drawGreatCircleArc(ptd1, ptd2, &viewportHalfspace);
}
}
}
示例3: draw
void SkyLine::draw(StelCore *core) const
{
if (!fader.getInterstate())
return;
StelProjectorP prj = core->getProjection(frameType, frameType!=StelCore::FrameAltAz ? StelCore::RefractionAuto : StelCore::RefractionOff);
// Get the bounding halfspace
const SphericalCap& viewPortSphericalCap = prj->getBoundingCap();
// Initialize a painter and set openGL state
StelPainter sPainter(prj);
sPainter.setColor(color[0], color[1], color[2], fader.getInterstate());
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
Vec4f textColor(color[0], color[1], color[2], 0);
textColor[3]=fader.getInterstate();
ViewportEdgeIntersectCallbackData userData(&sPainter);
sPainter.setFont(font);
userData.textColor = textColor;
userData.text = label;
/////////////////////////////////////////////////
// Draw the line
SphericalCap meridianSphericalCap(Vec3d(0,0,1), 0);
Vec3d fpt(1,0,0);
if (line_type==MERIDIAN)
{
meridianSphericalCap.n.set(0,1,0);
}
Vec3d p1, p2;
if (!SphericalCap::intersectionPoints(viewPortSphericalCap, meridianSphericalCap, p1, p2))
{
if ((viewPortSphericalCap.d<meridianSphericalCap.d && viewPortSphericalCap.contains(meridianSphericalCap.n))
|| (viewPortSphericalCap.d<-meridianSphericalCap.d && viewPortSphericalCap.contains(-meridianSphericalCap.n)))
{
// The meridian is fully included in the viewport, draw it in 3 sub-arcs to avoid length > 180.
const Mat4d& rotLon120 = Mat4d::rotation(meridianSphericalCap.n, 120.*M_PI/180.);
Vec3d rotFpt=fpt;
rotFpt.transfo4d(rotLon120);
Vec3d rotFpt2=rotFpt;
rotFpt2.transfo4d(rotLon120);
sPainter.drawGreatCircleArc(fpt, rotFpt, NULL, viewportEdgeIntersectCallback, &userData);
sPainter.drawGreatCircleArc(rotFpt, rotFpt2, NULL, viewportEdgeIntersectCallback, &userData);
sPainter.drawGreatCircleArc(rotFpt2, fpt, NULL, viewportEdgeIntersectCallback, &userData);
return;
}
else
return;
}
Vec3d middlePoint = p1+p2;
middlePoint.normalize();
if (!viewPortSphericalCap.contains(middlePoint))
middlePoint*=-1.;
// Draw the arc in 2 sub-arcs to avoid lengths > 180 deg
sPainter.drawGreatCircleArc(p1, middlePoint, NULL, viewportEdgeIntersectCallback, &userData);
sPainter.drawGreatCircleArc(p2, middlePoint, NULL, viewportEdgeIntersectCallback, &userData);
// // Johannes: use a big radius as a dirty workaround for the bug that the
// // ecliptic line is not drawn around the observer, but around the sun:
// const Vec3d vv(1000000,0,0);
}
示例4: draw
void SkyLine::draw(StelCore *core) const
{
if (!fader.getInterstate())
return;
StelProjectorP prj = core->getProjection(frameType, frameType!=StelCore::FrameAltAz ? StelCore::RefractionAuto : StelCore::RefractionOff);
// Get the bounding halfspace
const SphericalCap& viewPortSphericalCap = prj->getBoundingCap();
// Initialize a painter and set openGL state
StelPainter sPainter(prj);
sPainter.setColor(color[0], color[1], color[2], fader.getInterstate());
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
glEnable(GL_LINE_SMOOTH);
#endif
Vec4f textColor(color[0], color[1], color[2], 0);
textColor[3]=fader.getInterstate();
ViewportEdgeIntersectCallbackData userData(&sPainter);
sPainter.setFont(font);
userData.textColor = textColor;
userData.text = label;
/////////////////////////////////////////////////
// Draw the line
// Precession circles are Small Circles, all others are Great Circles.
if (line_type==PRECESSIONCIRCLE_N || line_type==PRECESSIONCIRCLE_S)
{
const double lat=(line_type==PRECESSIONCIRCLE_S ? -1.0 : 1.0) * (M_PI/2.0-getPrecessionAngleVondrakCurrentEpsilonA());
SphericalCap declinationCap(Vec3d(0,0,1), std::sin(lat));
const Vec3d rotCenter(0,0,declinationCap.d);
Vec3d p1, p2;
if (!SphericalCap::intersectionPoints(viewPortSphericalCap, declinationCap, p1, p2))
{
if ((viewPortSphericalCap.d<declinationCap.d && viewPortSphericalCap.contains(declinationCap.n))
|| (viewPortSphericalCap.d<-declinationCap.d && viewPortSphericalCap.contains(-declinationCap.n)))
{
// The line is fully included in the viewport, draw it in 3 sub-arcs to avoid length > 180.
Vec3d pt1;
Vec3d pt2;
Vec3d pt3;
const double lon1=0.0;
const double lon2=120.0*M_PI/180.0;
const double lon3=240.0*M_PI/180.0;
StelUtils::spheToRect(lon1, lat, pt1); pt1.normalize();
StelUtils::spheToRect(lon2, lat, pt2); pt2.normalize();
StelUtils::spheToRect(lon3, lat, pt3); pt3.normalize();
sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, viewportEdgeIntersectCallback, &userData);
sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, viewportEdgeIntersectCallback, &userData);
sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, viewportEdgeIntersectCallback, &userData);
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
glDisable(GL_BLEND);
return;
}
else
{
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
glDisable(GL_BLEND);
return;
}
}
// Draw the arc in 2 sub-arcs to avoid lengths > 180 deg
Vec3d middlePoint = p1-rotCenter+p2-rotCenter;
middlePoint.normalize();
middlePoint*=(p1-rotCenter).length();
middlePoint+=rotCenter;
if (!viewPortSphericalCap.contains(middlePoint))
{
middlePoint-=rotCenter;
middlePoint*=-1.;
middlePoint+=rotCenter;
}
sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,viewportEdgeIntersectCallback, &userData);
sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, viewportEdgeIntersectCallback, &userData);
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
glDisable(GL_BLEND);
return;
}
//.........这里部分代码省略.........