1 /************************************************************************* 2 * * 3 * Tokamak Physics Engine, Copyright (C) 2002-2007 David Lam. * 4 * All rights reserved. Email: david@tokamakphysics.com * 5 * Web: www.tokamakphysics.com * 6 * * 7 * This library is distributed in the hope that it will be useful, * 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * 10 * LICENSE.TXT for more details. * 11 * * 12 *************************************************************************/ 13 14 #pragma inline_recursion( on ) 15 #pragma inline_depth( 250 ) 16 17 #include "stdio.h" 18 19 /* 20 #ifdef _WIN32 21 #include <windows.h> 22 #endif 23 */ 24 25 #include "tokamak.h" 26 #include "containers.h" 27 #include "scenery.h" 28 #include "collision.h" 29 #include "constraint.h" 30 #include "rigidbody.h" 31 #include "scenery.h" 32 #include "stack.h" 33 #include "simulator.h" 34 #include "message.h" 35 36 37 /**************************************************************************** 38 * 39 * neCollisionBody_::UpdateAABB 40 * 41 ****************************************************************************/ 42 UpdateAABB()43void neCollisionBody_::UpdateAABB() 44 { 45 if (col.convexCount == 0 && !isCustomCD) 46 return; 47 /* 48 neM3 c; 49 50 c[0] = col.obb.as.box.boxSize[0] * col.obb.c2p.rot[0]; 51 c[1] = col.obb.as.box.boxSize[1] * col.obb.c2p.rot[1]; 52 c[2] = col.obb.as.box.boxSize[2] * col.obb.c2p.rot[2]; 53 */ 54 neT3 c2w = b2w * obb; 55 56 neV3 &pos = c2w.pos; 57 58 int i; 59 60 for (i = 0; i < 3; i++) 61 { 62 f32 a = neAbs(c2w.rot[0][i]) + neAbs(c2w.rot[1][i]) + neAbs(c2w.rot[2][i]); 63 64 minBound[i] = pos[i] - a; 65 maxBound[i] = pos[i] + a; 66 67 if (minCoord[i]) 68 minCoord[i]->value = pos[i] - a;// - col.boundingRadius; 69 70 if (maxCoord[i]) 71 maxCoord[i]->value = pos[i] + a;// + col.boundingRadius; 72 } 73 }; 74 Free()75void neCollisionBody_::Free() 76 { 77 neRigidBodyBase::Free(); 78 79 RemoveConstraintHeader(); 80 } 81