Changeset 7983 for code/branches/kicklib/src/external/bullet/BulletCollision/CollisionShapes/btConvexInternalShape.cpp
- Timestamp:
- Feb 27, 2011, 7:43:24 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib/src/external/bullet/BulletCollision/CollisionShapes/btConvexInternalShape.cpp
r5781 r7983 1 1 /* 2 2 Bullet Continuous Collision Detection and Physics Library 3 Copyright (c) 2003-200 6 Erwin Coumans http://continuousphysics.com/Bullet/3 Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 4 5 5 This software is provided 'as-is', without any express or implied warranty. … … 35 35 void btConvexInternalShape::getAabbSlow(const btTransform& trans,btVector3&minAabb,btVector3&maxAabb) const 36 36 { 37 37 #ifndef __SPU__ 38 //use localGetSupportingVertexWithoutMargin? 38 39 btScalar margin = getMargin(); 39 40 for (int i=0;i<3;i++) … … 50 51 minAabb[i] = tmp[i]-margin; 51 52 } 53 #endif 52 54 } 53 55 … … 80 82 81 83 84 btConvexInternalAabbCachingShape::btConvexInternalAabbCachingShape() 85 : btConvexInternalShape(), 86 m_localAabbMin(1,1,1), 87 m_localAabbMax(-1,-1,-1), 88 m_isLocalAabbValid(false) 89 { 90 } 91 92 93 void btConvexInternalAabbCachingShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const 94 { 95 getNonvirtualAabb(trans,aabbMin,aabbMax,getMargin()); 96 } 97 98 void btConvexInternalAabbCachingShape::setLocalScaling(const btVector3& scaling) 99 { 100 btConvexInternalShape::setLocalScaling(scaling); 101 recalcLocalAabb(); 102 } 103 104 105 void btConvexInternalAabbCachingShape::recalcLocalAabb() 106 { 107 m_isLocalAabbValid = true; 108 109 #if 1 110 static const btVector3 _directions[] = 111 { 112 btVector3( 1., 0., 0.), 113 btVector3( 0., 1., 0.), 114 btVector3( 0., 0., 1.), 115 btVector3( -1., 0., 0.), 116 btVector3( 0., -1., 0.), 117 btVector3( 0., 0., -1.) 118 }; 119 120 btVector3 _supporting[] = 121 { 122 btVector3( 0., 0., 0.), 123 btVector3( 0., 0., 0.), 124 btVector3( 0., 0., 0.), 125 btVector3( 0., 0., 0.), 126 btVector3( 0., 0., 0.), 127 btVector3( 0., 0., 0.) 128 }; 129 130 batchedUnitVectorGetSupportingVertexWithoutMargin(_directions, _supporting, 6); 131 132 for ( int i = 0; i < 3; ++i ) 133 { 134 m_localAabbMax[i] = _supporting[i][i] + m_collisionMargin; 135 m_localAabbMin[i] = _supporting[i + 3][i] - m_collisionMargin; 136 } 137 138 #else 139 140 for (int i=0;i<3;i++) 141 { 142 btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.)); 143 vec[i] = btScalar(1.); 144 btVector3 tmp = localGetSupportingVertex(vec); 145 m_localAabbMax[i] = tmp[i]+m_collisionMargin; 146 vec[i] = btScalar(-1.); 147 tmp = localGetSupportingVertex(vec); 148 m_localAabbMin[i] = tmp[i]-m_collisionMargin; 149 } 150 #endif 151 }
Note: See TracChangeset
for help on using the changeset viewer.