diff options
author | Joseph Eagar <joeedh@gmail.com> | 2010-03-09 07:32:40 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2010-03-09 07:32:40 +0300 |
commit | 71003b9bcc88ecf6138c3debb9abba4637c8e61a (patch) | |
tree | 7f85d40231311a36a72f731a7c07b8dbd6fff577 /source/gameengine/Physics | |
parent | ea540496c8281dcba899fb6b29c1bcfbb53a0482 (diff) | |
parent | 790d6ca256e6b572826b2bf214c6fd6c8a623969 (diff) |
merge with trunk at r27259 and commit of a patch by anthony jones to fix msvc (though further work may be needed because changes made by the merge
Diffstat (limited to 'source/gameengine/Physics')
18 files changed, 40 insertions, 41 deletions
diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index da885122a4f..11a535b35c8 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2006, Blender Foundation # All rights reserved. diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 4a3ba44e58c..a7412a9631a 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -236,7 +236,7 @@ bool CcdPhysicsController::CreateSoftbody() } } else { - btBvhTriangleMeshShape* trimeshshape = (btBvhTriangleMeshShape*) m_cci.m_collisionShape; + btTriangleMeshShape* trimeshshape = (btTriangleMeshShape*) m_cci.m_collisionShape; ///only deal with meshes that have 1 sub part/component, for now if (trimeshshape->getMeshInterface()->getNumSubParts()==1) { @@ -540,7 +540,7 @@ bool CcdPhysicsController::ReplaceControllerShape(btCollisionShape *newShape) for(int i= 0; i < obarr.size(); i++) { ob= obarr[i]; - if (ob->getCollisionShape() == newShape); { + if (ob->getCollisionShape() == newShape) { proxy = ob->getBroadphaseHandle(); if(proxy) @@ -682,7 +682,7 @@ void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionsta if (m_shapeInfo) { m_shapeInfo->AddRef(); - m_collisionShape = m_shapeInfo->CreateBulletShape(m_cci.m_margin); + m_collisionShape = m_shapeInfo->CreateBulletShape(m_cci.m_margin, m_cci.m_bGimpact, !m_cci.m_bSoft); if (m_collisionShape) { @@ -1276,7 +1276,7 @@ PHY_IPhysicsController* CcdPhysicsController::GetReplica() if (m_shapeInfo) { // This situation does not normally happen - cinfo.m_collisionShape = m_shapeInfo->CreateBulletShape(m_cci.m_margin); + cinfo.m_collisionShape = m_shapeInfo->CreateBulletShape(m_cci.m_margin, m_cci.m_bGimpact, !m_cci.m_bSoft); } else if (m_collisionShape) { @@ -1379,9 +1379,9 @@ void DefaultMotionState::calculateWorldTransformations() // Shape constructor std::map<RAS_MeshObject*, CcdShapeConstructionInfo*> CcdShapeConstructionInfo::m_meshShapeMap; -CcdShapeConstructionInfo* CcdShapeConstructionInfo::FindMesh(RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope, bool gimpact) +CcdShapeConstructionInfo* CcdShapeConstructionInfo::FindMesh(RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope) { - if (polytope || dm || gimpact) + if (polytope || dm) // not yet supported return NULL; @@ -1391,12 +1391,10 @@ CcdShapeConstructionInfo* CcdShapeConstructionInfo::FindMesh(RAS_MeshObject* mes return NULL; } -bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, bool polytope,bool useGimpact) +bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, bool polytope) { int numpolys, numverts; - m_useGimpact = useGimpact; - // assume no shape information // no support for dynamic change of shape yet assert(IsUnused()); @@ -1423,7 +1421,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, numpolys = dm->getNumTessFaces(dm); numverts = dm->getNumVerts(dm); int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX); - MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE); + MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE); m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH; @@ -1656,7 +1654,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, } // sharing only on static mesh at present, if you change that, you must also change in FindMesh - if (!polytope && !dm && !useGimpact) + if (!polytope && !dm) { // triangle shape can be shared, store the mesh object in the map m_meshShapeMap.insert(std::pair<RAS_MeshObject*,CcdShapeConstructionInfo*>(meshobj,this)); @@ -1991,13 +1989,13 @@ bool CcdShapeConstructionInfo::SetProxy(CcdShapeConstructionInfo* shapeInfo) return true; } -btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin) +btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, bool useGimpact, bool useBvh) { btCollisionShape* collisionShape = 0; btCompoundShape* compoundShape = 0; if (m_shapeType == PHY_SHAPE_PROXY && m_shapeProxy != NULL) - return m_shapeProxy->CreateBulletShape(margin); + return m_shapeProxy->CreateBulletShape(margin, useGimpact, useBvh); switch (m_shapeType) { @@ -2037,7 +2035,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin) // 9 multiplications/additions and one function call for each triangle that passes the mid phase filtering // One possible optimization is to use directly the btBvhTriangleMeshShape when the scale is 1,1,1 // and btScaledBvhTriangleMeshShape otherwise. - if (m_useGimpact) + if (useGimpact) { btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray( m_polygonIndexArray.size(), @@ -2095,14 +2093,14 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin) if(m_unscaledShape) { DeleteBulletShape(m_unscaledShape, false); m_unscaledShape->~btBvhTriangleMeshShape(); - - m_unscaledShape = new(m_unscaledShape) btBvhTriangleMeshShape( indexVertexArrays, true ); + m_unscaledShape = new(m_unscaledShape) btBvhTriangleMeshShape( indexVertexArrays, true, useBvh ); } else { - m_unscaledShape = new btBvhTriangleMeshShape( indexVertexArrays, true ); + m_unscaledShape = new btBvhTriangleMeshShape( indexVertexArrays, true, useBvh ); } - m_forceReInstance= false; - m_unscaledShape->recalcLocalAabb(); + } else if (useBvh && m_unscaledShape->getOptimizedBvh() == NULL) { + // the existing unscaledShape was not build with Bvh, do it now + m_unscaledShape->buildOptimizedBvh(); } collisionShape = new btScaledBvhTriangleMeshShape(m_unscaledShape, btVector3(1.0f,1.0f,1.0f)); collisionShape->setMargin(margin); @@ -2117,7 +2115,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin) sit != m_shapeArray.end(); sit++) { - collisionShape = (*sit)->CreateBulletShape(margin); + collisionShape = (*sit)->CreateBulletShape(margin, useGimpact, useBvh); if (collisionShape) { collisionShape->setLocalScaling((*sit)->m_childScale); @@ -2133,6 +2131,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin) void CcdShapeConstructionInfo::AddShape(CcdShapeConstructionInfo* shapeInfo) { m_shapeArray.push_back(shapeInfo); + shapeInfo->AddRef(); } CcdShapeConstructionInfo::~CcdShapeConstructionInfo() 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. diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt index d613bf8fd14..cb7a467dde9 100644 --- a/source/gameengine/Physics/Dummy/CMakeLists.txt +++ b/source/gameengine/Physics/Dummy/CMakeLists.txt @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2006, Blender Foundation # All rights reserved. diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp index e41574ff181..e6422f1bcc1 100644 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h index 28440ebdad4..9cf125f3e3f 100644 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h +++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt index a34bd19d400..3618725c2bf 100644 --- a/source/gameengine/Physics/common/CMakeLists.txt +++ b/source/gameengine/Physics/common/CMakeLists.txt @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2006, Blender Foundation # All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IController.cpp b/source/gameengine/Physics/common/PHY_IController.cpp index 47fe9a9eea8..5f7f5a1b8a9 100644 --- a/source/gameengine/Physics/common/PHY_IController.cpp +++ b/source/gameengine/Physics/common/PHY_IController.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h index e897de255c1..8fd9a37dea0 100644 --- a/source/gameengine/Physics/common/PHY_IController.h +++ b/source/gameengine/Physics/common/PHY_IController.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.cpp b/source/gameengine/Physics/common/PHY_IGraphicController.cpp index 4dccecd3d29..118aa5c01a1 100644 --- a/source/gameengine/Physics/common/PHY_IGraphicController.cpp +++ b/source/gameengine/Physics/common/PHY_IGraphicController.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h index eac3de68d4f..adca10cc1b4 100644 --- a/source/gameengine/Physics/common/PHY_IGraphicController.h +++ b/source/gameengine/Physics/common/PHY_IGraphicController.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IMotionState.cpp b/source/gameengine/Physics/common/PHY_IMotionState.cpp index e25eb21b22e..9d4d1e6c003 100644 --- a/source/gameengine/Physics/common/PHY_IMotionState.cpp +++ b/source/gameengine/Physics/common/PHY_IMotionState.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h index c3d01c010ff..41dc45e6e32 100644 --- a/source/gameengine/Physics/common/PHY_IMotionState.h +++ b/source/gameengine/Physics/common/PHY_IMotionState.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.cpp b/source/gameengine/Physics/common/PHY_IPhysicsController.cpp index f321001215a..0c96363d0e4 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsController.cpp +++ b/source/gameengine/Physics/common/PHY_IPhysicsController.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h index b34f8417e4c..07ae3a01c91 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsController.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsController.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp index d5ec436ba0e..9088a22cd5f 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h index 86e72c70bb7..b557d4edc07 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_Pro.h b/source/gameengine/Physics/common/PHY_Pro.h index 0249fc3118a..d51992da372 100644 --- a/source/gameengine/Physics/common/PHY_Pro.h +++ b/source/gameengine/Physics/common/PHY_Pro.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. |