Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _SPU_PREFERRED_PENETRATION_DIRECTIONS_H
00017 #define _SPU_PREFERRED_PENETRATION_DIRECTIONS_H
00018
00019
00020 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
00021
00022 int spuGetNumPreferredPenetrationDirections(int shapeType, void* shape)
00023 {
00024 switch (shapeType)
00025 {
00026 case TRIANGLE_SHAPE_PROXYTYPE:
00027 {
00028 return 2;
00029
00030 break;
00031 }
00032 default:
00033 {
00034 #if __ASSERT
00035 spu_printf("spuGetNumPreferredPenetrationDirections() - Unsupported bound type: %d.\n", shapeType);
00036 #endif // __ASSERT
00037 }
00038 }
00039
00040 return 0;
00041 }
00042
00043 void spuGetPreferredPenetrationDirection(int shapeType, void* shape, int index, btVector3& penetrationVector)
00044 {
00045
00046
00047 switch (shapeType)
00048 {
00049 case TRIANGLE_SHAPE_PROXYTYPE:
00050 {
00051 btVector3* vertices = (btVector3*)shape;
00053 penetrationVector = (vertices[1]-vertices[0]).cross(vertices[2]-vertices[0]);
00054 penetrationVector.normalize();
00055 if (index)
00056 penetrationVector *= btScalar(-1.);
00057 break;
00058 }
00059 default:
00060 {
00061
00062 #if __ASSERT
00063 spu_printf("spuGetNumPreferredPenetrationDirections() - Unsupported bound type: %d.\n", shapeType);
00064 #endif // __ASSERT
00065 }
00066 }
00067
00068 }
00069
00070 #endif //_SPU_PREFERRED_PENETRATION_DIRECTIONS_H