本文整理汇总了C++中Sensor::FindTracksInRange方法的典型用法代码示例。如果您正苦于以下问题:C++ Sensor::FindTracksInRange方法的具体用法?C++ Sensor::FindTracksInRange怎么用?C++ Sensor::FindTracksInRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensor
的用法示例。
在下文中一共展示了Sensor::FindTracksInRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void BubbleDisplay::Draw(const Sensor& sensor,
VSSprite *frontSprite,
VSSprite *rearSprite)
{
assert(frontSprite || rearSprite); // There should be at least one radar display
radarTime += GetElapsedTime();
leftRadar.SetSprite(frontSprite);
rightRadar.SetSprite(rearSprite);
impl->clear();
if (frontSprite)
frontSprite->Draw();
if (rearSprite)
rearSprite->Draw();
Sensor::TrackCollection tracks = sensor.FindTracksInRange();
Animate();
GFXEnable(DEPTHTEST);
GFXEnable(DEPTHWRITE);
GFXEnable(SMOOTH);
for (Sensor::TrackCollection::const_iterator it = tracks.begin(); it != tracks.end(); ++it)
{
if (it->GetPosition().z < 0)
{
// Draw tracks behind the ship
DrawTrack(sensor, rightRadar, *it);
}
else
{
// Draw tracks in front of the ship
DrawTrack(sensor, leftRadar, *it);
}
}
DrawBackground(leftRadar, currentTargetMarkerSize);
DrawBackground(rightRadar, currentTargetMarkerSize);
impl->flush();
GFXPointSize(1);
GFXDisable(DEPTHTEST);
GFXDisable(DEPTHWRITE);
GFXDisable(SMOOTH);
}
示例2: Draw
void SphereDisplay::Draw(const Sensor& sensor,
VSSprite *frontSprite,
VSSprite *rearSprite)
{
assert(frontSprite || rearSprite); // There should be at least one radar display
radarTime += GetElapsedTime();
leftRadar.SetSprite(frontSprite);
rightRadar.SetSprite(rearSprite);
if (frontSprite)
frontSprite->Draw();
if (rearSprite)
rearSprite->Draw();
Sensor::TrackCollection tracks = sensor.FindTracksInRange();
// FIXME: Consider using std::sort instead of the z-buffer
GFXEnable(DEPTHTEST);
GFXEnable(DEPTHWRITE);
DrawBackground(sensor, leftRadar);
DrawBackground(sensor, rightRadar);
for (Sensor::TrackCollection::const_iterator it = tracks.begin(); it != tracks.end(); ++it)
{
static bool draw_both =
XMLSupport::parse_bool( vs_config->getVariable( "graphics", "hud", "draw_blips_on_both_radar", "false" ));
if (it->GetPosition().z < 0 || draw_both)
{
// Draw tracks behind the ship
DrawTrack(sensor, rightRadar, *it,true);
}
if (it->GetPosition().z >= 0 || draw_both)
{
// Draw tracks in front of the ship
DrawTrack(sensor, leftRadar, *it);
}
}
GFXPointSize(1);
GFXDisable(DEPTHTEST);
GFXDisable(DEPTHWRITE);
}