本文整理汇总了C++中StelProjectorP::getMaskType方法的典型用法代码示例。如果您正苦于以下问题:C++ StelProjectorP::getMaskType方法的具体用法?C++ StelProjectorP::getMaskType怎么用?C++ StelProjectorP::getMaskType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StelProjectorP
的用法示例。
在下文中一共展示了StelProjectorP::getMaskType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawViewportShape
//! Fill with black around viewport disc shape.
static void drawViewportShape(StelRenderer* renderer, StelProjectorP projector)
{
if (projector->getMaskType() != StelProjector::MaskDisk)
{
return;
}
renderer->setBlendMode(BlendMode_None);
renderer->setGlobalColor(0.0f, 0.0f, 0.0f);
const float innerRadius = 0.5 * projector->getViewportFovDiameter();
const float outerRadius = projector->getViewportWidth() + projector->getViewportHeight();
Q_ASSERT_X(innerRadius >= 0.0f && outerRadius > innerRadius,
Q_FUNC_INFO, "Inner radius must be at least zero and outer radius must be greater");
const float sweepAngle = 360.0f;
static const int resolution = 192;
float sinCache[resolution];
float cosCache[resolution];
const float deltaRadius = outerRadius - innerRadius;
const int slices = resolution - 1;
// Cache is the vertex locations cache
for (int s = 0; s <= slices; s++)
{
const float angle = (M_PI * sweepAngle) / 180.0f * s / slices;
sinCache[s] = std::sin(angle);
cosCache[s] = std::cos(angle);
}
sinCache[slices] = sinCache[0];
cosCache[slices] = cosCache[0];
const float radiusHigh = outerRadius - deltaRadius;
StelVertexBuffer<VertexP2>* vertices =
renderer->createVertexBuffer<VertexP2>(PrimitiveType_TriangleStrip);
const Vec2f center = projector->getViewportCenterAbsolute();
for (int i = 0; i <= slices; i++)
{
vertices->addVertex(VertexP2(center[0] + outerRadius * sinCache[i],
center[1] + outerRadius * cosCache[i]));
vertices->addVertex(VertexP2(center[0] + radiusHigh * sinCache[i],
center[1] + radiusHigh * cosCache[i]));
}
vertices->lock();
renderer->setCulledFaces(CullFace_None);
renderer->drawVertexBuffer(vertices);
delete vertices;
}