Browse Source

Fix an uninitialized value in hsBounds.

Darryl Pogue 11 years ago
parent
commit
b66a2ba9e3
  1. 22
      Sources/Plasma/CoreLib/hsBounds.cpp

22
Sources/Plasma/CoreLib/hsBounds.cpp

@ -2208,9 +2208,11 @@ bool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel,
hsVector3 tstAxis;
float tstDepth;
int i;
for( i = 0; i < 3; i++ )
{
bool tryAxis;
bool tryAxis = false;
if( other.fExtFlags & kAxisAligned )
{
// first try the other box axes
@ -2229,25 +2231,22 @@ bool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel,
if( effMin > other.fMaxs[i] )
return false;
if( (other.fMins[i] <= effMin)
&&(other.fMaxs[i] <= effMax) )
if ((other.fMins[i] <= effMin) &&
(other.fMaxs[i] <= effMax))
{
tstDepth = other.fMaxs[i] - effMin;
hsAssert(tstDepth > -kRealSmall, "Late to be finding sep axis");
tstAxis.Set(i == 0 ? 1.f : 0, i & 1 ? 1.f : 0, i & 2 ? 1.f : 0);
tryAxis = true;
}
else
if( (other.fMins[i] >= effMin)
&&(other.fMaxs[i] >= effMax) )
else if ((other.fMins[i] >= effMin) &&
(other.fMaxs[i] >= effMax))
{
tstDepth = effMax - other.fMins[i];
hsAssert(tstDepth > -kRealSmall, "Late to be finding sep axis");
tstAxis.Set(i == 0 ? -1.f : 0, i & 1 ? -1.f : 0, i & 2 ? -1.f : 0);
tryAxis = true;
}
else
tryAxis = false;
}
else
{
@ -2278,17 +2277,14 @@ bool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel,
tstAxis = -other.fAxes[i];
hsAssert(tstDepth > -kRealSmall, "Late to be finding sep axis");
}
else
if( centerDist >= other.fDists[i].fY )
else if (centerDist >= other.fDists[i].fY)
{
tstDepth = other.fDists[i].fY - effMin;
tstAxis = other.fAxes[i];
hsAssert(tstDepth > -kRealSmall, "Late to be finding sep axis");
}
else
tryAxis = false;
}
if( tryAxis )
{
float magSq = tstAxis.MagnitudeSquared();

Loading…
Cancel
Save