瀏覽代碼

Merge pull request #570 from eightyeight/box3f-overlap

Fixed Box3F::overlap
Thomas Fischer 11 年之前
父節點
當前提交
e906865a56
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      Engine/source/math/mBox.h

+ 8 - 0
Engine/source/math/mBox.h

@@ -334,10 +334,18 @@ inline Box3F Box3F::getOverlap( const Box3F& otherBox ) const
    Box3F overlap;
 
    for( U32 i = 0; i < 3; ++ i )
+   {
       if( minExtents[ i ] > otherBox.maxExtents[ i ] || otherBox.minExtents[ i ] > maxExtents[ i ] )
+      {
          overlap.minExtents[ i ] = 0.f;
+         overlap.maxExtents[ i ] = 0.f;
+      }
       else
+      {
          overlap.minExtents[ i ] = getMax( minExtents[ i ], otherBox.minExtents[ i ] );
+         overlap.maxExtents[ i ] = getMin( maxExtents[ i ], otherBox.maxExtents[ i ] );
+      }
+   }
 
    return overlap;
 }