浏览代码

Little optimization in mPlane, originally by Winterleaf

Daniel Buckmaster 11 年之前
父节点
当前提交
8538b5fdbf
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      Engine/source/math/mPlane.h

+ 4 - 3
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.
    // Project the box onto the line defined by the plane center and normal.
    // See "3D Game Engine Design" chapter 4.3.2.
    // 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() );
    const F32 dist = distToPlane( obb.getCenter() );
    if( dist > r )
    if( dist > r )