Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef BT_HF_FLUID_COLLISION_SHAPE_H
00018 #define BT_HF_FLUID_COLLISION_SHAPE_H
00019
00020 #include "btHfFluid.h"
00021 #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
00022 #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
00023 #include "BulletCollision/CollisionShapes/btConvexInternalShape.h"
00024 #include "BulletCollision/CollisionShapes/btConcaveShape.h"
00025
00026 #include <iostream>
00027
00028 class btHfFluidCollisionShape : public btConcaveShape
00029 {
00030 public:
00031 btHfFluid* m_fluid;
00032
00033 btHfFluidCollisionShape(btHfFluid* backptr) :
00034 btConcaveShape()
00035 {
00036 m_shapeType = HFFLUID_SHAPE_PROXYTYPE;
00037 m_fluid = backptr;
00038 }
00039
00040 virtual ~btHfFluidCollisionShape()
00041 {
00042
00043 }
00044
00045 void processAllTriangles(btTriangleCallback* , const btVector3& ,
00046 const btVector3& ) const
00047 {
00048
00049 btAssert(0);
00050 }
00051
00053 virtual void getAabb(const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
00054 {
00055
00056 btVector3 mins;
00057 btVector3 maxs;
00058
00059 m_fluid->getAabb(mins, maxs);
00060
00061 const btVector3 crns[] = {t * btVector3(mins.x(), mins.y(), mins.z()), t * btVector3(maxs.x(), mins.y(), mins.z()),
00062 t * btVector3(maxs.x(), maxs.y(), mins.z()), t * btVector3(mins.x(), maxs.y(), mins.z()),
00063 t * btVector3(mins.x(), mins.y(), maxs.z()), t * btVector3(maxs.x(), mins.y(), maxs.z()),
00064 t * btVector3(maxs.x(), maxs.y(), maxs.z()), t * btVector3(mins.x(), maxs.y(), maxs.z())};
00065 aabbMin = aabbMax = crns[0];
00066 for (int i = 1; i < 8; ++i)
00067 {
00068 aabbMin.setMin(crns[i]);
00069 aabbMax.setMax(crns[i]);
00070 }
00071 }
00072
00073 virtual void setLocalScaling(const btVector3& )
00074 {
00076 btAssert(0);
00077 }
00078 virtual const btVector3& getLocalScaling() const
00079 {
00080 static const btVector3 dummy(1, 1, 1);
00081 return dummy;
00082 }
00083 virtual void calculateLocalInertia(btScalar , btVector3& ) const
00084 {
00086 btAssert(0);
00087 }
00088 virtual const char* getName() const
00089 {
00090 return "HfFluid";
00091 }
00092 };
00093
00094 #endif