本文整理汇总了C++中Planet::getEnglishName方法的典型用法代码示例。如果您正苦于以下问题:C++ Planet::getEnglishName方法的具体用法?C++ Planet::getEnglishName怎么用?C++ Planet::getEnglishName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Planet
的用法示例。
在下文中一共展示了Planet::getEnglishName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: moveObserverToSelected
void StelCore::moveObserverToSelected()
{
StelObjectMgr* objmgr = GETSTELMODULE(StelObjectMgr);
Q_ASSERT(objmgr);
if (objmgr->getWasSelected())
{
Planet* pl = dynamic_cast<Planet*>(objmgr->getSelectedObject()[0].data());
if (pl)
{
// We need to move to the selected planet. Try to generate a location from the current one
StelLocation loc = getCurrentLocation();
if (loc.planetName != pl->getEnglishName())
{
loc.planetName = pl->getEnglishName();
loc.name = "-";
loc.state = "";
moveObserverTo(loc);
LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr);
if (pl->getEnglishName() == "Solar System Observer")
{
landscapeMgr->setFlagAtmosphere(false);
landscapeMgr->setFlagFog(false);
landscapeMgr->setFlagLandscape(false);
}
else
{
landscapeMgr->setFlagAtmosphere(pl->hasAtmosphere());
landscapeMgr->setFlagFog(pl->hasAtmosphere());
landscapeMgr->setFlagLandscape(true);
}
}
}
}
StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr);
Q_ASSERT(mmgr);
mmgr->setFlagTracking(false);
}
示例2: draw
void TrailGroup::draw(StelCore* core, StelRenderer* renderer)
{
renderer->setBlendMode(BlendMode_Alpha);
float currentTime = core->getJDay();
StelProjector::ModelViewTranformP transfo = core->getJ2000ModelViewTransform();
transfo->combine(j2000ToTrailNativeInverted);
StelProjectorP projector = core->getProjection(transfo);
// We skip some positions to avoid drawing too many vertices when the history is long.
int totalPositions = 0;
foreach(const Trail& trail, allTrails)
{
totalPositions += trail.posHistory.size();
}
const int desiredMaxTotalTrailVertices = 8192;
const int skip = std::max(1, totalPositions / desiredMaxTotalTrailVertices);
for(int t = 0; t < allTrails.size(); t++)
{
Trail& trail(allTrails[t]);
Planet* hpl = dynamic_cast<Planet*>(trail.stelObject.data());
if (hpl != NULL)
{
// Avoid drawing the trails if the object is the home planet
QString homePlanetName = hpl == NULL ? "" : hpl->getEnglishName();
if (homePlanetName == StelApp::getInstance().getCore()->getCurrentLocation().planetName)
{
continue;
}
}
const QVector<Vec3f>& posHistory = trail.posHistory;
// Construct the vertex buffer if not yet constructed, otherwise clear it.
if(NULL == trail.vertexBuffer)
{
trail.vertexBuffer =
renderer->createVertexBuffer<ColoredVertex>(PrimitiveType_LineStrip);
}
else
{
trail.vertexBuffer->unlock();
trail.vertexBuffer->clear();
}
// Hand-optimized as this previously took up to 9% of time when
// trail groups were enabled. Now it's up to 3%. Further optimization
// is possible, but would lead to more uglification.
int posCount = posHistory.size();
int p = 0;
const float timeMult = 1.0f / timeExtent;
ColoredVertex vertex;
for (p = 0; p < posCount - 1; ++p)
{
// Skip if too many positions, but don't skip the last position.
if(p % skip != 0)
{
continue;
}
const float colorRatio = 1.0f - (currentTime - times.at(p)) * timeMult;
vertex.color = Vec4f(trail.color[0], trail.color[1], trail.color[2], colorRatio * opacity);
vertex.position = posHistory.at(p);
trail.vertexBuffer->addVertex(vertex);
}
// Last vertex (separate to avoid a branch in the code above)
const float colorRatio = 1.0f - (currentTime - times.at(p)) * timeMult;
vertex.color = Vec4f(trail.color[0], trail.color[1], trail.color[2], colorRatio * opacity);
vertex.position = posHistory.at(p);
trail.vertexBuffer->addVertex(vertex);
trail.vertexBuffer->lock();
renderer->drawVertexBuffer(trail.vertexBuffer, NULL, projector);
}
}