Changeset 8393 for code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btUniformScalingShape.cpp
- Timestamp:
- May 3, 2011, 5:07:42 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btUniformScalingShape.cpp
r8351 r8393 65 65 66 66 ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version 67 void btUniformScalingShape::getAabb(const btTransform& t ,btVector3& aabbMin,btVector3& aabbMax) const67 void btUniformScalingShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const 68 68 { 69 m_childConvexShape->getAabb(t,aabbMin,aabbMax); 70 btVector3 aabbCenter = (aabbMax+aabbMin)*btScalar(0.5); 71 btVector3 scaledAabbHalfExtends = (aabbMax-aabbMin)*btScalar(0.5)*m_uniformScalingFactor; 72 73 aabbMin = aabbCenter - scaledAabbHalfExtends; 74 aabbMax = aabbCenter + scaledAabbHalfExtends; 69 getAabbSlow(trans,aabbMin,aabbMax); 75 70 76 71 } … … 78 73 void btUniformScalingShape::getAabbSlow(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const 79 74 { 80 m_childConvexShape->getAabbSlow(t,aabbMin,aabbMax); 81 btVector3 aabbCenter = (aabbMax+aabbMin)*btScalar(0.5); 82 btVector3 scaledAabbHalfExtends = (aabbMax-aabbMin)*btScalar(0.5)*m_uniformScalingFactor; 75 #if 1 76 btVector3 _directions[] = 77 { 78 btVector3( 1., 0., 0.), 79 btVector3( 0., 1., 0.), 80 btVector3( 0., 0., 1.), 81 btVector3( -1., 0., 0.), 82 btVector3( 0., -1., 0.), 83 btVector3( 0., 0., -1.) 84 }; 85 86 btVector3 _supporting[] = 87 { 88 btVector3( 0., 0., 0.), 89 btVector3( 0., 0., 0.), 90 btVector3( 0., 0., 0.), 91 btVector3( 0., 0., 0.), 92 btVector3( 0., 0., 0.), 93 btVector3( 0., 0., 0.) 94 }; 83 95 84 aabbMin = aabbCenter - scaledAabbHalfExtends; 85 aabbMax = aabbCenter + scaledAabbHalfExtends; 96 for (int i=0;i<6;i++) 97 { 98 _directions[i] = _directions[i]*t.getBasis(); 99 } 100 101 batchedUnitVectorGetSupportingVertexWithoutMargin(_directions, _supporting, 6); 102 103 btVector3 aabbMin1(0,0,0),aabbMax1(0,0,0); 104 105 for ( int i = 0; i < 3; ++i ) 106 { 107 aabbMax1[i] = t(_supporting[i])[i]; 108 aabbMin1[i] = t(_supporting[i + 3])[i]; 109 } 110 btVector3 marginVec(getMargin(),getMargin(),getMargin()); 111 aabbMin = aabbMin1-marginVec; 112 aabbMax = aabbMax1+marginVec; 113 114 #else 115 116 btScalar margin = getMargin(); 117 for (int i=0;i<3;i++) 118 { 119 btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.)); 120 vec[i] = btScalar(1.); 121 btVector3 sv = localGetSupportingVertex(vec*t.getBasis()); 122 btVector3 tmp = t(sv); 123 aabbMax[i] = tmp[i]+margin; 124 vec[i] = btScalar(-1.); 125 sv = localGetSupportingVertex(vec*t.getBasis()); 126 tmp = t(sv); 127 aabbMin[i] = tmp[i]-margin; 128 } 129 130 #endif 86 131 } 87 132
Note: See TracChangeset
for help on using the changeset viewer.