From 8538b5fdbfad8b9509339c925c8541bc0ef09e6a Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Wed, 5 Nov 2014 21:17:12 +1100 Subject: [PATCH] Little optimization in mPlane, originally by Winterleaf --- Engine/source/math/mPlane.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Engine/source/math/mPlane.h b/Engine/source/math/mPlane.h index cb83788e1..a67d5c60b 100644 --- a/Engine/source/math/mPlane.h +++ b/Engine/source/math/mPlane.h @@ -383,9 +383,10 @@ inline PlaneF::Side PlaneF::whichSide( const OrientedBox3F& obb ) const // Project the box onto the line defined by the plane center and normal. // See "3D Game Engine Design" chapter 4.3.2. - const F32 r = obb.getHalfExtents().x * mFabs( mDot( obb.getAxis( 0 ), *this ) ) + - obb.getHalfExtents().y * mFabs( mDot( obb.getAxis( 1 ), *this ) ) + - obb.getHalfExtents().z * mFabs( mDot( obb.getAxis( 2 ), *this ) ); + Point3F mObbHalf = obb.getHalfExtents(); + const F32 r = mObbHalf.x * mFabs( mDot( obb.getAxis( 0 ), *this ) ) + + mObbHalf.y * mFabs( mDot( obb.getAxis( 1 ), *this ) ) + + mObbHalf.z * mFabs( mDot( obb.getAxis( 2 ), *this ) ); const F32 dist = distToPlane( obb.getCenter() ); if( dist > r )