diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2010-02-04 00:41:03 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2010-02-04 00:41:03 +0300 |
commit | 0020de72e45cae82561e07e284c520170e5e3ea8 (patch) | |
tree | ee7a23bfc47d2edaa7ec5d6fcb666c7f28ec28cd /source/gameengine/Physics/Bullet/CcdPhysicsController.h | |
parent | 02d9da1d5d0387238014e7737b76c87cd520b754 (diff) |
BGE: Optimize Soft body conversion: don't create BVH structure.
A btBvhTriangleMeshShape object is created when converting
a mesh to physics, also in case of Soft body although the
soft body will not use it (it only uses the mesh interface).
This patch keeps this system for compatibility with the
KX converter but avoids the creation of the BVH structure,
which consumes a lots of CPU. This should speed up
significantly the conversion of large mesh to softbody.
A secondary optimization is that the sharing of shapeInfo
is extended to rigid body using gImpact. Before it was
only active between static body and soft body.
Diffstat (limited to 'source/gameengine/Physics/Bullet/CcdPhysicsController.h')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 637007e2857..607602a4d0d 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -62,7 +62,7 @@ public: float uv[2]; }; - static CcdShapeConstructionInfo* FindMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope, bool gimpact); + static CcdShapeConstructionInfo* FindMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope); CcdShapeConstructionInfo() : m_shapeType(PHY_SHAPE_NONE), @@ -74,7 +74,6 @@ public: m_refCount(1), m_meshObject(NULL), m_unscaledShape(NULL), - m_useGimpact(false), m_forceReInstance(false), m_weldingThreshold1(0.f), m_shapeProxy(NULL) @@ -143,7 +142,7 @@ public: return true; } - bool SetMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope,bool useGimpact); + bool SetMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope); RAS_MeshObject* GetMesh(void) { return m_meshObject; @@ -158,7 +157,7 @@ public: return m_shapeProxy; } - btCollisionShape* CreateBulletShape(btScalar margin); + btCollisionShape* CreateBulletShape(btScalar margin, bool useGimpact=false, bool useBvh=true); // member variables PHY_ShapeType m_shapeType; @@ -193,7 +192,6 @@ protected: btBvhTriangleMeshShape* m_unscaledShape;// holds the shared unscale BVH mesh shape, // the actual shape is of type btScaledBvhTriangleMeshShape std::vector<CcdShapeConstructionInfo*> m_shapeArray; // for compound shapes - bool m_useGimpact; //use gimpact for concave dynamic/moving collision detection bool m_forceReInstance; //use gimpact for concave dynamic/moving collision detection float m_weldingThreshold1; //welding closeby vertices together can improve softbody stability etc. CcdShapeConstructionInfo* m_shapeProxy; // only used for PHY_SHAPE_PROXY, pointer to actual shape info @@ -240,6 +238,7 @@ struct CcdConstructionInfo m_bRigid(false), m_bSoft(false), m_bSensor(false), + m_bGimpact(false), m_collisionFilterGroup(DefaultFilter), m_collisionFilterMask(AllFilter), m_collisionShape(0), @@ -308,6 +307,7 @@ struct CcdConstructionInfo bool m_bRigid; bool m_bSoft; bool m_bSensor; + bool m_bGimpact; // use Gimpact for mesh body ///optional use of collision group/mask: ///only collision with object goups that match the collision mask. |