From 96d9e5408054e463ba2bc22269cf655c696018e2 Mon Sep 17 00:00:00 2001 From: donggas90 Date: Mon, 8 Jun 2015 13:35:17 +0900 Subject: [PATCH] Improve Compound Shape Construction. --- src/BulletCollision/CollisionShapes/btCompoundShape.cpp | 4 +++- src/BulletCollision/CollisionShapes/btCompoundShape.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/BulletCollision/CollisionShapes/btCompoundShape.cpp b/src/BulletCollision/CollisionShapes/btCompoundShape.cpp index 8842fa2f1..e8c8c336c 100644 --- a/src/BulletCollision/CollisionShapes/btCompoundShape.cpp +++ b/src/BulletCollision/CollisionShapes/btCompoundShape.cpp @@ -18,7 +18,7 @@ subject to the following restrictions: #include "BulletCollision/BroadphaseCollision/btDbvt.h" #include "LinearMath/btSerializer.h" -btCompoundShape::btCompoundShape(bool enableDynamicAabbTree) +btCompoundShape::btCompoundShape(bool enableDynamicAabbTree, const int initialChildCapacity) : m_localAabbMin(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)), m_localAabbMax(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)), m_dynamicAabbTree(0), @@ -34,6 +34,8 @@ m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)) m_dynamicAabbTree = new(mem) btDbvt(); btAssert(mem==m_dynamicAabbTree); } + + m_children.reserve(initialChildCapacity); } diff --git a/src/BulletCollision/CollisionShapes/btCompoundShape.h b/src/BulletCollision/CollisionShapes/btCompoundShape.h index 141034a8e..ce3dfa2fe 100644 --- a/src/BulletCollision/CollisionShapes/btCompoundShape.h +++ b/src/BulletCollision/CollisionShapes/btCompoundShape.h @@ -70,7 +70,7 @@ protected: public: BT_DECLARE_ALIGNED_ALLOCATOR(); - btCompoundShape(bool enableDynamicAabbTree = true); + explicit btCompoundShape(bool enableDynamicAabbTree = true, const int initialChildCapacity = 0); virtual ~btCompoundShape();