Physics2D/RigidBody2D: Little refactor
This commit is contained in:
parent
dc28a9161b
commit
e0ede5bf2d
|
|
@ -124,8 +124,9 @@ namespace Nz
|
||||||
if (m_shapes.empty())
|
if (m_shapes.empty())
|
||||||
return Rectf::Zero();
|
return Rectf::Zero();
|
||||||
|
|
||||||
cpBB bb = cpShapeGetBB(*m_shapes.begin());
|
auto it = m_shapes.begin();
|
||||||
for (auto it = ++m_shapes.begin(); it != m_shapes.end(); ++it)
|
cpBB bb = cpShapeGetBB(*it++);
|
||||||
|
for (; it != m_shapes.end(); ++it)
|
||||||
bb = cpBBMerge(bb, cpShapeGetBB(*it));
|
bb = cpBBMerge(bb, cpShapeGetBB(*it));
|
||||||
|
|
||||||
return Rectf(Rect<cpFloat>(bb.l, bb.b, bb.r - bb.l, bb.t - bb.b));
|
return Rectf(Rect<cpFloat>(bb.l, bb.b, bb.r - bb.l, bb.t - bb.b));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue