本文整理汇总了C++中Track::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetSize方法的具体用法?C++ Track::GetSize怎么用?C++ Track::GetSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::GetSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTrack
void BubbleDisplay::DrawTrack(const Sensor& sensor,
const ViewArea& radarView,
const Track& track)
{
if (!radarView.IsActive())
return;
GFXColor color = sensor.GetColor(track);
Vector position = track.GetPosition();
if (position.z < 0)
position.z = -position.z;
float magnitude = position.Magnitude();
float scaleFactor = 0.0; // [0; 1] where 0 = border, 1 = center
float maxRange = sensor.GetMaxRange();
if (magnitude <= maxRange)
{
// [innerSphere; outerSphere]
scaleFactor = (outerSphere - innerSphere) * ((maxRange - magnitude) / maxRange);
magnitude /= (1.0 - scaleFactor);
}
if (sensor.InsideNebula())
{
magnitude /= (1.0 - 0.04 * Jitter(0.0, 1.0));
}
Vector scaledPosition = sphereZoom * Vector(-position.x, position.y, position.z) / magnitude;
Vector head = radarView.Scale(scaledPosition);
GFXColor headColor = color;
headColor.a *= 0.2 + scaleFactor * (1.0 - 0.2); // [0;1] => [0.1;1]
if (sensor.UseThreatAssessment())
{
float dangerRate = GetDangerRate(sensor.IdentifyThreat(track));
if (dangerRate > 0.0)
{
// Blinking blip
headColor.a *= cosf(dangerRate * radarTime);
}
}
// Fade out dying ships
if (track.IsExploding())
{
headColor.a *= (1.0 - track.ExplodingProgress());
}
float trackSize = std::max(1.0f, std::log10(track.GetSize()));
if (track.GetType() != Track::Type::Cargo)
trackSize += 1.0;
if (sensor.IsTracking(track))
{
currentTargetMarkerSize = trackSize;
DrawTargetMarker(head, headColor, trackSize);
}
const bool isNebula = (track.GetType() == Track::Type::Nebula);
const bool isEcmActive = track.HasActiveECM();
if (isNebula || isEcmActive)
{
// Vary size between 50% and 150%
trackSize *= Jitter(0.5, 1.0);
}
impl->getPointBuffer(trackSize).insert(GFXColorVertex(head, headColor));
}