本文整理汇总了C++中Bound::GrowToContain方法的典型用法代码示例。如果您正苦于以下问题:C++ Bound::GrowToContain方法的具体用法?C++ Bound::GrowToContain怎么用?C++ Bound::GrowToContain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bound
的用法示例。
在下文中一共展示了Bound::GrowToContain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _UpdateSelect
//----------------------------------------------------------------------------
void Selection::_UpdateSelect()
{
mCenter = APoint::ORIGIN;
mBoundRadius = 0.0f;
APoint pos;
Bound bound;
int firstBound = true;
int numObjects = (int)mObjects.size();
for (int i = 0; i < numObjects; i++)
{
Object *obj = mObjects[i];
Movable *mov = DynamicCast<Movable>(obj);
if (mov)
{
pos += mov->WorldTransform.GetTranslate();
if (0.0f != mov->WorldBound.GetRadius())
{
if (firstBound)
{
bound = mov->WorldBound;
firstBound = false;
}
else
{
bound.GrowToContain(mov->WorldBound);
}
}
}
}
if (numObjects > 0)
{
mCenter = pos / (float)numObjects;
mBoundRadius = bound.GetRadius();
}
}
示例2: UpdateCtrl
//----------------------------------------------------------------------------
void BoundCtrl::UpdateCtrl()
{
mCtrlsGroup->SetActiveChild(1);
int numObjscts = PX2_SELECTION.GetNumObjects();
if (numObjscts > 0)
{
Bound bound;
int firstBound = true;
APoint pos;
for (int i = 0; i < numObjscts; i++)
{
Object *obj = PX2_SELECTION.GetObjectAt(i);
Actor *actor = DynamicCast<Actor>(obj);
Movable *movable = DynamicCast<Movable>(obj);
if (movable)
{
mCtrlsGroup->SetActiveChild(0);
pos += movable->WorldTransform.GetTranslate();
if (0.0f != movable->WorldBound.GetRadius())
{
if (firstBound)
{
bound = movable->WorldBound;
firstBound = false;
}
else
{
bound.GrowToContain(movable->WorldBound);
}
}
}
}
pos = pos / (float)numObjscts;
float radius = bound.GetRadius();
if (0.0f == radius)
{
radius = 1.0f;
mCtrlsGroup->WorldTransform.SetUniformScale(radius);
mCtrlsGroup->WorldTransform.SetTranslate(pos);
}
else
{
mCtrlsGroup->WorldTransform.SetUniformScale(radius);
mCtrlsGroup->WorldTransform.SetTranslate(bound.GetCenter());
}
}
else
{
mCtrlsGroup->SetActiveChild(1);
}
mCtrlsGroup->Update(Time::GetTimeInSeconds(), false);
}