本文整理汇总了C++中CClientStreamElement::GetDistanceToBoundingBoxSquared方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientStreamElement::GetDistanceToBoundingBoxSquared方法的具体用法?C++ CClientStreamElement::GetDistanceToBoundingBoxSquared怎么用?C++ CClientStreamElement::GetDistanceToBoundingBoxSquared使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientStreamElement
的用法示例。
在下文中一共展示了CClientStreamElement::GetDistanceToBoundingBoxSquared方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddToSortedList
void CClientStreamer::AddToSortedList ( list < CClientStreamElement* > * pList, CClientStreamElement * pElement )
{
// Make sure it's exp distance is updated
float fDistance = pElement->GetDistanceToBoundingBoxSquared ( m_vecPosition );
pElement->SetExpDistance ( fDistance );
// Don't add if already in the list
if ( ListContains ( *pList, pElement ) )
return;
// Search through our list. Add it behind the first item further away than this
CClientStreamElement * pTemp = NULL;
list < CClientStreamElement* > :: iterator iter = pList->begin ();
for ( ; iter != pList->end (); iter++ )
{
pTemp = *iter;
// Is it further than the one we add?
if ( pTemp->GetDistanceToBoundingBoxSquared ( m_vecPosition ) > fDistance )
{
// Add it before here
pList->insert ( iter, pElement );
return;
}
}
// We have no elements in the list, add it at the beginning
pList->push_back ( pElement );
}
示例2: SetExpDistances
void CClientStreamer::SetExpDistances ( list < CClientStreamElement * > * pList )
{
// Run through our list setting distances to world center
CClientStreamElement * pElement = NULL;
list < CClientStreamElement* >:: iterator iter = pList->begin ();
for ( ; iter != pList->end (); iter++ )
{
pElement = *iter;
// Set its distance ^ 2
pElement->SetExpDistance ( pElement->GetDistanceToBoundingBoxSquared ( m_vecPosition ) );
}
}