diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-11-21 03:53:40 +0300 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-11-21 03:53:40 +0300 |
commit | 46234f90cee9b3967cb6361661ce47b455cbaa57 (patch) | |
tree | 8f32252f55c29694c1fa619d00a67ea4b4941099 | |
parent | 4bbbabd04957d6564d43b076e1e144f0bb4da439 (diff) |
Removed old Blender/extern/bullet, and upgraded game engine to use Bullet 2.x
All platforms/build systems: either upgrade to use extern/bullet2, or disable the game engine until the build is fixed.
227 files changed, 595 insertions, 35373 deletions
diff --git a/extern/bullet/Bullet/BLI_Bullet.dsp b/extern/bullet/Bullet/BLI_Bullet.dsp deleted file mode 100644 index a7357ef7976..00000000000 --- a/extern/bullet/Bullet/BLI_Bullet.dsp +++ /dev/null @@ -1,610 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Bullet" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=Bullet - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "BLI_Bullet.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "BLI_Bullet.mak" CFG="Bullet - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Bullet - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "Bullet - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Bullet - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -MTL=midl.exe -LINK32=link.exe -lib -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /Zd /O2 /I "../LinearMath" /I "." /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "BUM_INLINED" /D "USE_ALGEBRAIC" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=copy bullet to ..lib\windows\lib -PostBuild_Cmds=XCOPY /Y .\release\*.lib .\..\..\..\..\lib\windows\bullet\lib\*.* -# End Special Build Tool - -!ELSEIF "$(CFG)" == "Bullet - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -MTL=midl.exe -LINK32=link.exe -lib -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../LinearMath" /I "." /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "BUM_INLINED" /D "USE_ALGEBRAIC" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Debug\BLI_Bullet_D.lib" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=copy bullet to ..lib\windows\lib -PostBuild_Cmds=XCOPY /Y .\debug\*.lib .\..\..\..\..\lib\windows\bullet\lib\*.* -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "Bullet - Win32 Release" -# Name "Bullet - Win32 Debug" -# Begin Group "NarrowPhaseCollision" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_Collidable.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_Collidable.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_CollisionPair.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_CollisionPair.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_EdgeEdge.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_EdgeEdge.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_MotionStateInterface.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_PolynomialSolverInterface.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_Screwing.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_Screwing.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_StaticMotionState.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_VertexPoly.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_VertexPoly.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\CollisionMargin.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ContinuousConvexCollision.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ContinuousConvexCollision.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ConvexCast.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ConvexCast.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ConvexPenetrationDepthSolver.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\DiscreteCollisionDetectorInterface.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\GjkConvexCast.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\GjkConvexCast.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\GjkPairDetector.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\GjkPairDetector.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ManifoldContactAddResult.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ManifoldContactAddResult.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ManifoldPoint.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\PersistentManifold.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\PersistentManifold.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\PointCollector.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\RaycastCallback.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\RaycastCallback.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\SimplexSolverInterface.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\SubSimplexConvexCast.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\SubSimplexConvexCast.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\VoronoiSimplexSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\VoronoiSimplexSolver.h -# End Source File -# End Group -# Begin Group "BroadphaseCollision" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\BroadphaseCollision\AxisSweep3.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\AxisSweep3.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\BroadPhaseInterface.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\BroadphaseProxy.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\BroadphaseProxy.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\CollisionAlgorithm.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\CollisionAlgorithm.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\Dispatcher.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\Dispatcher.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\OverlappingPairCache.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\OverlappingPairCache.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\SimpleBroadphase.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\SimpleBroadphase.h -# End Source File -# End Group -# Begin Group "CollisionShapes" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\CollisionShapes\BoxShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\BoxShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\BvhTriangleMeshShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\BvhTriangleMeshShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CollisionMargin.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CollisionShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CollisionShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CompoundShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CompoundShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConcaveShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConcaveShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConeShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConeShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexHullShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexHullShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexTriangleMeshShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexTriangleMeshShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CylinderShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CylinderShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\EmptyShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\EmptyShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\MinkowskiSumShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\MinkowskiSumShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\MultiSphereShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\MultiSphereShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\OptimizedBvh.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\OptimizedBvh.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\PolyhedralConvexShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\PolyhedralConvexShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\Simplex1to4Shape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\Simplex1to4Shape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\SphereShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\SphereShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\StaticPlaneShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\StaticPlaneShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\StridingMeshInterface.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\StridingMeshInterface.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleCallback.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleCallback.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleIndexVertexArray.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleIndexVertexArray.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleMesh.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleMesh.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleMeshShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleMeshShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleShape.h -# End Source File -# End Group -# Begin Group "CollisionDispatch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\CollisionDispatch\CollisionCreateFunc.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\CollisionDispatcher.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\CollisionDispatcher.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\CollisionObject.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\CollisionObject.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\CollisionWorld.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\CollisionWorld.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\CompoundCollisionAlgorithm.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\CompoundCollisionAlgorithm.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\ConvexConcaveCollisionAlgorithm.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\ConvexConcaveCollisionAlgorithm.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\ConvexConvexAlgorithm.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\ConvexConvexAlgorithm.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\EmptyCollisionAlgorithm.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\EmptyCollisionAlgorithm.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\ManifoldResult.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\ManifoldResult.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\SimulationIslandManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\SimulationIslandManager.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\UnionFind.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionDispatch\UnionFind.h -# End Source File -# End Group -# Begin Group "Extras" - -# PROP Default_Filter "" -# End Group -# End Target -# End Project diff --git a/extern/bullet/Bullet/BroadphaseCollision/AxisSweep3.cpp b/extern/bullet/Bullet/BroadphaseCollision/AxisSweep3.cpp deleted file mode 100644 index 235afa1f9fe..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/AxisSweep3.cpp +++ /dev/null @@ -1,502 +0,0 @@ - -//Bullet Continuous Collision Detection and Physics Library -//Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - - -// -// AxisSweep3 -// -// Copyright (c) 2006 Simon Hobbs -// -// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. -#include "AxisSweep3.h" - -#include <assert.h> - -BroadphaseProxy* AxisSweep3::CreateProxy( const SimdVector3& min, const SimdVector3& max,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask) -{ - unsigned short handleId = AddHandle(min,max, userPtr,collisionFilterGroup,collisionFilterMask); - - Handle* handle = GetHandle(handleId); - - return handle; -} - -void AxisSweep3::DestroyProxy(BroadphaseProxy* proxy) -{ - Handle* handle = static_cast<Handle*>(proxy); - RemoveHandle(handle->m_handleId); -} - -void AxisSweep3::SetAabb(BroadphaseProxy* proxy,const SimdVector3& aabbMin,const SimdVector3& aabbMax) -{ - Handle* handle = static_cast<Handle*>(proxy); - UpdateHandle(handle->m_handleId,aabbMin,aabbMax); -} - - - - - - -AxisSweep3::AxisSweep3(const SimdPoint3& worldAabbMin,const SimdPoint3& worldAabbMax, int maxHandles, int maxOverlaps) -:OverlappingPairCache(maxOverlaps) -{ - //assert(bounds.HasVolume()); - - // 1 handle is reserved as sentinel - assert(maxHandles > 1 && maxHandles < 32767); - - // doesn't need this limit right now, but I may want to use unsigned short indexes into overlaps array - assert(maxOverlaps > 0 && maxOverlaps < 65536); - - // init bounds - m_worldAabbMin = worldAabbMin; - m_worldAabbMax = worldAabbMax; - - SimdVector3 aabbSize = m_worldAabbMax - m_worldAabbMin; - - m_quantize = SimdVector3(65535.0f,65535.0f,65535.0f) / aabbSize; - - // allocate handles buffer and put all handles on free list - m_pHandles = new Handle[maxHandles]; - m_maxHandles = maxHandles; - m_numHandles = 0; - - // handle 0 is reserved as the null index, and is also used as the sentinel - m_firstFreeHandle = 1; - { - for (int i = m_firstFreeHandle; i < maxHandles; i++) - m_pHandles[i].SetNextFree(i + 1); - m_pHandles[maxHandles - 1].SetNextFree(0); - } - - { - // allocate edge buffers - for (int i = 0; i < 3; i++) - m_pEdges[i] = new Edge[maxHandles * 2]; - } - //removed overlap management - - // make boundary sentinels - - m_pHandles[0].m_clientObject = 0; - - for (int axis = 0; axis < 3; axis++) - { - m_pHandles[0].m_minEdges[axis] = 0; - m_pHandles[0].m_maxEdges[axis] = 1; - - m_pEdges[axis][0].m_pos = 0; - m_pEdges[axis][0].m_handle = 0; - m_pEdges[axis][1].m_pos = 0xffff; - m_pEdges[axis][1].m_handle = 0; - } -} - -AxisSweep3::~AxisSweep3() -{ - - for (int i = 2; i >= 0; i--) - delete[] m_pEdges[i]; - delete[] m_pHandles; -} - -void AxisSweep3::Quantize(unsigned short* out, const SimdPoint3& point, int isMax) const -{ - SimdPoint3 clampedPoint(point); - /* - if (isMax) - clampedPoint += SimdVector3(10,10,10); - else - { - clampedPoint -= SimdVector3(10,10,10); - } - */ - - - clampedPoint.setMax(m_worldAabbMin); - clampedPoint.setMin(m_worldAabbMax); - - SimdVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize; - out[0] = (unsigned short)(((int)v.getX() & 0xfffc) | isMax); - out[1] = (unsigned short)(((int)v.getY() & 0xfffc) | isMax); - out[2] = (unsigned short)(((int)v.getZ() & 0xfffc) | isMax); - -} - - - -unsigned short AxisSweep3::AllocHandle() -{ - assert(m_firstFreeHandle); - - unsigned short handle = m_firstFreeHandle; - m_firstFreeHandle = GetHandle(handle)->GetNextFree(); - m_numHandles++; - - return handle; -} - -void AxisSweep3::FreeHandle(unsigned short handle) -{ - assert(handle > 0 && handle < m_maxHandles); - - GetHandle(handle)->SetNextFree(m_firstFreeHandle); - m_firstFreeHandle = handle; - - m_numHandles--; -} - - - -unsigned short AxisSweep3::AddHandle(const SimdPoint3& aabbMin,const SimdPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask) -{ - // quantize the bounds - unsigned short min[3], max[3]; - Quantize(min, aabbMin, 0); - Quantize(max, aabbMax, 1); - - // allocate a handle - unsigned short handle = AllocHandle(); - assert(handle!= 0xcdcd); - - Handle* pHandle = GetHandle(handle); - - pHandle->m_handleId = handle; - //pHandle->m_pOverlaps = 0; - pHandle->m_clientObject = pOwner; - pHandle->m_collisionFilterGroup = collisionFilterGroup; - pHandle->m_collisionFilterMask = collisionFilterMask; - - // compute current limit of edge arrays - int limit = m_numHandles * 2; - - // insert new edges just inside the max boundary edge - for (int axis = 0; axis < 3; axis++) - { - m_pHandles[0].m_maxEdges[axis] += 2; - - m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1]; - - m_pEdges[axis][limit - 1].m_pos = min[axis]; - m_pEdges[axis][limit - 1].m_handle = handle; - - m_pEdges[axis][limit].m_pos = max[axis]; - m_pEdges[axis][limit].m_handle = handle; - - pHandle->m_minEdges[axis] = limit - 1; - pHandle->m_maxEdges[axis] = limit; - } - - // now sort the new edges to their correct position - SortMinDown(0, pHandle->m_minEdges[0], false); - SortMaxDown(0, pHandle->m_maxEdges[0], false); - SortMinDown(1, pHandle->m_minEdges[1], false); - SortMaxDown(1, pHandle->m_maxEdges[1], false); - SortMinDown(2, pHandle->m_minEdges[2], true); - SortMaxDown(2, pHandle->m_maxEdges[2], true); - - //PrintAxis(1); - - return handle; -} - - -void AxisSweep3::RemoveHandle(unsigned short handle) -{ - Handle* pHandle = GetHandle(handle); - - RemoveOverlappingPairsContainingProxy(pHandle); - - - // compute current limit of edge arrays - int limit = m_numHandles * 2; - int axis; - - for (axis = 0;axis<3;axis++) - { - Edge* pEdges = m_pEdges[axis]; - int maxEdge= pHandle->m_maxEdges[axis]; - pEdges[maxEdge].m_pos = 0xffff; - int minEdge = pHandle->m_minEdges[axis]; - pEdges[minEdge].m_pos = 0xffff; - } - - // remove the edges by sorting them up to the end of the list - for ( axis = 0; axis < 3; axis++) - { - Edge* pEdges = m_pEdges[axis]; - int max = pHandle->m_maxEdges[axis]; - pEdges[max].m_pos = 0xffff; - - SortMaxUp(axis,max,false); - - int i = pHandle->m_minEdges[axis]; - pEdges[i].m_pos = 0xffff; - - SortMinUp(axis,i,false); - - pEdges[limit-1].m_handle = 0; - pEdges[limit-1].m_pos = 0xffff; - - } - - // free the handle - FreeHandle(handle); - - -} - -bool AxisSweep3::TestOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB) -{ - //optimization 1: check the array index (memory address), instead of the m_pos - - for (int axis = 0; axis < 3; axis++) - { - if (axis != ignoreAxis) - { - if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] || - pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis]) - { - return false; - } - } - } - - //optimization 2: only 2 axis need to be tested - - /*for (int axis = 0; axis < 3; axis++) - { - if (m_pEdges[axis][pHandleA->m_maxEdges[axis]].m_pos < m_pEdges[axis][pHandleB->m_minEdges[axis]].m_pos || - m_pEdges[axis][pHandleB->m_maxEdges[axis]].m_pos < m_pEdges[axis][pHandleA->m_minEdges[axis]].m_pos) - { - return false; - } - } - */ - - return true; -} - -void AxisSweep3::UpdateHandle(unsigned short handle, const SimdPoint3& aabbMin,const SimdPoint3& aabbMax) -{ -// assert(bounds.IsFinite()); - //assert(bounds.HasVolume()); - - Handle* pHandle = GetHandle(handle); - - // quantize the new bounds - unsigned short min[3], max[3]; - Quantize(min, aabbMin, 0); - Quantize(max, aabbMax, 1); - - // update changed edges - for (int axis = 0; axis < 3; axis++) - { - unsigned short emin = pHandle->m_minEdges[axis]; - unsigned short emax = pHandle->m_maxEdges[axis]; - - int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos; - int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos; - - m_pEdges[axis][emin].m_pos = min[axis]; - m_pEdges[axis][emax].m_pos = max[axis]; - - // expand (only adds overlaps) - if (dmin < 0) - SortMinDown(axis, emin); - - if (dmax > 0) - SortMaxUp(axis, emax); - - // shrink (only removes overlaps) - if (dmin > 0) - SortMinUp(axis, emin); - - if (dmax < 0) - SortMaxDown(axis, emax); - } - - //PrintAxis(1); -} - -// sorting a min edge downwards can only ever *add* overlaps -void AxisSweep3::SortMinDown(int axis, unsigned short edge, bool updateOverlaps) -{ - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pPrev = pEdge - 1; - Handle* pHandleEdge = GetHandle(pEdge->m_handle); - - while (pEdge->m_pos < pPrev->m_pos) - { - Handle* pHandlePrev = GetHandle(pPrev->m_handle); - - if (pPrev->IsMax()) - { - // if previous edge is a maximum check the bounds and add an overlap if necessary - if (updateOverlaps && TestOverlap(axis,pHandleEdge, pHandlePrev)) - { - AddOverlappingPair(pHandleEdge,pHandlePrev); - - //AddOverlap(pEdge->m_handle, pPrev->m_handle); - - } - - // update edge reference in other handle - pHandlePrev->m_maxEdges[axis]++; - } - else - pHandlePrev->m_minEdges[axis]++; - - pHandleEdge->m_minEdges[axis]--; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pPrev; - *pPrev = swap; - - // decrement - pEdge--; - pPrev--; - } -} - -// sorting a min edge upwards can only ever *remove* overlaps -void AxisSweep3::SortMinUp(int axis, unsigned short edge, bool updateOverlaps) -{ - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pNext = pEdge + 1; - Handle* pHandleEdge = GetHandle(pEdge->m_handle); - - while (pEdge->m_pos > pNext->m_pos) - { - Handle* pHandleNext = GetHandle(pNext->m_handle); - - if (pNext->IsMax()) - { - // if next edge is maximum remove any overlap between the two handles - if (updateOverlaps) - { - Handle* handle0 = GetHandle(pEdge->m_handle); - Handle* handle1 = GetHandle(pNext->m_handle); - BroadphasePair* pair = FindPair(handle0,handle1); - //assert(pair); - if (pair) - { - RemoveOverlappingPair(*pair); - } - } - - // update edge reference in other handle - pHandleNext->m_maxEdges[axis]--; - } - else - pHandleNext->m_minEdges[axis]--; - - pHandleEdge->m_minEdges[axis]++; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pNext; - *pNext = swap; - - // increment - pEdge++; - pNext++; - } -} - -// sorting a max edge downwards can only ever *remove* overlaps -void AxisSweep3::SortMaxDown(int axis, unsigned short edge, bool updateOverlaps) -{ - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pPrev = pEdge - 1; - Handle* pHandleEdge = GetHandle(pEdge->m_handle); - - while (pEdge->m_pos < pPrev->m_pos) - { - Handle* pHandlePrev = GetHandle(pPrev->m_handle); - - if (!pPrev->IsMax()) - { - // if previous edge was a minimum remove any overlap between the two handles - if (updateOverlaps) - { - Handle* handle0 = GetHandle(pEdge->m_handle); - Handle* handle1 = GetHandle(pPrev->m_handle); - BroadphasePair* pair = FindPair(handle0,handle1); - //assert(pair); - - if (pair) - { - RemoveOverlappingPair(*pair); - } - } - - // update edge reference in other handle - pHandlePrev->m_minEdges[axis]++;; - } - else - pHandlePrev->m_maxEdges[axis]++; - - pHandleEdge->m_maxEdges[axis]--; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pPrev; - *pPrev = swap; - - // decrement - pEdge--; - pPrev--; - } -} - -// sorting a max edge upwards can only ever *add* overlaps -void AxisSweep3::SortMaxUp(int axis, unsigned short edge, bool updateOverlaps) -{ - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pNext = pEdge + 1; - Handle* pHandleEdge = GetHandle(pEdge->m_handle); - - while (pEdge->m_pos > pNext->m_pos) - { - Handle* pHandleNext = GetHandle(pNext->m_handle); - - if (!pNext->IsMax()) - { - // if next edge is a minimum check the bounds and add an overlap if necessary - if (updateOverlaps && TestOverlap(axis, pHandleEdge, pHandleNext)) - { - Handle* handle0 = GetHandle(pEdge->m_handle); - Handle* handle1 = GetHandle(pNext->m_handle); - AddOverlappingPair(handle0,handle1); - } - - // update edge reference in other handle - pHandleNext->m_minEdges[axis]--; - } - else - pHandleNext->m_maxEdges[axis]--; - - pHandleEdge->m_maxEdges[axis]++; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pNext; - *pNext = swap; - - // increment - pEdge++; - pNext++; - } -} diff --git a/extern/bullet/Bullet/BroadphaseCollision/AxisSweep3.h b/extern/bullet/Bullet/BroadphaseCollision/AxisSweep3.h deleted file mode 100644 index 0a4a75d523a..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/AxisSweep3.h +++ /dev/null @@ -1,115 +0,0 @@ -//Bullet Continuous Collision Detection and Physics Library -//Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -// -// AxisSweep3.h -// -// Copyright (c) 2006 Simon Hobbs -// -// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. - -#ifndef AXIS_SWEEP_3_H -#define AXIS_SWEEP_3_H - -#include "SimdPoint3.h" -#include "SimdVector3.h" -#include "OverlappingPairCache.h" -#include "BroadphaseProxy.h" - -/// AxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase. -/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using integer coordinates instead of floats. -/// The TestOverlap check is optimized to check the array index, rather then the actual AABB coordinates/pos -class AxisSweep3 : public OverlappingPairCache -{ - -public: - - - class Edge - { - public: - unsigned short m_pos; // low bit is min/max - unsigned short m_handle; - - unsigned short IsMax() const {return m_pos & 1;} - }; - -public: - class Handle : public BroadphaseProxy - { - public: - - // indexes into the edge arrays - unsigned short m_minEdges[3], m_maxEdges[3]; // 6 * 2 = 12 - unsigned short m_handleId; - unsigned short m_pad; - - //void* m_pOwner; this is now in BroadphaseProxy.m_clientObject - - inline void SetNextFree(unsigned short next) {m_minEdges[0] = next;} - inline unsigned short GetNextFree() const {return m_minEdges[0];} - }; // 24 bytes + 24 for Edge structures = 44 bytes total per entry - - -private: - SimdPoint3 m_worldAabbMin; // overall system bounds - SimdPoint3 m_worldAabbMax; // overall system bounds - - SimdVector3 m_quantize; // scaling factor for quantization - - int m_numHandles; // number of active handles - int m_maxHandles; // max number of handles - Handle* m_pHandles; // handles pool - unsigned short m_firstFreeHandle; // free handles list - - Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries) - - - // allocation/deallocation - unsigned short AllocHandle(); - void FreeHandle(unsigned short handle); - - - bool TestOverlap(int ignoreAxis,const Handle* pHandleA, const Handle* pHandleB); - - //Overlap* AddOverlap(unsigned short handleA, unsigned short handleB); - //void RemoveOverlap(unsigned short handleA, unsigned short handleB); - - void Quantize(unsigned short* out, const SimdPoint3& point, int isMax) const; - - void SortMinDown(int axis, unsigned short edge, bool updateOverlaps = true); - void SortMinUp(int axis, unsigned short edge, bool updateOverlaps = true); - void SortMaxDown(int axis, unsigned short edge, bool updateOverlaps = true); - void SortMaxUp(int axis, unsigned short edge, bool updateOverlaps = true); - -public: - AxisSweep3(const SimdPoint3& worldAabbMin,const SimdPoint3& worldAabbMax, int maxHandles = 1024, int maxOverlaps = 8192); - virtual ~AxisSweep3(); - - virtual void RefreshOverlappingPairs() - { - //this is replace by sweep and prune - } - - unsigned short AddHandle(const SimdPoint3& aabbMin,const SimdPoint3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask); - void RemoveHandle(unsigned short handle); - void UpdateHandle(unsigned short handle, const SimdPoint3& aabbMin,const SimdPoint3& aabbMax); - inline Handle* GetHandle(unsigned short index) const {return m_pHandles + index;} - - - //Broadphase Interface - virtual BroadphaseProxy* CreateProxy( const SimdVector3& min, const SimdVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask); - virtual void DestroyProxy(BroadphaseProxy* proxy); - virtual void SetAabb(BroadphaseProxy* proxy,const SimdVector3& aabbMin,const SimdVector3& aabbMax); - -}; - -#endif //AXIS_SWEEP_3_H diff --git a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseInterface.h b/extern/bullet/Bullet/BroadphaseCollision/BroadphaseInterface.h deleted file mode 100644 index 3ca273bde54..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseInterface.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef BROADPHASE_INTERFACE_H -#define BROADPHASE_INTERFACE_H - - - -struct DispatcherInfo; -class Dispatcher; -struct BroadphaseProxy; -#include "SimdVector3.h" - -///BroadphaseInterface for aabb-overlapping object pairs -class BroadphaseInterface -{ -public: - virtual ~BroadphaseInterface() {} - - virtual BroadphaseProxy* CreateProxy( const SimdVector3& min, const SimdVector3& max,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) =0; - virtual void DestroyProxy(BroadphaseProxy* proxy)=0; - virtual void SetAabb(BroadphaseProxy* proxy,const SimdVector3& aabbMin,const SimdVector3& aabbMax)=0; - virtual void CleanProxyFromPairs(BroadphaseProxy* proxy)=0; - - -}; - -#endif //BROADPHASE_INTERFACE_H diff --git a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.cpp b/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.cpp deleted file mode 100644 index 61bcdc4b610..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "BroadphaseProxy.h" - diff --git a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.h b/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.h deleted file mode 100644 index 35b2dc866f1..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/BroadphaseProxy.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef BROADPHASE_PROXY_H -#define BROADPHASE_PROXY_H - - - -/// Dispatcher uses these types -/// IMPORTANT NOTE:The types are ordered polyhedral, implicit convex and concave -/// to facilitate type checking -enum BroadphaseNativeTypes -{ -// polyhedral convex shapes - BOX_SHAPE_PROXYTYPE, - TRIANGLE_SHAPE_PROXYTYPE, - TETRAHEDRAL_SHAPE_PROXYTYPE, - CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE, - CONVEX_HULL_SHAPE_PROXYTYPE, -//implicit convex shapes -IMPLICIT_CONVEX_SHAPES_START_HERE, - SPHERE_SHAPE_PROXYTYPE, - MULTI_SPHERE_SHAPE_PROXYTYPE, - CONE_SHAPE_PROXYTYPE, - CONVEX_SHAPE_PROXYTYPE, - CYLINDER_SHAPE_PROXYTYPE, - MINKOWSKI_SUM_SHAPE_PROXYTYPE, - MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE, -//concave shapes -CONCAVE_SHAPES_START_HERE, - //keep all the convex shapetype below here, for the check IsConvexShape in broadphase proxy! - TRIANGLE_MESH_SHAPE_PROXYTYPE, - EMPTY_SHAPE_PROXYTYPE, - STATIC_PLANE_PROXYTYPE, -CONCAVE_SHAPES_END_HERE, - - COMPOUND_SHAPE_PROXYTYPE, - - MAX_BROADPHASE_COLLISION_TYPES -}; - - -///BroadphaseProxy -struct BroadphaseProxy -{ - - //Usually the client CollisionObject or Rigidbody class - void* m_clientObject; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; - - //used for memory pools - BroadphaseProxy() :m_clientObject(0){} - - BroadphaseProxy(void* userPtr,short int collisionFilterGroup, short int collisionFilterMask) - :m_clientObject(userPtr), - m_collisionFilterGroup(collisionFilterGroup), - m_collisionFilterMask(collisionFilterMask) - { - } - -}; - -class CollisionAlgorithm; - -struct BroadphaseProxy; - -#define SIMPLE_MAX_ALGORITHMS 2 - -/// contains a pair of aabb-overlapping objects -struct BroadphasePair -{ - BroadphasePair () - : - m_pProxy0(0), - m_pProxy1(0) - { - for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++) - { - m_algorithms[i] = 0; - } - } - - BroadphasePair(const BroadphasePair& other) - : m_pProxy0(other.m_pProxy0), - m_pProxy1(other.m_pProxy1) - { - for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++) - { - m_algorithms[i] = other.m_algorithms[i]; - } - } - BroadphasePair(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) - : - m_pProxy0(&proxy0), - m_pProxy1(&proxy1) - { - for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++) - { - m_algorithms[i] = 0; - } - - } - - - BroadphaseProxy* m_pProxy0; - BroadphaseProxy* m_pProxy1; - - mutable CollisionAlgorithm* m_algorithms[SIMPLE_MAX_ALGORITHMS]; -}; - -#endif //BROADPHASE_PROXY_H - diff --git a/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.cpp b/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.cpp deleted file mode 100644 index d63966c83cf..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CollisionAlgorithm.h" -#include "Dispatcher.h" - -CollisionAlgorithm::CollisionAlgorithm(const CollisionAlgorithmConstructionInfo& ci) -{ - m_dispatcher = ci.m_dispatcher; -} - diff --git a/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.h b/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.h deleted file mode 100644 index 9368a16f227..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/CollisionAlgorithm.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COLLISION_ALGORITHM_H -#define COLLISION_ALGORITHM_H - -struct BroadphaseProxy; -class Dispatcher; - -struct CollisionAlgorithmConstructionInfo -{ - CollisionAlgorithmConstructionInfo() - :m_dispatcher(0) - { - } - CollisionAlgorithmConstructionInfo(Dispatcher* dispatcher,int temp) - :m_dispatcher(dispatcher) - { - } - - Dispatcher* m_dispatcher; - - int GetDispatcherId(); - -}; - - -///CollisionAlgorithm is an collision interface that is compatible with the Broadphase and Dispatcher. -///It is persistent over frames -class CollisionAlgorithm -{ - -protected: - - Dispatcher* m_dispatcher; - -protected: - int GetDispatcherId(); - -public: - - CollisionAlgorithm() {}; - - CollisionAlgorithm(const CollisionAlgorithmConstructionInfo& ci); - - virtual ~CollisionAlgorithm() {}; - - virtual void ProcessCollision (BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const struct DispatcherInfo& dispatchInfo) = 0; - - virtual float CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const struct DispatcherInfo& dispatchInfo) = 0; - -}; - - -#endif //COLLISION_ALGORITHM_H diff --git a/extern/bullet/Bullet/BroadphaseCollision/Dispatcher.cpp b/extern/bullet/Bullet/BroadphaseCollision/Dispatcher.cpp deleted file mode 100644 index a73c7eac39e..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/Dispatcher.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "Dispatcher.h" - -Dispatcher::~Dispatcher() -{ - -} - diff --git a/extern/bullet/Bullet/BroadphaseCollision/Dispatcher.h b/extern/bullet/Bullet/BroadphaseCollision/Dispatcher.h deleted file mode 100644 index 5edfbbdd3b5..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/Dispatcher.h +++ /dev/null @@ -1,99 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _DISPATCHER_H -#define _DISPATCHER_H - -class CollisionAlgorithm; -struct BroadphaseProxy; -class RigidBody; -struct CollisionObject; -class ManifoldResult; -class OverlappingPairCache; - -enum CollisionDispatcherId -{ - RIGIDBODY_DISPATCHER = 0, - USERCALLBACK_DISPATCHER -}; - -class PersistentManifold; - -struct DispatcherInfo -{ - enum DispatchFunc - { - DISPATCH_DISCRETE = 1, - DISPATCH_CONTINUOUS - }; - DispatcherInfo() - :m_dispatchFunc(DISPATCH_DISCRETE), - m_timeOfImpact(1.f), - m_useContinuous(false), - m_debugDraw(0), - m_enableSatConvex(false) - { - - } - float m_timeStep; - int m_stepCount; - int m_dispatchFunc; - float m_timeOfImpact; - bool m_useContinuous; - class IDebugDraw* m_debugDraw; - bool m_enableSatConvex; - -}; - -/// Dispatcher can be used in combination with broadphase to dispatch overlapping pairs. -/// For example for pairwise collision detection or user callbacks (game logic). -class Dispatcher -{ - - -public: - virtual ~Dispatcher() ; - - virtual CollisionAlgorithm* FindAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) = 0; - - // - // asume dispatchers to have unique id's in the range [0..max dispacher] - // - virtual int GetUniqueId() = 0; - - virtual PersistentManifold* GetNewManifold(void* body0,void* body1)=0; - - virtual void ReleaseManifold(PersistentManifold* manifold)=0; - - virtual void ClearManifold(PersistentManifold* manifold)=0; - - virtual bool NeedsCollision(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) = 0; - - virtual bool NeedsResponse(const CollisionObject& colObj0,const CollisionObject& colObj1)=0; - - virtual ManifoldResult* GetNewManifoldResult(CollisionObject* obj0,CollisionObject* obj1,PersistentManifold* manifold) =0; - - virtual void ReleaseManifoldResult(ManifoldResult*)=0; - - virtual void DispatchAllCollisionPairs(struct BroadphasePair* pairs,int numPairs,DispatcherInfo& dispatchInfo)=0; - - virtual int GetNumManifolds() const = 0; - - virtual PersistentManifold* GetManifoldByIndexInternal(int index) = 0; - -}; - - -#endif //_DISPATCHER_H diff --git a/extern/bullet/Bullet/BroadphaseCollision/OverlappingPairCache.cpp b/extern/bullet/Bullet/BroadphaseCollision/OverlappingPairCache.cpp deleted file mode 100644 index df535044df1..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/OverlappingPairCache.cpp +++ /dev/null @@ -1,151 +0,0 @@ - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#include "OverlappingPairCache.h" - -#include "Dispatcher.h" -#include "CollisionAlgorithm.h" - - -OverlappingPairCache::OverlappingPairCache(int maxOverlap): -m_blockedForChanges(false), -m_NumOverlapBroadphasePair(0), -m_maxOverlap(maxOverlap) -{ - m_OverlappingPairs = new BroadphasePair[maxOverlap]; -} - - -OverlappingPairCache::~OverlappingPairCache() -{ - delete [] m_OverlappingPairs; -} - - -void OverlappingPairCache::RemoveOverlappingPair(BroadphasePair& pair) -{ - CleanOverlappingPair(pair); - int index = &pair - &m_OverlappingPairs[0]; - //remove efficiently, swap with the last - m_OverlappingPairs[index] = m_OverlappingPairs[m_NumOverlapBroadphasePair-1]; - m_NumOverlapBroadphasePair--; -} - - -void OverlappingPairCache::CleanOverlappingPair(BroadphasePair& pair) -{ - for (int dispatcherId=0;dispatcherId<SIMPLE_MAX_ALGORITHMS;dispatcherId++) - { - if (pair.m_algorithms[dispatcherId]) - { - { - delete pair.m_algorithms[dispatcherId]; - pair.m_algorithms[dispatcherId]=0; - } - } - } -} - - - - - -void OverlappingPairCache::AddOverlappingPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1) -{ - //don't add overlap with own - assert(proxy0 != proxy1); - - if (!NeedsCollision(proxy0,proxy1)) - return; - - - BroadphasePair pair(*proxy0,*proxy1); - m_OverlappingPairs[m_NumOverlapBroadphasePair] = pair; - - int i; - for (i=0;i<SIMPLE_MAX_ALGORITHMS;i++) - { - assert(!m_OverlappingPairs[m_NumOverlapBroadphasePair].m_algorithms[i]); - m_OverlappingPairs[m_NumOverlapBroadphasePair].m_algorithms[i] = 0; - } - - if (m_NumOverlapBroadphasePair >= m_maxOverlap) - { - //printf("Error: too many overlapping objects: m_NumOverlapBroadphasePair: %d\n",m_NumOverlapBroadphasePair); -#ifdef DEBUG - assert(0); -#endif - } else - { - m_NumOverlapBroadphasePair++; - } - - -} - - -BroadphasePair* OverlappingPairCache::FindPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1) -{ - BroadphasePair* foundPair = 0; - - int i; - for (i=m_NumOverlapBroadphasePair-1;i>=0;i--) - { - BroadphasePair& pair = m_OverlappingPairs[i]; - if (((pair.m_pProxy0 == proxy0) && (pair.m_pProxy1 == proxy1)) || - ((pair.m_pProxy0 == proxy1) && (pair.m_pProxy1 == proxy0))) - { - foundPair = &pair; - return foundPair; - } - } - - return foundPair; -} - - - -void OverlappingPairCache::CleanProxyFromPairs(BroadphaseProxy* proxy) -{ - for (int i=0;i<m_NumOverlapBroadphasePair;i++) - { - BroadphasePair& pair = m_OverlappingPairs[i]; - if (pair.m_pProxy0 == proxy || - pair.m_pProxy1 == proxy) - { - CleanOverlappingPair(pair); - } - } -} - -void OverlappingPairCache::RemoveOverlappingPairsContainingProxy(BroadphaseProxy* proxy) -{ - int i; - for ( i=m_NumOverlapBroadphasePair-1;i>=0;i--) - { - BroadphasePair& pair = m_OverlappingPairs[i]; - if (pair.m_pProxy0 == proxy || - pair.m_pProxy1 == proxy) - { - RemoveOverlappingPair(pair); - } - } -} - - - diff --git a/extern/bullet/Bullet/BroadphaseCollision/OverlappingPairCache.h b/extern/bullet/Bullet/BroadphaseCollision/OverlappingPairCache.h deleted file mode 100644 index 0fba0b2e558..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/OverlappingPairCache.h +++ /dev/null @@ -1,85 +0,0 @@ - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef OVERLAPPING_PAIR_CACHE_H -#define OVERLAPPING_PAIR_CACHE_H - - -#include "BroadphaseInterface.h" -#include "BroadphaseProxy.h" -#include "SimdPoint3.h" - - -///OverlappingPairCache maintains the objects with overlapping AABB -///Typically managed by the Broadphase, Axis3Sweep or SimpleBroadphase -class OverlappingPairCache : public BroadphaseInterface -{ - - BroadphasePair* m_OverlappingPairs; - int m_NumOverlapBroadphasePair; - int m_maxOverlap; - - //during the dispatch, check that user doesn't destroy/create proxy - bool m_blockedForChanges; - - - public: - - OverlappingPairCache(int maxOverlap); - virtual ~OverlappingPairCache(); - - int GetNumOverlappingPairs() const - { - return m_NumOverlapBroadphasePair; - } - - BroadphasePair& GetOverlappingPair(int index) - { - return m_OverlappingPairs[index]; - } - - void RemoveOverlappingPair(BroadphasePair& pair); - - void CleanOverlappingPair(BroadphasePair& pair); - - void AddOverlappingPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1); - - BroadphasePair* FindPair(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1); - - - - void CleanProxyFromPairs(BroadphaseProxy* proxy); - - void RemoveOverlappingPairsContainingProxy(BroadphaseProxy* proxy); - - - inline bool NeedsCollision(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1) const - { - bool collides = proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask; - collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask); - - return collides; - } - - - - virtual void RefreshOverlappingPairs() =0; - - - - -}; -#endif //OVERLAPPING_PAIR_CACHE_H
\ No newline at end of file diff --git a/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.cpp b/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.cpp deleted file mode 100644 index 5a648e1d306..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "SimpleBroadphase.h" -#include <BroadphaseCollision/Dispatcher.h> -#include <BroadphaseCollision/CollisionAlgorithm.h> - -#include "SimdVector3.h" -#include "SimdTransform.h" -#include "SimdMatrix3x3.h" -#include <vector> - - -void SimpleBroadphase::validate() -{ - for (int i=0;i<m_numProxies;i++) - { - for (int j=i+1;j<m_numProxies;j++) - { - assert(m_pProxies[i] != m_pProxies[j]); - } - } - -} - -SimpleBroadphase::SimpleBroadphase(int maxProxies,int maxOverlap) - :OverlappingPairCache(maxOverlap), - m_firstFreeProxy(0), - m_numProxies(0), - m_maxProxies(maxProxies) -{ - - m_proxies = new SimpleBroadphaseProxy[maxProxies]; - m_freeProxies = new int[maxProxies]; - m_pProxies = new SimpleBroadphaseProxy*[maxProxies]; - - - int i; - for (i=0;i<m_maxProxies;i++) - { - m_freeProxies[i] = i; - } -} - -SimpleBroadphase::~SimpleBroadphase() -{ - delete[] m_proxies; - delete []m_freeProxies; - delete [] m_pProxies; - - /*int i; - for (i=m_numProxies-1;i>=0;i--) - { - BP_Proxy* proxy = m_pProxies[i]; - destroyProxy(proxy); - } - */ -} - - -BroadphaseProxy* SimpleBroadphase::CreateProxy( const SimdVector3& min, const SimdVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask) -{ - if (m_numProxies >= m_maxProxies) - { - assert(0); - return 0; //should never happen, but don't let the game crash ;-) - } - assert(min[0]<= max[0] && min[1]<= max[1] && min[2]<= max[2]); - - int freeIndex= m_freeProxies[m_firstFreeProxy]; - SimpleBroadphaseProxy* proxy = new (&m_proxies[freeIndex])SimpleBroadphaseProxy(min,max,shapeType,userPtr,collisionFilterGroup,collisionFilterMask); - m_firstFreeProxy++; - - SimpleBroadphaseProxy* proxy1 = &m_proxies[0]; - - int index = proxy - proxy1; - assert(index == freeIndex); - - m_pProxies[m_numProxies] = proxy; - m_numProxies++; - //validate(); - - return proxy; -} - - - -void SimpleBroadphase::DestroyProxy(BroadphaseProxy* proxyOrg) -{ - - int i; - - SimpleBroadphaseProxy* proxy0 = static_cast<SimpleBroadphaseProxy*>(proxyOrg); - SimpleBroadphaseProxy* proxy1 = &m_proxies[0]; - - int index = proxy0 - proxy1; - assert (index < m_maxProxies); - m_freeProxies[--m_firstFreeProxy] = index; - - RemoveOverlappingPairsContainingProxy(proxyOrg); - - - for (i=0;i<m_numProxies;i++) - { - if (m_pProxies[i] == proxyOrg) - { - m_pProxies[i] = m_pProxies[m_numProxies-1]; - break; - } - } - m_numProxies--; - //validate(); - -} - -void SimpleBroadphase::SetAabb(BroadphaseProxy* proxy,const SimdVector3& aabbMin,const SimdVector3& aabbMax) -{ - SimpleBroadphaseProxy* sbp = GetSimpleProxyFromProxy(proxy); - sbp->m_min = aabbMin; - sbp->m_max = aabbMax; -} - - - - - - - - - -bool SimpleBroadphase::AabbOverlap(SimpleBroadphaseProxy* proxy0,SimpleBroadphaseProxy* proxy1) -{ - return proxy0->m_min[0] <= proxy1->m_max[0] && proxy1->m_min[0] <= proxy0->m_max[0] && - proxy0->m_min[1] <= proxy1->m_max[1] && proxy1->m_min[1] <= proxy0->m_max[1] && - proxy0->m_min[2] <= proxy1->m_max[2] && proxy1->m_min[2] <= proxy0->m_max[2]; - -} -void SimpleBroadphase::RefreshOverlappingPairs() -{ - //first check for new overlapping pairs - int i,j; - - for (i=0;i<m_numProxies;i++) - { - BroadphaseProxy* proxy0 = m_pProxies[i]; - for (j=i+1;j<m_numProxies;j++) - { - BroadphaseProxy* proxy1 = m_pProxies[j]; - SimpleBroadphaseProxy* p0 = GetSimpleProxyFromProxy(proxy0); - SimpleBroadphaseProxy* p1 = GetSimpleProxyFromProxy(proxy1); - - if (AabbOverlap(p0,p1)) - { - if ( !FindPair(proxy0,proxy1)) - { - AddOverlappingPair(proxy0,proxy1); - } - } - - } - } - - //then remove non-overlapping ones - for (i=0;i<GetNumOverlappingPairs();i++) - { - BroadphasePair& pair = GetOverlappingPair(i); - - SimpleBroadphaseProxy* proxy0 = GetSimpleProxyFromProxy(pair.m_pProxy0); - SimpleBroadphaseProxy* proxy1 = GetSimpleProxyFromProxy(pair.m_pProxy1); - if (!AabbOverlap(proxy0,proxy1)) - { - RemoveOverlappingPair(pair); - } - } - - - -} - - diff --git a/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.h b/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.h deleted file mode 100644 index e67c7105687..00000000000 --- a/extern/bullet/Bullet/BroadphaseCollision/SimpleBroadphase.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SIMPLE_BROADPHASE_H -#define SIMPLE_BROADPHASE_H - - -#include "OverlappingPairCache.h" - - -struct SimpleBroadphaseProxy : public BroadphaseProxy -{ - SimdVector3 m_min; - SimdVector3 m_max; - - SimpleBroadphaseProxy() {}; - - SimpleBroadphaseProxy(const SimdPoint3& minpt,const SimdPoint3& maxpt,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask) - :BroadphaseProxy(userPtr,collisionFilterGroup,collisionFilterMask), - m_min(minpt),m_max(maxpt) - { - } - - -}; - -///SimpleBroadphase is a brute force aabb culling broadphase based on O(n^2) aabb checks -class SimpleBroadphase : public OverlappingPairCache -{ - - SimpleBroadphaseProxy* m_proxies; - int* m_freeProxies; - int m_firstFreeProxy; - - SimpleBroadphaseProxy** m_pProxies; - int m_numProxies; - - - - int m_maxProxies; - - - inline SimpleBroadphaseProxy* GetSimpleProxyFromProxy(BroadphaseProxy* proxy) - { - SimpleBroadphaseProxy* proxy0 = static_cast<SimpleBroadphaseProxy*>(proxy); - return proxy0; - } - - bool AabbOverlap(SimpleBroadphaseProxy* proxy0,SimpleBroadphaseProxy* proxy1); - - void validate(); - -protected: - - - virtual void RefreshOverlappingPairs(); -public: - SimpleBroadphase(int maxProxies=4096,int maxOverlap=8192); - virtual ~SimpleBroadphase(); - - - virtual BroadphaseProxy* CreateProxy( const SimdVector3& min, const SimdVector3& max,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask); - - - virtual void DestroyProxy(BroadphaseProxy* proxy); - virtual void SetAabb(BroadphaseProxy* proxy,const SimdVector3& aabbMin,const SimdVector3& aabbMax); - - - - - - -}; - - - -#endif //SIMPLE_BROADPHASE_H - diff --git a/extern/bullet/Bullet/Bullet3.dsp b/extern/bullet/Bullet/Bullet3.dsp deleted file mode 100644 index 2e4ffaf6738..00000000000 --- a/extern/bullet/Bullet/Bullet3.dsp +++ /dev/null @@ -1,412 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Bullet" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=Bullet - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Bullet3.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Bullet3.mak" CFG="Bullet - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Bullet - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "Bullet - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Bullet - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -MTL=midl.exe -LINK32=link.exe -lib -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /Zd /O2 /I "../LinearMath" /I "." /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "BUM_INLINED" /D "USE_ALGEBRAIC" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "Bullet - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -MTL=midl.exe -LINK32=link.exe -lib -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../LinearMath" /I "." /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "BUM_INLINED" /D "USE_ALGEBRAIC" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "Bullet - Win32 Release" -# Name "Bullet - Win32 Debug" -# Begin Group "NarrowPhaseCollision" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_Collidable.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_Collidable.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_CollisionPair.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_CollisionPair.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_EdgeEdge.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_EdgeEdge.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_MotionStateInterface.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_PolynomialSolverInterface.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_Screwing.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_Screwing.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_StaticMotionState.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_VertexPoly.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\BU_VertexPoly.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\CollisionMargin.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ContinuousConvexCollision.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ContinuousConvexCollision.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ConvexCast.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ConvexCast.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ConvexPenetrationDepthSolver.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\DiscreteCollisionDetectorInterface.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\GjkConvexCast.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\GjkConvexCast.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\GjkPairDetector.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\GjkPairDetector.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\ManifoldPoint.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\PersistentManifold.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\PersistentManifold.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\PointCollector.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\RaycastCallback.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\RaycastCallback.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\SimplexSolverInterface.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\SubSimplexConvexCast.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\SubSimplexConvexCast.h -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\VoronoiSimplexSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\NarrowPhaseCollision\VoronoiSimplexSolver.h -# End Source File -# End Group -# Begin Group "BroadphaseCollision" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\BroadphaseCollision\BroadPhaseInterface.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\BroadphaseProxy.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\BroadphaseProxy.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\CollisionAlgorithm.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\CollisionAlgorithm.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\CollisionDispatcher.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\CollisionDispatcher.h -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\SimpleBroadphase.cpp -# End Source File -# Begin Source File - -SOURCE=.\BroadphaseCollision\SimpleBroadphase.h -# End Source File -# End Group -# Begin Group "CollisionShapes" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\CollisionShapes\BoxShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\BoxShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CollisionShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CollisionShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConeShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConeShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexHullShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexHullShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\ConvexShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CylinderShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\CylinderShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\MinkowskiSumShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\MinkowskiSumShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\MultiSphereShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\MultiSphereShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\PolyhedralConvexShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\PolyhedralConvexShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\Simplex1to4Shape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\Simplex1to4Shape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\SphereShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\SphereShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\StridingMeshInterface.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\StridingMeshInterface.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleCallback.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleMesh.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleMesh.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleMeshShape.cpp -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleMeshShape.h -# End Source File -# Begin Source File - -SOURCE=.\CollisionShapes\TriangleShape.h -# End Source File -# End Group -# End Target -# End Project diff --git a/extern/bullet/Bullet/Bullet3_vc7.vcproj b/extern/bullet/Bullet/Bullet3_vc7.vcproj deleted file mode 100644 index 933b00fa238..00000000000 --- a/extern/bullet/Bullet/Bullet3_vc7.vcproj +++ /dev/null @@ -1,517 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="Bullet3ContinuousCollision" - ProjectGUID="{FFD3C64A-30E2-4BC7-BC8F-51818C320400}" - SccProjectName="" - SccLocalPath=""> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory=".\Debug" - IntermediateDirectory=".\Debug" - ConfigurationType="4" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\LinearMath" - PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="2" - PrecompiledHeaderFile=".\Debug/Bullet.pch" - AssemblerListingLocation=".\Debug/" - ObjectFile=".\Debug/" - ProgramDataBaseFileName=".\Debug/" - WarningLevel="3" - SuppressStartupBanner="TRUE" - DebugInformationFormat="4" - CompileAs="0"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile=".\Debug\Bullet.lib" - SuppressStartupBanner="TRUE"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG" - Culture="1033"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory=".\Release" - IntermediateDirectory=".\Release" - ConfigurationType="4" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - InlineFunctionExpansion="1" - AdditionalIncludeDirectories=".;..\LinearMath" - PreprocessorDefinitions="NDEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC" - StringPooling="TRUE" - RuntimeLibrary="4" - EnableFunctionLevelLinking="TRUE" - UsePrecompiledHeader="2" - PrecompiledHeaderFile=".\Release/Bullet.pch" - AssemblerListingLocation=".\Release/" - ObjectFile=".\Release/" - ProgramDataBaseFileName=".\Release/" - WarningLevel="3" - SuppressStartupBanner="TRUE" - DebugInformationFormat="2" - CompileAs="0"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\build\msvc_7\libs\extern\Bullet.lib" - SuppressStartupBanner="TRUE"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG" - Culture="1033"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="NarrowPhaseCollision" - Filter=""> - <File - RelativePath=".\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_Collidable.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_Collidable.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_CollisionPair.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_CollisionPair.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_EdgeEdge.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_EdgeEdge.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_MotionStateInterface.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_PolynomialSolverInterface.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_Screwing.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_Screwing.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_StaticMotionState.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_VertexPoly.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_VertexPoly.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\CollisionMargin.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\ContinuousConvexCollision.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\ContinuousConvexCollision.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\ConvexCast.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\ConvexPenetrationDepthSolver.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\DiscreteCollisionDetectorInterface.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\GjkConvexCast.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\GjkConvexCast.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\GjkPairDetector.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\GjkPairDetector.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\ManifoldContactAddResult.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\ManifoldContactAddResult.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\ManifoldPoint.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\PersistentManifold.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\PersistentManifold.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\PointCollector.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\RaycastCallback.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\RaycastCallback.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\SimplexSolverInterface.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\SubSimplexConvexCast.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\SubSimplexConvexCast.h"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\VoronoiSimplexSolver.cpp"> - </File> - <File - RelativePath=".\NarrowPhaseCollision\VoronoiSimplexSolver.h"> - </File> - </Filter> - <Filter - Name="CollisionShapes" - Filter=""> - <File - RelativePath=".\CollisionShapes\BoxShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\BoxShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\BvhTriangleMeshShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\BvhTriangleMeshShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\CollisionShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\CollisionShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\ConeShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\ConeShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\ConvexHullShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\ConvexHullShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\ConvexShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\ConvexShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\ConvexTriangleCallback.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\ConvexTriangleCallback.h"> - </File> - <File - RelativePath=".\CollisionShapes\CylinderShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\CylinderShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\MinkowskiSumShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\MinkowskiSumShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\MultiSphereShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\MultiSphereShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\OptimizedBvh.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\OptimizedBvh.h"> - </File> - <File - RelativePath=".\CollisionShapes\PolyhedralConvexShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\PolyhedralConvexShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\Simplex1to4Shape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\Simplex1to4Shape.h"> - </File> - <File - RelativePath=".\CollisionShapes\SphereShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\SphereShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\StridingMeshInterface.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\StridingMeshInterface.h"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleCallback.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleCallback.h"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleIndexVertexArray.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleIndexVertexArray.h"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleMesh.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleMesh.h"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleMeshShape.cpp"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleMeshShape.h"> - </File> - <File - RelativePath=".\CollisionShapes\TriangleShape.h"> - </File> - </Filter> - <Filter - Name="BroadphaseCollision" - Filter=""> - <File - RelativePath=".\BroadphaseCollision\AxisSweep3.cpp"> - </File> - <File - RelativePath=".\BroadphaseCollision\AxisSweep3.h"> - </File> - <File - RelativePath=".\BroadphaseCollision\BroadPhaseInterface.h"> - </File> - <File - RelativePath=".\BroadphaseCollision\BroadphaseProxy.cpp"> - </File> - <File - RelativePath=".\BroadphaseCollision\BroadphaseProxy.h"> - </File> - <File - RelativePath=".\BroadphaseCollision\CollisionAlgorithm.cpp"> - </File> - <File - RelativePath=".\BroadphaseCollision\CollisionAlgorithm.h"> - </File> - <File - RelativePath=".\BroadphaseCollision\Dispatcher.cpp"> - </File> - <File - RelativePath=".\BroadphaseCollision\Dispatcher.h"> - </File> - <File - RelativePath=".\BroadphaseCollision\SimpleBroadphase.cpp"> - </File> - <File - RelativePath=".\BroadphaseCollision\SimpleBroadphase.h"> - </File> - </Filter> - <Filter - Name="LinearAlgebra" - Filter=""> - <File - RelativePath="..\LinearMath\AabbUtil2.h"> - </File> - <File - RelativePath="..\LinearMath\GEN_List.h"> - </File> - <File - RelativePath="..\LinearMath\GEN_MinMax.h"> - </File> - <File - RelativePath="..\LinearMath\GEN_random.h"> - </File> - <File - RelativePath="..\LinearMath\SimdMatrix3x3.h"> - </File> - <File - RelativePath="..\LinearMath\SimdMinMax.h"> - </File> - <File - RelativePath="..\LinearMath\SimdPoint3.h"> - </File> - <File - RelativePath="..\LinearMath\SimdQuadword.h"> - </File> - <File - RelativePath="..\LinearMath\SimdQuaternion.h"> - </File> - <File - RelativePath="..\LinearMath\SimdScalar.h"> - </File> - <File - RelativePath="..\LinearMath\SimdTransform.h"> - </File> - <File - RelativePath="..\LinearMath\SimdTransformUtil.h"> - </File> - <File - RelativePath="..\LinearMath\SimdVector3.h"> - </File> - </Filter> - <Filter - Name="CollisionDispatch" - Filter=""> - <File - RelativePath=".\CollisionDispatch\CollisionDispatcher.cpp"> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath=".\CollisionDispatch\CollisionDispatcher.h"> - </File> - <File - RelativePath=".\CollisionDispatch\CollisionObject.cpp"> - </File> - <File - RelativePath=".\CollisionDispatch\CollisionObject.h"> - </File> - <File - RelativePath=".\CollisionDispatch\CollisionWorld.cpp"> - </File> - <File - RelativePath=".\CollisionDispatch\CollisionWorld.h"> - </File> - <File - RelativePath=".\CollisionDispatch\ConvexConcaveCollisionAlgorithm.cpp"> - </File> - <File - RelativePath=".\CollisionDispatch\ConvexConcaveCollisionAlgorithm.h"> - </File> - <File - RelativePath=".\CollisionDispatch\ConvexConvexAlgorithm.cpp"> - </File> - <File - RelativePath=".\CollisionDispatch\ConvexConvexAlgorithm.h"> - </File> - <File - RelativePath=".\CollisionDispatch\EmptyCollisionAlgorithm.cpp"> - </File> - <File - RelativePath=".\CollisionDispatch\EmptyCollisionAlgorithm.h"> - </File> - <File - RelativePath=".\CollisionDispatch\ManifoldResult.cpp"> - </File> - <File - RelativePath=".\CollisionDispatch\ManifoldResult.h"> - </File> - <File - RelativePath=".\CollisionDispatch\UnionFind.cpp"> - </File> - <File - RelativePath=".\CollisionDispatch\UnionFind.h"> - </File> - </Filter> - <File - RelativePath=".\NarrowPhaseCollision\ConvexCast.cpp"> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/Bullet/Bullet3_vc8.sln b/extern/bullet/Bullet/Bullet3_vc8.sln deleted file mode 100644 index d95ceb0fbf3..00000000000 --- a/extern/bullet/Bullet/Bullet3_vc8.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bullet3ContinuousCollision", "Bullet3_vc8.vcproj", "{FFD3C64A-30E2-4BC7-BC8F-51818C320400}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Debug|Win32.ActiveCfg = Debug|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Debug|Win32.Build.0 = Debug|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Release|Win32.ActiveCfg = Release|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/extern/bullet/Bullet/Bullet3_vc8.vcproj b/extern/bullet/Bullet/Bullet3_vc8.vcproj deleted file mode 100644 index ff40fb01419..00000000000 --- a/extern/bullet/Bullet/Bullet3_vc8.vcproj +++ /dev/null @@ -1,716 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="Bullet3ContinuousCollision" - ProjectGUID="{FFD3C64A-30E2-4BC7-BC8F-51818C320400}" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory=".\Debug" - IntermediateDirectory=".\Debug" - ConfigurationType="4" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="false" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\LinearMath" - PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC" - ExceptionHandling="0" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - PrecompiledHeaderFile="" - AssemblerListingLocation=".\Debug/" - ObjectFile=".\Debug/" - ProgramDataBaseFileName=".\Debug/" - WarningLevel="3" - SuppressStartupBanner="true" - DebugInformationFormat="4" - CompileAs="0" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG" - Culture="1033" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile=".\Debug\Bullet.lib" - SuppressStartupBanner="true" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory=".\Release" - IntermediateDirectory=".\Release" - ConfigurationType="4" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="false" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - InlineFunctionExpansion="1" - AdditionalIncludeDirectories=".;..\LinearMath" - PreprocessorDefinitions="NDEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC" - StringPooling="true" - RuntimeLibrary="0" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - PrecompiledHeaderFile="" - AssemblerListingLocation=".\Release/" - ObjectFile=".\Release/" - ProgramDataBaseFileName=".\Release/" - WarningLevel="3" - SuppressStartupBanner="true" - DebugInformationFormat="3" - CompileAs="0" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG" - Culture="1033" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile=".\Release\Bullet.lib" - SuppressStartupBanner="true" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="NarrowPhaseCollision" - > - <File - RelativePath=".\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_Collidable.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_Collidable.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_CollisionPair.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_CollisionPair.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_EdgeEdge.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_EdgeEdge.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_MotionStateInterface.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_PolynomialSolverInterface.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_Screwing.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_Screwing.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_StaticMotionState.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_VertexPoly.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\BU_VertexPoly.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\CollisionMargin.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\ContinuousConvexCollision.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\ContinuousConvexCollision.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\ConvexCast.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\ConvexCast.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\ConvexPenetrationDepthSolver.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\DiscreteCollisionDetectorInterface.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\Epa.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\Epa.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\EpaFace.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\EpaFace.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\EpaHalfEdge.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\EpaPenetrationDepthSolver.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\EpaPenetrationDepthSolver.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\EpaPolyhedron.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\EpaPolyhedron.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\EpaVertex.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\GjkConvexCast.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\GjkConvexCast.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\GjkPairDetector.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\GjkPairDetector.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\ManifoldContactAddResult.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\ManifoldContactAddResult.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\ManifoldPoint.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\PersistentManifold.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\PersistentManifold.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\PointCollector.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\RaycastCallback.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\RaycastCallback.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\SimplexSolverInterface.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\SubSimplexConvexCast.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\SubSimplexConvexCast.h" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\VoronoiSimplexSolver.cpp" - > - </File> - <File - RelativePath=".\NarrowPhaseCollision\VoronoiSimplexSolver.h" - > - </File> - </Filter> - <Filter - Name="CollisionShapes" - > - <File - RelativePath=".\CollisionShapes\BoxShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\BoxShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\CollisionShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\CollisionShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\ConeShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\ConeShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\ConvexHullShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\ConvexHullShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\ConvexShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\ConvexShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\CylinderShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\CylinderShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\EmptyShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\EmptyShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\MinkowskiSumShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\MinkowskiSumShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\MultiSphereShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\MultiSphereShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\PolyhedralConvexShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\PolyhedralConvexShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\Simplex1to4Shape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\Simplex1to4Shape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\SphereShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\SphereShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\StridingMeshInterface.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\StridingMeshInterface.h" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleCallback.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleCallback.h" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleMesh.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleMesh.h" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleMeshShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleMeshShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleShape.h" - > - </File> - </Filter> - <Filter - Name="BroadphaseCollision" - > - <File - RelativePath=".\BroadphaseCollision\AxisSweep3.cpp" - > - </File> - <File - RelativePath=".\BroadphaseCollision\AxisSweep3.h" - > - </File> - <File - RelativePath=".\BroadphaseCollision\BroadPhaseInterface.h" - > - </File> - <File - RelativePath=".\BroadphaseCollision\BroadphaseProxy.cpp" - > - </File> - <File - RelativePath=".\BroadphaseCollision\BroadphaseProxy.h" - > - </File> - <File - RelativePath=".\BroadphaseCollision\CollisionAlgorithm.cpp" - > - </File> - <File - RelativePath=".\BroadphaseCollision\CollisionAlgorithm.h" - > - </File> - <File - RelativePath=".\BroadphaseCollision\Dispatcher.cpp" - > - </File> - <File - RelativePath=".\BroadphaseCollision\Dispatcher.h" - > - </File> - <File - RelativePath=".\BroadphaseCollision\SimpleBroadphase.cpp" - > - </File> - <File - RelativePath=".\BroadphaseCollision\SimpleBroadphase.h" - > - </File> - </Filter> - <Filter - Name="LinearAlgebra" - > - <File - RelativePath="..\LinearMath\AabbUtil2.h" - > - </File> - <File - RelativePath="..\LinearMath\GEN_List.h" - > - </File> - <File - RelativePath="..\LinearMath\GEN_MinMax.h" - > - </File> - <File - RelativePath="..\LinearMath\GEN_random.h" - > - </File> - <File - RelativePath="..\LinearMath\IDebugDraw.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdMatrix3x3.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdMinMax.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdPoint3.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdQuadword.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdQuaternion.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdScalar.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdTransform.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdTransformUtil.h" - > - </File> - <File - RelativePath="..\LinearMath\SimdVector3.h" - > - </File> - </Filter> - <Filter - Name="CollisionDispatch" - > - <File - RelativePath=".\CollisionDispatch\CollisionDispatcher.cpp" - > - </File> - <File - RelativePath=".\CollisionDispatch\CollisionDispatcher.h" - > - </File> - <File - RelativePath=".\CollisionDispatch\CollisionObject.cpp" - > - </File> - <File - RelativePath=".\CollisionDispatch\CollisionObject.h" - > - </File> - <File - RelativePath=".\CollisionDispatch\CollisionWorld.cpp" - > - </File> - <File - RelativePath=".\CollisionDispatch\CollisionWorld.h" - > - </File> - <File - RelativePath=".\CollisionDispatch\ConvexConcaveCollisionAlgorithm.cpp" - > - </File> - <File - RelativePath=".\CollisionDispatch\ConvexConcaveCollisionAlgorithm.h" - > - </File> - <File - RelativePath=".\CollisionDispatch\ConvexConvexAlgorithm.cpp" - > - </File> - <File - RelativePath=".\CollisionDispatch\ConvexConvexAlgorithm.h" - > - </File> - <File - RelativePath=".\CollisionDispatch\EmptyCollisionAlgorithm.cpp" - > - </File> - <File - RelativePath=".\CollisionDispatch\EmptyCollisionAlgorithm.h" - > - </File> - <File - RelativePath=".\CollisionDispatch\ManifoldResult.cpp" - > - </File> - <File - RelativePath=".\CollisionDispatch\ManifoldResult.h" - > - </File> - <File - RelativePath=".\CollisionDispatch\UnionFind.cpp" - > - </File> - <File - RelativePath=".\CollisionDispatch\UnionFind.h" - > - </File> - </Filter> - <File - RelativePath=".\CollisionShapes\BvhTriangleMeshShape.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\BvhTriangleMeshShape.h" - > - </File> - <File - RelativePath=".\CollisionShapes\OptimizedBvh.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\OptimizedBvh.h" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleIndexVertexArray.cpp" - > - </File> - <File - RelativePath=".\CollisionShapes\TriangleIndexVertexArray.h" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/Bullet/CollisionDispatch/CollisionCreateFunc.h b/extern/bullet/Bullet/CollisionDispatch/CollisionCreateFunc.h deleted file mode 100644 index 5df073bec87..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CollisionCreateFunc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COLLISION_CREATE_FUNC -#define COLLISION_CREATE_FUNC - -#include <vector> - -typedef std::vector<struct CollisionObject*> CollisionObjectArray; -class CollisionAlgorithm; -struct BroadphaseProxy; - - - -struct CollisionAlgorithmCreateFunc -{ - bool m_swapped; - - CollisionAlgorithmCreateFunc() - :m_swapped(false) - { - } - virtual ~CollisionAlgorithmCreateFunc(){}; - - virtual CollisionAlgorithm* CreateCollisionAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) - { - return 0; - } -}; -#endif //COLLISION_CREATE_FUNC
\ No newline at end of file diff --git a/extern/bullet/Bullet/CollisionDispatch/CollisionDispatcher.cpp b/extern/bullet/Bullet/CollisionDispatch/CollisionDispatcher.cpp deleted file mode 100644 index 06e999fbe0d..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CollisionDispatcher.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "CollisionDispatcher.h" - - -#include "BroadphaseCollision/CollisionAlgorithm.h" -#include "CollisionDispatch/ConvexConvexAlgorithm.h" -#include "CollisionDispatch/EmptyCollisionAlgorithm.h" -#include "CollisionDispatch/ConvexConcaveCollisionAlgorithm.h" -#include "CollisionDispatch/CompoundCollisionAlgorithm.h" -#include "CollisionShapes/CollisionShape.h" -#include "CollisionDispatch/CollisionObject.h" -#include <algorithm> -#include "BroadphaseCollision/OverlappingPairCache.h" - -int gNumManifold = 0; - - - - - -CollisionDispatcher::CollisionDispatcher (): - m_useIslands(true), - m_defaultManifoldResult(0,0,0), - m_count(0) -{ - int i; - - for (i=0;i<MAX_BROADPHASE_COLLISION_TYPES;i++) - { - for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++) - { - m_doubleDispatch[i][j] = 0; - } - } - - -}; - -PersistentManifold* CollisionDispatcher::GetNewManifold(void* b0,void* b1) -{ - gNumManifold++; - - //ASSERT(gNumManifold < 65535); - - - CollisionObject* body0 = (CollisionObject*)b0; - CollisionObject* body1 = (CollisionObject*)b1; - - PersistentManifold* manifold = new PersistentManifold (body0,body1); - m_manifoldsPtr.push_back(manifold); - - return manifold; -} - -void CollisionDispatcher::ClearManifold(PersistentManifold* manifold) -{ - manifold->ClearManifold(); -} - - -void CollisionDispatcher::ReleaseManifold(PersistentManifold* manifold) -{ - - gNumManifold--; - - //printf("ReleaseManifold: gNumManifold %d\n",gNumManifold); - - ClearManifold(manifold); - - std::vector<PersistentManifold*>::iterator i = - std::find(m_manifoldsPtr.begin(), m_manifoldsPtr.end(), manifold); - if (!(i == m_manifoldsPtr.end())) - { - std::swap(*i, m_manifoldsPtr.back()); - m_manifoldsPtr.pop_back(); - delete manifold; - - } - - -} - - - - - -CollisionAlgorithm* CollisionDispatcher::InternalFindAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) -{ - m_count++; - CollisionObject* body0 = (CollisionObject*)proxy0.m_clientObject; - CollisionObject* body1 = (CollisionObject*)proxy1.m_clientObject; - - CollisionAlgorithmConstructionInfo ci; - ci.m_dispatcher = this; - - if (body0->m_collisionShape->IsConvex() && body1->m_collisionShape->IsConvex() ) - { - return new ConvexConvexAlgorithm(0,ci,&proxy0,&proxy1); - } - - if (body0->m_collisionShape->IsConvex() && body1->m_collisionShape->IsConcave()) - { - return new ConvexConcaveCollisionAlgorithm(ci,&proxy0,&proxy1); - } - - if (body1->m_collisionShape->IsConvex() && body0->m_collisionShape->IsConcave()) - { - return new ConvexConcaveCollisionAlgorithm(ci,&proxy1,&proxy0); - } - - if (body0->m_collisionShape->IsCompound()) - { - return new CompoundCollisionAlgorithm(ci,&proxy0,&proxy1); - } else - { - if (body1->m_collisionShape->IsCompound()) - { - return new CompoundCollisionAlgorithm(ci,&proxy1,&proxy0); - } - } - - //failed to find an algorithm - return new EmptyAlgorithm(ci); - -} - -bool CollisionDispatcher::NeedsResponse(const CollisionObject& colObj0,const CollisionObject& colObj1) -{ - - - //here you can do filtering - bool hasResponse = - (!(colObj0.m_collisionFlags & CollisionObject::noContactResponse)) && - (!(colObj1.m_collisionFlags & CollisionObject::noContactResponse)); - hasResponse = hasResponse && - (colObj0.IsActive() || colObj1.IsActive()); - return hasResponse; -} - -bool CollisionDispatcher::NeedsCollision(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) -{ - - CollisionObject* body0 = (CollisionObject*)proxy0.m_clientObject; - CollisionObject* body1 = (CollisionObject*)proxy1.m_clientObject; - - assert(body0); - assert(body1); - - bool needsCollision = true; - - if ((body0->m_collisionFlags & CollisionObject::isStatic) && - (body1->m_collisionFlags & CollisionObject::isStatic)) - needsCollision = false; - - if ((!body0->IsActive()) && (!body1->IsActive())) - needsCollision = false; - - return needsCollision ; - -} - -///allows the user to get contact point callbacks -ManifoldResult* CollisionDispatcher::GetNewManifoldResult(CollisionObject* obj0,CollisionObject* obj1,PersistentManifold* manifold) -{ - - - //in-place, this prevents parallel dispatching, but just adding a list would fix that. - ManifoldResult* manifoldResult = new (&m_defaultManifoldResult) ManifoldResult(obj0,obj1,manifold); - return manifoldResult; -} - -///allows the user to get contact point callbacks -void CollisionDispatcher::ReleaseManifoldResult(ManifoldResult*) -{ - -} - - -void CollisionDispatcher::DispatchAllCollisionPairs(BroadphasePair* pairs,int numPairs,DispatcherInfo& dispatchInfo) -{ - //m_blockedForChanges = true; - - int i; - - int dispatcherId = GetUniqueId(); - - - - for (i=0;i<numPairs;i++) - { - - BroadphasePair& pair = pairs[i]; - - if (dispatcherId>= 0) - { - //dispatcher will keep algorithms persistent in the collision pair - if (!pair.m_algorithms[dispatcherId]) - { - pair.m_algorithms[dispatcherId] = FindAlgorithm( - *pair.m_pProxy0, - *pair.m_pProxy1); - } - - if (pair.m_algorithms[dispatcherId]) - { - if (dispatchInfo.m_dispatchFunc == DispatcherInfo::DISPATCH_DISCRETE) - { - pair.m_algorithms[dispatcherId]->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo); - } else - { - float toi = pair.m_algorithms[dispatcherId]->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo); - if (dispatchInfo.m_timeOfImpact > toi) - dispatchInfo.m_timeOfImpact = toi; - - } - } - } else - { - //non-persistent algorithm dispatcher - CollisionAlgorithm* algo = FindAlgorithm( - *pair.m_pProxy0, - *pair.m_pProxy1); - - if (algo) - { - if (dispatchInfo.m_dispatchFunc == DispatcherInfo::DISPATCH_DISCRETE) - { - algo->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo); - } else - { - float toi = algo->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo); - if (dispatchInfo.m_timeOfImpact > toi) - dispatchInfo.m_timeOfImpact = toi; - } - } - } - - } - - //m_blockedForChanges = false; - -}
\ No newline at end of file diff --git a/extern/bullet/Bullet/CollisionDispatch/CollisionDispatcher.h b/extern/bullet/Bullet/CollisionDispatch/CollisionDispatcher.h deleted file mode 100644 index 773978b9218..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CollisionDispatcher.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COLLISION__DISPATCHER_H -#define COLLISION__DISPATCHER_H - -#include "BroadphaseCollision/Dispatcher.h" -#include "NarrowPhaseCollision/PersistentManifold.h" - -#include "CollisionDispatch/ManifoldResult.h" - -#include "BroadphaseCollision/BroadphaseProxy.h" - - -class IDebugDraw; -class OverlappingPairCache; - - -#include "CollisionCreateFunc.h" - - - - -///CollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs. -///Time of Impact, Closest Points and Penetration Depth. -class CollisionDispatcher : public Dispatcher -{ - - std::vector<PersistentManifold*> m_manifoldsPtr; - - - - bool m_useIslands; - - ManifoldResult m_defaultManifoldResult; - - CollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLLISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES]; - -public: - - - - - - - int GetNumManifolds() const - { - return m_manifoldsPtr.size(); - } - - PersistentManifold* GetManifoldByIndexInternal(int index) - { - return m_manifoldsPtr[index]; - } - - const PersistentManifold* GetManifoldByIndexInternal(int index) const - { - return m_manifoldsPtr[index]; - } - - int m_count; - - CollisionDispatcher (); - virtual ~CollisionDispatcher() {}; - - virtual PersistentManifold* GetNewManifold(void* b0,void* b1); - - virtual void ReleaseManifold(PersistentManifold* manifold); - - - ///allows the user to get contact point callbacks - virtual ManifoldResult* GetNewManifoldResult(CollisionObject* obj0,CollisionObject* obj1,PersistentManifold* manifold); - - ///allows the user to get contact point callbacks - virtual void ReleaseManifoldResult(ManifoldResult*); - - virtual void ClearManifold(PersistentManifold* manifold); - - - CollisionAlgorithm* FindAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) - { - CollisionAlgorithm* algo = InternalFindAlgorithm(proxy0,proxy1); - return algo; - } - - CollisionAlgorithm* InternalFindAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1); - - virtual bool NeedsCollision(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1); - - virtual bool NeedsResponse(const CollisionObject& colObj0,const CollisionObject& colObj1); - - virtual int GetUniqueId() { return RIGIDBODY_DISPATCHER;} - - virtual void DispatchAllCollisionPairs(BroadphasePair* pairs,int numPairs,DispatcherInfo& dispatchInfo); - - - -}; - -#endif //COLLISION__DISPATCHER_H - diff --git a/extern/bullet/Bullet/CollisionDispatch/CollisionObject.cpp b/extern/bullet/Bullet/CollisionDispatch/CollisionObject.cpp deleted file mode 100644 index a96707f5e86..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CollisionObject.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CollisionObject.h" - -CollisionObject::CollisionObject() - : m_collisionFlags(0), - m_activationState1(1), - m_deactivationTime(0.f), - m_broadphaseHandle(0), - m_collisionShape(0), - m_hitFraction(1.f), - m_ccdSweptShereRadius(0.f), - m_ccdSquareMotionTreshold(0.f) -{ - m_cachedInvertedWorldTransform.setIdentity(); - -} - - -void CollisionObject::SetActivationState(int newState) -{ - if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION)) - m_activationState1 = newState; -} - -void CollisionObject::ForceActivationState(int newState) -{ - m_activationState1 = newState; -} - -void CollisionObject::activate() -{ - if (!(m_collisionFlags & isStatic)) - { - SetActivationState(1); - m_deactivationTime = 0.f; - } -} - -bool CollisionObject::mergesSimulationIslands() const -{ - return ( !(m_collisionFlags & isStatic)); -} diff --git a/extern/bullet/Bullet/CollisionDispatch/CollisionObject.h b/extern/bullet/Bullet/CollisionDispatch/CollisionObject.h deleted file mode 100644 index da4e9b934f5..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CollisionObject.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COLLISION_OBJECT_H -#define COLLISION_OBJECT_H - -#include "SimdTransform.h" - -//island management, m_activationState1 -#define ACTIVE_TAG 1 -#define ISLAND_SLEEPING 2 -#define WANTS_DEACTIVATION 3 -#define DISABLE_DEACTIVATION 4 -#define DISABLE_SIMULATION 5 - -struct BroadphaseProxy; -class CollisionShape; - -/// CollisionObject can be used to manage collision detection objects. -/// CollisionObject maintains all information that is needed for a collision detection: Shape, Transform and AABB proxy. -/// They can be added to the CollisionWorld. -struct CollisionObject -{ - SimdTransform m_worldTransform; - - //m_interpolationWorldTransform is used for CCD and interpolation - //it can be either previous or future (predicted) transform - SimdTransform m_interpolationWorldTransform; - - SimdTransform m_cachedInvertedWorldTransform; - - enum CollisionFlags - { - isStatic = 1, - noContactResponse = 2, - customMaterialCallback = 4,//this allows per-triangle material (friction/restitution) - }; - - int m_collisionFlags; - - int m_islandTag1; - int m_activationState1; - float m_deactivationTime; - - SimdScalar m_friction; - SimdScalar m_restitution; - - BroadphaseProxy* m_broadphaseHandle; - CollisionShape* m_collisionShape; - - void* m_userPointer;//not use by Bullet internally - - ///time of impact calculation - float m_hitFraction; - - ///Swept sphere radius (0.0 by default), see ConvexConvexAlgorithm:: - float m_ccdSweptShereRadius; - - /// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionTreshold - float m_ccdSquareMotionTreshold; - - bool mergesSimulationIslands() const; - - inline bool IsStatic() const { - return m_collisionFlags & isStatic; - } - - inline bool HasContactResponse() { - return !(m_collisionFlags & noContactResponse); - } - - - - - CollisionObject(); - - - void SetCollisionShape(CollisionShape* collisionShape) - { - m_collisionShape = collisionShape; - } - - int GetActivationState() const { return m_activationState1;} - - void SetActivationState(int newState); - - void ForceActivationState(int newState); - - void activate(); - - inline bool IsActive() const - { - return ((GetActivationState() != ISLAND_SLEEPING) && (GetActivationState() != DISABLE_SIMULATION)); - } - - void setRestitution(float rest) - { - m_restitution = rest; - } - float getRestitution() const - { - return m_restitution; - } - void setFriction(float frict) - { - m_friction = frict; - } - float getFriction() const - { - return m_friction; - } - - -}; - -#endif //COLLISION_OBJECT_H diff --git a/extern/bullet/Bullet/CollisionDispatch/CollisionWorld.cpp b/extern/bullet/Bullet/CollisionDispatch/CollisionWorld.cpp deleted file mode 100644 index bc4413c3427..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CollisionWorld.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CollisionWorld.h" -#include "CollisionDispatcher.h" -#include "CollisionDispatch/CollisionObject.h" -#include "CollisionShapes/CollisionShape.h" -#include "CollisionShapes/SphereShape.h" //for raycasting -#include "CollisionShapes/TriangleMeshShape.h" //for raycasting -#include "NarrowPhaseCollision/RaycastCallback.h" -#include "CollisionShapes/CompoundShape.h" - -#include "NarrowPhaseCollision/SubSimplexConvexCast.h" -#include "BroadphaseCollision/BroadphaseInterface.h" -#include "AabbUtil2.h" - -#include <algorithm> - -CollisionWorld::~CollisionWorld() -{ - //clean up remaining objects - std::vector<CollisionObject*>::iterator i; - - int index = 0; - for (i=m_collisionObjects.begin(); - !(i==m_collisionObjects.end()); i++) - - { - CollisionObject* collisionObject= (*i); - - BroadphaseProxy* bp = collisionObject->m_broadphaseHandle; - if (bp) - { - // - // only clear the cached algorithms - // - GetBroadphase()->CleanProxyFromPairs(bp); - GetBroadphase()->DestroyProxy(bp); - } - } - -} - - - - - - - - - - -void CollisionWorld::AddCollisionObject(CollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask) -{ - m_collisionObjects.push_back(collisionObject); - - //calculate new AABB - SimdTransform trans = collisionObject->m_worldTransform; - - SimdVector3 minAabb; - SimdVector3 maxAabb; - collisionObject->m_collisionShape->GetAabb(trans,minAabb,maxAabb); - - int type = collisionObject->m_collisionShape->GetShapeType(); - collisionObject->m_broadphaseHandle = GetBroadphase()->CreateProxy( - minAabb, - maxAabb, - type, - collisionObject, - collisionFilterGroup, - collisionFilterMask - ); - - - - -} - -void CollisionWorld::PerformDiscreteCollisionDetection() -{ - DispatcherInfo dispatchInfo; - dispatchInfo.m_timeStep = 0.f; - dispatchInfo.m_stepCount = 0; - - //update aabb (of all moved objects) - - SimdVector3 aabbMin,aabbMax; - for (size_t i=0;i<m_collisionObjects.size();i++) - { - m_collisionObjects[i]->m_collisionShape->GetAabb(m_collisionObjects[i]->m_worldTransform,aabbMin,aabbMax); - m_pairCache->SetAabb(m_collisionObjects[i]->m_broadphaseHandle,aabbMin,aabbMax); - } - - Dispatcher* dispatcher = GetDispatcher(); - if (dispatcher) - dispatcher->DispatchAllCollisionPairs(&m_pairCache->GetOverlappingPair(0),m_pairCache->GetNumOverlappingPairs(),dispatchInfo); - -} - - -void CollisionWorld::RemoveCollisionObject(CollisionObject* collisionObject) -{ - - - //bool removeFromBroadphase = false; - - { - - BroadphaseProxy* bp = collisionObject->m_broadphaseHandle; - if (bp) - { - // - // only clear the cached algorithms - // - GetBroadphase()->CleanProxyFromPairs(bp); - GetBroadphase()->DestroyProxy(bp); - collisionObject->m_broadphaseHandle = 0; - } - } - - - std::vector<CollisionObject*>::iterator i = std::find(m_collisionObjects.begin(), m_collisionObjects.end(), collisionObject); - - if (!(i == m_collisionObjects.end())) - { - std::swap(*i, m_collisionObjects.back()); - m_collisionObjects.pop_back(); - } -} - -void RayTestSingle(const SimdTransform& rayFromTrans,const SimdTransform& rayToTrans, - CollisionObject* collisionObject, - const CollisionShape* collisionShape, - const SimdTransform& colObjWorldTransform, - CollisionWorld::RayResultCallback& resultCallback) -{ - - SphereShape pointShape(0.0f); - - if (collisionShape->IsConvex()) - { - ConvexCast::CastResult castResult; - castResult.m_fraction = 1.f;//?? - - ConvexShape* convexShape = (ConvexShape*) collisionShape; - VoronoiSimplexSolver simplexSolver; - SubsimplexConvexCast convexCaster(&pointShape,convexShape,&simplexSolver); - //GjkConvexCast convexCaster(&pointShape,convexShape,&simplexSolver); - //ContinuousConvexCollision convexCaster(&pointShape,convexShape,&simplexSolver,0); - - if (convexCaster.calcTimeOfImpact(rayFromTrans,rayToTrans,colObjWorldTransform,colObjWorldTransform,castResult)) - { - //add hit - if (castResult.m_normal.length2() > 0.0001f) - { - castResult.m_normal.normalize(); - if (castResult.m_fraction < resultCallback.m_closestHitFraction) - { - - - CollisionWorld::LocalRayResult localRayResult - ( - collisionObject, - 0, - castResult.m_normal, - castResult.m_fraction - ); - - resultCallback.AddSingleResult(localRayResult); - - } - } - } - } - else - { - - if (collisionShape->IsConcave()) - { - - TriangleMeshShape* triangleMesh = (TriangleMeshShape*)collisionShape; - - SimdTransform worldTocollisionObject = colObjWorldTransform.inverse(); - - SimdVector3 rayFromLocal = worldTocollisionObject * rayFromTrans.getOrigin(); - SimdVector3 rayToLocal = worldTocollisionObject * rayToTrans.getOrigin(); - - //ConvexCast::CastResult - - struct BridgeTriangleRaycastCallback : public TriangleRaycastCallback - { - CollisionWorld::RayResultCallback* m_resultCallback; - CollisionObject* m_collisionObject; - TriangleMeshShape* m_triangleMesh; - - BridgeTriangleRaycastCallback( const SimdVector3& from,const SimdVector3& to, - CollisionWorld::RayResultCallback* resultCallback, CollisionObject* collisionObject,TriangleMeshShape* triangleMesh): - TriangleRaycastCallback(from,to), - m_resultCallback(resultCallback), - m_collisionObject(collisionObject), - m_triangleMesh(triangleMesh) - { - } - - - virtual float ReportHit(const SimdVector3& hitNormalLocal, float hitFraction, int partId, int triangleIndex ) - { - CollisionWorld::LocalShapeInfo shapeInfo; - shapeInfo.m_shapePart = partId; - shapeInfo.m_triangleIndex = triangleIndex; - - CollisionWorld::LocalRayResult rayResult - (m_collisionObject, - &shapeInfo, - hitNormalLocal, - hitFraction); - - return m_resultCallback->AddSingleResult(rayResult); - - - } - - }; - - - BridgeTriangleRaycastCallback rcb(rayFromLocal,rayToLocal,&resultCallback,collisionObject,triangleMesh); - rcb.m_hitFraction = resultCallback.m_closestHitFraction; - - SimdVector3 rayAabbMinLocal = rayFromLocal; - rayAabbMinLocal.setMin(rayToLocal); - SimdVector3 rayAabbMaxLocal = rayFromLocal; - rayAabbMaxLocal.setMax(rayToLocal); - - triangleMesh->ProcessAllTriangles(&rcb,rayAabbMinLocal,rayAabbMaxLocal); - - } else - { - //todo: use AABB tree or other BVH acceleration structure! - if (collisionShape->IsCompound()) - { - const CompoundShape* compoundShape = static_cast<const CompoundShape*>(collisionShape); - int i=0; - for (i=0;i<compoundShape->GetNumChildShapes();i++) - { - SimdTransform childTrans = compoundShape->GetChildTransform(i); - const CollisionShape* childCollisionShape = compoundShape->GetChildShape(i); - SimdTransform childWorldTrans = colObjWorldTransform * childTrans; - RayTestSingle(rayFromTrans,rayToTrans, - collisionObject, - childCollisionShape, - childWorldTrans, - resultCallback); - - } - - - } - } - } -} - -void CollisionWorld::RayTest(const SimdVector3& rayFromWorld, const SimdVector3& rayToWorld, RayResultCallback& resultCallback) -{ - - - SimdTransform rayFromTrans,rayToTrans; - rayFromTrans.setIdentity(); - rayFromTrans.setOrigin(rayFromWorld); - rayToTrans.setIdentity(); - - rayToTrans.setOrigin(rayToWorld); - - //do culling based on aabb (rayFrom/rayTo) - SimdVector3 rayAabbMin = rayFromWorld; - SimdVector3 rayAabbMax = rayFromWorld; - rayAabbMin.setMin(rayToWorld); - rayAabbMax.setMax(rayToWorld); - - - /// brute force go over all objects. Once there is a broadphase, use that, or - /// add a raycast against aabb first. - - std::vector<CollisionObject*>::iterator iter; - - for (iter=m_collisionObjects.begin(); - !(iter==m_collisionObjects.end()); iter++) - { - - CollisionObject* collisionObject= (*iter); - - //RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject(); - SimdVector3 collisionObjectAabbMin,collisionObjectAabbMax; - collisionObject->m_collisionShape->GetAabb(collisionObject->m_worldTransform,collisionObjectAabbMin,collisionObjectAabbMax); - - //check aabb overlap - - if (TestAabbAgainstAabb2(rayAabbMin,rayAabbMax,collisionObjectAabbMin,collisionObjectAabbMax)) - { - RayTestSingle(rayFromTrans,rayToTrans, - collisionObject, - collisionObject->m_collisionShape, - collisionObject->m_worldTransform, - resultCallback); - - } - } - -} diff --git a/extern/bullet/Bullet/CollisionDispatch/CollisionWorld.h b/extern/bullet/Bullet/CollisionDispatch/CollisionWorld.h deleted file mode 100644 index 8414ba4e459..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CollisionWorld.h +++ /dev/null @@ -1,230 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -/** - * @mainpage Bullet Documentation - * - * @section intro_sec Introduction - * Bullet Collision Detection & Physics SDK - * - * Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ). - * - * There is the Physics Forum for Feedback and General Collision Detection and Physics discussions. - * Please visit http://www.continuousphysics.com/Bullet/phpBB2/index.php - * - * @section install_sec Installation - * - * @subsection step1 Step 1: Download - * You can download the Bullet Physics Library from our website: http://www.continuousphysics.com/Bullet/ - * @subsection step2 Step 2: Building - * Bullet comes with autogenerated Project Files for Microsoft Visual Studio 6, 7, 7.1 and 8. - * The main Workspace/Solution is located in Bullet/msvc/8/wksbullet.sln (replace 8 with your version). - * - * Under other platforms, like Linux or Mac OS-X, Bullet can be build using jam, http://www.perforce.com/jam/jam.html . - * Jam is a build system that can build the library, demos and also autogenerate the MSVC Project Files. - * So if you are not using MSVC, you can run configure and jam . - * If you don't have jam installed, you can make jam from the included jam-2.5 sources, or download jam from ftp://ftp.perforce.com/pub/jam/ - * - * @subsection step3 Step 3: Testing demos - * Try to run and experiment with CcdPhysicsDemo executable as a starting point. - * Bullet can be used in several ways, as Full Rigid Body simulation, as Collision Detector Library or Low Level / Snippets like the GJK Closest Point calculation. - * The Dependencies can be seen in this documentation under Directories - * - * @subsection step4 Step 4: Integrating in your application, Full Rigid Body Simulation - * Check out CcdPhysicsDemo how to create a CcdPhysicsEnvironment , CollisionShape and RigidBody, Stepping the simulation and synchronizing your derived version of the PHY_IMotionState class. - * @subsection step5 Step 5 : Integrate the Collision Detection Library (without Dynamics and other Extras) - * Bullet Collision Detection can also be used without the Dynamics/Extras. - * Check out CollisionWorld and CollisionObject, and the CollisionInterfaceDemo. Also in Extras/test_BulletOde.cpp there is a sample Collision Detection integration with Open Dynamics Engine, ODE, http://www.ode.org - * @subsection step6 Step 6 : Use Snippets like the GJK Closest Point calculation. - * Bullet has been designed in a modular way keeping dependencies to a minimum. The ConvexHullDistance demo demonstrates direct use of GjkPairDetector. - * - * @section copyright Copyright - * Copyright (C) 2005-2006 Erwin Coumans, some contributions Copyright Gino van den Bergen, Christer Ericson, Simon Hobbs, Ricardo Padrela, F Richter(res), Stephane Redon - * Special thanks to all visitors of the Bullet Physics forum, and in particular above contributors, Dave Eberle, Dirk Gregorius, Erin Catto, Dave Eberle, Adam Moravanszky, - * Pierre Terdiman, Kenny Erleben, Russell Smith, Oliver Strunk, Jan Paul van Waveren. - * - */ - - - -#ifndef COLLISION_WORLD_H -#define COLLISION_WORLD_H - - -class CollisionShape; -class BroadphaseInterface; -#include "SimdVector3.h" -#include "SimdTransform.h" -#include "CollisionObject.h" -#include "CollisionDispatcher.h" //for definition of CollisionObjectArray -#include "BroadphaseCollision/OverlappingPairCache.h" - -#include <vector> - - - -///CollisionWorld is interface and container for the collision detection -class CollisionWorld -{ - - - - std::vector<CollisionObject*> m_collisionObjects; - - Dispatcher* m_dispatcher1; - - OverlappingPairCache* m_pairCache; - - -public: - - CollisionWorld(Dispatcher* dispatcher,OverlappingPairCache* pairCache) - :m_dispatcher1(dispatcher), - m_pairCache(pairCache) - { - - } - virtual ~CollisionWorld(); - - - BroadphaseInterface* GetBroadphase() - { - return m_pairCache; - } - - OverlappingPairCache* GetPairCache() - { - return m_pairCache; - } - - - Dispatcher* GetDispatcher() - { - return m_dispatcher1; - } - - ///LocalShapeInfo gives extra information for complex shapes - ///Currently, only TriangleMeshShape is available, so it just contains triangleIndex and subpart - struct LocalShapeInfo - { - int m_shapePart; - int m_triangleIndex; - - //const CollisionShape* m_shapeTemp; - //const SimdTransform* m_shapeLocalTransform; - }; - - struct LocalRayResult - { - LocalRayResult(const CollisionObject* collisionObject, - LocalShapeInfo* localShapeInfo, - const SimdVector3& hitNormalLocal, - float hitFraction) - :m_collisionObject(collisionObject), - m_localShapeInfo(m_localShapeInfo), - m_hitNormalLocal(hitNormalLocal), - m_hitFraction(hitFraction) - { - } - - const CollisionObject* m_collisionObject; - LocalShapeInfo* m_localShapeInfo; - const SimdVector3& m_hitNormalLocal; - float m_hitFraction; - - }; - - ///RayResultCallback is used to report new raycast results - struct RayResultCallback - { - virtual ~RayResultCallback() - { - } - float m_closestHitFraction; - bool HasHit() - { - return (m_closestHitFraction < 1.f); - } - - RayResultCallback() - :m_closestHitFraction(1.f) - { - } - virtual float AddSingleResult(const LocalRayResult& rayResult) = 0; - }; - - struct ClosestRayResultCallback : public RayResultCallback - { - ClosestRayResultCallback(SimdVector3 rayFromWorld,SimdVector3 rayToWorld) - :m_rayFromWorld(rayFromWorld), - m_rayToWorld(rayToWorld), - m_collisionObject(0) - { - } - - SimdVector3 m_rayFromWorld;//used to calculate hitPointWorld from hitFraction - SimdVector3 m_rayToWorld; - - SimdVector3 m_hitNormalWorld; - SimdVector3 m_hitPointWorld; - const CollisionObject* m_collisionObject; - - virtual float AddSingleResult(const LocalRayResult& rayResult) - { - -//caller already does the filter on the m_closestHitFraction - assert(rayResult.m_hitFraction <= m_closestHitFraction); - - m_closestHitFraction = rayResult.m_hitFraction; - m_collisionObject = rayResult.m_collisionObject; - m_hitNormalWorld = m_collisionObject->m_worldTransform.getBasis()*rayResult.m_hitNormalLocal; - m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction); - return rayResult.m_hitFraction; - } - }; - - - - - int GetNumCollisionObjects() const - { - return m_collisionObjects.size(); - } - - void RayTest(const SimdVector3& rayFromWorld, const SimdVector3& rayToWorld, RayResultCallback& resultCallback); - - - void AddCollisionObject(CollisionObject* collisionObject,short int collisionFilterGroup=1,short int collisionFilterMask=1); - - CollisionObjectArray& GetCollisionObjectArray() - { - return m_collisionObjects; - } - - const CollisionObjectArray& GetCollisionObjectArray() const - { - return m_collisionObjects; - } - - - void RemoveCollisionObject(CollisionObject* collisionObject); - - virtual void PerformDiscreteCollisionDetection(); - -}; - - -#endif //COLLISION_WORLD_H diff --git a/extern/bullet/Bullet/CollisionDispatch/CompoundCollisionAlgorithm.cpp b/extern/bullet/Bullet/CollisionDispatch/CompoundCollisionAlgorithm.cpp deleted file mode 100644 index 0a79d2b7b91..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CompoundCollisionAlgorithm.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CollisionDispatch/CompoundCollisionAlgorithm.h" -#include "CollisionDispatch/CollisionObject.h" -#include "CollisionShapes/CompoundShape.h" - - -CompoundCollisionAlgorithm::CompoundCollisionAlgorithm( const CollisionAlgorithmConstructionInfo& ci,BroadphaseProxy* proxy0,BroadphaseProxy* proxy1) -:m_dispatcher(ci.m_dispatcher), -m_compoundProxy(*proxy0), -m_otherProxy(*proxy1) -{ - CollisionObject* colObj = static_cast<CollisionObject*>(m_compoundProxy.m_clientObject); - assert (colObj->m_collisionShape->IsCompound()); - - CompoundShape* compoundShape = static_cast<CompoundShape*>(colObj->m_collisionShape); - int numChildren = compoundShape->GetNumChildShapes(); - m_childProxies.resize( numChildren ); - int i; - for (i=0;i<numChildren;i++) - { - m_childProxies[i] = BroadphaseProxy(*proxy0); - } - - m_childCollisionAlgorithms.resize(numChildren); - for (i=0;i<numChildren;i++) - { - CollisionShape* childShape = compoundShape->GetChildShape(i); - CollisionObject* colObj = static_cast<CollisionObject*>(m_childProxies[i].m_clientObject); - CollisionShape* orgShape = colObj->m_collisionShape; - colObj->m_collisionShape = childShape; - m_childCollisionAlgorithms[i] = m_dispatcher->FindAlgorithm(m_childProxies[i],m_otherProxy); - colObj->m_collisionShape =orgShape; - } -} - - -CompoundCollisionAlgorithm::~CompoundCollisionAlgorithm() -{ - int numChildren = m_childCollisionAlgorithms.size(); - int i; - for (i=0;i<numChildren;i++) - { - delete m_childCollisionAlgorithms[i]; - } -} - -void CompoundCollisionAlgorithm::ProcessCollision (BroadphaseProxy* ,BroadphaseProxy* ,const DispatcherInfo& dispatchInfo) -{ - CollisionObject* colObj = static_cast<CollisionObject*>(m_compoundProxy.m_clientObject); - assert (colObj->m_collisionShape->IsCompound()); - - CompoundShape* compoundShape = static_cast<CompoundShape*>(colObj->m_collisionShape); - - //We will use the OptimizedBVH, AABB tree to cull potential child-overlaps - //If both proxies are Compound, we will deal with that directly, by performing sequential/parallel tree traversals - //given Proxy0 and Proxy1, if both have a tree, Tree0 and Tree1, this means: - //determine overlapping nodes of Proxy1 using Proxy0 AABB against Tree1 - //then use each overlapping node AABB against Tree0 - //and vise versa. - - - int numChildren = m_childCollisionAlgorithms.size(); - int i; - for (i=0;i<numChildren;i++) - { - //temporarily exchange parent CollisionShape with childShape, and recurse - CollisionShape* childShape = compoundShape->GetChildShape(i); - CollisionObject* colObj = static_cast<CollisionObject*>(m_childProxies[i].m_clientObject); - - //backup - SimdTransform orgTrans = colObj->m_worldTransform; - CollisionShape* orgShape = colObj->m_collisionShape; - - SimdTransform childTrans = compoundShape->GetChildTransform(i); - SimdTransform newChildWorldTrans = orgTrans*childTrans ; - colObj->m_worldTransform = newChildWorldTrans; - - colObj->m_collisionShape = childShape; - m_childCollisionAlgorithms[i]->ProcessCollision(&m_childProxies[i],&m_otherProxy,dispatchInfo); - //revert back - colObj->m_collisionShape =orgShape; - colObj->m_worldTransform = orgTrans; - } -} - -float CompoundCollisionAlgorithm::CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo) -{ - CollisionObject* colObj = static_cast<CollisionObject*>(m_compoundProxy.m_clientObject); - assert (colObj->m_collisionShape->IsCompound()); - - CompoundShape* compoundShape = static_cast<CompoundShape*>(colObj->m_collisionShape); - - //We will use the OptimizedBVH, AABB tree to cull potential child-overlaps - //If both proxies are Compound, we will deal with that directly, by performing sequential/parallel tree traversals - //given Proxy0 and Proxy1, if both have a tree, Tree0 and Tree1, this means: - //determine overlapping nodes of Proxy1 using Proxy0 AABB against Tree1 - //then use each overlapping node AABB against Tree0 - //and vise versa. - - float hitFraction = 1.f; - - int numChildren = m_childCollisionAlgorithms.size(); - int i; - for (i=0;i<numChildren;i++) - { - //temporarily exchange parent CollisionShape with childShape, and recurse - CollisionShape* childShape = compoundShape->GetChildShape(i); - CollisionObject* colObj = static_cast<CollisionObject*>(m_childProxies[i].m_clientObject); - - //backup - SimdTransform orgTrans = colObj->m_worldTransform; - CollisionShape* orgShape = colObj->m_collisionShape; - - SimdTransform childTrans = compoundShape->GetChildTransform(i); - SimdTransform newChildWorldTrans = orgTrans*childTrans ; - colObj->m_worldTransform = newChildWorldTrans; - - colObj->m_collisionShape = childShape; - float frac = m_childCollisionAlgorithms[i]->CalculateTimeOfImpact(&m_childProxies[i],&m_otherProxy,dispatchInfo); - if (frac<hitFraction) - { - hitFraction = frac; - } - //revert back - colObj->m_collisionShape =orgShape; - colObj->m_worldTransform = orgTrans; - } - return hitFraction; - -}
\ No newline at end of file diff --git a/extern/bullet/Bullet/CollisionDispatch/CompoundCollisionAlgorithm.h b/extern/bullet/Bullet/CollisionDispatch/CompoundCollisionAlgorithm.h deleted file mode 100644 index a41d3a8f455..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/CompoundCollisionAlgorithm.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COMPOUND_COLLISION_ALGORITHM_H -#define COMPOUND_COLLISION_ALGORITHM_H - -#include "BroadphaseCollision/CollisionAlgorithm.h" -#include "BroadphaseCollision/Dispatcher.h" -#include "BroadphaseCollision/BroadphaseInterface.h" - -#include "NarrowPhaseCollision/PersistentManifold.h" -class Dispatcher; -#include "BroadphaseCollision/BroadphaseProxy.h" -#include <vector> - - -/// CompoundCollisionAlgorithm supports collision between CompoundCollisionShapes and other collision shapes -/// Place holder, not fully implemented yet -class CompoundCollisionAlgorithm : public CollisionAlgorithm -{ - BroadphaseProxy m_compoundProxy; - BroadphaseProxy m_otherProxy; - std::vector<BroadphaseProxy> m_childProxies; - std::vector<CollisionAlgorithm*> m_childCollisionAlgorithms; - - Dispatcher* m_dispatcher; - BroadphaseProxy m_compound; - - BroadphaseProxy m_other; - - -public: - - CompoundCollisionAlgorithm( const CollisionAlgorithmConstructionInfo& ci,BroadphaseProxy* proxy0,BroadphaseProxy* proxy1); - - virtual ~CompoundCollisionAlgorithm(); - - virtual void ProcessCollision (BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo); - - float CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo); - -}; - -#endif //COMPOUND_COLLISION_ALGORITHM_H diff --git a/extern/bullet/Bullet/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp b/extern/bullet/Bullet/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp deleted file mode 100644 index 63ed29888ab..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "ConvexConcaveCollisionAlgorithm.h" -#include "CollisionDispatch/CollisionObject.h" -#include "CollisionShapes/MultiSphereShape.h" -#include "ConvexConvexAlgorithm.h" -#include "BroadphaseCollision/BroadphaseProxy.h" -#include "CollisionShapes/ConcaveShape.h" -#include "CollisionDispatch/ManifoldResult.h" -#include "NarrowPhaseCollision/RaycastCallback.h" -#include "CollisionShapes/TriangleShape.h" -#include "CollisionShapes/SphereShape.h" -#include "IDebugDraw.h" -#include "NarrowPhaseCollision/SubSimplexConvexCast.h" - -ConvexConcaveCollisionAlgorithm::ConvexConcaveCollisionAlgorithm( const CollisionAlgorithmConstructionInfo& ci,BroadphaseProxy* proxy0,BroadphaseProxy* proxy1) -: CollisionAlgorithm(ci),m_convex(*proxy0),m_concave(*proxy1), -m_ConvexTriangleCallback(ci.m_dispatcher,proxy0,proxy1) - -{ -} - -ConvexConcaveCollisionAlgorithm::~ConvexConcaveCollisionAlgorithm() -{ -} - - - -ConvexTriangleCallback::ConvexTriangleCallback(Dispatcher* dispatcher,BroadphaseProxy* proxy0,BroadphaseProxy* proxy1): - m_convexProxy(proxy0),m_triangleProxy(*proxy1),m_dispatcher(dispatcher), - m_dispatchInfoPtr(0) -{ - - // - // create the manifold from the dispatcher 'manifold pool' - // - m_manifoldPtr = m_dispatcher->GetNewManifold(proxy0->m_clientObject,proxy1->m_clientObject); - - ClearCache(); -} - -ConvexTriangleCallback::~ConvexTriangleCallback() -{ - ClearCache(); - m_dispatcher->ReleaseManifold( m_manifoldPtr ); - -} - - -void ConvexTriangleCallback::ClearCache() -{ - m_dispatcher->ClearManifold(m_manifoldPtr); -}; - - - -void ConvexTriangleCallback::ProcessTriangle(SimdVector3* triangle,int partId, int triangleIndex) -{ - - //just for debugging purposes - //printf("triangle %d",m_triangleCount++); - - - //aabb filter is already applied! - - CollisionAlgorithmConstructionInfo ci; - ci.m_dispatcher = m_dispatcher; - - CollisionObject* ob = static_cast<CollisionObject*>(m_triangleProxy.m_clientObject); - - - - ///debug drawing of the overlapping triangles - if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && m_dispatchInfoPtr->m_debugDraw->GetDebugMode() > 0) - { - SimdVector3 color(255,255,0); - SimdTransform& tr = ob->m_worldTransform; - m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[0]),tr(triangle[1]),color); - m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[1]),tr(triangle[2]),color); - m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[2]),tr(triangle[0]),color); - - //SimdVector3 center = triangle[0] + triangle[1]+triangle[2]; - //center *= 0.333333f; - //m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[0]),tr(center),color); - //m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[1]),tr(center),color); - //m_dispatchInfoPtr->m_debugDraw->DrawLine(tr(triangle[2]),tr(center),color); - - } - - - CollisionObject* colObj = static_cast<CollisionObject*>(m_convexProxy->m_clientObject); - - if (colObj->m_collisionShape->IsConvex()) - { - TriangleShape tm(triangle[0],triangle[1],triangle[2]); - tm.SetMargin(m_collisionMarginTriangle); - - - CollisionShape* tmpShape = ob->m_collisionShape; - ob->m_collisionShape = &tm; - - ConvexConvexAlgorithm cvxcvxalgo(m_manifoldPtr,ci,m_convexProxy,&m_triangleProxy); - cvxcvxalgo.SetShapeIdentifiers(-1,-1,partId,triangleIndex); - cvxcvxalgo.ProcessCollision(m_convexProxy,&m_triangleProxy,*m_dispatchInfoPtr); - ob->m_collisionShape = tmpShape; - - } - - - -} - - - -void ConvexTriangleCallback::SetTimeStepAndCounters(float collisionMarginTriangle,const DispatcherInfo& dispatchInfo) -{ - m_dispatchInfoPtr = &dispatchInfo; - m_collisionMarginTriangle = collisionMarginTriangle; - - //recalc aabbs - CollisionObject* convexBody = (CollisionObject* )m_convexProxy->m_clientObject; - CollisionObject* triBody = (CollisionObject* )m_triangleProxy.m_clientObject; - - SimdTransform convexInTriangleSpace; - convexInTriangleSpace = triBody->m_worldTransform.inverse() * convexBody->m_worldTransform; - - CollisionShape* convexShape = static_cast<CollisionShape*>(convexBody->m_collisionShape); - //CollisionShape* triangleShape = static_cast<CollisionShape*>(triBody->m_collisionShape); - - convexShape->GetAabb(convexInTriangleSpace,m_aabbMin,m_aabbMax); - - float extraMargin = collisionMarginTriangle;//CONVEX_DISTANCE_MARGIN;//+0.1f; - - SimdVector3 extra(extraMargin,extraMargin,extraMargin); - - m_aabbMax += extra; - m_aabbMin -= extra; - -} - -void ConvexConcaveCollisionAlgorithm::ClearCache() -{ - m_ConvexTriangleCallback.ClearCache(); - -} - -void ConvexConcaveCollisionAlgorithm::ProcessCollision (BroadphaseProxy* ,BroadphaseProxy* ,const DispatcherInfo& dispatchInfo) -{ - - CollisionObject* convexBody = static_cast<CollisionObject* >(m_convex.m_clientObject); - CollisionObject* triBody = static_cast<CollisionObject* >(m_concave.m_clientObject); - - if (triBody->m_collisionShape->IsConcave()) - { - - if (!m_dispatcher->NeedsCollision(m_convex,m_concave)) - return; - - - - CollisionObject* triOb = static_cast<CollisionObject*>(m_concave.m_clientObject); - ConcaveShape* concaveShape = static_cast<ConcaveShape*>( triOb->m_collisionShape); - - if (convexBody->m_collisionShape->IsConvex()) - { - float collisionMarginTriangle = concaveShape->GetMargin(); - - m_ConvexTriangleCallback.SetTimeStepAndCounters(collisionMarginTriangle,dispatchInfo); - - //Disable persistency. previously, some older algorithm calculated all contacts in one go, so you can clear it here. - //m_dispatcher->ClearManifold(m_ConvexTriangleCallback.m_manifoldPtr); - - - m_ConvexTriangleCallback.m_manifoldPtr->SetBodies(m_convex.m_clientObject,m_concave.m_clientObject); - - concaveShape->ProcessAllTriangles( &m_ConvexTriangleCallback,m_ConvexTriangleCallback.GetAabbMin(),m_ConvexTriangleCallback.GetAabbMax()); - - - } - - } - -} - - -float ConvexConcaveCollisionAlgorithm::CalculateTimeOfImpact(BroadphaseProxy* ,BroadphaseProxy* ,const DispatcherInfo& dispatchInfo) -{ - - //quick approximation using raycast, todo: hook up to the continuous collision detection (one of the ConvexCast) - CollisionObject* convexbody = (CollisionObject* )m_convex.m_clientObject; - CollisionObject* triBody = static_cast<CollisionObject* >(m_concave.m_clientObject); - - //only perform CCD above a certain treshold, this prevents blocking on the long run - //because object in a blocked ccd state (hitfraction<1) get their linear velocity halved each frame... - float squareMot0 = (convexbody->m_interpolationWorldTransform.getOrigin() - convexbody->m_worldTransform.getOrigin()).length2(); - if (squareMot0 < convexbody->m_ccdSquareMotionTreshold) - { - return 1.f; - } - - //const SimdVector3& from = convexbody->m_worldTransform.getOrigin(); - //SimdVector3 to = convexbody->m_interpolationWorldTransform.getOrigin(); - //todo: only do if the motion exceeds the 'radius' - - SimdTransform convexFromLocal = triBody->m_cachedInvertedWorldTransform * convexbody->m_worldTransform; - SimdTransform convexToLocal = triBody->m_cachedInvertedWorldTransform * convexbody->m_interpolationWorldTransform; - - struct LocalTriangleSphereCastCallback : public TriangleCallback - { - SimdTransform m_ccdSphereFromTrans; - SimdTransform m_ccdSphereToTrans; - SimdTransform m_meshTransform; - - float m_ccdSphereRadius; - float m_hitFraction; - - - LocalTriangleSphereCastCallback(const SimdTransform& from,const SimdTransform& to,float ccdSphereRadius,float hitFraction) - :m_ccdSphereFromTrans(from), - m_ccdSphereToTrans(to), - m_ccdSphereRadius(ccdSphereRadius), - m_hitFraction(hitFraction) - { - } - - - virtual void ProcessTriangle(SimdVector3* triangle, int partId, int triangleIndex) - { - //do a swept sphere for now - SimdTransform ident; - ident.setIdentity(); - ConvexCast::CastResult castResult; - castResult.m_fraction = m_hitFraction; - SphereShape pointShape(m_ccdSphereRadius); - TriangleShape triShape(triangle[0],triangle[1],triangle[2]); - VoronoiSimplexSolver simplexSolver; - SubsimplexConvexCast convexCaster(&pointShape,&triShape,&simplexSolver); - //GjkConvexCast convexCaster(&pointShape,convexShape,&simplexSolver); - //ContinuousConvexCollision convexCaster(&pointShape,convexShape,&simplexSolver,0); - //local space? - - if (convexCaster.calcTimeOfImpact(m_ccdSphereFromTrans,m_ccdSphereToTrans, - ident,ident,castResult)) - { - if (m_hitFraction > castResult.m_fraction) - m_hitFraction = castResult.m_fraction; - } - - } - - }; - - - - - - if (triBody->m_collisionShape->IsConcave()) - { - SimdVector3 rayAabbMin = convexFromLocal.getOrigin(); - rayAabbMin.setMin(convexToLocal.getOrigin()); - SimdVector3 rayAabbMax = convexFromLocal.getOrigin(); - rayAabbMax.setMax(convexToLocal.getOrigin()); - rayAabbMin -= SimdVector3(convexbody->m_ccdSweptShereRadius,convexbody->m_ccdSweptShereRadius,convexbody->m_ccdSweptShereRadius); - rayAabbMax += SimdVector3(convexbody->m_ccdSweptShereRadius,convexbody->m_ccdSweptShereRadius,convexbody->m_ccdSweptShereRadius); - - float curHitFraction = 1.f; //is this available? - LocalTriangleSphereCastCallback raycastCallback(convexFromLocal,convexToLocal, - convexbody->m_ccdSweptShereRadius,curHitFraction); - - raycastCallback.m_hitFraction = convexbody->m_hitFraction; - - CollisionObject* concavebody = (CollisionObject* )m_concave.m_clientObject; - - ConcaveShape* triangleMesh = (ConcaveShape*) concavebody->m_collisionShape; - - if (triangleMesh) - { - triangleMesh->ProcessAllTriangles(&raycastCallback,rayAabbMin,rayAabbMax); - } - - - - if (raycastCallback.m_hitFraction < convexbody->m_hitFraction) - { - convexbody->m_hitFraction = raycastCallback.m_hitFraction; - return raycastCallback.m_hitFraction; - } - } - - return 1.f; - -} diff --git a/extern/bullet/Bullet/CollisionDispatch/ConvexConcaveCollisionAlgorithm.h b/extern/bullet/Bullet/CollisionDispatch/ConvexConcaveCollisionAlgorithm.h deleted file mode 100644 index 47b4de3bbe1..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/ConvexConcaveCollisionAlgorithm.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONVEX_CONCAVE_COLLISION_ALGORITHM_H -#define CONVEX_CONCAVE_COLLISION_ALGORITHM_H - -#include "BroadphaseCollision/CollisionAlgorithm.h" -#include "BroadphaseCollision/Dispatcher.h" -#include "BroadphaseCollision/BroadphaseInterface.h" -#include "CollisionShapes/TriangleCallback.h" -#include "NarrowPhaseCollision/PersistentManifold.h" -class Dispatcher; -#include "BroadphaseCollision/BroadphaseProxy.h" - - -///For each triangle in the concave mesh that overlaps with the AABB of a convex (m_convexProxy), ProcessTriangle is called. -class ConvexTriangleCallback : public TriangleCallback -{ - BroadphaseProxy* m_convexProxy; - BroadphaseProxy m_triangleProxy; - - SimdVector3 m_aabbMin; - SimdVector3 m_aabbMax ; - - Dispatcher* m_dispatcher; - const DispatcherInfo* m_dispatchInfoPtr; - float m_collisionMarginTriangle; - -public: -int m_triangleCount; - - PersistentManifold* m_manifoldPtr; - - ConvexTriangleCallback(Dispatcher* dispatcher,BroadphaseProxy* proxy0,BroadphaseProxy* proxy1); - - void SetTimeStepAndCounters(float collisionMarginTriangle,const DispatcherInfo& dispatchInfo); - - virtual ~ConvexTriangleCallback(); - - virtual void ProcessTriangle(SimdVector3* triangle, int partId, int triangleIndex); - - void ClearCache(); - - inline const SimdVector3& GetAabbMin() const - { - return m_aabbMin; - } - inline const SimdVector3& GetAabbMax() const - { - return m_aabbMax; - } - -}; - - - - -/// ConvexConcaveCollisionAlgorithm supports collision between convex shapes and (concave) trianges meshes. -class ConvexConcaveCollisionAlgorithm : public CollisionAlgorithm -{ - - BroadphaseProxy m_convex; - - BroadphaseProxy m_concave; - - ConvexTriangleCallback m_ConvexTriangleCallback; - - -public: - - ConvexConcaveCollisionAlgorithm( const CollisionAlgorithmConstructionInfo& ci,BroadphaseProxy* proxy0,BroadphaseProxy* proxy1); - - virtual ~ConvexConcaveCollisionAlgorithm(); - - virtual void ProcessCollision (BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo); - - float CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo); - - void ClearCache(); - -}; - -#endif //CONVEX_CONCAVE_COLLISION_ALGORITHM_H diff --git a/extern/bullet/Bullet/CollisionDispatch/ConvexConvexAlgorithm.cpp b/extern/bullet/Bullet/CollisionDispatch/ConvexConvexAlgorithm.cpp deleted file mode 100644 index 765ae8625f6..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/ConvexConvexAlgorithm.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "ConvexConvexAlgorithm.h" - -#include <stdio.h> -#include "NarrowPhaseCollision/DiscreteCollisionDetectorInterface.h" -#include "BroadphaseCollision/BroadphaseInterface.h" -#include "CollisionDispatch/CollisionObject.h" -#include "CollisionShapes/ConvexShape.h" -#include "NarrowPhaseCollision/GjkPairDetector.h" -#include "BroadphaseCollision/BroadphaseProxy.h" -#include "CollisionDispatch/CollisionDispatcher.h" -#include "CollisionShapes/BoxShape.h" -#include "CollisionDispatch/ManifoldResult.h" - -#include "NarrowPhaseCollision/ConvexPenetrationDepthSolver.h" -#include "NarrowPhaseCollision/ContinuousConvexCollision.h" -#include "NarrowPhaseCollision/SubSimplexConvexCast.h" -#include "NarrowPhaseCollision/GjkConvexCast.h" - - - -#include "CollisionShapes/MinkowskiSumShape.h" -#include "NarrowPhaseCollision/VoronoiSimplexSolver.h" -#include "CollisionShapes/SphereShape.h" - -#include "NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.h" - -//#include "NarrowPhaseCollision/EpaPenetrationDepthSolver.h" - -#ifdef WIN32 -#if _MSC_VER >= 1310 -//only use SIMD Hull code under Win32 -#ifdef TEST_HULL -#define USE_HULL 1 -#endif //TEST_HULL -#endif //_MSC_VER -#endif //WIN32 - - -#ifdef USE_HULL - -#include "NarrowPhaseCollision/Hull.h" -#include "NarrowPhaseCollision/HullContactCollector.h" - - -#endif //USE_HULL - -bool gUseEpa = false; - - -#ifdef WIN32 -void DrawRasterizerLine(const float* from,const float* to,int color); -#endif - - - - -//#define PROCESS_SINGLE_CONTACT -#ifdef WIN32 -bool gForceBoxBox = false;//false;//true; - -#else -bool gForceBoxBox = false;//false;//true; -#endif -bool gBoxBoxUseGjk = true;//true;//false; -bool gDisableConvexCollision = false; - - - -ConvexConvexAlgorithm::ConvexConvexAlgorithm(PersistentManifold* mf,const CollisionAlgorithmConstructionInfo& ci,BroadphaseProxy* proxy0,BroadphaseProxy* proxy1) -: CollisionAlgorithm(ci), -m_gjkPairDetector(0,0,&m_simplexSolver,0), -m_useEpa(!gUseEpa), -m_box0(*proxy0), -m_box1(*proxy1), -m_ownManifold (false), -m_manifoldPtr(mf), -m_lowLevelOfDetail(false) -{ - CheckPenetrationDepthSolver(); - - { - if (!m_manifoldPtr && m_dispatcher->NeedsCollision(m_box0,m_box1)) - { - m_manifoldPtr = m_dispatcher->GetNewManifold(proxy0->m_clientObject,proxy1->m_clientObject); - m_ownManifold = true; - } - } - -} - - - -ConvexConvexAlgorithm::~ConvexConvexAlgorithm() -{ - if (m_ownManifold) - { - if (m_manifoldPtr) - m_dispatcher->ReleaseManifold(m_manifoldPtr); - } -} - -void ConvexConvexAlgorithm ::SetLowLevelOfDetail(bool useLowLevel) -{ - m_lowLevelOfDetail = useLowLevel; -} - - - -class FlippedContactResult : public DiscreteCollisionDetectorInterface::Result -{ - DiscreteCollisionDetectorInterface::Result* m_org; - -public: - - FlippedContactResult(DiscreteCollisionDetectorInterface::Result* org) - : m_org(org) - { - - } - - virtual void AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth) - { - SimdVector3 flippedNormal = -normalOnBInWorld; - - m_org->AddContactPoint(flippedNormal,pointInWorld,depth); - } - -}; - -static MinkowskiPenetrationDepthSolver gPenetrationDepthSolver; - -//static EpaPenetrationDepthSolver gEpaPenetrationDepthSolver; - -#ifdef USE_EPA -Solid3EpaPenetrationDepth gSolidEpaPenetrationSolver; -#endif //USE_EPA - -void ConvexConvexAlgorithm::CheckPenetrationDepthSolver() -{ - if (m_useEpa != gUseEpa) - { - m_useEpa = gUseEpa; - if (m_useEpa) - { - - // m_gjkPairDetector.SetPenetrationDepthSolver(&gEpaPenetrationDepthSolver); - - - } else - { - m_gjkPairDetector.SetPenetrationDepthSolver(&gPenetrationDepthSolver); - } - } - -} - -#ifdef USE_HULL - -Transform GetTransformFromSimdTransform(const SimdTransform& trans) -{ - //const SimdVector3& rowA0 = trans.getBasis().getRow(0); - ////const SimdVector3& rowA1 = trans.getBasis().getRow(1); - //const SimdVector3& rowA2 = trans.getBasis().getRow(2); - - SimdVector3 rowA0 = trans.getBasis().getColumn(0); - SimdVector3 rowA1 = trans.getBasis().getColumn(1); - SimdVector3 rowA2 = trans.getBasis().getColumn(2); - - - Vector3 x(rowA0.getX(),rowA0.getY(),rowA0.getZ()); - Vector3 y(rowA1.getX(),rowA1.getY(),rowA1.getZ()); - Vector3 z(rowA2.getX(),rowA2.getY(),rowA2.getZ()); - - Matrix33 ornA(x,y,z); - - Point3 transA( - trans.getOrigin().getX(), - trans.getOrigin().getY(), - trans.getOrigin().getZ()); - - return Transform(ornA,transA); -} - -class ManifoldResultCollector : public HullContactCollector -{ -public: - ManifoldResult& m_manifoldResult; - - ManifoldResultCollector(ManifoldResult& manifoldResult) - :m_manifoldResult(manifoldResult) - { - - } - - - virtual ~ManifoldResultCollector() {}; - - virtual int BatchAddContactGroup(const Separation& sep,int numContacts,const Vector3& normalWorld,const Vector3& tangent,const Point3* positionsWorld,const float* depths) - { - for (int i=0;i<numContacts;i++) - { - //printf("numContacts = %i\n",numContacts); - SimdVector3 normalOnBInWorld(sep.m_axis.GetX(),sep.m_axis.GetY(),sep.m_axis.GetZ()); - //normalOnBInWorld.normalize(); - SimdVector3 pointInWorld(positionsWorld[i].GetX(),positionsWorld[i].GetY(),positionsWorld[i].GetZ()); - float depth = -depths[i]; - m_manifoldResult.AddContactPoint(normalOnBInWorld,pointInWorld,depth); - - } - return 0; - } - - virtual int GetMaxNumContacts() const - { - return 4; - } - -}; -#endif //USE_HULL - - -// -// Convex-Convex collision algorithm -// -void ConvexConvexAlgorithm ::ProcessCollision (BroadphaseProxy* ,BroadphaseProxy* ,const DispatcherInfo& dispatchInfo) -{ - - if (!m_manifoldPtr) - return; - - CheckPenetrationDepthSolver(); - -// printf("ConvexConvexAlgorithm::ProcessCollision\n"); - - bool needsCollision = m_dispatcher->NeedsCollision(m_box0,m_box1); - if (!needsCollision) - return; - - CollisionObject* col0 = static_cast<CollisionObject*>(m_box0.m_clientObject); - CollisionObject* col1 = static_cast<CollisionObject*>(m_box1.m_clientObject); - -#ifdef USE_HULL - - - if (dispatchInfo.m_enableSatConvex) - { - if ((col0->m_collisionShape->IsPolyhedral()) && - (col1->m_collisionShape->IsPolyhedral())) - { - - - PolyhedralConvexShape* polyhedron0 = static_cast<PolyhedralConvexShape*>(col0->m_collisionShape); - PolyhedralConvexShape* polyhedron1 = static_cast<PolyhedralConvexShape*>(col1->m_collisionShape); - if (polyhedron0->m_optionalHull && polyhedron1->m_optionalHull) - { - //printf("Hull-Hull"); - - //todo: cache this information, rather then initialize - Separation sep; - sep.m_featureA = 0; - sep.m_featureB = 0; - sep.m_contact = -1; - sep.m_separator = 0; - - //convert from SimdTransform to Transform - - Transform trA = GetTransformFromSimdTransform(col0->m_worldTransform); - Transform trB = GetTransformFromSimdTransform(col1->m_worldTransform); - - //either use persistent manifold or clear it every time - m_dispatcher->ClearManifold(m_manifoldPtr); - ManifoldResult* resultOut = m_dispatcher->GetNewManifoldResult(col0,col1,m_manifoldPtr); - - ManifoldResultCollector hullContactCollector(*resultOut); - - Hull::ProcessHullHull(sep,*polyhedron0->m_optionalHull,*polyhedron1->m_optionalHull, - trA,trB,&hullContactCollector); - - - //user provided hull's, so we use SAT Hull collision detection - return; - } - } - } - -#endif //USE_HULL - - - ManifoldResult* resultOut = m_dispatcher->GetNewManifoldResult(col0,col1,m_manifoldPtr); - - ConvexShape* min0 = static_cast<ConvexShape*>(col0->m_collisionShape); - ConvexShape* min1 = static_cast<ConvexShape*>(col1->m_collisionShape); - - GjkPairDetector::ClosestPointInput input; - - - //TODO: if (dispatchInfo.m_useContinuous) - m_gjkPairDetector.SetMinkowskiA(min0); - m_gjkPairDetector.SetMinkowskiB(min1); - input.m_maximumDistanceSquared = min0->GetMargin() + min1->GetMargin() + m_manifoldPtr->GetContactBreakingTreshold(); - input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared; - -// input.m_maximumDistanceSquared = 1e30f; - - input.m_transformA = col0->m_worldTransform; - input.m_transformB = col1->m_worldTransform; - - m_gjkPairDetector.GetClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw); - - m_dispatcher->ReleaseManifoldResult(resultOut); -} - - - -bool disableCcd = false; -float ConvexConvexAlgorithm::CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo) -{ - ///Rather then checking ALL pairs, only calculate TOI when motion exceeds treshold - - ///Linear motion for one of objects needs to exceed m_ccdSquareMotionTreshold - ///col0->m_worldTransform, - float resultFraction = 1.f; - - CollisionObject* col1 = static_cast<CollisionObject*>(m_box1.m_clientObject); - CollisionObject* col0 = static_cast<CollisionObject*>(m_box0.m_clientObject); - - float squareMot0 = (col0->m_interpolationWorldTransform.getOrigin() - col0->m_worldTransform.getOrigin()).length2(); - float squareMot1 = (col1->m_interpolationWorldTransform.getOrigin() - col1->m_worldTransform.getOrigin()).length2(); - - if (squareMot0 < col0->m_ccdSquareMotionTreshold && - squareMot0 < col0->m_ccdSquareMotionTreshold) - return resultFraction; - - - - if (disableCcd) - return 1.f; - - CheckPenetrationDepthSolver(); - - //An adhoc way of testing the Continuous Collision Detection algorithms - //One object is approximated as a sphere, to simplify things - //Starting in penetration should report no time of impact - //For proper CCD, better accuracy and handling of 'allowed' penetration should be added - //also the mainloop of the physics should have a kind of toi queue (something like Brian Mirtich's application of Timewarp for Rigidbodies) - - bool needsCollision = m_dispatcher->NeedsCollision(m_box0,m_box1); - - if (!needsCollision) - return 1.f; - - - /// Convex0 against sphere for Convex1 - { - ConvexShape* convex0 = static_cast<ConvexShape*>(col0->m_collisionShape); - - SphereShape sphere1(col1->m_ccdSweptShereRadius); //todo: allow non-zero sphere sizes, for better approximation - ConvexCast::CastResult result; - VoronoiSimplexSolver voronoiSimplex; - //SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex); - ///Simplification, one object is simplified as a sphere - GjkConvexCast ccd1( convex0 ,&sphere1,&voronoiSimplex); - //ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0); - if (ccd1.calcTimeOfImpact(col0->m_worldTransform,col0->m_interpolationWorldTransform, - col1->m_worldTransform,col1->m_interpolationWorldTransform,result)) - { - - //store result.m_fraction in both bodies - - if (col0->m_hitFraction > result.m_fraction) - col0->m_hitFraction = result.m_fraction; - - if (col1->m_hitFraction > result.m_fraction) - col1->m_hitFraction = result.m_fraction; - - if (resultFraction > result.m_fraction) - resultFraction = result.m_fraction; - - } - - - - - } - - /// Sphere (for convex0) against Convex1 - { - ConvexShape* convex1 = static_cast<ConvexShape*>(col1->m_collisionShape); - - SphereShape sphere0(col0->m_ccdSweptShereRadius); //todo: allow non-zero sphere sizes, for better approximation - ConvexCast::CastResult result; - VoronoiSimplexSolver voronoiSimplex; - //SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex); - ///Simplification, one object is simplified as a sphere - GjkConvexCast ccd1(&sphere0,convex1,&voronoiSimplex); - //ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0); - if (ccd1.calcTimeOfImpact(col0->m_worldTransform,col0->m_interpolationWorldTransform, - col1->m_worldTransform,col1->m_interpolationWorldTransform,result)) - { - - //store result.m_fraction in both bodies - - if (col0->m_hitFraction > result.m_fraction) - col0->m_hitFraction = result.m_fraction; - - if (col1->m_hitFraction > result.m_fraction) - col1->m_hitFraction = result.m_fraction; - - if (resultFraction > result.m_fraction) - resultFraction = result.m_fraction; - - } - } - - return resultFraction; - -} diff --git a/extern/bullet/Bullet/CollisionDispatch/ConvexConvexAlgorithm.h b/extern/bullet/Bullet/CollisionDispatch/ConvexConvexAlgorithm.h deleted file mode 100644 index a1cadabe7eb..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/ConvexConvexAlgorithm.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONVEX_CONVEX_ALGORITHM_H -#define CONVEX_CONVEX_ALGORITHM_H - -#include "BroadphaseCollision/CollisionAlgorithm.h" -#include "NarrowPhaseCollision/GjkPairDetector.h" -#include "NarrowPhaseCollision/PersistentManifold.h" -#include "BroadphaseCollision/BroadphaseProxy.h" -#include "NarrowPhaseCollision/VoronoiSimplexSolver.h" - -class ConvexPenetrationDepthSolver; - -///ConvexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations. -class ConvexConvexAlgorithm : public CollisionAlgorithm -{ - //ConvexPenetrationDepthSolver* m_penetrationDepthSolver; - VoronoiSimplexSolver m_simplexSolver; - GjkPairDetector m_gjkPairDetector; - bool m_useEpa; -public: - BroadphaseProxy m_box0; - BroadphaseProxy m_box1; - - bool m_ownManifold; - PersistentManifold* m_manifoldPtr; - bool m_lowLevelOfDetail; - - void CheckPenetrationDepthSolver(); - - - -public: - - ConvexConvexAlgorithm(PersistentManifold* mf,const CollisionAlgorithmConstructionInfo& ci,BroadphaseProxy* proxy0,BroadphaseProxy* proxy1); - - virtual ~ConvexConvexAlgorithm(); - - virtual void ProcessCollision (BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo); - - virtual float CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo); - - void SetLowLevelOfDetail(bool useLowLevel); - - virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1) - { - m_gjkPairDetector.m_partId0=partId0; - m_gjkPairDetector.m_partId1=partId1; - m_gjkPairDetector.m_index0=index0; - m_gjkPairDetector.m_index1=index1; - } - - const PersistentManifold* GetManifold() - { - return m_manifoldPtr; - } - -}; - -#endif //CONVEX_CONVEX_ALGORITHM_H diff --git a/extern/bullet/Bullet/CollisionDispatch/EmptyCollisionAlgorithm.cpp b/extern/bullet/Bullet/CollisionDispatch/EmptyCollisionAlgorithm.cpp deleted file mode 100644 index 6ef31ad6fb4..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/EmptyCollisionAlgorithm.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "EmptyCollisionAlgorithm.h" - - - -EmptyAlgorithm::EmptyAlgorithm(const CollisionAlgorithmConstructionInfo& ci) - : CollisionAlgorithm(ci) -{ -} - -void EmptyAlgorithm::ProcessCollision (BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo) -{ - -} - -float EmptyAlgorithm::CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo) -{ - return 1.f; -} - - diff --git a/extern/bullet/Bullet/CollisionDispatch/EmptyCollisionAlgorithm.h b/extern/bullet/Bullet/CollisionDispatch/EmptyCollisionAlgorithm.h deleted file mode 100644 index c85efac9959..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/EmptyCollisionAlgorithm.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef EMPTY_ALGORITH -#define EMPTY_ALGORITH -#include "BroadphaseCollision/CollisionAlgorithm.h" - -#define ATTRIBUTE_ALIGNED(a) - -///EmptyAlgorithm is a stub for unsupported collision pairs. -///The dispatcher can dispatch a persistent EmptyAlgorithm to avoid a search every frame. -class EmptyAlgorithm : public CollisionAlgorithm -{ - -public: - - EmptyAlgorithm(const CollisionAlgorithmConstructionInfo& ci); - - virtual void ProcessCollision (BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo); - - virtual float CalculateTimeOfImpact(BroadphaseProxy* proxy0,BroadphaseProxy* proxy1,const DispatcherInfo& dispatchInfo); - - - - -} ATTRIBUTE_ALIGNED(16); - -#endif //EMPTY_ALGORITH diff --git a/extern/bullet/Bullet/CollisionDispatch/ManifoldResult.cpp b/extern/bullet/Bullet/CollisionDispatch/ManifoldResult.cpp deleted file mode 100644 index 36f7255a737..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/ManifoldResult.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "ManifoldResult.h" -#include "NarrowPhaseCollision/PersistentManifold.h" -#include "CollisionDispatch/CollisionObject.h" - - -///This is to allow MaterialCombiner/Custom Friction/Restitution values -ContactAddedCallback gContactAddedCallback=0; - -///User can override this material combiner by implementing gContactAddedCallback and setting body0->m_collisionFlags |= CollisionObject::customMaterialCallback; -inline SimdScalar calculateCombinedFriction(const CollisionObject* body0,const CollisionObject* body1) -{ - SimdScalar friction = body0->getFriction() * body1->getFriction(); - - const SimdScalar MAX_FRICTION = 10.f; - if (friction < -MAX_FRICTION) - friction = -MAX_FRICTION; - if (friction > MAX_FRICTION) - friction = MAX_FRICTION; - return friction; - -} - -inline SimdScalar calculateCombinedRestitution(const CollisionObject* body0,const CollisionObject* body1) -{ - return body0->getRestitution() * body1->getRestitution(); -} - - - -ManifoldResult::ManifoldResult(CollisionObject* body0,CollisionObject* body1,PersistentManifold* manifoldPtr) - :m_manifoldPtr(manifoldPtr), - m_body0(body0), - m_body1(body1) - { - } - - -void ManifoldResult::AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth) -{ - if (depth > m_manifoldPtr->GetContactBreakingTreshold()) - return; - - - SimdTransform transAInv = m_body0->m_cachedInvertedWorldTransform; - SimdTransform transBInv= m_body1->m_cachedInvertedWorldTransform; - - //transAInv = m_body0->m_worldTransform.inverse(); - //transBInv= m_body1->m_worldTransform.inverse(); - SimdVector3 pointA = pointInWorld + normalOnBInWorld * depth; - SimdVector3 localA = transAInv(pointA ); - SimdVector3 localB = transBInv(pointInWorld); - ManifoldPoint newPt(localA,localB,normalOnBInWorld,depth); - - - - int insertIndex = m_manifoldPtr->GetCacheEntry(newPt); - if (insertIndex >= 0) - { - -// This is not needed, just use the old info! -// const ManifoldPoint& oldPoint = m_manifoldPtr->GetContactPoint(insertIndex); -// newPt.CopyPersistentInformation(oldPoint); -// m_manifoldPtr->ReplaceContactPoint(newPt,insertIndex); - - - } else - { - - newPt.m_combinedFriction = calculateCombinedFriction(m_body0,m_body1); - newPt.m_combinedRestitution = calculateCombinedRestitution(m_body0,m_body1); - - //User can override friction and/or restitution - if (gContactAddedCallback && - //and if either of the two bodies requires custom material - ((m_body0->m_collisionFlags & CollisionObject::customMaterialCallback) || - (m_body1->m_collisionFlags & CollisionObject::customMaterialCallback))) - { - //experimental feature info, for per-triangle material etc. - (*gContactAddedCallback)(newPt,m_body0,m_partId0,m_index0,m_body1,m_partId1,m_index1); - } - - m_manifoldPtr->AddManifoldPoint(newPt); - } -} - diff --git a/extern/bullet/Bullet/CollisionDispatch/ManifoldResult.h b/extern/bullet/Bullet/CollisionDispatch/ManifoldResult.h deleted file mode 100644 index fe2438980a1..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/ManifoldResult.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef MANIFOLD_RESULT_H -#define MANIFOLD_RESULT_H - -#include "NarrowPhaseCollision/DiscreteCollisionDetectorInterface.h" -struct CollisionObject; -class PersistentManifold; -class ManifoldPoint; - -typedef bool (*ContactAddedCallback)(ManifoldPoint& cp, const CollisionObject* colObj0,int partId0,int index0,const CollisionObject* colObj1,int partId1,int index1); -extern ContactAddedCallback gContactAddedCallback; - - - -///ManifoldResult is a helper class to manage contact results. -class ManifoldResult : public DiscreteCollisionDetectorInterface::Result -{ - PersistentManifold* m_manifoldPtr; - CollisionObject* m_body0; - CollisionObject* m_body1; - int m_partId0; - int m_partId1; - int m_index0; - int m_index1; -public: - - ManifoldResult(CollisionObject* body0,CollisionObject* body1,PersistentManifold* manifoldPtr); - - virtual ~ManifoldResult() {}; - - virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1) - { - m_partId0=partId0; - m_partId1=partId1; - m_index0=index0; - m_index1=index1; - } - - virtual void AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth); - - - -}; - -#endif //MANIFOLD_RESULT_H diff --git a/extern/bullet/Bullet/CollisionDispatch/SimulationIslandManager.cpp b/extern/bullet/Bullet/CollisionDispatch/SimulationIslandManager.cpp deleted file mode 100644 index 75f30847ff9..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/SimulationIslandManager.cpp +++ /dev/null @@ -1,211 +0,0 @@ - -#include "SimulationIslandManager.h" -#include "BroadphaseCollision/Dispatcher.h" -#include "NarrowPhaseCollision/PersistentManifold.h" -#include "CollisionDispatch/CollisionObject.h" -#include "CollisionDispatch/CollisionWorld.h" - - - -SimulationIslandManager::SimulationIslandManager() -{ -} - -void SimulationIslandManager::InitUnionFind(int n) -{ - m_unionFind.reset(n); -} - - -void SimulationIslandManager::FindUnions(Dispatcher* dispatcher) -{ - - { - for (int i=0;i<dispatcher->GetNumManifolds();i++) - { - const PersistentManifold* manifold = dispatcher->GetManifoldByIndexInternal(i); - //static objects (invmass 0.f) don't merge ! - - const CollisionObject* colObj0 = static_cast<const CollisionObject*>(manifold->GetBody0()); - const CollisionObject* colObj1 = static_cast<const CollisionObject*>(manifold->GetBody1()); - - if (colObj0 && colObj1 && dispatcher->NeedsResponse(*colObj0,*colObj1)) - { - if (((colObj0) && ((colObj0)->mergesSimulationIslands())) && - ((colObj1) && ((colObj1)->mergesSimulationIslands()))) - { - - m_unionFind.unite((colObj0)->m_islandTag1, - (colObj1)->m_islandTag1); - } - } - - - } - } - -} - - -void SimulationIslandManager::UpdateActivationState(CollisionWorld* colWorld,Dispatcher* dispatcher) -{ - - InitUnionFind(colWorld->GetCollisionObjectArray().size()); - - // put the index into m_controllers into m_tag - { - std::vector<CollisionObject*>::iterator i; - - int index = 0; - for (i=colWorld->GetCollisionObjectArray().begin(); - !(i==colWorld->GetCollisionObjectArray().end()); i++) - { - - CollisionObject* collisionObject= (*i); - collisionObject->m_islandTag1 = index; - collisionObject->m_hitFraction = 1.f; - index++; - - } - } - // do the union find - - FindUnions(dispatcher); - - - -} - - - - -void SimulationIslandManager::StoreIslandActivationState(CollisionWorld* colWorld) -{ - // put the islandId ('find' value) into m_tag - { - - - std::vector<CollisionObject*>::iterator i; - - int index = 0; - for (i=colWorld->GetCollisionObjectArray().begin(); - !(i==colWorld->GetCollisionObjectArray().end()); i++) - { - CollisionObject* collisionObject= (*i); - - if (collisionObject->mergesSimulationIslands()) - { - collisionObject->m_islandTag1 = m_unionFind.find(index); - } else - { - collisionObject->m_islandTag1 = -1; - } - index++; - } - } -} - - - - -// -// todo: this is random access, it can be walked 'cache friendly'! -// -void SimulationIslandManager::BuildAndProcessIslands(Dispatcher* dispatcher,CollisionObjectArray& collisionObjects, IslandCallback* callback) -{ - - int numBodies = collisionObjects.size(); - - //first calculate the number of islands, and iterate over the islands id's - - const UnionFind& uf = this->GetUnionFind(); - - for (int islandId=0;islandId<uf.getNumElements();islandId++) - { - if (uf.isRoot(islandId)) - { - - std::vector<PersistentManifold*> islandmanifold; - - //int numSleeping = 0; - - bool allSleeping = true; - - int i; - for (i=0;i<numBodies;i++) - { - CollisionObject* colObj0 = collisionObjects[i]; - - if (colObj0->m_islandTag1 == islandId) - { - - if (colObj0->GetActivationState()== ACTIVE_TAG) - { - allSleeping = false; - } - if (colObj0->GetActivationState()== DISABLE_DEACTIVATION) - { - allSleeping = false; - } - } - } - - - for (i=0;i<dispatcher->GetNumManifolds();i++) - { - PersistentManifold* manifold = dispatcher->GetManifoldByIndexInternal(i); - - //filtering for response - - CollisionObject* colObj0 = static_cast<CollisionObject*>(manifold->GetBody0()); - CollisionObject* colObj1 = static_cast<CollisionObject*>(manifold->GetBody1()); - assert(colObj0); - assert(colObj1); - { - if (((colObj0)->m_islandTag1 == (islandId)) || - ((colObj1)->m_islandTag1 == (islandId))) - { - if (dispatcher->NeedsResponse(*colObj0,*colObj1)) - islandmanifold.push_back(manifold); - } - } - } - if (allSleeping) - { - int i; - for (i=0;i<numBodies;i++) - { - CollisionObject* colObj0 = collisionObjects[i]; - if (colObj0->m_islandTag1 == islandId) - { - colObj0->SetActivationState( ISLAND_SLEEPING ); - } - } - - - } else - { - - int i; - for (i=0;i<numBodies;i++) - { - CollisionObject* colObj0 = collisionObjects[i]; - if (colObj0->m_islandTag1 == islandId) - { - if ( colObj0->GetActivationState() == ISLAND_SLEEPING) - { - colObj0->SetActivationState( WANTS_DEACTIVATION); - } - } - } - - /// Process the actual simulation, only if not sleeping/deactivated - if (islandmanifold.size()) - { - callback->ProcessIsland(&islandmanifold[0],islandmanifold.size()); - } - - } - } - } -} diff --git a/extern/bullet/Bullet/CollisionDispatch/SimulationIslandManager.h b/extern/bullet/Bullet/CollisionDispatch/SimulationIslandManager.h deleted file mode 100644 index 84285283628..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/SimulationIslandManager.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SIMULATION_ISLAND_MANAGER_H -#define SIMULATION_ISLAND_MANAGER_H - -#include "CollisionDispatch/UnionFind.h" -#include "CollisionCreateFunc.h" - -class CollisionWorld; -class Dispatcher; - -///SimulationIslandManager creates and handles simulation islands, using UnionFind -class SimulationIslandManager -{ - UnionFind m_unionFind; - -public: - SimulationIslandManager(); - - - void InitUnionFind(int n); - - - UnionFind& GetUnionFind() { return m_unionFind;} - - virtual void UpdateActivationState(CollisionWorld* colWorld,Dispatcher* dispatcher); - virtual void StoreIslandActivationState(CollisionWorld* world); - - - void FindUnions(Dispatcher* dispatcher); - - - - struct IslandCallback - { - virtual ~IslandCallback() {}; - - virtual void ProcessIsland(class PersistentManifold** manifolds,int numManifolds) = 0; - }; - - void BuildAndProcessIslands(Dispatcher* dispatcher,CollisionObjectArray& collisionObjects, IslandCallback* callback); - -}; - -#endif //SIMULATION_ISLAND_MANAGER_H diff --git a/extern/bullet/Bullet/CollisionDispatch/UnionFind.cpp b/extern/bullet/Bullet/CollisionDispatch/UnionFind.cpp deleted file mode 100644 index 43c87bb4f61..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/UnionFind.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "UnionFind.h" -#include <assert.h> - - -int UnionFind::find(int x) -{ - assert(x < m_N); - assert(x >= 0); - - while (x != m_id[x]) - { -//not really a reason not to use path compression, and it flattens the trees/improves find performance dramatically -#define USE_PATH_COMPRESSION 1 -#ifdef USE_PATH_COMPRESSION - // - m_id[x] = m_id[m_id[x]]; -#endif // - x = m_id[x]; - assert(x < m_N); - assert(x >= 0); - - } - return x; -} - -UnionFind::~UnionFind() -{ - Free(); - -} - -UnionFind::UnionFind() -:m_id(0), -m_sz(0), -m_N(0) -{ - -} - -void UnionFind::Allocate(int N) -{ - if (m_N < N) - { - Free(); - - m_N = N; - m_id = new int[N]; - m_sz = new int[N]; - } -} -void UnionFind::Free() -{ - if (m_N) - { - m_N=0; - delete m_id; - delete m_sz; - } -} - - -void UnionFind::reset(int N) -{ - Allocate(N); - - for (int i = 0; i < m_N; i++) - { - m_id[i] = i; m_sz[i] = 1; - } -} - - -int UnionFind ::find(int p, int q) -{ - return (find(p) == find(q)); -} - -void UnionFind ::unite(int p, int q) -{ - int i = find(p), j = find(q); - if (i == j) - return; - - //weighted quick union, this keeps the 'trees' balanced, and keeps performance of unite O( log(n) ) - if (m_sz[i] < m_sz[j]) - { - m_id[i] = j; m_sz[j] += m_sz[i]; - } - else - { - m_id[j] = i; m_sz[i] += m_sz[j]; - } -} diff --git a/extern/bullet/Bullet/CollisionDispatch/UnionFind.h b/extern/bullet/Bullet/CollisionDispatch/UnionFind.h deleted file mode 100644 index 8705e579189..00000000000 --- a/extern/bullet/Bullet/CollisionDispatch/UnionFind.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef UNION_FIND_H -#define UNION_FIND_H - -///UnionFind calculates connected subsets -// Implements weighted Quick Union with path compression -// optimization: could use short ints instead of ints (halving memory, would limit the number of rigid bodies to 64k, sounds reasonable) -class UnionFind - { - private: - int* m_id; - int* m_sz; - int m_N; - - public: - int find(int x); - - UnionFind(); - ~UnionFind(); - - void reset(int N); - - inline int getNumElements() const - { - return m_N; - } - inline bool isRoot(int x) const - { - return (x == m_id[x]); - } - - int find(int p, int q); - void unite(int p, int q); - - void Allocate(int N); - void Free(); - - }; - - -#endif //UNION_FIND_H diff --git a/extern/bullet/Bullet/CollisionShapes/BoxShape.cpp b/extern/bullet/Bullet/CollisionShapes/BoxShape.cpp deleted file mode 100644 index 2be1996da16..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/BoxShape.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "BoxShape.h" - -SimdVector3 BoxShape::GetHalfExtents() const -{ - return m_boxHalfExtents1 * m_localScaling; -} -//{ - - -void BoxShape::GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const -{ - SimdVector3 halfExtents = GetHalfExtents(); - - SimdMatrix3x3 abs_b = t.getBasis().absolute(); - SimdPoint3 center = t.getOrigin(); - SimdVector3 extent = SimdVector3(abs_b[0].dot(halfExtents), - abs_b[1].dot(halfExtents), - abs_b[2].dot(halfExtents)); - extent += SimdVector3(GetMargin(),GetMargin(),GetMargin()); - - aabbMin = center - extent; - aabbMax = center + extent; - - -} - - -void BoxShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - //float margin = 0.f; - SimdVector3 halfExtents = GetHalfExtents(); - - SimdScalar lx=2.f*(halfExtents.x()); - SimdScalar ly=2.f*(halfExtents.y()); - SimdScalar lz=2.f*(halfExtents.z()); - - inertia[0] = mass/(12.0f) * (ly*ly + lz*lz); - inertia[1] = mass/(12.0f) * (lx*lx + lz*lz); - inertia[2] = mass/(12.0f) * (lx*lx + ly*ly); - - -} - diff --git a/extern/bullet/Bullet/CollisionShapes/BoxShape.h b/extern/bullet/Bullet/CollisionShapes/BoxShape.h deleted file mode 100644 index 67ce82078f3..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/BoxShape.h +++ /dev/null @@ -1,267 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef OBB_BOX_MINKOWSKI_H -#define OBB_BOX_MINKOWSKI_H - -#include "PolyhedralConvexShape.h" -#include "CollisionShapes/CollisionMargin.h" -#include "BroadphaseCollision/BroadphaseProxy.h" -#include "SimdPoint3.h" -#include "SimdMinMax.h" - -///BoxShape implements both a feature based (vertex/edge/plane) and implicit (getSupportingVertex) Box -class BoxShape: public PolyhedralConvexShape -{ - - SimdVector3 m_boxHalfExtents1; - - -public: - - virtual ~BoxShape() - { - - } - - SimdVector3 GetHalfExtents() const; - //{ return m_boxHalfExtents1 * m_localScaling;} - //const SimdVector3& GetHalfExtents() const{ return m_boxHalfExtents1;} - - - - virtual int GetShapeType() const { return BOX_SHAPE_PROXYTYPE;} - - virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec) const - { - - SimdVector3 halfExtents = GetHalfExtents(); - - SimdVector3 supVertex; - supVertex = SimdPoint3(vec.x() < SimdScalar(0.0f) ? -halfExtents.x() : halfExtents.x(), - vec.y() < SimdScalar(0.0f) ? -halfExtents.y() : halfExtents.y(), - vec.z() < SimdScalar(0.0f) ? -halfExtents.z() : halfExtents.z()); - - return supVertex; - } - - virtual inline SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const - { - SimdVector3 halfExtents = GetHalfExtents(); - SimdVector3 margin(GetMargin(),GetMargin(),GetMargin()); - halfExtents -= margin; - - return SimdVector3(vec.x() < SimdScalar(0.0f) ? -halfExtents.x() : halfExtents.x(), - vec.y() < SimdScalar(0.0f) ? -halfExtents.y() : halfExtents.y(), - vec.z() < SimdScalar(0.0f) ? -halfExtents.z() : halfExtents.z()); - } - - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const - { - SimdVector3 halfExtents = GetHalfExtents(); - SimdVector3 margin(GetMargin(),GetMargin(),GetMargin()); - halfExtents -= margin; - - - for (int i=0;i<numVectors;i++) - { - const SimdVector3& vec = vectors[i]; - supportVerticesOut[i].setValue(vec.x() < SimdScalar(0.0f) ? -halfExtents.x() : halfExtents.x(), - vec.y() < SimdScalar(0.0f) ? -halfExtents.y() : halfExtents.y(), - vec.z() < SimdScalar(0.0f) ? -halfExtents.z() : halfExtents.z()); - } - - } - - - BoxShape( const SimdVector3& boxHalfExtents) : m_boxHalfExtents1(boxHalfExtents){}; - - virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const; - - - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const - { - //this plane might not be aligned... - SimdVector4 plane ; - GetPlaneEquation(plane,i); - planeNormal = SimdVector3(plane.getX(),plane.getY(),plane.getZ()); - planeSupport = LocalGetSupportingVertex(-planeNormal); - } - - - virtual int GetNumPlanes() const - { - return 6; - } - - virtual int GetNumVertices() const - { - return 8; - } - - virtual int GetNumEdges() const - { - return 12; - } - - - virtual void GetVertex(int i,SimdVector3& vtx) const - { - SimdVector3 halfExtents = GetHalfExtents(); - - vtx = SimdVector3( - halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1), - halfExtents.y() * (1-((i&2)>>1)) - halfExtents.y() * ((i&2)>>1), - halfExtents.z() * (1-((i&4)>>2)) - halfExtents.z() * ((i&4)>>2)); - } - - - virtual void GetPlaneEquation(SimdVector4& plane,int i) const - { - SimdVector3 halfExtents = GetHalfExtents(); - - switch (i) - { - case 0: - plane.setValue(1.f,0.f,0.f); - plane[3] = -halfExtents.x(); - break; - case 1: - plane.setValue(-1.f,0.f,0.f); - plane[3] = -halfExtents.x(); - break; - case 2: - plane.setValue(0.f,1.f,0.f); - plane[3] = -halfExtents.y(); - break; - case 3: - plane.setValue(0.f,-1.f,0.f); - plane[3] = -halfExtents.y(); - break; - case 4: - plane.setValue(0.f,0.f,1.f); - plane[3] = -halfExtents.z(); - break; - case 5: - plane.setValue(0.f,0.f,-1.f); - plane[3] = -halfExtents.z(); - break; - default: - assert(0); - } - } - - - virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const - //virtual void GetEdge(int i,Edge& edge) const - { - int edgeVert0 = 0; - int edgeVert1 = 0; - - switch (i) - { - case 0: - edgeVert0 = 0; - edgeVert1 = 1; - break; - case 1: - edgeVert0 = 0; - edgeVert1 = 2; - break; - case 2: - edgeVert0 = 1; - edgeVert1 = 3; - - break; - case 3: - edgeVert0 = 2; - edgeVert1 = 3; - break; - case 4: - edgeVert0 = 0; - edgeVert1 = 4; - break; - case 5: - edgeVert0 = 1; - edgeVert1 = 5; - - break; - case 6: - edgeVert0 = 2; - edgeVert1 = 6; - break; - case 7: - edgeVert0 = 3; - edgeVert1 = 7; - break; - case 8: - edgeVert0 = 4; - edgeVert1 = 5; - break; - case 9: - edgeVert0 = 4; - edgeVert1 = 6; - break; - case 10: - edgeVert0 = 5; - edgeVert1 = 7; - break; - case 11: - edgeVert0 = 6; - edgeVert1 = 7; - break; - default: - ASSERT(0); - - } - - GetVertex(edgeVert0,pa ); - GetVertex(edgeVert1,pb ); - } - - - - - - virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const - { - SimdVector3 halfExtents = GetHalfExtents(); - - //SimdScalar minDist = 2*tolerance; - - bool result = (pt.x() <= (halfExtents.x()+tolerance)) && - (pt.x() >= (-halfExtents.x()-tolerance)) && - (pt.y() <= (halfExtents.y()+tolerance)) && - (pt.y() >= (-halfExtents.y()-tolerance)) && - (pt.z() <= (halfExtents.z()+tolerance)) && - (pt.z() >= (-halfExtents.z()-tolerance)); - - return result; - } - - - //debugging - virtual char* GetName()const - { - return "Box"; - } - - -}; - -#endif //OBB_BOX_MINKOWSKI_H diff --git a/extern/bullet/Bullet/CollisionShapes/BvhTriangleMeshShape.cpp b/extern/bullet/Bullet/CollisionShapes/BvhTriangleMeshShape.cpp deleted file mode 100644 index d2624dcdfe1..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/BvhTriangleMeshShape.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -//#define DISABLE_BVH - - -#include "CollisionShapes/BvhTriangleMeshShape.h" -#include "CollisionShapes/OptimizedBvh.h" - -///Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization. -///Uses an interface to access the triangles to allow for sharing graphics/physics triangles. -BvhTriangleMeshShape::BvhTriangleMeshShape(StridingMeshInterface* meshInterface) -:TriangleMeshShape(meshInterface) -{ - //construct bvh from meshInterface -#ifndef DISABLE_BVH - - m_bvh = new OptimizedBvh(); - m_bvh->Build(meshInterface); - -#endif //DISABLE_BVH - -} - -BvhTriangleMeshShape::~BvhTriangleMeshShape() -{ - delete m_bvh; -} - -//perform bvh tree traversal and report overlapping triangles to 'callback' -void BvhTriangleMeshShape::ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - -#ifdef DISABLE_BVH - //brute force traverse all triangles - TriangleMeshShape::ProcessAllTriangles(callback,aabbMin,aabbMax); -#else - - //first get all the nodes - - - struct MyNodeOverlapCallback : public NodeOverlapCallback - { - StridingMeshInterface* m_meshInterface; - TriangleCallback* m_callback; - SimdVector3 m_triangle[3]; - - - MyNodeOverlapCallback(TriangleCallback* callback,StridingMeshInterface* meshInterface) - :m_meshInterface(meshInterface), - m_callback(callback) - { - } - - virtual void ProcessNode(const OptimizedBvhNode* node) - { - const unsigned char *vertexbase; - int numverts; - PHY_ScalarType type; - int stride; - const unsigned char *indexbase; - int indexstride; - int numfaces; - PHY_ScalarType indicestype; - - - m_meshInterface->getLockedReadOnlyVertexIndexBase( - &vertexbase, - numverts, - type, - stride, - &indexbase, - indexstride, - numfaces, - indicestype, - node->m_subPart); - - int* gfxbase = (int*)(indexbase+node->m_triangleIndex*indexstride); - - const SimdVector3& meshScaling = m_meshInterface->getScaling(); - for (int j=2;j>=0;j--) - { - - int graphicsindex = gfxbase[j]; -#ifdef DEBUG_TRIANGLE_MESH - printf("%d ,",graphicsindex); -#endif //DEBUG_TRIANGLE_MESH - float* graphicsbase = (float*)(vertexbase+graphicsindex*stride); - - m_triangle[j] = SimdVector3( - graphicsbase[0]*meshScaling.getX(), - graphicsbase[1]*meshScaling.getY(), - graphicsbase[2]*meshScaling.getZ()); -#ifdef DEBUG_TRIANGLE_MESH - printf("triangle vertices:%f,%f,%f\n",triangle[j].x(),triangle[j].y(),triangle[j].z()); -#endif //DEBUG_TRIANGLE_MESH - } - - m_callback->ProcessTriangle(m_triangle,node->m_subPart,node->m_triangleIndex); - m_meshInterface->unLockReadOnlyVertexBase(node->m_subPart); - } - - }; - - MyNodeOverlapCallback myNodeCallback(callback,m_meshInterface); - - m_bvh->ReportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax); - - -#endif//DISABLE_BVH - - -} - - -void BvhTriangleMeshShape::setLocalScaling(const SimdVector3& scaling) -{ - if ((getLocalScaling() -scaling).length2() > SIMD_EPSILON) - { - TriangleMeshShape::setLocalScaling(scaling); - delete m_bvh; - m_bvh = new OptimizedBvh(); - m_bvh->Build(m_meshInterface); - //rebuild the bvh... - } -} diff --git a/extern/bullet/Bullet/CollisionShapes/BvhTriangleMeshShape.h b/extern/bullet/Bullet/CollisionShapes/BvhTriangleMeshShape.h deleted file mode 100644 index 849ea2e9935..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/BvhTriangleMeshShape.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef BVH_TRIANGLE_MESH_SHAPE_H -#define BVH_TRIANGLE_MESH_SHAPE_H - -#include "CollisionShapes/TriangleMeshShape.h" -#include "CollisionShapes/OptimizedBvh.h" - -///Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization. -///Uses an interface to access the triangles to allow for sharing graphics/physics triangles. -class BvhTriangleMeshShape : public TriangleMeshShape -{ - - OptimizedBvh* m_bvh; - - -public: - BvhTriangleMeshShape(StridingMeshInterface* meshInterface); - - virtual ~BvhTriangleMeshShape(); - - - /* - virtual int GetShapeType() const - { - return TRIANGLE_MESH_SHAPE_PROXYTYPE; - } - */ - - - - virtual void ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - - //debugging - virtual char* GetName()const {return "BVHTRIANGLEMESH";} - - - virtual void setLocalScaling(const SimdVector3& scaling); - - - -}; - -#endif //BVH_TRIANGLE_MESH_SHAPE_H diff --git a/extern/bullet/Bullet/CollisionShapes/CollisionMargin.h b/extern/bullet/Bullet/CollisionShapes/CollisionMargin.h deleted file mode 100644 index 377f0e506a2..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/CollisionMargin.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COLLISION_MARGIN_H -#define COLLISION_MARGIN_H - -//used by Gjk and some other algorithms - -#define CONVEX_DISTANCE_MARGIN 0.04f// 0.1f//;//0.01f - - - -#endif //COLLISION_MARGIN_H - diff --git a/extern/bullet/Bullet/CollisionShapes/CollisionShape.cpp b/extern/bullet/Bullet/CollisionShapes/CollisionShape.cpp deleted file mode 100644 index 0c5e48aeb3f..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/CollisionShape.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CollisionShapes/CollisionShape.h" - -void CollisionShape::GetBoundingSphere(SimdVector3& center,SimdScalar& radius) const -{ - SimdTransform tr; - tr.setIdentity(); - SimdVector3 aabbMin,aabbMax; - - GetAabb(tr,aabbMin,aabbMax); - - radius = (aabbMax-aabbMin).length()*0.5f; - center = (aabbMin+aabbMax)*0.5f; -} - -float CollisionShape::GetAngularMotionDisc() const -{ - SimdVector3 center; - float disc; - GetBoundingSphere(center,disc); - disc += (center).length(); - return disc; -} - -void CollisionShape::CalculateTemporalAabb(const SimdTransform& curTrans,const SimdVector3& linvel,const SimdVector3& angvel,SimdScalar timeStep, SimdVector3& temporalAabbMin,SimdVector3& temporalAabbMax) -{ - //start with static aabb - GetAabb(curTrans,temporalAabbMin,temporalAabbMax); - - float temporalAabbMaxx = temporalAabbMax.getX(); - float temporalAabbMaxy = temporalAabbMax.getY(); - float temporalAabbMaxz = temporalAabbMax.getZ(); - float temporalAabbMinx = temporalAabbMin.getX(); - float temporalAabbMiny = temporalAabbMin.getY(); - float temporalAabbMinz = temporalAabbMin.getZ(); - - // add linear motion - SimdVector3 linMotion = linvel*timeStep; - //todo: simd would have a vector max/min operation, instead of per-element access - if (linMotion.x() > 0.f) - temporalAabbMaxx += linMotion.x(); - else - temporalAabbMinx += linMotion.x(); - if (linMotion.y() > 0.f) - temporalAabbMaxy += linMotion.y(); - else - temporalAabbMiny += linMotion.y(); - if (linMotion.z() > 0.f) - temporalAabbMaxz += linMotion.z(); - else - temporalAabbMinz += linMotion.z(); - - //add conservative angular motion - SimdScalar angularMotion = angvel.length() * GetAngularMotionDisc() * timeStep; - SimdVector3 angularMotion3d(angularMotion,angularMotion,angularMotion); - temporalAabbMin = SimdVector3(temporalAabbMinx,temporalAabbMiny,temporalAabbMinz); - temporalAabbMax = SimdVector3(temporalAabbMaxx,temporalAabbMaxy,temporalAabbMaxz); - - temporalAabbMin -= angularMotion3d; - temporalAabbMax += angularMotion3d; -} diff --git a/extern/bullet/Bullet/CollisionShapes/CollisionShape.h b/extern/bullet/Bullet/CollisionShapes/CollisionShape.h deleted file mode 100644 index 57bf97874b2..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/CollisionShape.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COLLISION_SHAPE_H -#define COLLISION_SHAPE_H - -#include "SimdTransform.h" -#include "SimdVector3.h" -#include <SimdMatrix3x3.h> -#include "SimdPoint3.h" -#include "BroadphaseCollision/BroadphaseProxy.h" //for the shape types - -///CollisionShape provides generic interface for collidable objects -class CollisionShape -{ - -public: - - CollisionShape() - :m_tempDebug(0) - { - } - virtual ~CollisionShape() - { - } - - virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const =0; - - virtual void GetBoundingSphere(SimdVector3& center,SimdScalar& radius) const; - - virtual float GetAngularMotionDisc() const; - - virtual int GetShapeType() const=0; - - ///CalculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep) - ///result is conservative - void CalculateTemporalAabb(const SimdTransform& curTrans,const SimdVector3& linvel,const SimdVector3& angvel,SimdScalar timeStep, SimdVector3& temporalAabbMin,SimdVector3& temporalAabbMax); - - bool IsPolyhedral() const - { - return (GetShapeType() < IMPLICIT_CONVEX_SHAPES_START_HERE); - } - - bool IsConvex() const - { - return (GetShapeType() < CONCAVE_SHAPES_START_HERE); - } - bool IsConcave() const - { - return ((GetShapeType() > CONCAVE_SHAPES_START_HERE) && - (GetShapeType() < CONCAVE_SHAPES_END_HERE)); - } - bool IsCompound() const - { - return (GetShapeType() == COMPOUND_SHAPE_PROXYTYPE); - } - - virtual void setLocalScaling(const SimdVector3& scaling) =0; - virtual const SimdVector3& getLocalScaling() const =0; - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) = 0; - -//debugging support - virtual char* GetName()const =0 ; - const char* GetExtraDebugInfo() const { return m_tempDebug;} - void SetExtraDebugInfo(const char* extraDebugInfo) { m_tempDebug = extraDebugInfo;} - const char * m_tempDebug; -//endif debugging support - - virtual void SetMargin(float margin) = 0; - virtual float GetMargin() const = 0; - -}; - -#endif //COLLISION_SHAPE_H - diff --git a/extern/bullet/Bullet/CollisionShapes/CompoundShape.cpp b/extern/bullet/Bullet/CollisionShapes/CompoundShape.cpp deleted file mode 100644 index ecb11701373..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/CompoundShape.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CompoundShape.h" - - -#include "CollisionShape.h" - - -CompoundShape::CompoundShape() -:m_localAabbMin(1e30f,1e30f,1e30f), -m_localAabbMax(-1e30f,-1e30f,-1e30f), -m_aabbTree(0), -m_collisionMargin(0.f), -m_localScaling(1.f,1.f,1.f) -{ -} - - -CompoundShape::~CompoundShape() -{ -} - -void CompoundShape::AddChildShape(const SimdTransform& localTransform,CollisionShape* shape) -{ - m_childTransforms.push_back(localTransform); - m_childShapes.push_back(shape); - - //extend the local aabbMin/aabbMax - SimdVector3 localAabbMin,localAabbMax; - shape->GetAabb(localTransform,localAabbMin,localAabbMax); - for (int i=0;i<3;i++) - { - if (m_localAabbMin[i] > localAabbMin[i]) - { - m_localAabbMin[i] = localAabbMin[i]; - } - if (m_localAabbMax[i] < localAabbMax[i]) - { - m_localAabbMax[i] = localAabbMax[i]; - } - - } -} - - - - ///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version -void CompoundShape::GetAabb(const SimdTransform& trans,SimdVector3& aabbMin,SimdVector3& aabbMax) const -{ - SimdVector3 localHalfExtents = 0.5f*(m_localAabbMax-m_localAabbMin); - SimdVector3 localCenter = 0.5f*(m_localAabbMax+m_localAabbMin); - - SimdMatrix3x3 abs_b = trans.getBasis().absolute(); - - SimdPoint3 center = trans(localCenter); - - SimdVector3 extent = SimdVector3(abs_b[0].dot(localHalfExtents), - abs_b[1].dot(localHalfExtents), - abs_b[2].dot(localHalfExtents)); - extent += SimdVector3(GetMargin(),GetMargin(),GetMargin()); - - aabbMin = center - extent; - aabbMax = center + extent; -} - -void CompoundShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - //approximation: take the inertia from the aabb for now - SimdTransform ident; - ident.setIdentity(); - SimdVector3 aabbMin,aabbMax; - GetAabb(ident,aabbMin,aabbMax); - - SimdVector3 halfExtents = (aabbMax-aabbMin)*0.5f; - - SimdScalar lx=2.f*(halfExtents.x()); - SimdScalar ly=2.f*(halfExtents.y()); - SimdScalar lz=2.f*(halfExtents.z()); - - inertia[0] = mass/(12.0f) * (ly*ly + lz*lz); - inertia[1] = mass/(12.0f) * (lx*lx + lz*lz); - inertia[2] = mass/(12.0f) * (lx*lx + ly*ly); - -} - - - diff --git a/extern/bullet/Bullet/CollisionShapes/CompoundShape.h b/extern/bullet/Bullet/CollisionShapes/CompoundShape.h deleted file mode 100644 index 7a43e44c285..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/CompoundShape.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COMPOUND_SHAPE_H -#define COMPOUND_SHAPE_H - -#include "CollisionShape.h" - -#include "SimdVector3.h" -#include "SimdTransform.h" -#include "SimdMatrix3x3.h" -#include <vector> -#include "CollisionShapes/CollisionMargin.h" - -class OptimizedBvh; - -/// CompoundShape allows to store multiple other CollisionShapes -/// This allows for concave collision objects. This is more general then the Static Concave TriangleMeshShape. -class CompoundShape : public CollisionShape -{ - std::vector<SimdTransform> m_childTransforms; - std::vector<CollisionShape*> m_childShapes; - SimdVector3 m_localAabbMin; - SimdVector3 m_localAabbMax; - - OptimizedBvh* m_aabbTree; - -public: - CompoundShape(); - - virtual ~CompoundShape(); - - void AddChildShape(const SimdTransform& localTransform,CollisionShape* shape); - - int GetNumChildShapes() const - { - return m_childShapes.size(); - } - - CollisionShape* GetChildShape(int index) - { - return m_childShapes[index]; - } - const CollisionShape* GetChildShape(int index) const - { - return m_childShapes[index]; - } - - SimdTransform GetChildTransform(int index) - { - return m_childTransforms[index]; - } - const SimdTransform GetChildTransform(int index) const - { - return m_childTransforms[index]; - } - - ///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version - void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const; - - - virtual void setLocalScaling(const SimdVector3& scaling) - { - m_localScaling = scaling; - } - virtual const SimdVector3& getLocalScaling() const - { - return m_localScaling; - } - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - virtual int GetShapeType() const { return COMPOUND_SHAPE_PROXYTYPE;} - - virtual void SetMargin(float margin) - { - m_collisionMargin = margin; - } - virtual float GetMargin() const - { - return m_collisionMargin; - } - virtual char* GetName()const - { - return "Compound"; - } - - //this is optional, but should make collision queries faster, by culling non-overlapping nodes - void CreateAabbTreeFromChildren(); - - const OptimizedBvh* GetAabbTree() const - { - return m_aabbTree; - } - -private: - SimdScalar m_collisionMargin; -protected: - SimdVector3 m_localScaling; - -}; - - - -#endif //COMPOUND_SHAPE_H diff --git a/extern/bullet/Bullet/CollisionShapes/ConcaveShape.cpp b/extern/bullet/Bullet/CollisionShapes/ConcaveShape.cpp deleted file mode 100644 index c060a4df592..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConcaveShape.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "ConcaveShape.h" - -ConcaveShape::ConcaveShape() : m_collisionMargin(0.f) -{ - -} - -ConcaveShape::~ConcaveShape() -{ - -} diff --git a/extern/bullet/Bullet/CollisionShapes/ConcaveShape.h b/extern/bullet/Bullet/CollisionShapes/ConcaveShape.h deleted file mode 100644 index d6c589dd8fc..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConcaveShape.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONCAVE_SHAPE_H -#define CONCAVE_SHAPE_H - -#include "CollisionShapes/CollisionShape.h" -#include "BroadphaseCollision/BroadphaseProxy.h" // for the types - -#include "TriangleCallback.h" - - -///Concave shape proves an interface concave shapes that can produce triangles that overlapping a given AABB. -///Static triangle mesh, infinite plane, height field/landscapes are example that implement this interface. -class ConcaveShape : public CollisionShape -{ -protected: - float m_collisionMargin; - -public: - ConcaveShape(); - - virtual ~ConcaveShape(); - - virtual void ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const = 0; - - virtual float GetMargin() const { - return m_collisionMargin; - } - virtual void SetMargin(float collisionMargin) - { - m_collisionMargin = collisionMargin; - } - - - -}; - -#endif //CONCAVE_SHAPE_H diff --git a/extern/bullet/Bullet/CollisionShapes/ConeShape.cpp b/extern/bullet/Bullet/CollisionShapes/ConeShape.cpp deleted file mode 100644 index fb99c2c4480..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConeShape.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "ConeShape.h" -#include "SimdPoint3.h" - -#ifdef WIN32 -static int coneindices[3] = {1,2,0}; -#else -static int coneindices[3] = {2,1,0}; -#endif - -ConeShape::ConeShape (SimdScalar radius,SimdScalar height): -m_radius (radius), -m_height(height) -{ - SimdVector3 halfExtents; - m_sinAngle = (m_radius / sqrt(m_radius * m_radius + m_height * m_height)); -} - - -SimdVector3 ConeShape::ConeLocalSupport(const SimdVector3& v) const -{ - - float halfHeight = m_height * 0.5f; - - if (v[coneindices[1]] > v.length() * m_sinAngle) - { - SimdVector3 tmp; - - tmp[coneindices[0]] = 0.f; - tmp[coneindices[1]] = halfHeight; - tmp[coneindices[2]] = 0.f; - return tmp; - } - else { - SimdScalar s = SimdSqrt(v[coneindices[0]] * v[coneindices[0]] + v[coneindices[2]] * v[coneindices[2]]); - if (s > SIMD_EPSILON) { - SimdScalar d = m_radius / s; - SimdVector3 tmp; - tmp[coneindices[0]] = v[coneindices[0]] * d; - tmp[coneindices[1]] = -halfHeight; - tmp[coneindices[2]] = v[coneindices[2]] * d; - return tmp; - } - else { - SimdVector3 tmp; - tmp[coneindices[0]] = 0.f; - tmp[coneindices[1]] = -halfHeight; - tmp[coneindices[2]] = 0.f; - return tmp; - } - } - -} - -SimdVector3 ConeShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec) const -{ - return ConeLocalSupport(vec); -} - -void ConeShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - for (int i=0;i<numVectors;i++) - { - const SimdVector3& vec = vectors[i]; - supportVerticesOut[i] = ConeLocalSupport(vec); - } -} - - -SimdVector3 ConeShape::LocalGetSupportingVertex(const SimdVector3& vec) const -{ - SimdVector3 supVertex = ConeLocalSupport(vec); - if ( GetMargin()!=0.f ) - { - SimdVector3 vecnorm = vec; - if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON)) - { - vecnorm.setValue(-1.f,-1.f,-1.f); - } - vecnorm.normalize(); - supVertex+= GetMargin() * vecnorm; - } - return supVertex; -} - - diff --git a/extern/bullet/Bullet/CollisionShapes/ConeShape.h b/extern/bullet/Bullet/CollisionShapes/ConeShape.h deleted file mode 100644 index b7408df13cc..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConeShape.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONE_MINKOWSKI_H -#define CONE_MINKOWSKI_H - -#include "ConvexShape.h" -#include "BroadphaseCollision/BroadphaseProxy.h" // for the types - -/// implements cone shape interface -class ConeShape : public ConvexShape - -{ - - float m_sinAngle; - float m_radius; - float m_height; - - SimdVector3 ConeLocalSupport(const SimdVector3& v) const; - - -public: - ConeShape (SimdScalar radius,SimdScalar height); - - virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec) const; - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec) const; - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - float GetRadius() const { return m_radius;} - float GetHeight() const { return m_height;} - - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) - { - SimdTransform identity; - identity.setIdentity(); - SimdVector3 aabbMin,aabbMax; - GetAabb(identity,aabbMin,aabbMax); - - SimdVector3 halfExtents = (aabbMax-aabbMin)*0.5f; - - float margin = GetMargin(); - - SimdScalar lx=2.f*(halfExtents.x()+margin); - SimdScalar ly=2.f*(halfExtents.y()+margin); - SimdScalar lz=2.f*(halfExtents.z()+margin); - const SimdScalar x2 = lx*lx; - const SimdScalar y2 = ly*ly; - const SimdScalar z2 = lz*lz; - const SimdScalar scaledmass = mass * 0.08333333f; - - inertia = scaledmass * (SimdVector3(y2+z2,x2+z2,x2+y2)); - -// inertia.x() = scaledmass * (y2+z2); -// inertia.y() = scaledmass * (x2+z2); -// inertia.z() = scaledmass * (x2+y2); - } - - - - virtual int GetShapeType() const { return CONE_SHAPE_PROXYTYPE; } - - virtual char* GetName()const - { - return "Cone"; - } -}; - - -#endif //CONE_MINKOWSKI_H - diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.cpp b/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.cpp deleted file mode 100644 index e527dcd7e84..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ -#include "ConvexHullShape.h" -#include "CollisionShapes/CollisionMargin.h" - -#include "SimdQuaternion.h" - - -ConvexHullShape ::ConvexHullShape (SimdPoint3* points,int numPoints) -{ - m_points.resize(numPoints); - for (int i=0;i<numPoints;i++) - m_points[i] = points[i]; -} - -SimdVector3 ConvexHullShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const -{ - SimdVector3 supVec(0.f,0.f,0.f); - SimdScalar newDot,maxDot = -1e30f; - - SimdVector3 vec = vec0; - SimdScalar lenSqr = vec.length2(); - if (lenSqr < 0.0001f) - { - vec.setValue(1,0,0); - } else - { - float rlen = 1.f / SimdSqrt(lenSqr ); - vec *= rlen; - } - - - for (size_t i=0;i<m_points.size();i++) - { - SimdPoint3 vtx = m_points[i] * m_localScaling; - - newDot = vec.dot(vtx); - if (newDot > maxDot) - { - maxDot = newDot; - supVec = vtx; - } - } - return supVec; -} - -void ConvexHullShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - SimdScalar newDot; - //use 'w' component of supportVerticesOut? - { - for (int i=0;i<numVectors;i++) - { - supportVerticesOut[i][3] = -1e30f; - } - } - for (size_t i=0;i<m_points.size();i++) - { - SimdPoint3 vtx = m_points[i] * m_localScaling; - - for (int j=0;j<numVectors;j++) - { - const SimdVector3& vec = vectors[j]; - - newDot = vec.dot(vtx); - if (newDot > supportVerticesOut[j][3]) - { - //WARNING: don't swap next lines, the w component would get overwritten! - supportVerticesOut[j] = vtx; - supportVerticesOut[j][3] = newDot; - } - } - } - - - -} - - - -SimdVector3 ConvexHullShape::LocalGetSupportingVertex(const SimdVector3& vec)const -{ - SimdVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec); - - if ( GetMargin()!=0.f ) - { - SimdVector3 vecnorm = vec; - if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON)) - { - vecnorm.setValue(-1.f,-1.f,-1.f); - } - vecnorm.normalize(); - supVertex+= GetMargin() * vecnorm; - } - return supVertex; -} - - - - - - - - - -//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection -//Please note that you can debug-draw ConvexHullShape with the Raytracer Demo -int ConvexHullShape::GetNumVertices() const -{ - return m_points.size(); -} - -int ConvexHullShape::GetNumEdges() const -{ - return m_points.size()*m_points.size(); -} - -void ConvexHullShape::GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const -{ - - int index0 = i%m_points.size(); - int index1 = i/m_points.size(); - pa = m_points[index0]*m_localScaling; - pb = m_points[index1]*m_localScaling; -} - -void ConvexHullShape::GetVertex(int i,SimdPoint3& vtx) const -{ - vtx = m_points[i]*m_localScaling; -} - -int ConvexHullShape::GetNumPlanes() const -{ - return 0; -} - -void ConvexHullShape::GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const -{ - assert(0); -} - -//not yet -bool ConvexHullShape::IsInside(const SimdPoint3& pt,SimdScalar tolerance) const -{ - assert(0); - return false; -} - diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.h b/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.h deleted file mode 100644 index cbcc5687a28..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConvexHullShape.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONVEX_HULL_SHAPE_H -#define CONVEX_HULL_SHAPE_H - -#include "PolyhedralConvexShape.h" -#include "BroadphaseCollision/BroadphaseProxy.h" // for the types - -#include <vector> - -///ConvexHullShape implements an implicit (getSupportingVertex) Convex Hull of a Point Cloud (vertices) -///No connectivity is needed. LocalGetSupportingVertex iterates linearly though all vertices. -///on modern hardware, due to cache coherency this isn't that bad. Complex algorithms tend to trash the cash. -///(memory is much slower then the cpu) -class ConvexHullShape : public PolyhedralConvexShape -{ - std::vector<SimdPoint3> m_points; - -public: - ConvexHullShape(SimdPoint3* points,int numPoints); - - void AddPoint(const SimdPoint3& point) - { - m_points.push_back(point); - } - virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec)const; - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - - virtual int GetShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; } - - //debugging - virtual char* GetName()const {return "Convex";} - - - virtual int GetNumVertices() const; - virtual int GetNumEdges() const; - virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const; - virtual void GetVertex(int i,SimdPoint3& vtx) const; - virtual int GetNumPlanes() const; - virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const; - virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const; - - - -}; - - -#endif //CONVEX_HULL_SHAPE_H - diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexShape.cpp b/extern/bullet/Bullet/CollisionShapes/ConvexShape.cpp deleted file mode 100644 index 951f7a07d3a..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConvexShape.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "ConvexShape.h" - -ConvexShape::~ConvexShape() -{ - -} - -ConvexShape::ConvexShape() -:m_collisionMargin(CONVEX_DISTANCE_MARGIN), -m_localScaling(1.f,1.f,1.f) -{ -} - - -void ConvexShape::setLocalScaling(const SimdVector3& scaling) -{ - m_localScaling = scaling; -} - - - -void ConvexShape::GetAabbSlow(const SimdTransform& trans,SimdVector3&minAabb,SimdVector3&maxAabb) const -{ - - SimdScalar margin = GetMargin(); - for (int i=0;i<3;i++) - { - SimdVector3 vec(0.f,0.f,0.f); - vec[i] = 1.f; - - SimdVector3 sv = LocalGetSupportingVertex(vec*trans.getBasis()); - - SimdVector3 tmp = trans(sv); - maxAabb[i] = tmp[i]+margin; - vec[i] = -1.f; - tmp = trans(LocalGetSupportingVertex(vec*trans.getBasis())); - minAabb[i] = tmp[i]-margin; - } -}; - -SimdVector3 ConvexShape::LocalGetSupportingVertex(const SimdVector3& vec)const - { - SimdVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec); - - if ( GetMargin()!=0.f ) - { - SimdVector3 vecnorm = vec; - if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON)) - { - vecnorm.setValue(-1.f,-1.f,-1.f); - } - vecnorm.normalize(); - supVertex+= GetMargin() * vecnorm; - } - return supVertex; - - } - - diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexShape.h b/extern/bullet/Bullet/CollisionShapes/ConvexShape.h deleted file mode 100644 index 8961f451755..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConvexShape.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONVEX_SHAPE_INTERFACE1 -#define CONVEX_SHAPE_INTERFACE1 - -#include "CollisionShape.h" - -#include "SimdVector3.h" -#include "SimdTransform.h" -#include "SimdMatrix3x3.h" -#include <vector> -#include "CollisionShapes/CollisionMargin.h" - -//todo: get rid of this ConvexCastResult thing! -struct ConvexCastResult; - - -/// ConvexShape is an abstract shape interface. -/// The explicit part provides plane-equations, the implicit part provides GetClosestPoint interface. -/// used in combination with GJK or ConvexCast -class ConvexShape : public CollisionShape -{ -public: - ConvexShape(); - - virtual ~ConvexShape(); - - virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec)const; - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec) const= 0; - - //notice that the vectors should be unit length - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const= 0; - - // testing for hullnode code - - ///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version - void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const - { - GetAabbSlow(t,aabbMin,aabbMax); - } - - - - virtual void GetAabbSlow(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const; - - - virtual void setLocalScaling(const SimdVector3& scaling); - virtual const SimdVector3& getLocalScaling() const - { - return m_localScaling; - } - - - virtual void SetMargin(float margin) - { - m_collisionMargin = margin; - } - virtual float GetMargin() const - { - return m_collisionMargin; - } -private: - SimdScalar m_collisionMargin; - //local scaling. collisionMargin is not scaled ! -protected: - SimdVector3 m_localScaling; - -}; - - - -#endif //CONVEX_SHAPE_INTERFACE1 diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexTriangleMeshShape.cpp b/extern/bullet/Bullet/CollisionShapes/ConvexTriangleMeshShape.cpp deleted file mode 100644 index 44bbaeb85f4..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConvexTriangleMeshShape.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ -#include "ConvexTriangleMeshShape.h" -#include "CollisionShapes/CollisionMargin.h" - -#include "SimdQuaternion.h" -#include "CollisionShapes/StridingMeshInterface.h" - - -ConvexTriangleMeshShape ::ConvexTriangleMeshShape (StridingMeshInterface* meshInterface) -:m_stridingMesh(meshInterface) -{ -} - - - - -///It's not nice to have all this virtual function overhead, so perhaps we can also gather the points once -///but then we are duplicating -class LocalSupportVertexCallback: public InternalTriangleIndexCallback -{ - - SimdVector3 m_supportVertexLocal; -public: - - SimdScalar m_maxDot; - SimdVector3 m_supportVecLocal; - - LocalSupportVertexCallback(const SimdVector3& supportVecLocal) - : m_supportVertexLocal(0.f,0.f,0.f), - m_supportVecLocal(supportVecLocal), - m_maxDot(-1e30f) - { - } - - virtual void InternalProcessTriangleIndex(SimdVector3* triangle,int partId,int triangleIndex) - { - for (int i=0;i<3;i++) - { - SimdScalar dot = m_supportVecLocal.dot(triangle[i]); - if (dot > m_maxDot) - { - m_maxDot = dot; - m_supportVertexLocal = triangle[i]; - } - } - } - - SimdVector3 GetSupportVertexLocal() - { - return m_supportVertexLocal; - } - -}; - - - - - -SimdVector3 ConvexTriangleMeshShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const -{ - SimdVector3 supVec(0.f,0.f,0.f); - SimdScalar newDot,maxDot = -1e30f; - - SimdVector3 vec = vec0; - SimdScalar lenSqr = vec.length2(); - if (lenSqr < 0.0001f) - { - vec.setValue(1,0,0); - } else - { - float rlen = 1.f / SimdSqrt(lenSqr ); - vec *= rlen; - } - - LocalSupportVertexCallback supportCallback(vec); - SimdVector3 aabbMax(1e30f,1e30f,1e30f); - m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax); - supVec = supportCallback.GetSupportVertexLocal(); - - return supVec; -} - -void ConvexTriangleMeshShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - SimdScalar newDot; - //use 'w' component of supportVerticesOut? - { - for (int i=0;i<numVectors;i++) - { - supportVerticesOut[i][3] = -1e30f; - } - } - - //todo: could do the batch inside the callback! - - - for (int j=0;j<numVectors;j++) - { - const SimdVector3& vec = vectors[j]; - LocalSupportVertexCallback supportCallback(vec); - SimdVector3 aabbMax(1e30f,1e30f,1e30f); - m_stridingMesh->InternalProcessAllTriangles(&supportCallback,-aabbMax,aabbMax); - supportVerticesOut[j] = supportCallback.GetSupportVertexLocal(); - } - -} - - - -SimdVector3 ConvexTriangleMeshShape::LocalGetSupportingVertex(const SimdVector3& vec)const -{ - SimdVector3 supVertex = LocalGetSupportingVertexWithoutMargin(vec); - - if ( GetMargin()!=0.f ) - { - SimdVector3 vecnorm = vec; - if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON)) - { - vecnorm.setValue(-1.f,-1.f,-1.f); - } - vecnorm.normalize(); - supVertex+= GetMargin() * vecnorm; - } - return supVertex; -} - - - - - - - - - -//currently just for debugging (drawing), perhaps future support for algebraic continuous collision detection -//Please note that you can debug-draw ConvexTriangleMeshShape with the Raytracer Demo -int ConvexTriangleMeshShape::GetNumVertices() const -{ - //cache this? - assert(0); - return 0; - -} - -int ConvexTriangleMeshShape::GetNumEdges() const -{ - assert(0); - return 0; -} - -void ConvexTriangleMeshShape::GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const -{ - assert(0); -} - -void ConvexTriangleMeshShape::GetVertex(int i,SimdPoint3& vtx) const -{ - assert(0); -} - -int ConvexTriangleMeshShape::GetNumPlanes() const -{ - return 0; -} - -void ConvexTriangleMeshShape::GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const -{ - assert(0); -} - -//not yet -bool ConvexTriangleMeshShape::IsInside(const SimdPoint3& pt,SimdScalar tolerance) const -{ - assert(0); - return false; -} - - - -void ConvexTriangleMeshShape::setLocalScaling(const SimdVector3& scaling) -{ - m_stridingMesh->setScaling(scaling); -} - diff --git a/extern/bullet/Bullet/CollisionShapes/ConvexTriangleMeshShape.h b/extern/bullet/Bullet/CollisionShapes/ConvexTriangleMeshShape.h deleted file mode 100644 index 28bcb2e56b8..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/ConvexTriangleMeshShape.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef CONVEX_TRIANGLEMESH_SHAPE_H -#define CONVEX_TRIANGLEMESH_SHAPE_H - - -#include "PolyhedralConvexShape.h" -#include "BroadphaseCollision/BroadphaseProxy.h" // for the types - -#include <vector> - -/// ConvexTriangleMeshShape is a convex hull of a triangle mesh. If you just have a point cloud, you can use ConvexHullShape instead. -/// It uses the StridingMeshInterface instead of a point cloud. This can avoid the duplication of the triangle mesh data. -class ConvexTriangleMeshShape : public PolyhedralConvexShape -{ - - class StridingMeshInterface* m_stridingMesh; - -public: - ConvexTriangleMeshShape(StridingMeshInterface* meshInterface); - - class StridingMeshInterface* GetStridingMesh() - { - return m_stridingMesh; - } - - virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec)const; - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - virtual int GetShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; } - - //debugging - virtual char* GetName()const {return "ConvexTrimesh";} - - virtual int GetNumVertices() const; - virtual int GetNumEdges() const; - virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const; - virtual void GetVertex(int i,SimdPoint3& vtx) const; - virtual int GetNumPlanes() const; - virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const; - virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const; - - - void setLocalScaling(const SimdVector3& scaling); - -}; - - - -#endif //CONVEX_TRIANGLEMESH_SHAPE_H
\ No newline at end of file diff --git a/extern/bullet/Bullet/CollisionShapes/CylinderShape.cpp b/extern/bullet/Bullet/CollisionShapes/CylinderShape.cpp deleted file mode 100644 index 49163b4579e..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/CylinderShape.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ -#include "CylinderShape.h" -#include "SimdPoint3.h" - -CylinderShape::CylinderShape (const SimdVector3& halfExtents) -:BoxShape(halfExtents) -{ - -} - - -CylinderShapeX::CylinderShapeX (const SimdVector3& halfExtents) -:CylinderShape(halfExtents) -{ -} - - -CylinderShapeZ::CylinderShapeZ (const SimdVector3& halfExtents) -:CylinderShape(halfExtents) -{ -} - - - -inline SimdVector3 CylinderLocalSupportX(const SimdVector3& halfExtents,const SimdVector3& v) -{ -const int cylinderUpAxis = 0; -const int XX = 1; -const int YY = 0; -const int ZZ = 2; - - //mapping depends on how cylinder local orientation is - // extents of the cylinder is: X,Y is for radius, and Z for height - - - float radius = halfExtents[XX]; - float halfHeight = halfExtents[cylinderUpAxis]; - - - SimdVector3 tmp; - SimdScalar d ; - - SimdScalar s = SimdSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]); - if (s != SimdScalar(0.0)) - { - d = radius / s; - tmp[XX] = v[XX] * d; - tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight; - tmp[ZZ] = v[ZZ] * d; - return tmp; - } - else - { - tmp[XX] = radius; - tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight; - tmp[ZZ] = SimdScalar(0.0); - return tmp; - } - - -} - - - - - - -inline SimdVector3 CylinderLocalSupportY(const SimdVector3& halfExtents,const SimdVector3& v) -{ - -const int cylinderUpAxis = 1; -const int XX = 0; -const int YY = 1; -const int ZZ = 2; - - - float radius = halfExtents[XX]; - float halfHeight = halfExtents[cylinderUpAxis]; - - - SimdVector3 tmp; - SimdScalar d ; - - SimdScalar s = SimdSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]); - if (s != SimdScalar(0.0)) - { - d = radius / s; - tmp[XX] = v[XX] * d; - tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight; - tmp[ZZ] = v[ZZ] * d; - return tmp; - } - else - { - tmp[XX] = radius; - tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight; - tmp[ZZ] = SimdScalar(0.0); - return tmp; - } - -} - -inline SimdVector3 CylinderLocalSupportZ(const SimdVector3& halfExtents,const SimdVector3& v) -{ -const int cylinderUpAxis = 2; -const int XX = 0; -const int YY = 2; -const int ZZ = 1; - - //mapping depends on how cylinder local orientation is - // extents of the cylinder is: X,Y is for radius, and Z for height - - - float radius = halfExtents[XX]; - float halfHeight = halfExtents[cylinderUpAxis]; - - - SimdVector3 tmp; - SimdScalar d ; - - SimdScalar s = SimdSqrt(v[XX] * v[XX] + v[ZZ] * v[ZZ]); - if (s != SimdScalar(0.0)) - { - d = radius / s; - tmp[XX] = v[XX] * d; - tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight; - tmp[ZZ] = v[ZZ] * d; - return tmp; - } - else - { - tmp[XX] = radius; - tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight; - tmp[ZZ] = SimdScalar(0.0); - return tmp; - } - - -} - -SimdVector3 CylinderShapeX::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const -{ - return CylinderLocalSupportX(GetHalfExtents(),vec); -} - - -SimdVector3 CylinderShapeZ::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const -{ - return CylinderLocalSupportZ(GetHalfExtents(),vec); -} -SimdVector3 CylinderShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const -{ - return CylinderLocalSupportY(GetHalfExtents(),vec); -} - -void CylinderShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - for (int i=0;i<numVectors;i++) - { - supportVerticesOut[i] = CylinderLocalSupportY(GetHalfExtents(),vectors[i]); - } -} - -void CylinderShapeZ::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - for (int i=0;i<numVectors;i++) - { - supportVerticesOut[i] = CylinderLocalSupportZ(GetHalfExtents(),vectors[i]); - } -} - - - - -void CylinderShapeX::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - for (int i=0;i<numVectors;i++) - { - supportVerticesOut[i] = CylinderLocalSupportX(GetHalfExtents(),vectors[i]); - } -} - - diff --git a/extern/bullet/Bullet/CollisionShapes/CylinderShape.h b/extern/bullet/Bullet/CollisionShapes/CylinderShape.h deleted file mode 100644 index 217ce70369a..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/CylinderShape.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CYLINDER_MINKOWSKI_H -#define CYLINDER_MINKOWSKI_H - -#include "BoxShape.h" -#include "BroadphaseCollision/BroadphaseProxy.h" // for the types -#include "SimdVector3.h" - -/// implements cylinder shape interface -class CylinderShape : public BoxShape - -{ - -public: - CylinderShape (const SimdVector3& halfExtents); - - ///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version - void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const - { - GetAabbSlow(t,aabbMin,aabbMax); - } - - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec) const - { - - SimdVector3 supVertex; - supVertex = LocalGetSupportingVertexWithoutMargin(vec); - - if ( GetMargin()!=0.f ) - { - SimdVector3 vecnorm = vec; - if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON)) - { - vecnorm.setValue(-1.f,-1.f,-1.f); - } - vecnorm.normalize(); - supVertex+= GetMargin() * vecnorm; - } - return supVertex; - } - - - //use box inertia - // virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - virtual int GetShapeType() const - { - return CYLINDER_SHAPE_PROXYTYPE; - } - - virtual int GetUpAxis() const - { - return 1; - } - - //debugging - virtual char* GetName()const - { - return "CylinderY"; - } - - - -}; - -class CylinderShapeX : public CylinderShape -{ -public: - CylinderShapeX (const SimdVector3& halfExtents); - - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - virtual int GetUpAxis() const - { - return 0; - } - //debugging - virtual char* GetName()const - { - return "CylinderX"; - } - -}; - -class CylinderShapeZ : public CylinderShape -{ -public: - CylinderShapeZ (const SimdVector3& halfExtents); - - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - virtual int GetUpAxis() const - { - return 2; - } - //debugging - virtual char* GetName()const - { - return "CylinderZ"; - } - -}; - - -#endif //CYLINDER_MINKOWSKI_H - diff --git a/extern/bullet/Bullet/CollisionShapes/EmptyShape.cpp b/extern/bullet/Bullet/CollisionShapes/EmptyShape.cpp deleted file mode 100644 index 939377c724b..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/EmptyShape.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "EmptyShape.h" - - -#include "CollisionShape.h" - - -EmptyShape::EmptyShape() -{ -} - - -EmptyShape::~EmptyShape() -{ -} - - - ///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version -void EmptyShape::GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const -{ - SimdVector3 margin(GetMargin(),GetMargin(),GetMargin()); - - aabbMin = t.getOrigin() - margin; - - aabbMax = t.getOrigin() + margin; - -} - -void EmptyShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - assert(0); -} - - - diff --git a/extern/bullet/Bullet/CollisionShapes/EmptyShape.h b/extern/bullet/Bullet/CollisionShapes/EmptyShape.h deleted file mode 100644 index 4407a22acdf..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/EmptyShape.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef EMPTY_SHAPE_H -#define EMPTY_SHAPE_H - -#include "ConcaveShape.h" - -#include "SimdVector3.h" -#include "SimdTransform.h" -#include "SimdMatrix3x3.h" -#include <vector> -#include "CollisionShapes/CollisionMargin.h" - - - - -/// EmptyShape is a collision shape without actual collision detection. -///It can be replaced by another shape during runtime -class EmptyShape : public ConcaveShape -{ -public: - EmptyShape(); - - virtual ~EmptyShape(); - - - ///GetAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version - void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const; - - - virtual void setLocalScaling(const SimdVector3& scaling) - { - m_localScaling = scaling; - } - virtual const SimdVector3& getLocalScaling() const - { - return m_localScaling; - } - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - virtual int GetShapeType() const { return EMPTY_SHAPE_PROXYTYPE;} - - - virtual char* GetName()const - { - return "Empty"; - } - - -protected: - SimdVector3 m_localScaling; - -}; - - - -#endif //EMPTY_SHAPE_H diff --git a/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.cpp b/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.cpp deleted file mode 100644 index 9bd6f9c350c..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "MinkowskiSumShape.h" - - -MinkowskiSumShape::MinkowskiSumShape(ConvexShape* shapeA,ConvexShape* shapeB) -:m_shapeA(shapeA), -m_shapeB(shapeB) -{ - m_transA.setIdentity(); - m_transB.setIdentity(); -} - -SimdVector3 MinkowskiSumShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const -{ - SimdVector3 supVertexA = m_transA(m_shapeA->LocalGetSupportingVertexWithoutMargin(vec*m_transA.getBasis())); - SimdVector3 supVertexB = m_transB(m_shapeB->LocalGetSupportingVertexWithoutMargin(vec*m_transB.getBasis())); - return supVertexA + supVertexB; -} - -void MinkowskiSumShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - //todo: could make recursive use of batching. probably this shape is not used frequently. - for (int i=0;i<numVectors;i++) - { - supportVerticesOut[i] = LocalGetSupportingVertexWithoutMargin(vectors[i]); - } - -} - - - -float MinkowskiSumShape::GetMargin() const -{ - return m_shapeA->GetMargin() + m_shapeB->GetMargin(); -} - - -void MinkowskiSumShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - assert(0); - inertia.setValue(0,0,0); -} diff --git a/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.h b/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.h deleted file mode 100644 index 69dee7c0382..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/MinkowskiSumShape.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef MINKOWSKI_SUM_SHAPE_H -#define MINKOWSKI_SUM_SHAPE_H - -#include "ConvexShape.h" -#include "BroadphaseCollision/BroadphaseProxy.h" // for the types - -/// MinkowskiSumShape represents implicit (getSupportingVertex) based minkowski sum of two convex implicit shapes. -class MinkowskiSumShape : public ConvexShape -{ - - SimdTransform m_transA; - SimdTransform m_transB; - ConvexShape* m_shapeA; - ConvexShape* m_shapeB; - -public: - - MinkowskiSumShape(ConvexShape* shapeA,ConvexShape* shapeB); - - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - void SetTransformA(const SimdTransform& transA) { m_transA = transA;} - void SetTransformB(const SimdTransform& transB) { m_transB = transB;} - - const SimdTransform& GetTransformA()const { return m_transA;} - const SimdTransform& GetTransformB()const { return m_transB;} - - - virtual int GetShapeType() const { return MINKOWSKI_SUM_SHAPE_PROXYTYPE; } - - virtual float GetMargin() const; - - const ConvexShape* GetShapeA() const { return m_shapeA;} - const ConvexShape* GetShapeB() const { return m_shapeB;} - - virtual char* GetName()const - { - return "MinkowskiSum"; - } -}; - -#endif //MINKOWSKI_SUM_SHAPE_H diff --git a/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.cpp b/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.cpp deleted file mode 100644 index 83d1a72d67a..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "MultiSphereShape.h" -#include "CollisionShapes/CollisionMargin.h" -#include "SimdQuaternion.h" - -MultiSphereShape::MultiSphereShape (const SimdVector3& inertiaHalfExtents,const SimdVector3* positions,const SimdScalar* radi,int numSpheres) -:m_inertiaHalfExtents(inertiaHalfExtents) -{ - m_minRadius = 1e30f; - - m_numSpheres = numSpheres; - for (int i=0;i<m_numSpheres;i++) - { - m_localPositions[i] = positions[i]; - m_radi[i] = radi[i]; - if (radi[i] < m_minRadius) - m_minRadius = radi[i]; - } - SetMargin(m_minRadius); - -} - - - - - SimdVector3 MultiSphereShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const -{ - int i; - SimdVector3 supVec(0,0,0); - - SimdScalar maxDot(-1e30f); - - - SimdVector3 vec = vec0; - SimdScalar lenSqr = vec.length2(); - if (lenSqr < 0.0001f) - { - vec.setValue(1,0,0); - } else - { - float rlen = 1.f / SimdSqrt(lenSqr ); - vec *= rlen; - } - - SimdVector3 vtx; - SimdScalar newDot; - - const SimdVector3* pos = &m_localPositions[0]; - const SimdScalar* rad = &m_radi[0]; - - for (i=0;i<m_numSpheres;i++) - { - vtx = (*pos) +vec*((*rad)-m_minRadius); - pos++; - rad++; - newDot = vec.dot(vtx); - if (newDot > maxDot) - { - maxDot = newDot; - supVec = vtx; - } - } - - return supVec; - -} - - void MultiSphereShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - - for (int j=0;j<numVectors;j++) - { - SimdScalar maxDot(-1e30f); - - const SimdVector3& vec = vectors[j]; - - SimdVector3 vtx; - SimdScalar newDot; - - const SimdVector3* pos = &m_localPositions[0]; - const SimdScalar* rad = &m_radi[0]; - - for (int i=0;i<m_numSpheres;i++) - { - vtx = (*pos) +vec*((*rad)-m_minRadius); - pos++; - rad++; - newDot = vec.dot(vtx); - if (newDot > maxDot) - { - maxDot = newDot; - supportVerticesOut[j] = vtx; - } - } - } -} - - - - - - - - -void MultiSphereShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - //as an approximation, take the inertia of the box that bounds the spheres - - SimdTransform ident; - ident.setIdentity(); -// SimdVector3 aabbMin,aabbMax; - -// GetAabb(ident,aabbMin,aabbMax); - - SimdVector3 halfExtents = m_inertiaHalfExtents;//(aabbMax - aabbMin)* 0.5f; - - float margin = CONVEX_DISTANCE_MARGIN; - - SimdScalar lx=2.f*(halfExtents[0]+margin); - SimdScalar ly=2.f*(halfExtents[1]+margin); - SimdScalar lz=2.f*(halfExtents[2]+margin); - const SimdScalar x2 = lx*lx; - const SimdScalar y2 = ly*ly; - const SimdScalar z2 = lz*lz; - const SimdScalar scaledmass = mass * 0.08333333f; - - inertia[0] = scaledmass * (y2+z2); - inertia[1] = scaledmass * (x2+z2); - inertia[2] = scaledmass * (x2+y2); - -} - - - diff --git a/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.h b/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.h deleted file mode 100644 index 19c9d978f48..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/MultiSphereShape.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef MULTI_SPHERE_MINKOWSKI_H -#define MULTI_SPHERE_MINKOWSKI_H - -#include "ConvexShape.h" -#include "BroadphaseCollision/BroadphaseProxy.h" // for the types - -#define MAX_NUM_SPHERES 5 - -///MultiSphereShape represents implicit convex hull of a collection of spheres (using getSupportingVertex) -class MultiSphereShape : public ConvexShape - -{ - - SimdVector3 m_localPositions[MAX_NUM_SPHERES]; - SimdScalar m_radi[MAX_NUM_SPHERES]; - SimdVector3 m_inertiaHalfExtents; - - int m_numSpheres; - float m_minRadius; - - - - - -public: - MultiSphereShape (const SimdVector3& inertiaHalfExtents,const SimdVector3* positions,const SimdScalar* radi,int numSpheres); - - ///CollisionShape Interface - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - /// ConvexShape Interface - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - - virtual int GetShapeType() const { return MULTI_SPHERE_SHAPE_PROXYTYPE; } - - virtual char* GetName()const - { - return "MultiSphere"; - } - -}; - - -#endif //MULTI_SPHERE_MINKOWSKI_H diff --git a/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.cpp b/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.cpp deleted file mode 100644 index 1b30bfbcb83..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "OptimizedBvh.h" -#include "StridingMeshInterface.h" -#include "AabbUtil2.h" - - - -void OptimizedBvh::Build(StridingMeshInterface* triangles) -{ - //int countTriangles = 0; - - - - // NodeArray triangleNodes; - - struct NodeTriangleCallback : public InternalTriangleIndexCallback - { - NodeArray& m_triangleNodes; - - NodeTriangleCallback(NodeArray& triangleNodes) - :m_triangleNodes(triangleNodes) - { - - } - - virtual void InternalProcessTriangleIndex(SimdVector3* triangle,int partId,int triangleIndex) - { - - OptimizedBvhNode node; - node.m_aabbMin = SimdVector3(1e30f,1e30f,1e30f); - node.m_aabbMax = SimdVector3(-1e30f,-1e30f,-1e30f); - node.m_aabbMin.setMin(triangle[0]); - node.m_aabbMax.setMax(triangle[0]); - node.m_aabbMin.setMin(triangle[1]); - node.m_aabbMax.setMax(triangle[1]); - node.m_aabbMin.setMin(triangle[2]); - node.m_aabbMax.setMax(triangle[2]); - - node.m_escapeIndex = -1; - node.m_leftChild = 0; - node.m_rightChild = 0; - - - //for child nodes - node.m_subPart = partId; - node.m_triangleIndex = triangleIndex; - - - m_triangleNodes.push_back(node); - } - }; - - - - NodeTriangleCallback callback(m_leafNodes); - - SimdVector3 aabbMin(-1e30f,-1e30f,-1e30f); - SimdVector3 aabbMax(1e30f,1e30f,1e30f); - - triangles->InternalProcessAllTriangles(&callback,aabbMin,aabbMax); - - //now we have an array of leafnodes in m_leafNodes - - m_contiguousNodes = new OptimizedBvhNode[2*m_leafNodes.size()]; - m_curNodeIndex = 0; - - m_rootNode1 = BuildTree(m_leafNodes,0,m_leafNodes.size()); - - - ///create the leafnodes first -// OptimizedBvhNode* leafNodes = new OptimizedBvhNode; -} - - -OptimizedBvhNode* OptimizedBvh::BuildTree (NodeArray& leafNodes,int startIndex,int endIndex) -{ - OptimizedBvhNode* internalNode; - - int splitAxis, splitIndex, i; - int numIndices =endIndex-startIndex; - int curIndex = m_curNodeIndex; - - assert(numIndices>0); - - if (numIndices==1) - { - return new (&m_contiguousNodes[m_curNodeIndex++]) OptimizedBvhNode(leafNodes[startIndex]); - } - //calculate Best Splitting Axis and where to split it. Sort the incoming 'leafNodes' array within range 'startIndex/endIndex'. - - splitAxis = CalcSplittingAxis(leafNodes,startIndex,endIndex); - - splitIndex = SortAndCalcSplittingIndex(leafNodes,startIndex,endIndex,splitAxis); - - internalNode = &m_contiguousNodes[m_curNodeIndex++]; - - internalNode->m_aabbMax.setValue(-1e30f,-1e30f,-1e30f); - internalNode->m_aabbMin.setValue(1e30f,1e30f,1e30f); - - for (i=startIndex;i<endIndex;i++) - { - internalNode->m_aabbMax.setMax(leafNodes[i].m_aabbMax); - internalNode->m_aabbMin.setMin(leafNodes[i].m_aabbMin); - } - - - - //internalNode->m_escapeIndex; - internalNode->m_leftChild = BuildTree(leafNodes,startIndex,splitIndex); - internalNode->m_rightChild = BuildTree(leafNodes,splitIndex,endIndex); - - internalNode->m_escapeIndex = m_curNodeIndex - curIndex; - return internalNode; -} - -int OptimizedBvh::SortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis) -{ - int i; - int splitIndex =startIndex; - int numIndices = endIndex - startIndex; - float splitValue; - - SimdVector3 means(0.f,0.f,0.f); - for (i=startIndex;i<endIndex;i++) - { - SimdVector3 center = 0.5f*(leafNodes[i].m_aabbMax+leafNodes[i].m_aabbMin); - means+=center; - } - means *= (1.f/(float)numIndices); - - splitValue = means[splitAxis]; - - //sort leafNodes so all values larger then splitValue comes first, and smaller values start from 'splitIndex'. - for (i=startIndex;i<endIndex;i++) - { - SimdVector3 center = 0.5f*(leafNodes[i].m_aabbMax+leafNodes[i].m_aabbMin); - if (center[splitAxis] > splitValue) - { - //swap - OptimizedBvhNode tmp = leafNodes[i]; - leafNodes[i] = leafNodes[splitIndex]; - leafNodes[splitIndex] = tmp; - splitIndex++; - } - } - if ((splitIndex==startIndex) || (splitIndex == (endIndex-1))) - { - splitIndex = startIndex+ (numIndices>>1); - } - return splitIndex; -} - - -int OptimizedBvh::CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex) -{ - int i; - - SimdVector3 means(0.f,0.f,0.f); - SimdVector3 variance(0.f,0.f,0.f); - int numIndices = endIndex-startIndex; - - for (i=startIndex;i<endIndex;i++) - { - SimdVector3 center = 0.5f*(leafNodes[i].m_aabbMax+leafNodes[i].m_aabbMin); - means+=center; - } - means *= (1.f/(float)numIndices); - - for (i=startIndex;i<endIndex;i++) - { - SimdVector3 center = 0.5f*(leafNodes[i].m_aabbMax+leafNodes[i].m_aabbMin); - SimdVector3 diff2 = center-means; - diff2 = diff2 * diff2; - variance += diff2; - } - variance *= (1.f/ ((float)numIndices-1) ); - - return variance.maxAxis(); -} - - - -void OptimizedBvh::ReportAabbOverlappingNodex(NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - //either choose recursive traversal (WalkTree) or stackless (WalkStacklessTree) - - //WalkTree(m_rootNode1,nodeCallback,aabbMin,aabbMax); - - WalkStacklessTree(m_rootNode1,nodeCallback,aabbMin,aabbMax); -} - -void OptimizedBvh::WalkTree(OptimizedBvhNode* rootNode,NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - bool isLeafNode, aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax); - if (aabbOverlap) - { - isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild); - if (isLeafNode) - { - nodeCallback->ProcessNode(rootNode); - } else - { - WalkTree(rootNode->m_leftChild,nodeCallback,aabbMin,aabbMax); - WalkTree(rootNode->m_rightChild,nodeCallback,aabbMin,aabbMax); - } - } - -} - -int maxIterations = 0; - -void OptimizedBvh::WalkStacklessTree(OptimizedBvhNode* rootNode,NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - int escapeIndex, curIndex = 0; - int walkIterations = 0; - bool aabbOverlap, isLeafNode; - - while (curIndex < m_curNodeIndex) - { - //catch bugs in tree data - assert (walkIterations < m_curNodeIndex); - - walkIterations++; - aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax); - isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild); - - if (isLeafNode && aabbOverlap) - { - nodeCallback->ProcessNode(rootNode); - } - - if (aabbOverlap || isLeafNode) - { - rootNode++; - curIndex++; - } else - { - escapeIndex = rootNode->m_escapeIndex; - rootNode += escapeIndex; - curIndex += escapeIndex; - } - - } - - if (maxIterations < walkIterations) - maxIterations = walkIterations; - -} - - -void OptimizedBvh::ReportSphereOverlappingNodex(NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - -} - diff --git a/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.h b/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.h deleted file mode 100644 index ec550e46746..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/OptimizedBvh.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef OPTIMIZED_BVH_H -#define OPTIMIZED_BVH_H -#include "SimdVector3.h" -#include <vector> - -class StridingMeshInterface; - -/// OptimizedBvhNode contains both internal and leaf node information. -/// It hasn't been optimized yet for storage. Some obvious optimizations are: -/// Removal of the pointers (can already be done, they are not used for traversal) -/// and storing aabbmin/max as quantized integers. -/// 'subpart' doesn't need an integer either. It allows to re-use graphics triangle -/// meshes stored in a non-uniform way (like batches/subparts of triangle-fans -struct OptimizedBvhNode -{ - - SimdVector3 m_aabbMin; - SimdVector3 m_aabbMax; - -//these 2 pointers are obsolete, the stackless traversal just uses the escape index - OptimizedBvhNode* m_leftChild; - OptimizedBvhNode* m_rightChild; - - int m_escapeIndex; - - //for child nodes - int m_subPart; - int m_triangleIndex; - -}; - -class NodeOverlapCallback -{ -public: - virtual ~NodeOverlapCallback() {}; - - virtual void ProcessNode(const OptimizedBvhNode* node) = 0; -}; - -typedef std::vector<OptimizedBvhNode> NodeArray; - - -///OptimizedBvh store an AABB tree that can be quickly traversed on CPU (and SPU,GPU in future) -class OptimizedBvh -{ - OptimizedBvhNode* m_rootNode1; - - OptimizedBvhNode* m_contiguousNodes; - int m_curNodeIndex; - - int m_numNodes; - - NodeArray m_leafNodes; - -public: - OptimizedBvh() :m_rootNode1(0), m_numNodes(0) { } - virtual ~OptimizedBvh() {}; - - void Build(StridingMeshInterface* triangles); - - OptimizedBvhNode* BuildTree (NodeArray& leafNodes,int startIndex,int endIndex); - - int CalcSplittingAxis(NodeArray& leafNodes,int startIndex,int endIndex); - - int SortAndCalcSplittingIndex(NodeArray& leafNodes,int startIndex,int endIndex,int splitAxis); - - void WalkTree(OptimizedBvhNode* rootNode,NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - void WalkStacklessTree(OptimizedBvhNode* rootNode,NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - - //OptimizedBvhNode* GetRootNode() { return m_rootNode1;} - - int GetNumNodes() { return m_numNodes;} - - void ReportAabbOverlappingNodex(NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - void ReportSphereOverlappingNodex(NodeOverlapCallback* nodeCallback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - -}; - - -#endif //OPTIMIZED_BVH_H - diff --git a/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.cpp b/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.cpp deleted file mode 100644 index bfdf7501451..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include <CollisionShapes/PolyhedralConvexShape.h> - -PolyhedralConvexShape::PolyhedralConvexShape() -:m_optionalHull(0) -{ - -} - - - -SimdVector3 PolyhedralConvexShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec0)const -{ - int i; - SimdVector3 supVec(0,0,0); - - SimdScalar maxDot(-1e30f); - - SimdVector3 vec = vec0; - SimdScalar lenSqr = vec.length2(); - if (lenSqr < 0.0001f) - { - vec.setValue(1,0,0); - } else - { - float rlen = 1.f / SimdSqrt(lenSqr ); - vec *= rlen; - } - - SimdVector3 vtx; - SimdScalar newDot; - - for (i=0;i<GetNumVertices();i++) - { - GetVertex(i,vtx); - newDot = vec.dot(vtx); - if (newDot > maxDot) - { - maxDot = newDot; - supVec = vtx; - } - } - - return supVec; - -} - -void PolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - int i; - - SimdVector3 vtx; - SimdScalar newDot; - - for (int j=0;j<numVectors;j++) - { - SimdScalar maxDot(-1e30f); - - const SimdVector3& vec = vectors[j]; - - for (i=0;i<GetNumVertices();i++) - { - GetVertex(i,vtx); - newDot = vec.dot(vtx); - if (newDot > maxDot) - { - maxDot = newDot; - supportVerticesOut[i] = vtx; - } - } - } -} - - - -void PolyhedralConvexShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - //not yet, return box inertia - - float margin = GetMargin(); - - SimdTransform ident; - ident.setIdentity(); - SimdVector3 aabbMin,aabbMax; - GetAabb(ident,aabbMin,aabbMax); - SimdVector3 halfExtents = (aabbMax-aabbMin)*0.5f; - - SimdScalar lx=2.f*(halfExtents.x()+margin); - SimdScalar ly=2.f*(halfExtents.y()+margin); - SimdScalar lz=2.f*(halfExtents.z()+margin); - const SimdScalar x2 = lx*lx; - const SimdScalar y2 = ly*ly; - const SimdScalar z2 = lz*lz; - const SimdScalar scaledmass = mass * 0.08333333f; - - inertia = scaledmass * (SimdVector3(y2+z2,x2+z2,x2+y2)); - -} - diff --git a/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.h b/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.h deleted file mode 100644 index 358bf71d0d9..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/PolyhedralConvexShape.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef BU_SHAPE -#define BU_SHAPE - -#include <SimdPoint3.h> -#include <SimdMatrix3x3.h> -#include <CollisionShapes/ConvexShape.h> - - -///PolyhedralConvexShape is an interface class for feature based (vertex/edge/face) convex shapes. -class PolyhedralConvexShape : public ConvexShape -{ - -public: - - PolyhedralConvexShape(); - - //brute force implementations - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - - - virtual int GetNumVertices() const = 0 ; - virtual int GetNumEdges() const = 0; - virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const = 0; - virtual void GetVertex(int i,SimdPoint3& vtx) const = 0; - virtual int GetNumPlanes() const = 0; - virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i ) const = 0; -// virtual int GetIndex(int i) const = 0 ; - - virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const = 0; - - /// optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp - class Hull* m_optionalHull; - -}; - -#endif //BU_SHAPE diff --git a/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.cpp b/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.cpp deleted file mode 100644 index e1d02f956d4..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.cpp +++ /dev/null @@ -1,193 +0,0 @@ - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ -#include "Simplex1to4Shape.h" -#include "SimdMatrix3x3.h" - -BU_Simplex1to4::BU_Simplex1to4() -:m_numVertices(0) -{ -} - -BU_Simplex1to4::BU_Simplex1to4(const SimdPoint3& pt0) -:m_numVertices(0) -{ - AddVertex(pt0); -} - -BU_Simplex1to4::BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1) -:m_numVertices(0) -{ - AddVertex(pt0); - AddVertex(pt1); -} - -BU_Simplex1to4::BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2) -:m_numVertices(0) -{ - AddVertex(pt0); - AddVertex(pt1); - AddVertex(pt2); -} - -BU_Simplex1to4::BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2,const SimdPoint3& pt3) -:m_numVertices(0) -{ - AddVertex(pt0); - AddVertex(pt1); - AddVertex(pt2); - AddVertex(pt3); -} - - - - - -void BU_Simplex1to4::AddVertex(const SimdPoint3& pt) -{ - m_vertices[m_numVertices++] = pt; -} - - -int BU_Simplex1to4::GetNumVertices() const -{ - return m_numVertices; -} - -int BU_Simplex1to4::GetNumEdges() const -{ - //euler formula, F-E+V = 2, so E = F+V-2 - - switch (m_numVertices) - { - case 0: - return 0; - case 1: return 0; - case 2: return 1; - case 3: return 3; - case 4: return 6; - - - } - - return 0; -} - -void BU_Simplex1to4::GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const -{ - - switch (m_numVertices) - { - - case 2: - pa = m_vertices[0]; - pb = m_vertices[1]; - break; - case 3: - switch (i) - { - case 0: - pa = m_vertices[0]; - pb = m_vertices[1]; - break; - case 1: - pa = m_vertices[1]; - pb = m_vertices[2]; - break; - case 2: - pa = m_vertices[2]; - pb = m_vertices[0]; - break; - - } - break; - case 4: - switch (i) - { - case 0: - pa = m_vertices[0]; - pb = m_vertices[1]; - break; - case 1: - pa = m_vertices[1]; - pb = m_vertices[2]; - break; - case 2: - pa = m_vertices[2]; - pb = m_vertices[0]; - break; - case 3: - pa = m_vertices[0]; - pb = m_vertices[3]; - break; - case 4: - pa = m_vertices[1]; - pb = m_vertices[3]; - break; - case 5: - pa = m_vertices[2]; - pb = m_vertices[3]; - break; - } - - } - - - - -} - -void BU_Simplex1to4::GetVertex(int i,SimdPoint3& vtx) const -{ - vtx = m_vertices[i]; -} - -int BU_Simplex1to4::GetNumPlanes() const -{ - switch (m_numVertices) - { - case 0: - return 0; - case 1: - return 0; - case 2: - return 0; - case 3: - return 2; - case 4: - return 4; - default: - { - } - } - return 0; -} - - -void BU_Simplex1to4::GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i) const -{ - -} - -int BU_Simplex1to4::GetIndex(int i) const -{ - return 0; -} - -bool BU_Simplex1to4::IsInside(const SimdPoint3& pt,SimdScalar tolerance) const -{ - return false; -} - diff --git a/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.h b/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.h deleted file mode 100644 index 8e5d124f31e..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/Simplex1to4Shape.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef BU_SIMPLEX_1TO4_SHAPE -#define BU_SIMPLEX_1TO4_SHAPE - - -#include <CollisionShapes/PolyhedralConvexShape.h> -#include "BroadphaseCollision/BroadphaseProxy.h" - - -///BU_Simplex1to4 implements feature based and implicit simplex of up to 4 vertices (tetrahedron, triangle, line, vertex). -class BU_Simplex1to4 : public PolyhedralConvexShape -{ -protected: - - int m_numVertices; - SimdPoint3 m_vertices[4]; - -public: - BU_Simplex1to4(); - - BU_Simplex1to4(const SimdPoint3& pt0); - BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1); - BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2); - BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2,const SimdPoint3& pt3); - - - void Reset() - { - m_numVertices = 0; - } - - - virtual int GetShapeType() const{ return TETRAHEDRAL_SHAPE_PROXYTYPE; } - - void AddVertex(const SimdPoint3& pt); - - //PolyhedralConvexShape interface - - virtual int GetNumVertices() const; - - virtual int GetNumEdges() const; - - virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const; - - virtual void GetVertex(int i,SimdPoint3& vtx) const; - - virtual int GetNumPlanes() const; - - virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i) const; - - virtual int GetIndex(int i) const; - - virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const; - - - ///GetName is for debugging - virtual char* GetName()const { return "BU_Simplex1to4";} - -}; - -#endif //BU_SIMPLEX_1TO4_SHAPE diff --git a/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp b/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp deleted file mode 100644 index 28c46a28ab7..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "SphereShape.h" -#include "CollisionShapes/CollisionMargin.h" - -#include "SimdQuaternion.h" - - -SphereShape ::SphereShape (SimdScalar radius) -: m_radius(radius) -{ -} - -SimdVector3 SphereShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const -{ - return SimdVector3(0.f,0.f,0.f); -} - -void SphereShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const -{ - for (int i=0;i<numVectors;i++) - { - supportVerticesOut[i].setValue(0.f,0.f,0.f); - } -} - - -SimdVector3 SphereShape::LocalGetSupportingVertex(const SimdVector3& vec)const -{ - SimdVector3 supVertex; - supVertex = LocalGetSupportingVertexWithoutMargin(vec); - - SimdVector3 vecnorm = vec; - if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON)) - { - vecnorm.setValue(-1.f,-1.f,-1.f); - } - vecnorm.normalize(); - supVertex+= GetMargin() * vecnorm; - return supVertex; -} - - -//broken due to scaling -void SphereShape::GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const -{ - const SimdVector3& center = t.getOrigin(); - SimdVector3 extent(GetMargin(),GetMargin(),GetMargin()); - aabbMin = center - extent; - aabbMax = center + extent; -} - - - -void SphereShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - SimdScalar elem = 0.4f * mass * GetMargin()*GetMargin(); - inertia[0] = inertia[1] = inertia[2] = elem; - -} - diff --git a/extern/bullet/Bullet/CollisionShapes/SphereShape.h b/extern/bullet/Bullet/CollisionShapes/SphereShape.h deleted file mode 100644 index d93174c7bd7..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/SphereShape.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SPHERE_MINKOWSKI_H -#define SPHERE_MINKOWSKI_H - -#include "ConvexShape.h" -#include "BroadphaseCollision/BroadphaseProxy.h" // for the types - -///SphereShape implements an implicit (getSupportingVertex) Sphere -class SphereShape : public ConvexShape - -{ - SimdScalar m_radius; - -public: - SphereShape (SimdScalar radius); - - - virtual SimdVector3 LocalGetSupportingVertex(const SimdVector3& vec)const; - virtual SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const; - //notice that the vectors should be unit length - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const; - - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const; - - virtual int GetShapeType() const { return SPHERE_SHAPE_PROXYTYPE; } - - SimdScalar GetRadius() const { return m_radius;} - - //debugging - virtual char* GetName()const {return "SPHERE";} - - virtual void SetMargin(float margin) - { - ConvexShape::SetMargin(margin); - } - virtual float GetMargin() const - { - //to improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case - //this means, non-uniform scaling is not supported anymore - return m_localScaling[0] * m_radius + ConvexShape::GetMargin(); - } - - -}; - - -#endif //SPHERE_MINKOWSKI_H diff --git a/extern/bullet/Bullet/CollisionShapes/StaticPlaneShape.cpp b/extern/bullet/Bullet/CollisionShapes/StaticPlaneShape.cpp deleted file mode 100644 index 48aecf5e508..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/StaticPlaneShape.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "StaticPlaneShape.h" - -#include "SimdTransformUtil.h" - - -StaticPlaneShape::StaticPlaneShape(const SimdVector3& planeNormal,SimdScalar planeConstant) -:m_planeNormal(planeNormal), -m_planeConstant(planeConstant), -m_localScaling(0.f,0.f,0.f) -{ -} - - -StaticPlaneShape::~StaticPlaneShape() -{ -} - - - -void StaticPlaneShape::GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const -{ - SimdVector3 infvec (1e30f,1e30f,1e30f); - - SimdVector3 center = m_planeNormal*m_planeConstant; - aabbMin = center + infvec*m_planeNormal; - aabbMax = aabbMin; - aabbMin.setMin(center - infvec*m_planeNormal); - aabbMax.setMax(center - infvec*m_planeNormal); - - aabbMin.setValue(-1e30f,-1e30f,-1e30f); - aabbMax.setValue(1e30f,1e30f,1e30f); - -} - - - - -void StaticPlaneShape::ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - - SimdVector3 halfExtents = (aabbMax - aabbMin) * 0.5f; - SimdScalar radius = halfExtents.length(); - SimdVector3 center = (aabbMax + aabbMin) * 0.5f; - - //this is where the triangles are generated, given AABB and plane equation (normal/constant) - - SimdVector3 tangentDir0,tangentDir1; - - //tangentDir0/tangentDir1 can be precalculated - SimdPlaneSpace1(m_planeNormal,tangentDir0,tangentDir1); - - SimdVector3 supVertex0,supVertex1; - - SimdVector3 projectedCenter = center - (m_planeNormal.dot(center) - m_planeConstant)*m_planeNormal; - - SimdVector3 triangle[3]; - triangle[0] = projectedCenter + tangentDir0*radius + tangentDir1*radius; - triangle[1] = projectedCenter + tangentDir0*radius - tangentDir1*radius; - triangle[2] = projectedCenter - tangentDir0*radius - tangentDir1*radius; - - callback->ProcessTriangle(triangle,0,0); - - triangle[0] = projectedCenter - tangentDir0*radius - tangentDir1*radius; - triangle[1] = projectedCenter - tangentDir0*radius + tangentDir1*radius; - triangle[2] = projectedCenter + tangentDir0*radius + tangentDir1*radius; - - callback->ProcessTriangle(triangle,0,1); - -} - -void StaticPlaneShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - //moving concave objects not supported - - inertia.setValue(0.f,0.f,0.f); -} - -void StaticPlaneShape::setLocalScaling(const SimdVector3& scaling) -{ - m_localScaling = scaling; -} -const SimdVector3& StaticPlaneShape::getLocalScaling() const -{ - return m_localScaling; -} diff --git a/extern/bullet/Bullet/CollisionShapes/StaticPlaneShape.h b/extern/bullet/Bullet/CollisionShapes/StaticPlaneShape.h deleted file mode 100644 index eaf8761c660..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/StaticPlaneShape.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef STATIC_PLANE_SHAPE_H -#define STATIC_PLANE_SHAPE_H - -#include "CollisionShapes/ConcaveShape.h" - - -///StaticPlaneShape simulates an 'infinite' plane by dynamically reporting triangles approximated by intersection of the plane with the AABB. -///Assumed is that the other objects is not also infinite, so a reasonable sized AABB. -class StaticPlaneShape : public ConcaveShape -{ -protected: - SimdVector3 m_localAabbMin; - SimdVector3 m_localAabbMax; - - SimdVector3 m_planeNormal; - SimdVector3 m_localScaling; - SimdScalar m_planeConstant; - -public: - StaticPlaneShape(const SimdVector3& planeNormal,SimdScalar planeConstant); - - virtual ~StaticPlaneShape(); - - - virtual int GetShapeType() const - { - return STATIC_PLANE_PROXYTYPE; - } - - virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const; - - virtual void ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - virtual void setLocalScaling(const SimdVector3& scaling); - virtual const SimdVector3& getLocalScaling() const; - - - //debugging - virtual char* GetName()const {return "STATICPLANE";} - - -}; - -#endif //STATIC_PLANE_SHAPE_H diff --git a/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.cpp b/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.cpp deleted file mode 100644 index 874660c7ead..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "StridingMeshInterface.h" - -StridingMeshInterface::~StridingMeshInterface() -{ - -} - - -void StridingMeshInterface::InternalProcessAllTriangles(InternalTriangleIndexCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - - SimdVector3 meshScaling = getScaling(); - - int numtotalphysicsverts = 0; - int part,graphicssubparts = getNumSubParts(); - for (part=0;part<graphicssubparts ;part++) - { - const unsigned char * vertexbase; - const unsigned char * indexbase; - int indexstride; - PHY_ScalarType type; - PHY_ScalarType gfxindextype; - int stride,numverts,numtriangles; - getLockedReadOnlyVertexIndexBase(&vertexbase,numverts,type,stride,&indexbase,indexstride,numtriangles,gfxindextype,part); - - numtotalphysicsverts+=numtriangles*3; //upper bound - - - int gfxindex; - SimdVector3 triangle[3]; - - for (gfxindex=0;gfxindex<numtriangles;gfxindex++) - { - - int graphicsindex=0; - -#ifdef DEBUG_TRIANGLE_MESH - printf("triangle indices:\n"); -#endif //DEBUG_TRIANGLE_MESH - ASSERT(gfxindextype == PHY_INTEGER); - int* gfxbase = (int*)(indexbase+gfxindex*indexstride); - - for (int j=2;j>=0;j--) - { - - graphicsindex = gfxbase[j]; -#ifdef DEBUG_TRIANGLE_MESH - printf("%d ,",graphicsindex); -#endif //DEBUG_TRIANGLE_MESH - float* graphicsbase = (float*)(vertexbase+graphicsindex*stride); - - triangle[j] = SimdVector3( - graphicsbase[0]*meshScaling.getX(), - graphicsbase[1]*meshScaling.getY(), - graphicsbase[2]*meshScaling.getZ()); -#ifdef DEBUG_TRIANGLE_MESH - printf("triangle vertices:%f,%f,%f\n",triangle[j].x(),triangle[j].y(),triangle[j].z()); -#endif //DEBUG_TRIANGLE_MESH - } - - - //check aabb in triangle-space, before doing this - callback->InternalProcessTriangleIndex(triangle,part,gfxindex); - - } - - unLockReadOnlyVertexBase(part); - } -} - diff --git a/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.h b/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.h deleted file mode 100644 index 0b482afdc9c..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/StridingMeshInterface.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef STRIDING_MESHINTERFACE_H -#define STRIDING_MESHINTERFACE_H - -#include "SimdVector3.h" -#include "TriangleCallback.h" - -/// PHY_ScalarType enumerates possible scalar types. -/// See the StridingMeshInterface for its use -typedef enum PHY_ScalarType { - PHY_FLOAT, - PHY_DOUBLE, - PHY_INTEGER, - PHY_SHORT, - PHY_FIXEDPOINT88 -} PHY_ScalarType; - -/// StridingMeshInterface is the interface class for high performance access to triangle meshes -/// It allows for sharing graphics and collision meshes. Also it provides locking/unlocking of graphics meshes that are in gpu memory. -class StridingMeshInterface -{ - protected: - - SimdVector3 m_scaling; - - public: - StridingMeshInterface() :m_scaling(1.f,1.f,1.f) - { - - } - - virtual ~StridingMeshInterface(); - - - - void InternalProcessAllTriangles(InternalTriangleIndexCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - - /// get read and write access to a subpart of a triangle mesh - /// this subpart has a continuous array of vertices and indices - /// in this way the mesh can be handled as chunks of memory with striding - /// very similar to OpenGL vertexarray support - /// make a call to unLockVertexBase when the read and write access is finished - virtual void getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0)=0; - - virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0) const=0; - - /// unLockVertexBase finishes the access to a subpart of the triangle mesh - /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished - virtual void unLockVertexBase(int subpart)=0; - - virtual void unLockReadOnlyVertexBase(int subpart) const=0; - - - /// getNumSubParts returns the number of seperate subparts - /// each subpart has a continuous array of vertices and indices - virtual int getNumSubParts() const=0; - - virtual void preallocateVertices(int numverts)=0; - virtual void preallocateIndices(int numindices)=0; - - const SimdVector3& getScaling() const { - return m_scaling; - } - void setScaling(const SimdVector3& scaling) - { - m_scaling = scaling; - } - - -}; - -#endif //STRIDING_MESHINTERFACE_H diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleCallback.cpp b/extern/bullet/Bullet/CollisionShapes/TriangleCallback.cpp deleted file mode 100644 index 499d377a00c..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleCallback.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "TriangleCallback.h" - -TriangleCallback::~TriangleCallback() -{ - -} - - -InternalTriangleIndexCallback::~InternalTriangleIndexCallback() -{ - -} - diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleCallback.h b/extern/bullet/Bullet/CollisionShapes/TriangleCallback.h deleted file mode 100644 index 810d4e62644..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleCallback.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef TRIANGLE_CALLBACK_H -#define TRIANGLE_CALLBACK_H - -#include "SimdVector3.h" - - -class TriangleCallback -{ -public: - - virtual ~TriangleCallback(); - virtual void ProcessTriangle(SimdVector3* triangle, int partId, int triangleIndex) = 0; -}; - -class InternalTriangleIndexCallback -{ -public: - - virtual ~InternalTriangleIndexCallback(); - virtual void InternalProcessTriangleIndex(SimdVector3* triangle,int partId,int triangleIndex) = 0; -}; - - - -#endif //TRIANGLE_CALLBACK_H diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleIndexVertexArray.cpp b/extern/bullet/Bullet/CollisionShapes/TriangleIndexVertexArray.cpp deleted file mode 100644 index d01d87d3f5d..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleIndexVertexArray.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "TriangleIndexVertexArray.h" - -TriangleIndexVertexArray::TriangleIndexVertexArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,float* vertexBase,int vertexStride) -{ - IndexedMesh mesh; - - mesh.m_numTriangles = numTriangles; - mesh.m_triangleIndexBase = triangleIndexBase; - mesh.m_triangleIndexStride = triangleIndexStride; - mesh.m_numVertices = numVertices; - mesh.m_vertexBase = vertexBase; - mesh.m_vertexStride = vertexStride; - - AddIndexedMesh(mesh); - -} - -void TriangleIndexVertexArray::getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart) -{ - ASSERT(subpart< getNumSubParts() ); - - IndexedMesh& mesh = m_indexedMeshes[subpart]; - - numverts = mesh.m_numVertices; - (*vertexbase) = (unsigned char *) mesh.m_vertexBase; - type = PHY_FLOAT; - vertexStride = mesh.m_vertexStride; - - numfaces = mesh.m_numTriangles; - - (*indexbase) = (unsigned char *)mesh.m_triangleIndexBase; - indexstride = mesh.m_triangleIndexStride; - indicestype = PHY_INTEGER; -} - -void TriangleIndexVertexArray::getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart) const -{ - const IndexedMesh& mesh = m_indexedMeshes[subpart]; - - numverts = mesh.m_numVertices; - (*vertexbase) = (const unsigned char *)mesh.m_vertexBase; - type = PHY_FLOAT; - vertexStride = mesh.m_vertexStride; - - numfaces = mesh.m_numTriangles; - (*indexbase) = (const unsigned char *)mesh.m_triangleIndexBase; - indexstride = mesh.m_triangleIndexStride; - indicestype = PHY_INTEGER; -} - diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleIndexVertexArray.h b/extern/bullet/Bullet/CollisionShapes/TriangleIndexVertexArray.h deleted file mode 100644 index a44ef4514d5..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleIndexVertexArray.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "StridingMeshInterface.h" -#include <vector> - -///IndexedMesh indexes into existing vertex and index arrays, in a similar way OpenGL glDrawElements -///instead of the number of indices, we pass the number of triangles -///todo: explain with pictures -struct IndexedMesh - { - int m_numTriangles; - int* m_triangleIndexBase; - int m_triangleIndexStride; - int m_numVertices; - float* m_vertexBase; - int m_vertexStride; - }; - -///TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays. -///Additional meshes can be added using AddIndexedMesh -///No duplcate is made of the vertex/index data, it only indexes into external vertex/index arrays. -///So keep those arrays around during the lifetime of this TriangleIndexVertexArray. -class TriangleIndexVertexArray : public StridingMeshInterface -{ - std::vector<IndexedMesh> m_indexedMeshes; - - -public: - - - - TriangleIndexVertexArray() - { - } - - //just to be backwards compatible - TriangleIndexVertexArray(int numTriangleIndices,int* triangleIndexBase,int triangleIndexStride,int numVertices,float* vertexBase,int vertexStride); - - void AddIndexedMesh(const IndexedMesh& mesh) - { - m_indexedMeshes.push_back(mesh); - } - - - virtual void getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0); - - virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& vertexStride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0) const; - - /// unLockVertexBase finishes the access to a subpart of the triangle mesh - /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished - virtual void unLockVertexBase(int subpart) {} - - virtual void unLockReadOnlyVertexBase(int subpart) const {} - - /// getNumSubParts returns the number of seperate subparts - /// each subpart has a continuous array of vertices and indices - virtual int getNumSubParts() const { - return (int)m_indexedMeshes.size(); - } - - virtual void preallocateVertices(int numverts){} - virtual void preallocateIndices(int numindices){} - -}; - diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleMesh.cpp b/extern/bullet/Bullet/CollisionShapes/TriangleMesh.cpp deleted file mode 100644 index c86d286d9d6..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleMesh.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "TriangleMesh.h" -#include <assert.h> - -static int myindices[3] = {0,1,2}; - -TriangleMesh::TriangleMesh () -{ - -} - -void TriangleMesh::getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart) -{ - numverts = 3; - *vertexbase = (unsigned char*)&m_triangles[subpart]; - type = PHY_FLOAT; - stride = sizeof(SimdVector3); - - - numfaces = 1; - *indexbase = (unsigned char*) &myindices[0]; - indicestype = PHY_INTEGER; - indexstride = sizeof(int); - -} - -void TriangleMesh::getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart) const -{ - numverts = 3; - *vertexbase = (unsigned char*)&m_triangles[subpart]; - type = PHY_FLOAT; - stride = sizeof(SimdVector3); - - - numfaces = 1; - *indexbase = (unsigned char*) &myindices[0]; - indicestype = PHY_INTEGER; - indexstride = sizeof(int); - -} - - - -int TriangleMesh::getNumSubParts() const -{ - return m_triangles.size(); -} diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleMesh.h b/extern/bullet/Bullet/CollisionShapes/TriangleMesh.h deleted file mode 100644 index 9623cb401d2..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleMesh.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef TRIANGLE_MESH_H -#define TRIANGLE_MESH_H - -#include "CollisionShapes/StridingMeshInterface.h" -#include <vector> -#include <SimdVector3.h> - -struct MyTriangle -{ - SimdVector3 m_vert0; - SimdVector3 m_vert1; - SimdVector3 m_vert2; -}; - -///TriangleMesh provides storage for a concave triangle mesh. It can be used as data for the TriangleMeshShape. -class TriangleMesh : public StridingMeshInterface -{ - std::vector<MyTriangle> m_triangles; - - - public: - TriangleMesh (); - - void AddTriangle(const SimdVector3& vertex0,const SimdVector3& vertex1,const SimdVector3& vertex2) - { - MyTriangle tri; - tri.m_vert0 = vertex0; - tri.m_vert1 = vertex1; - tri.m_vert2 = vertex2; - m_triangles.push_back(tri); - } - - -//StridingMeshInterface interface implementation - - virtual void getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0); - - virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0) const; - - /// unLockVertexBase finishes the access to a subpart of the triangle mesh - /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished - virtual void unLockVertexBase(int subpart) {} - - virtual void unLockReadOnlyVertexBase(int subpart) const {} - - /// getNumSubParts returns the number of seperate subparts - /// each subpart has a continuous array of vertices and indices - virtual int getNumSubParts() const; - - virtual void preallocateVertices(int numverts){} - virtual void preallocateIndices(int numindices){} - - -}; - -#endif //TRIANGLE_MESH_H - diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.cpp b/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.cpp deleted file mode 100644 index bc28946208c..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "TriangleMeshShape.h" -#include "SimdVector3.h" -#include "SimdQuaternion.h" -#include "StridingMeshInterface.h" -#include "AabbUtil2.h" -#include "CollisionShapes/CollisionMargin.h" - -#include "stdio.h" - -TriangleMeshShape::TriangleMeshShape(StridingMeshInterface* meshInterface) -: m_meshInterface(meshInterface) -{ - RecalcLocalAabb(); -} - - -TriangleMeshShape::~TriangleMeshShape() -{ - -} - - - - -void TriangleMeshShape::GetAabb(const SimdTransform& trans,SimdVector3& aabbMin,SimdVector3& aabbMax) const -{ - - SimdVector3 localHalfExtents = 0.5f*(m_localAabbMax-m_localAabbMin); - SimdVector3 localCenter = 0.5f*(m_localAabbMax+m_localAabbMin); - - SimdMatrix3x3 abs_b = trans.getBasis().absolute(); - - SimdPoint3 center = trans(localCenter); - - SimdVector3 extent = SimdVector3(abs_b[0].dot(localHalfExtents), - abs_b[1].dot(localHalfExtents), - abs_b[2].dot(localHalfExtents)); - extent += SimdVector3(GetMargin(),GetMargin(),GetMargin()); - - aabbMin = center - extent; - aabbMax = center + extent; - - -} - - - -class LocalAabbCalculator : public TriangleCallback -{ - -public: - - SimdVector3 m_localAabbMin; - SimdVector3 m_localAabbMax; - - LocalAabbCalculator() - : m_localAabbMin(1e30f,1e30f,1e30f), m_localAabbMax(-1e30f,-1e30f,-1e30f) - { - } - - virtual void ProcessTriangle( SimdVector3* triangle,int partId, int triangleIndex) - { - for (int i=0;i<3;i++) - { - m_localAabbMin.setMin(triangle[i]); - m_localAabbMax.setMax(triangle[i]); - } - } -}; - - -void TriangleMeshShape::RecalcLocalAabb() -{ - - LocalAabbCalculator aabbCalculator; - SimdVector3 aabbMax(1e30f,1e30f,1e30f); - - NonVirtualProcessAllTriangles(&aabbCalculator,-aabbMax,aabbMax); - SimdVector3 marginVec(m_collisionMargin,m_collisionMargin,m_collisionMargin); - m_localAabbMax = aabbCalculator.m_localAabbMax + marginVec; - m_localAabbMin = aabbCalculator.m_localAabbMin - marginVec; - -} - - -void TriangleMeshShape::setLocalScaling(const SimdVector3& scaling) -{ - m_meshInterface->setScaling(scaling); - RecalcLocalAabb(); -} - -const SimdVector3& TriangleMeshShape::getLocalScaling() const -{ - return m_meshInterface->getScaling(); -} - - - - - - -//#define DEBUG_TRIANGLE_MESH - -void TriangleMeshShape::NonVirtualProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - struct FilteredCallback : public InternalTriangleIndexCallback - { - TriangleCallback* m_callback; - SimdVector3 m_aabbMin; - SimdVector3 m_aabbMax; - - FilteredCallback(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) - :m_callback(callback), - m_aabbMin(aabbMin), - m_aabbMax(aabbMax) - { - } - - virtual void InternalProcessTriangleIndex(SimdVector3* triangle,int partId,int triangleIndex) - { - if (TestTriangleAgainstAabb2(&triangle[0],m_aabbMin,m_aabbMax)) - { - //check aabb in triangle-space, before doing this - m_callback->ProcessTriangle(triangle,partId,triangleIndex); - } - - } - - }; - - FilteredCallback filterCallback(callback,aabbMin,aabbMax); - - m_meshInterface->InternalProcessAllTriangles(&filterCallback,aabbMin,aabbMax); - -} - - -void TriangleMeshShape::ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const -{ - NonVirtualProcessAllTriangles(callback,aabbMin,aabbMax); -} - -void TriangleMeshShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) -{ - //moving concave objects not supported - assert(0); - inertia.setValue(0.f,0.f,0.f); -} - diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.h b/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.h deleted file mode 100644 index 972176cfbec..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleMeshShape.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef TRIANGLE_MESH_SHAPE_H -#define TRIANGLE_MESH_SHAPE_H - -#include "CollisionShapes/ConcaveShape.h" -#include "CollisionShapes/StridingMeshInterface.h" - - -///Concave triangle mesh. Uses an interface to access the triangles to allow for sharing graphics/physics triangles. -class TriangleMeshShape : public ConcaveShape -{ -protected: - StridingMeshInterface* m_meshInterface; - SimdVector3 m_localAabbMin; - SimdVector3 m_localAabbMax; - - -public: - TriangleMeshShape(StridingMeshInterface* meshInterface); - - virtual ~TriangleMeshShape(); - - void RecalcLocalAabb(); - - virtual int GetShapeType() const - { - return TRIANGLE_MESH_SHAPE_PROXYTYPE; - } - - virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const; - - void NonVirtualProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - virtual void ProcessAllTriangles(TriangleCallback* callback,const SimdVector3& aabbMin,const SimdVector3& aabbMax) const; - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia); - - virtual void setLocalScaling(const SimdVector3& scaling); - virtual const SimdVector3& getLocalScaling() const; - - - //debugging - virtual char* GetName()const {return "TRIANGLEMESH";} - - -}; - -#endif //TRIANGLE_MESH_SHAPE_H diff --git a/extern/bullet/Bullet/CollisionShapes/TriangleShape.h b/extern/bullet/Bullet/CollisionShapes/TriangleShape.h deleted file mode 100644 index d1b4a993030..00000000000 --- a/extern/bullet/Bullet/CollisionShapes/TriangleShape.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef OBB_TRIANGLE_MINKOWSKI_H -#define OBB_TRIANGLE_MINKOWSKI_H - -#include "ConvexShape.h" -#include "CollisionShapes/BoxShape.h" - -class TriangleShape : public PolyhedralConvexShape -{ - - -public: - - SimdVector3 m_vertices1[3]; - - - virtual int GetNumVertices() const - { - return 3; - } - - const SimdVector3& GetVertexPtr(int index) const - { - return m_vertices1[index]; - } - virtual void GetVertex(int index,SimdVector3& vert) const - { - vert = m_vertices1[index]; - } - virtual int GetShapeType() const - { - return TRIANGLE_SHAPE_PROXYTYPE; - } - - virtual int GetNumEdges() const - { - return 3; - } - - virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const - { - GetVertex(i,pa); - GetVertex((i+1)%3,pb); - } - - virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax)const - { -// ASSERT(0); - GetAabbSlow(t,aabbMin,aabbMax); - } - - SimdVector3 LocalGetSupportingVertexWithoutMargin(const SimdVector3& dir)const - { - SimdVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2])); - return m_vertices1[dots.maxAxis()]; - - } - - virtual void BatchedUnitVectorGetSupportingVertexWithoutMargin(const SimdVector3* vectors,SimdVector3* supportVerticesOut,int numVectors) const - { - for (int i=0;i<numVectors;i++) - { - const SimdVector3& dir = vectors[i]; - SimdVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2])); - supportVerticesOut[i] = m_vertices1[dots.maxAxis()]; - } - - } - - - - TriangleShape(const SimdVector3& p0,const SimdVector3& p1,const SimdVector3& p2) - { - m_vertices1[0] = p0; - m_vertices1[1] = p1; - m_vertices1[2] = p2; - } - - - - virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i) const - { - GetPlaneEquation(i,planeNormal,planeSupport); - } - - virtual int GetNumPlanes() const - { - return 1; - } - - void CalcNormal(SimdVector3& normal) const - { - normal = (m_vertices1[1]-m_vertices1[0]).cross(m_vertices1[2]-m_vertices1[0]); - normal.normalize(); - } - - virtual void GetPlaneEquation(int i, SimdVector3& planeNormal,SimdPoint3& planeSupport) const - { - CalcNormal(planeNormal); - planeSupport = m_vertices1[0]; - } - - virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia) - { - ASSERT(0); - inertia.setValue(0.f,0.f,0.f); - } - - virtual bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const - { - SimdVector3 normal; - CalcNormal(normal); - //distance to plane - SimdScalar dist = pt.dot(normal); - SimdScalar planeconst = m_vertices1[0].dot(normal); - dist -= planeconst; - if (dist >= -tolerance && dist <= tolerance) - { - //inside check on edge-planes - int i; - for (i=0;i<3;i++) - { - SimdPoint3 pa,pb; - GetEdge(i,pa,pb); - SimdVector3 edge = pb-pa; - SimdVector3 edgeNormal = edge.cross(normal); - edgeNormal.normalize(); - SimdScalar dist = pt.dot( edgeNormal); - SimdScalar edgeConst = pa.dot(edgeNormal); - dist -= edgeConst; - if (dist < -tolerance) - return false; - } - - return true; - } - - return false; - } - //debugging - virtual char* GetName()const - { - return "Triangle"; - } - - -}; - -#endif //OBB_TRIANGLE_MINKOWSKI_H - diff --git a/extern/bullet/Bullet/Doxyfile b/extern/bullet/Bullet/Doxyfile deleted file mode 100644 index 4ecb6acb62f..00000000000 --- a/extern/bullet/Bullet/Doxyfile +++ /dev/null @@ -1,746 +0,0 @@ -# Doxyfile 1.2.4 - -# This file describes the settings to be used by doxygen for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. -PROJECT_NAME = "Bullet Continuous Collision Detection Library" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, -# Korean, Hungarian, Norwegian, Spanish, Romanian, Russian, Croatian, -# Polish, Portuguese and Slovene. - -OUTPUT_LANGUAGE = English - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these class will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. It is allowed to use relative paths in the argument list. - -STRIP_FROM_PATH = - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a class diagram (in Html and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. - -CLASS_DIAGRAMS = YES - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower case letters. If set to YES upper case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# users are adviced to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explict @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# reimplements. - -INHERIT_DOCS = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# The ENABLE_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = . - - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -FILE_PATTERNS = *.h *.cpp *.c - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. - -INPUT_FILTER = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse. - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side pannel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript and frames is required (for instance Netscape 4.0+ -# or Internet explorer 4.0+). - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimised for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using a WORD or other. -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assigments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. Warning: This feature -# is still experimental and very incomplete. - -GENERATE_XML = NO - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = ../../generic/extern - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES tag can be used to specify one or more tagfiles. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to -# YES then doxygen will generate a graph for each documented file showing -# the direct and indirect include dependencies of the file with other -# documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to -# YES then doxygen will generate a graph for each documented header file showing -# the documented files that directly or indirectly include this file - -INCLUDED_BY_GRAPH = YES - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. - -DOT_PATH = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO - -# The CGI_NAME tag should be the name of the CGI script that -# starts the search engine (doxysearch) with the correct parameters. -# A script with this name will be generated by doxygen. - -CGI_NAME = search.cgi - -# The CGI_URL tag should be the absolute URL to the directory where the -# cgi binaries are located. See the documentation of your http daemon for -# details. - -CGI_URL = - -# The DOC_URL tag should be the absolute URL to the directory where the -# documentation is located. If left blank the absolute path to the -# documentation, with file:// prepended to it, will be used. - -DOC_URL = - -# The DOC_ABSPATH tag should be the absolute path to the directory where the -# documentation is located. If left blank the directory on the local machine -# will be used. - -DOC_ABSPATH = - -# The BIN_ABSPATH tag must point to the directory where the doxysearch binary -# is installed. - -BIN_ABSPATH = c:\program files\doxygen\bin - -# The EXT_DOC_PATHS tag can be used to specify one or more paths to -# documentation generated for other projects. This allows doxysearch to search -# the documentation for these projects as well. - -EXT_DOC_PATHS = diff --git a/extern/bullet/Bullet/Makefile b/extern/bullet/Bullet/Makefile deleted file mode 100644 index 8c4284239cc..00000000000 --- a/extern/bullet/Bullet/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. The Blender -# Foundation also sells licenses for use in proprietary software under -# the Blender License. See http://www.blender.org/BL/ for information -# about this. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# 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. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL/BL DUAL LICENSE BLOCK ***** -# opennl intern Makefile -# - -LIBNAME = bullet -SOURCEDIR = extern/bullet/Bullet -DIR = $(OCGDIR)/$(SOURCEDIR) - -CCSRCS = $(wildcard BroadphaseCollision/*.cpp) -CCSRCS += $(wildcard NarrowPhaseCollision/*.cpp) -CCSRCS += $(wildcard CollisionShapes/*.cpp) -CCSRCS += $(wildcard CollisionDispatch/*.cpp) - -CPPFLAGS += -DUSE_DOUBLES -DQHULL -D_LIB -CPPFLAGS += -I../Bullet -I../BulletDynamics -I../LinearMath - -all debug:: objdirs - -include nan_compile.mk - -.PHONY: objdirs clean -objdirs: - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR) - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)BroadphaseCollision - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)NarrowPhaseCollision - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)CollisionShapes - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)CollisionDispatch - -optclean:: - @-[ ! -d $(DIR)/BroadphaseCollision ] || (cd $(DIR)/BroadphaseCollision && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/NarrowPhaseCollision ] || (cd $(DIR)/NarrowPhaseCollision && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/CollisionShapes ] || (cd $(DIR)/CollisionShapes && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/CollisionDispatch ] || (cd $(DIR)/CollisionDispatch && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - -debugclean:: - @-[ ! -d $(DIR)/debug/BroadphaseCollision ] || (cd $(DIR)/debug/BroadphaseCollision && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/debug/NarrowPhaseCollision ] || (cd $(DIR)/debug/NarrowPhaseCollision && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/debug/CollisionShapes ] || (cd $(DIR)/debug/CollisionShapes && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/debug/CollisionDispatch ] || (cd $(DIR)/debug/CollisionDispatch && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.cpp deleted file mode 100644 index e318c25da23..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "BU_AlgebraicPolynomialSolver.h" -#include <math.h> -#include <SimdMinMax.h> - -int BU_AlgebraicPolynomialSolver::Solve2Quadratic(SimdScalar p, SimdScalar q) -{ - - SimdScalar basic_h_local; - SimdScalar basic_h_local_delta; - - basic_h_local = p * 0.5f; - basic_h_local_delta = basic_h_local * basic_h_local - q; - if (basic_h_local_delta > 0.0f) { - basic_h_local_delta = SimdSqrt(basic_h_local_delta); - m_roots[0] = - basic_h_local + basic_h_local_delta; - m_roots[1] = - basic_h_local - basic_h_local_delta; - return 2; - } - else if (SimdGreaterEqual(basic_h_local_delta, SIMD_EPSILON)) { - m_roots[0] = - basic_h_local; - return 1; - } - else { - return 0; - } - } - - -int BU_AlgebraicPolynomialSolver::Solve2QuadraticFull(SimdScalar a,SimdScalar b, SimdScalar c) -{ - SimdScalar radical = b * b - 4.0f * a * c; - if(radical >= 0.f) - { - SimdScalar sqrtRadical = SimdSqrt(radical); - SimdScalar idenom = 1.0f/(2.0f * a); - m_roots[0]=(-b + sqrtRadical) * idenom; - m_roots[1]=(-b - sqrtRadical) * idenom; - return 2; - } - return 0; -} - - -#define cubic_rt(x) \ - ((x) > 0.0f ? SimdPow((SimdScalar)(x), 0.333333333333333333333333f) : \ - ((x) < 0.0f ? -SimdPow((SimdScalar)-(x), 0.333333333333333333333333f) : 0.0f)) - - - -/* */ -/* this function solves the following cubic equation: */ -/* */ -/* 3 2 */ -/* lead * x + a * x + b * x + c = 0. */ -/* */ -/* it returns the number of different roots found, and stores the roots in */ -/* roots[0,2]. it returns -1 for a degenerate equation 0 = 0. */ -/* */ -int BU_AlgebraicPolynomialSolver::Solve3Cubic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c) -{ - SimdScalar p, q, r; - SimdScalar delta, u, phi; - SimdScalar dummy; - - if (lead != 1.0) { - /* */ - /* transform into normal form: x^3 + a x^2 + b x + c = 0 */ - /* */ - if (SimdEqual(lead, SIMD_EPSILON)) { - /* */ - /* we have a x^2 + b x + c = 0 */ - /* */ - if (SimdEqual(a, SIMD_EPSILON)) { - /* */ - /* we have b x + c = 0 */ - /* */ - if (SimdEqual(b, SIMD_EPSILON)) { - if (SimdEqual(c, SIMD_EPSILON)) { - return -1; - } - else { - return 0; - } - } - else { - m_roots[0] = -c / b; - return 1; - } - } - else { - p = c / a; - q = b / a; - return Solve2QuadraticFull(a,b,c); - } - } - else { - a = a / lead; - b = b / lead; - c = c / lead; - } - } - - /* */ - /* we substitute x = y - a / 3 in order to eliminate the quadric term. */ - /* we get x^3 + p x + q = 0 */ - /* */ - a /= 3.0f; - u = a * a; - p = b / 3.0f - u; - q = a * (2.0f * u - b) + c; - - /* */ - /* now use Cardano's formula */ - /* */ - if (SimdEqual(p, SIMD_EPSILON)) { - if (SimdEqual(q, SIMD_EPSILON)) { - /* */ - /* one triple root */ - /* */ - m_roots[0] = -a; - return 1; - } - else { - /* */ - /* one real and two complex roots */ - /* */ - m_roots[0] = cubic_rt(-q) - a; - return 1; - } - } - - q /= 2.0f; - delta = p * p * p + q * q; - if (delta > 0.0f) { - /* */ - /* one real and two complex roots. note that v = -p / u. */ - /* */ - u = -q + SimdSqrt(delta); - u = cubic_rt(u); - m_roots[0] = u - p / u - a; - return 1; - } - else if (delta < 0.0) { - /* */ - /* Casus irreducibilis: we have three real roots */ - /* */ - r = SimdSqrt(-p); - p *= -r; - r *= 2.0; - phi = SimdAcos(-q / p) / 3.0f; - dummy = SIMD_2_PI / 3.0f; - m_roots[0] = r * SimdCos(phi) - a; - m_roots[1] = r * SimdCos(phi + dummy) - a; - m_roots[2] = r * SimdCos(phi - dummy) - a; - return 3; - } - else { - /* */ - /* one single and one SimdScalar root */ - /* */ - r = cubic_rt(-q); - m_roots[0] = 2.0f * r - a; - m_roots[1] = -r - a; - return 2; - } -} - - -/* */ -/* this function solves the following quartic equation: */ -/* */ -/* 4 3 2 */ -/* lead * x + a * x + b * x + c * x + d = 0. */ -/* */ -/* it returns the number of different roots found, and stores the roots in */ -/* roots[0,3]. it returns -1 for a degenerate equation 0 = 0. */ -/* */ -int BU_AlgebraicPolynomialSolver::Solve4Quartic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c, SimdScalar d) -{ - SimdScalar p, q ,r; - SimdScalar u, v, w; - int i, num_roots, num_tmp; - //SimdScalar tmp[2]; - - if (lead != 1.0) { - /* */ - /* transform into normal form: x^4 + a x^3 + b x^2 + c x + d = 0 */ - /* */ - if (SimdEqual(lead, SIMD_EPSILON)) { - /* */ - /* we have a x^3 + b x^2 + c x + d = 0 */ - /* */ - if (SimdEqual(a, SIMD_EPSILON)) { - /* */ - /* we have b x^2 + c x + d = 0 */ - /* */ - if (SimdEqual(b, SIMD_EPSILON)) { - /* */ - /* we have c x + d = 0 */ - /* */ - if (SimdEqual(c, SIMD_EPSILON)) { - if (SimdEqual(d, SIMD_EPSILON)) { - return -1; - } - else { - return 0; - } - } - else { - m_roots[0] = -d / c; - return 1; - } - } - else { - p = c / b; - q = d / b; - return Solve2QuadraticFull(b,c,d); - - } - } - else { - return Solve3Cubic(1.0, b / a, c / a, d / a); - } - } - else { - a = a / lead; - b = b / lead; - c = c / lead; - d = d / lead; - } - } - - /* */ - /* we substitute x = y - a / 4 in order to eliminate the cubic term. */ - /* we get: y^4 + p y^2 + q y + r = 0. */ - /* */ - a /= 4.0f; - p = b - 6.0f * a * a; - q = a * (8.0f * a * a - 2.0f * b) + c; - r = a * (a * (b - 3.f * a * a) - c) + d; - if (SimdEqual(q, SIMD_EPSILON)) { - /* */ - /* biquadratic equation: y^4 + p y^2 + r = 0. */ - /* */ - num_roots = Solve2Quadratic(p, r); - if (num_roots > 0) { - if (m_roots[0] > 0.0f) { - if (num_roots > 1) { - if ((m_roots[1] > 0.0f) && (m_roots[1] != m_roots[0])) { - u = SimdSqrt(m_roots[1]); - m_roots[2] = u - a; - m_roots[3] = -u - a; - u = SimdSqrt(m_roots[0]); - m_roots[0] = u - a; - m_roots[1] = -u - a; - return 4; - } - else { - u = SimdSqrt(m_roots[0]); - m_roots[0] = u - a; - m_roots[1] = -u - a; - return 2; - } - } - else { - u = SimdSqrt(m_roots[0]); - m_roots[0] = u - a; - m_roots[1] = -u - a; - return 2; - } - } - } - return 0; - } - else if (SimdEqual(r, SIMD_EPSILON)) { - /* */ - /* no absolute term: y (y^3 + p y + q) = 0. */ - /* */ - num_roots = Solve3Cubic(1.0, 0.0, p, q); - for (i = 0; i < num_roots; ++i) m_roots[i] -= a; - if (num_roots != -1) { - m_roots[num_roots] = -a; - ++num_roots; - } - else { - m_roots[0] = -a; - num_roots = 1;; - } - return num_roots; - } - else { - /* */ - /* we solve the resolvent cubic equation */ - /* */ - num_roots = Solve3Cubic(1.0f, -0.5f * p, -r, 0.5f * r * p - 0.125f * q * q); - if (num_roots == -1) { - num_roots = 1; - m_roots[0] = 0.0f; - } - - /* */ - /* build two quadric equations */ - /* */ - w = m_roots[0]; - u = w * w - r; - v = 2.0f * w - p; - - if (SimdEqual(u, SIMD_EPSILON)) - u = 0.0; - else if (u > 0.0f) - u = SimdSqrt(u); - else - return 0; - - if (SimdEqual(v, SIMD_EPSILON)) - v = 0.0; - else if (v > 0.0f) - v = SimdSqrt(v); - else - return 0; - - if (q < 0.0f) v = -v; - w -= u; - num_roots=Solve2Quadratic(v, w); - for (i = 0; i < num_roots; ++i) - { - m_roots[i] -= a; - } - w += 2.0f *u; - SimdScalar tmp[2]; - tmp[0] = m_roots[0]; - tmp[1] = m_roots[1]; - - num_tmp = Solve2Quadratic(-v, w); - for (i = 0; i < num_tmp; ++i) - { - m_roots[i + num_roots] = tmp[i] - a; - m_roots[i]=tmp[i]; - } - - return (num_tmp + num_roots); - } -} - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.h deleted file mode 100644 index 2d2fe5fc1f9..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_AlgebraicPolynomialSolver.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BU_ALGEBRAIC_POLYNOMIAL_SOLVER_H -#define BU_ALGEBRAIC_POLYNOMIAL_SOLVER_H - -#include "BU_PolynomialSolverInterface.h" - -/// BU_AlgebraicPolynomialSolver implements polynomial root finding by analytically solving algebraic equations. -/// Polynomials up to 4rd degree are supported, Cardano's formula is used for 3rd degree -class BU_AlgebraicPolynomialSolver : public BUM_PolynomialSolverInterface -{ -public: - BU_AlgebraicPolynomialSolver() {}; - - int Solve2Quadratic(SimdScalar p, SimdScalar q); - int Solve2QuadraticFull(SimdScalar a,SimdScalar b, SimdScalar c); - int Solve3Cubic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c); - int Solve4Quartic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c, SimdScalar d); - - - SimdScalar GetRoot(int i) const - { - return m_roots[i]; - } - -private: - SimdScalar m_roots[4]; - -}; - -#endif //BU_ALGEBRAIC_POLYNOMIAL_SOLVER_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.cpp deleted file mode 100644 index bb06e7edb3a..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "BU_Collidable.h" -#include "CollisionShapes/CollisionShape.h" -#include <SimdTransform.h> -#include "BU_MotionStateInterface.h" - -BU_Collidable::BU_Collidable(BU_MotionStateInterface& motion,PolyhedralConvexShape& shape,void* userPointer ) -:m_motionState(motion),m_shape(shape),m_userPointer(userPointer) -{ -} diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.h deleted file mode 100644 index 0a63d32f663..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Collidable.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BU_COLLIDABLE -#define BU_COLLIDABLE - - -class PolyhedralConvexShape; -class BU_MotionStateInterface; -#include <SimdPoint3.h> - -class BU_Collidable -{ -public: - BU_Collidable(BU_MotionStateInterface& motion,PolyhedralConvexShape& shape, void* userPointer); - - void* GetUserPointer() const - { - return m_userPointer; - } - - BU_MotionStateInterface& GetMotionState() - { - return m_motionState; - } - inline const BU_MotionStateInterface& GetMotionState() const - { - return m_motionState; - } - - inline const PolyhedralConvexShape& GetShape() const - { - return m_shape; - }; - - -private: - BU_MotionStateInterface& m_motionState; - PolyhedralConvexShape& m_shape; - void* m_userPointer; - -}; - -#endif //BU_COLLIDABLE diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.cpp deleted file mode 100644 index ebd80cc31f1..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.cpp +++ /dev/null @@ -1,581 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#include "BU_CollisionPair.h" -#include "NarrowPhaseCollision/BU_VertexPoly.h" -#include "NarrowPhaseCollision/BU_EdgeEdge.h" -#include "BU_Collidable.h" - - -#include "BU_MotionStateInterface.h" -#include "CollisionShapes/PolyhedralConvexShape.h" -#include <SimdMinMax.h> -#include "SimdTransformUtil.h" - - - -BU_CollisionPair::BU_CollisionPair(const PolyhedralConvexShape* convexA,const PolyhedralConvexShape* convexB,SimdScalar tolerance) -: m_convexA(convexA),m_convexB(convexB),m_screwing(SimdVector3(0,0,0),SimdVector3(0,0,0)), -m_tolerance(tolerance) -{ - -} - -// if there exists a time-of-impact between any feature_pair (edgeA,edgeB), -// (vertexA,faceB) or (vertexB,faceA) in [0..1], report true and smallest time - - -/* -bool BU_CollisionPair::GetTimeOfImpact(const SimdVector3& linearMotionA,const SimdQuaternion& angularMotionA,const SimdVector3& linearMotionB,const SimdQuaternion& angularMotionB, SimdScalar& toi,SimdTransform& impactTransA,SimdTransform& impactTransB) - -*/ - -bool BU_CollisionPair::calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result) -{ - - - - - SimdVector3 linvelA,angvelA; - SimdVector3 linvelB,angvelB; - - SimdTransformUtil::CalculateVelocity(fromA,toA,1.f,linvelA,angvelA); - SimdTransformUtil::CalculateVelocity(fromB,toB,1.f,linvelB,angvelB); - - - SimdVector3 linearMotionA = toA.getOrigin() - fromA.getOrigin(); - SimdQuaternion angularMotionA(0,0,0,1.f); - SimdVector3 linearMotionB = toB.getOrigin() - fromB.getOrigin(); - SimdQuaternion angularMotionB(0,0,0,1); - - - - result.m_fraction = 1.f; - - SimdTransform impactTransA; - SimdTransform impactTransB; - - int index=0; - - SimdScalar toiUnscaled=result.m_fraction; - const SimdScalar toiUnscaledLimit = result.m_fraction; - - SimdTransform a2w; - a2w = fromA; - SimdTransform b2w = fromB; - -/* debugging code - { - const int numvertsB = m_convexB->GetNumVertices(); - for (int v=0;v<numvertsB;v++) - { - SimdPoint3 pt; - m_convexB->GetVertex(v,pt); - pt = b2w * pt; - char buf[1000]; - - if (pt.y() < 0.) - { - sprintf(buf,"PRE ERROR (%d) %.20E %.20E %.20E!!!!!!!!!\n",v,pt.x(),pt.y(),pt.z()); - if (debugFile) - fwrite(buf,1,strlen(buf),debugFile); - } else - { - sprintf(buf,"PRE %d = %.20E,%.20E,%.20E\n",v,pt.x(),pt.y(),pt.z()); - if (debugFile) - fwrite(buf,1,strlen(buf),debugFile); - - } - } - } -*/ - - - SimdTransform b2wp = b2w; - - b2wp.setOrigin(b2w.getOrigin() + linearMotionB); - b2wp.setRotation( b2w.getRotation() + angularMotionB); - - impactTransB = b2wp; - - SimdTransform a2wp; - a2wp.setOrigin(a2w.getOrigin()+ linearMotionA); - a2wp.setRotation(a2w.getRotation()+angularMotionA); - - impactTransA = a2wp; - - SimdTransform a2winv; - a2winv = a2w.inverse(); - - SimdTransform b2wpinv; - b2wpinv = b2wp.inverse(); - - SimdTransform b2winv; - b2winv = b2w.inverse(); - - SimdTransform a2wpinv; - a2wpinv = a2wp.inverse(); - - //Redon's version with concatenated transforms - - SimdTransform relative; - - relative = b2w * b2wpinv * a2wp * a2winv; - - //relative = a2winv * a2wp * b2wpinv * b2w; - - SimdQuaternion qrel; - relative.getBasis().getRotation(qrel); - - SimdVector3 linvel = relative.getOrigin(); - - if (linvel.length() < SCREWEPSILON) - { - linvel.setValue(0.,0.,0.); - } - SimdVector3 angvel; - angvel[0] = 2.f * SimdAsin (qrel[0]); - angvel[1] = 2.f * SimdAsin (qrel[1]); - angvel[2] = 2.f * SimdAsin (qrel[2]); - - if (angvel.length() < SCREWEPSILON) - { - angvel.setValue(0.f,0.f,0.f); - } - - //Redon's version with concatenated transforms - m_screwing = BU_Screwing(linvel,angvel); - - SimdTransform w2s; - m_screwing.LocalMatrix(w2s); - - SimdTransform s2w; - s2w = w2s.inverse(); - - //impactTransA = a2w; - //impactTransB = b2w; - - bool hit = false; - - if (SimdFuzzyZero(m_screwing.GetS()) && SimdFuzzyZero(m_screwing.GetW())) - { - //W = 0 , S = 0 , no collision - //toi = 0; - /* - { - const int numvertsB = m_convexB->GetNumVertices(); - for (int v=0;v<numvertsB;v++) - { - SimdPoint3 pt; - m_convexB->GetVertex(v,pt); - pt = impactTransB * pt; - char buf[1000]; - - if (pt.y() < 0.) - { - sprintf(buf,"EARLY POST ERROR (%d) %.20E,%.20E,%.20E!!!!!!!!!\n",v,pt.x(),pt.y(),pt.z()); - if (debugFile) - fwrite(buf,1,strlen(buf),debugFile); - } - else - { - sprintf(buf,"EARLY POST %d = %.20E,%.20E,%.20E\n",v,pt.x(),pt.y(),pt.z()); - if (debugFile) - fwrite(buf,1,strlen(buf),debugFile); - } - } - } - */ - - return false;//don't continue moving within epsilon - } - -#define EDGEEDGE -#ifdef EDGEEDGE - - BU_EdgeEdge edgeEdge; - - //for all edged in A check agains all edges in B - for (int ea = 0;ea < m_convexA->GetNumEdges();ea++) - { - SimdPoint3 pA0,pA1; - - m_convexA->GetEdge(ea,pA0,pA1); - - pA0= a2w * pA0;//in world space - pA0 = w2s * pA0;//in screwing space - - pA1= a2w * pA1;//in world space - pA1 = w2s * pA1;//in screwing space - - int numedgesB = m_convexB->GetNumEdges(); - for (int eb = 0; eb < numedgesB;eb++) - { - { - SimdPoint3 pB0,pB1; - m_convexB->GetEdge(eb,pB0,pB1); - - pB0= b2w * pB0;//in world space - pB0 = w2s * pB0;//in screwing space - - pB1= b2w * pB1;//in world space - pB1 = w2s * pB1;//in screwing space - - - SimdScalar lambda,mu; - - toiUnscaled = 1.; - - SimdVector3 edgeDirA(pA1-pA0); - SimdVector3 edgeDirB(pB1-pB0); - - if (edgeEdge.GetTimeOfImpact(m_screwing,pA0,edgeDirA,pB0,edgeDirB,toiUnscaled,lambda,mu)) - { - //printf("edgeedge potential hit\n"); - if (toiUnscaled>=0) - { - if (toiUnscaled < toiUnscaledLimit) - { - - //inside check is already done by checking the mu and gamma ! - - SimdPoint3 vtx = pA0+lambda * (pA1-pA0); - SimdPoint3 hitpt = m_screwing.InBetweenPosition(vtx,toiUnscaled); - - SimdPoint3 hitptWorld = s2w * hitpt; - { - - if (toiUnscaled < result.m_fraction) - result.m_fraction = toiUnscaled; - - hit = true; - - SimdVector3 hitNormal = edgeDirB.cross(edgeDirA); - - hitNormal = m_screwing.InBetweenVector(hitNormal,toiUnscaled); - - - hitNormal.normalize(); - - //an approximated normal can be calculated by taking the cross product of both edges - //take care of the sign ! - - SimdVector3 hitNormalWorld = s2w.getBasis() * hitNormal ; - - SimdScalar dist = m_screwing.GetU().dot(hitNormalWorld); - if (dist > 0) - hitNormalWorld *= -1; - - //todo: this is the wrong point, because b2winv is still at begin of motion - // not at time-of-impact location! - //bhitpt = b2winv * hitptWorld; - -// m_manifold.SetContactPoint(BUM_FeatureEdgeEdge,index,ea,eb,hitptWorld,hitNormalWorld); - } - - } - } - } - } - - index++; - } - }; -#endif //EDGEEDGE - -#define VERTEXFACE -#ifdef VERTEXFACE - - // for all vertices in A, for each face in B,do vertex-face - { - const int numvertsA = m_convexA->GetNumVertices(); - for (int v=0;v<numvertsA;v++) - //int v=3; - - { - SimdPoint3 vtx; - m_convexA->GetVertex(v,vtx); - - vtx = a2w * vtx;//in world space - vtx = w2s * vtx;//in screwing space - - const int numplanesB = m_convexB->GetNumPlanes(); - - for (int p = 0 ; p < numplanesB; p++) - //int p=2; - { - - { - - SimdVector3 planeNorm; - SimdPoint3 planeSupport; - - m_convexB->GetPlane(planeNorm,planeSupport,p); - - - planeSupport = b2w * planeSupport;//transform to world space - SimdVector3 planeNormWorld = b2w.getBasis() * planeNorm; - - planeSupport = w2s * planeSupport ; //transform to screwing space - planeNorm = w2s.getBasis() * planeNormWorld; - - planeNorm.normalize(); - - SimdScalar d = planeSupport.dot(planeNorm); - - SimdVector4 planeEq(planeNorm[0],planeNorm[1],planeNorm[2],d); - - BU_VertexPoly vtxApolyB; - - toiUnscaled = 1.; - - if ((p==2) && (v==6)) - { -// printf("%f toiUnscaled\n",toiUnscaled); - - } - if (vtxApolyB.GetTimeOfImpact(m_screwing,vtx,planeEq,toiUnscaled,false)) - { - - - - - if (toiUnscaled >= 0. ) - { - //not only collect the first point, get every contactpoint, later we have to check the - //manifold properly! - - if (toiUnscaled <= toiUnscaledLimit) - { - // printf("toiUnscaled %f\n",toiUnscaled ); - - SimdPoint3 hitpt = m_screwing.InBetweenPosition(vtx,toiUnscaled); - SimdVector3 hitNormal = m_screwing.InBetweenVector(planeNorm ,toiUnscaled); - - SimdVector3 hitNormalWorld = s2w.getBasis() * hitNormal ; - SimdPoint3 hitptWorld = s2w * hitpt; - - - hitpt = b2winv * hitptWorld; - //vertex has to be 'within' the facet's boundary - if (m_convexB->IsInside(hitpt,m_tolerance)) - { -// m_manifold.SetContactPoint(BUM_FeatureVertexFace, index,v,p,hitptWorld,hitNormalWorld); - - if (toiUnscaled < result.m_fraction) - result.m_fraction= toiUnscaled; - hit = true; - - } - } - } - } - - } - - index++; - } - } - } - - // - // for all vertices in B, for each face in A,do vertex-face - //copy and pasted from all verts A -> all planes B so potential typos! - //todo: make this into one method with a kind of 'swapped' logic - // - { - const int numvertsB = m_convexB->GetNumVertices(); - for (int v=0;v<numvertsB;v++) - //int v=0; - - { - SimdPoint3 vtx; - m_convexB->GetVertex(v,vtx); - - vtx = b2w * vtx;//in world space -/* - - char buf[1000]; - - if (vtx.y() < 0.) - { - sprintf(buf,"ERROR !!!!!!!!!\n",v,vtx.x(),vtx.y(),vtx.z()); - if (debugFile) - fwrite(buf,1,strlen(buf),debugFile); - } - sprintf(buf,"vertexWorld(%d) = (%.20E,%.20E,%.20E)\n",v,vtx.x(),vtx.y(),vtx.z()); - if (debugFile) - fwrite(buf,1,strlen(buf),debugFile); - -*/ - vtx = w2s * vtx;//in screwing space - - const int numplanesA = m_convexA->GetNumPlanes(); - - for (int p = 0 ; p < numplanesA; p++) - //int p=2; - { - - { - SimdVector3 planeNorm; - SimdPoint3 planeSupport; - - m_convexA->GetPlane(planeNorm,planeSupport,p); - - - planeSupport = a2w * planeSupport;//transform to world space - SimdVector3 planeNormWorld = a2w.getBasis() * planeNorm; - - planeSupport = w2s * planeSupport ; //transform to screwing space - planeNorm = w2s.getBasis() * planeNormWorld; - - planeNorm.normalize(); - - SimdScalar d = planeSupport.dot(planeNorm); - - SimdVector4 planeEq(planeNorm[0],planeNorm[1],planeNorm[2],d); - - BU_VertexPoly vtxBpolyA; - - toiUnscaled = 1.; - - if (vtxBpolyA.GetTimeOfImpact(m_screwing,vtx,planeEq,toiUnscaled,true)) - { - if (toiUnscaled>=0.) - { - if (toiUnscaled < toiUnscaledLimit) - { - SimdPoint3 hitpt = m_screwing.InBetweenPosition( vtx , -toiUnscaled); - SimdVector3 hitNormal = m_screwing.InBetweenVector(-planeNorm ,-toiUnscaled); - //SimdScalar len = hitNormal.length()-1; - - //assert( SimdFuzzyZero(len) ); - - - SimdVector3 hitNormalWorld = s2w.getBasis() * hitNormal ; - SimdPoint3 hitptWorld = s2w * hitpt; - hitpt = a2winv * hitptWorld; - - - //vertex has to be 'within' the facet's boundary - if (m_convexA->IsInside(hitpt,m_tolerance)) - { - -// m_manifold.SetContactPoint(BUM_FeatureFaceVertex,index,p,v,hitptWorld,hitNormalWorld); - if (toiUnscaled <result.m_fraction) - result.m_fraction = toiUnscaled; - hit = true; - } - } - - } - - } - } - - } - - index++; - } - } - - -#endif// VERTEXFACE - - //the manifold now consists of all points/normals generated by feature-pairs that have a time-of-impact within this frame - //in addition there are contact points from previous frames - //we have to cleanup the manifold, using an additional epsilon/tolerance - //as long as the distance from the contactpoint (in worldspace) to both objects is within this epsilon we keep the point - //else throw it away - - - if (hit) - { - - //try to avoid numerical drift on close contact - - if (result.m_fraction < 0.00001) - { -// printf("toiUnscaledMin< 0.00001\n"); - impactTransA = a2w; - impactTransB = b2w; - - } else - { - - //SimdScalar vel = linearMotionB.length(); - - //todo: check this margin - result.m_fraction *= 0.99f; - - //move B to new position - impactTransB.setOrigin(b2w.getOrigin()+ result.m_fraction*linearMotionB); - SimdQuaternion ornB = b2w.getRotation()+angularMotionB*result.m_fraction; - ornB.normalize(); - impactTransB.setRotation(ornB); - - //now transform A - SimdTransform a2s,a2b; - a2s.mult( w2s , a2w); - a2s= m_screwing.InBetweenTransform(a2s,result.m_fraction); - a2s.multInverseLeft(w2s,a2s); - a2b.multInverseLeft(b2w, a2s); - - //transform by motion B - impactTransA.mult(impactTransB, a2b); - //normalize rotation - SimdQuaternion orn; - impactTransA.getBasis().getRotation(orn); - orn.normalize(); - impactTransA.setBasis(SimdMatrix3x3(orn)); - } - } - -/* - { - const int numvertsB = m_convexB->GetNumVertices(); - for (int v=0;v<numvertsB;v++) - { - SimdPoint3 pt; - m_convexB->GetVertex(v,pt); - pt = impactTransB * pt; - char buf[1000]; - - if (pt.y() < 0.) - { - sprintf(buf,"POST ERROR (%d) %.20E,%.20E,%.20E!!!!!!!!!\n",v,pt.x(),pt.y(),pt.z()); - if (debugFile) - fwrite(buf,1,strlen(buf),debugFile); - } - else - { - sprintf(buf,"POST %d = %.20E,%.20E,%.20E\n",v,pt.x(),pt.y(),pt.z()); - if (debugFile) - fwrite(buf,1,strlen(buf),debugFile); - } - } - } -*/ - return hit; -} - - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.h deleted file mode 100644 index 8dcea364708..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_CollisionPair.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BU_COLLISIONPAIR -#define BU_COLLISIONPAIR - -#include <NarrowPhaseCollision/BU_Screwing.h> -#include <NarrowPhaseCollision/ConvexCast.h> - - -#include <SimdQuaternion.h> - -class PolyhedralConvexShape; - - -///BU_CollisionPair implements collision algorithm for algebraic time of impact calculation of feature based shapes. -class BU_CollisionPair : public ConvexCast -{ - -public: - BU_CollisionPair(const PolyhedralConvexShape* convexA,const PolyhedralConvexShape* convexB,SimdScalar tolerance=0.2f); - //toi - - virtual bool calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result); - - - - -private: - const PolyhedralConvexShape* m_convexA; - const PolyhedralConvexShape* m_convexB; - BU_Screwing m_screwing; - SimdScalar m_tolerance; - -}; -#endif //BU_COLLISIONPAIR diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.cpp deleted file mode 100644 index 75103c0f767..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.cpp +++ /dev/null @@ -1,578 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "BU_EdgeEdge.h" -#include "BU_Screwing.h" -#include <SimdPoint3.h> -#include <SimdPoint3.h> - -//#include "BU_IntervalArithmeticPolynomialSolver.h" -#include "BU_AlgebraicPolynomialSolver.h" - -#define USE_ALGEBRAIC -#ifdef USE_ALGEBRAIC -#define BU_Polynomial BU_AlgebraicPolynomialSolver -#else -#define BU_Polynomial BU_IntervalArithmeticPolynomialSolver -#endif - -BU_EdgeEdge::BU_EdgeEdge() -{ -} - - -bool BU_EdgeEdge::GetTimeOfImpact( - const BU_Screwing& screwAB, - const SimdPoint3& a,//edge in object A - const SimdVector3& u, - const SimdPoint3& c,//edge in object B - const SimdVector3& v, - SimdScalar &minTime, - SimdScalar &lambda1, - SimdScalar& mu1 - - ) -{ - bool hit=false; - - SimdScalar lambda; - SimdScalar mu; - - const SimdScalar w=screwAB.GetW(); - const SimdScalar s=screwAB.GetS(); - - if (SimdFuzzyZero(s) && - SimdFuzzyZero(w)) - { - //no motion, no collision - return false; - } - - if (SimdFuzzyZero(w) ) - { - //pure translation W=0, S <> 0 - //no trig, f(t)=t - SimdScalar det = u.y()*v.x()-u.x()*v.y(); - if (!SimdFuzzyZero(det)) - { - lambda = (a.x()*v.y() - c.x() * v.y() - v.x() * a.y() + v.x() * c.y()) / det; - mu = (u.y() * a.x() - u.y() * c.x() - u.x() * a.y() + u.x() * c.y()) / det; - - if (mu >=0 && mu <= 1 && lambda >= 0 && lambda <= 1) - { - // single potential collision is - SimdScalar t = (c.z()-a.z()+mu*v.z()-lambda*u.z())/s; - //if this is on the edge, and time t within [0..1] report hit - if (t>=0 && t <= minTime) - { - hit = true; - lambda1 = lambda; - mu1 = mu; - minTime=t; - } - } - - } else - { - //parallel case, not yet - } - } else - { - if (SimdFuzzyZero(s) ) - { - if (SimdFuzzyZero(u.z()) ) - { - if (SimdFuzzyZero(v.z()) ) - { - //u.z()=0,v.z()=0 - if (SimdFuzzyZero(a.z()-c.z())) - { - //printf("NOT YET planar problem, 4 vertex=edge cases\n"); - - } else - { - //printf("parallel but distinct planes, no collision\n"); - return false; - } - - } else - { - SimdScalar mu = (a.z() - c.z())/v.z(); - if (0<=mu && mu <= 1) - { - // printf("NOT YET//u.z()=0,v.z()<>0\n"); - } else - { - return false; - } - - } - } else - { - //u.z()<>0 - - if (SimdFuzzyZero(v.z()) ) - { - //printf("u.z()<>0,v.z()=0\n"); - lambda = (c.z() - a.z())/u.z(); - if (0<=lambda && lambda <= 1) - { - //printf("u.z()<>0,v.z()=0\n"); - SimdPoint3 rotPt(a.x()+lambda * u.x(), a.y()+lambda * u.y(),0.f); - SimdScalar r2 = rotPt.length2();//px*px + py*py; - - //either y=a*x+b, or x = a*x+b... - //depends on whether value v.x() is zero or not - SimdScalar aa; - SimdScalar bb; - - if (SimdFuzzyZero(v.x())) - { - aa = v.x()/v.y(); - bb= c.x()+ (-c.y() /v.y()) *v.x(); - } else - { - //line is c+mu*v; - //x = c.x()+mu*v.x(); - //mu = ((x-c.x())/v.x()); - //y = c.y()+((x-c.x())/v.x())*v.y(); - //y = c.y()+ (-c.x() /v.x()) *v.y() + (x /v.x()) *v.y(); - //y = a*x+b,where a = v.y()/v.x(), b= c.y()+ (-c.x() /v.x()) *v.y(); - aa = v.y()/v.x(); - bb= c.y()+ (-c.x() /v.x()) *v.y(); - } - - SimdScalar disc = aa*aa*r2 + r2 - bb*bb; - if (disc <0) - { - //edge doesn't intersect the circle (motion of the vertex) - return false; - } - SimdScalar rad = SimdSqrt(r2); - - if (SimdFuzzyZero(disc)) - { - SimdPoint3 intersectPt; - - SimdScalar mu; - //intersectionPoint edge with circle; - if (SimdFuzzyZero(v.x())) - { - intersectPt.setY( (-2*aa*bb)/(2*(aa*aa+1))); - intersectPt.setX( aa*intersectPt.y()+bb ); - mu = ((intersectPt.y()-c.y())/v.y()); - } else - { - intersectPt.setX((-2*aa*bb)/(2*(aa*aa+1))); - intersectPt.setY(aa*intersectPt.x()+bb); - mu = ((intersectPt.getX()-c.getX())/v.getX()); - - } - - if (0 <= mu && mu <= 1) - { - hit = Calc2DRotationPointPoint(rotPt,rad,screwAB.GetW(),intersectPt,minTime); - } - //only one solution - } else - { - //two points... - //intersectionPoint edge with circle; - SimdPoint3 intersectPt; - //intersectionPoint edge with circle; - if (SimdFuzzyZero(v.x())) - { - SimdScalar mu; - - intersectPt.setY((-2.f*aa*bb+2.f*SimdSqrt(disc))/(2.f*(aa*aa+1.f))); - intersectPt.setX(aa*intersectPt.y()+bb); - mu = ((intersectPt.getY()-c.getY())/v.getY()); - if (0.f <= mu && mu <= 1.f) - { - hit = Calc2DRotationPointPoint(rotPt,rad,screwAB.GetW(),intersectPt,minTime); - } - intersectPt.setY((-2.f*aa*bb-2.f*SimdSqrt(disc))/(2.f*(aa*aa+1.f))); - intersectPt.setX(aa*intersectPt.y()+bb); - mu = ((intersectPt.getY()-c.getY())/v.getY()); - if (0 <= mu && mu <= 1) - { - hit = hit || Calc2DRotationPointPoint(rotPt,rad,screwAB.GetW(),intersectPt,minTime); - } - - } else - { - SimdScalar mu; - - intersectPt.setX((-2.f*aa*bb+2.f*SimdSqrt(disc))/(2*(aa*aa+1.f))); - intersectPt.setY(aa*intersectPt.x()+bb); - mu = ((intersectPt.getX()-c.getX())/v.getX()); - if (0 <= mu && mu <= 1) - { - hit = Calc2DRotationPointPoint(rotPt,rad,screwAB.GetW(),intersectPt,minTime); - } - intersectPt.setX((-2.f*aa*bb-2.f*SimdSqrt(disc))/(2.f*(aa*aa+1.f))); - intersectPt.setY(aa*intersectPt.x()+bb); - mu = ((intersectPt.getX()-c.getX())/v.getX()); - if (0.f <= mu && mu <= 1.f) - { - hit = hit || Calc2DRotationPointPoint(rotPt,rad,screwAB.GetW(),intersectPt,minTime); - } - } - } - - - - //int k=0; - - } else - { - return false; - } - - - } else - { - //u.z()<>0,v.z()<>0 - //printf("general case with s=0\n"); - hit = GetTimeOfImpactGeneralCase(screwAB,a,u,c,v,minTime,lambda,mu); - if (hit) - { - lambda1 = lambda; - mu1 = mu; - - } - } - } - - } else - { - //printf("general case, W<>0,S<>0\n"); - hit = GetTimeOfImpactGeneralCase(screwAB,a,u,c,v,minTime,lambda,mu); - if (hit) - { - lambda1 = lambda; - mu1 = mu; - } - - } - - - //W <> 0,pure rotation - } - - return hit; -} - - -bool BU_EdgeEdge::GetTimeOfImpactGeneralCase( - const BU_Screwing& screwAB, - const SimdPoint3& a,//edge in object A - const SimdVector3& u, - const SimdPoint3& c,//edge in object B - const SimdVector3& v, - SimdScalar &minTime, - SimdScalar &lambda, - SimdScalar& mu - - ) -{ - bool hit = false; - - SimdScalar coefs[4]={0.f,0.f,0.f,0.f}; - BU_Polynomial polynomialSolver; - int numroots = 0; - - //SimdScalar eps=1e-15f; - //SimdScalar eps2=1e-20f; - SimdScalar s=screwAB.GetS(); - SimdScalar w = screwAB.GetW(); - - SimdScalar ax = a.x(); - SimdScalar ay = a.y(); - SimdScalar az = a.z(); - SimdScalar cx = c.x(); - SimdScalar cy = c.y(); - SimdScalar cz = c.z(); - SimdScalar vx = v.x(); - SimdScalar vy = v.y(); - SimdScalar vz = v.z(); - SimdScalar ux = u.x(); - SimdScalar uy = u.y(); - SimdScalar uz = u.z(); - - - if (!SimdFuzzyZero(v.z())) - { - - //Maple Autogenerated C code - SimdScalar t1,t2,t3,t4,t7,t8,t10; - SimdScalar t13,t14,t15,t16,t17,t18,t19,t20; - SimdScalar t21,t22,t23,t24,t25,t26,t27,t28,t29,t30; - SimdScalar t31,t32,t33,t34,t35,t36,t39,t40; - SimdScalar t41,t43,t48; - SimdScalar t63; - - SimdScalar aa,bb,cc,dd;//the coefficients - - t1 = v.y()*s; t2 = t1*u.x(); - t3 = v.x()*s; - t4 = t3*u.y(); - t7 = SimdTan(w/2.0f); - t8 = 1.0f/t7; - t10 = 1.0f/v.z(); - aa = (t2-t4)*t8*t10; - t13 = a.x()*t7; - t14 = u.z()*v.y(); - t15 = t13*t14; - t16 = u.x()*v.z(); - t17 = a.y()*t7; - t18 = t16*t17; - t19 = u.y()*v.z(); - t20 = t13*t19; - t21 = v.y()*u.x(); - t22 = c.z()*t7; - t23 = t21*t22; - t24 = v.x()*a.z(); - t25 = t7*u.y(); - t26 = t24*t25; - t27 = c.y()*t7; - t28 = t16*t27; - t29 = a.z()*t7; - t30 = t21*t29; - t31 = u.z()*v.x(); - t32 = t31*t27; - t33 = t31*t17; - t34 = c.x()*t7; - t35 = t34*t19; - t36 = t34*t14; - t39 = v.x()*c.z(); - t40 = t39*t25; - t41 = 2.0f*t1*u.y()-t15+t18-t20-t23-t26+t28+t30+t32+t33-t35-t36+2.0f*t3*u.x()+t40; - bb = t41*t8*t10; - t43 = t7*u.x(); - t48 = u.y()*v.y(); - cc = (-2.0f*t39*t43+2.0f*t24*t43+t4-2.0f*t48*t22+2.0f*t34*t16-2.0f*t31*t13-t2 - -2.0f*t17*t14+2.0f*t19*t27+2.0f*t48*t29)*t8*t10; - t63 = -t36+t26+t32-t40+t23+t35-t20+t18-t28-t33+t15-t30; - dd = t63*t8*t10; - - coefs[0]=aa; - coefs[1]=bb; - coefs[2]=cc; - coefs[3]=dd; - - } else - { - - SimdScalar t1,t2,t3,t4,t7,t8,t10; - SimdScalar t13,t14,t15,t16,t17,t18,t19,t20; - SimdScalar t21,t22,t23,t24,t25,t26,t27,t28,t29,t30; - SimdScalar t31,t32,t33,t34,t35,t36,t37,t38,t57; - SimdScalar p1,p2,p3,p4; - - t1 = uy*s; - t2 = t1*vx; - t3 = ux*s; - t4 = t3*vy; - t7 = SimdTan(w/2.0f); - t8 = 1/t7; - t10 = 1/uz; - t13 = ux*az; - t14 = t7*vy; - t15 = t13*t14; - t16 = ax*t7; - t17 = uy*vz; - t18 = t16*t17; - t19 = cx*t7; - t20 = t19*t17; - t21 = vy*uz; - t22 = t19*t21; - t23 = ay*t7; - t24 = vx*uz; - t25 = t23*t24; - t26 = uy*cz; - t27 = t7*vx; - t28 = t26*t27; - t29 = t16*t21; - t30 = cy*t7; - t31 = ux*vz; - t32 = t30*t31; - t33 = ux*cz; - t34 = t33*t14; - t35 = t23*t31; - t36 = t30*t24; - t37 = uy*az; - t38 = t37*t27; - - p4 = (-t2+t4)*t8*t10; - p3 = 2.0f*t1*vy+t15-t18-t20-t22+t25+t28-t29+t32-t34+t35+t36-t38+2.0f*t3*vx; - p2 = -2.0f*t33*t27-2.0f*t26*t14-2.0f*t23*t21+2.0f*t37*t14+2.0f*t30*t17+2.0f*t13 -*t27+t2-t4+2.0f*t19*t31-2.0f*t16*t24; - t57 = -t22+t29+t36-t25-t32+t34+t35-t28-t15+t20-t18+t38; - p1 = t57*t8*t10; - - coefs[0] = p4; - coefs[1] = p3; - coefs[2] = p2; - coefs[1] = p1; - - } - - numroots = polynomialSolver.Solve3Cubic(coefs[0],coefs[1],coefs[2],coefs[3]); - - for (int i=0;i<numroots;i++) - { - //SimdScalar tau = roots[i];//polynomialSolver.GetRoot(i); - SimdScalar tau = polynomialSolver.GetRoot(i); - - //check whether mu and lambda are in range [0..1] - - if (!SimdFuzzyZero(v.z())) - { - SimdScalar A1=(ux-ux*tau*tau-2.f*tau*uy)-((1.f+tau*tau)*vx*uz/vz); - SimdScalar B1=((1.f+tau*tau)*(cx*SimdTan(1.f/2.f*w)*vz+ - vx*az*SimdTan(1.f/2.f*w)-vx*cz*SimdTan(1.f/2.f*w)+ - vx*s*tau)/SimdTan(1.f/2.f*w)/vz)-(ax-ax*tau*tau-2.f*tau*ay); - lambda = B1/A1; - - mu = (a.z()-c.z()+lambda*u.z()+(s*tau)/(SimdTan(w/2.f)))/v.z(); - - - //double check in original equation - - SimdScalar lhs = (a.x()+lambda*u.x()) - *((1.f-tau*tau)/(1.f+tau*tau))- - (a.y()+lambda*u.y())*((2.f*tau)/(1.f+tau*tau)); - - lhs = lambda*((ux-ux*tau*tau-2.f*tau*uy)-((1.f+tau*tau)*vx*uz/vz)); - - SimdScalar rhs = c.x()+mu*v.x(); - - rhs = ((1.f+tau*tau)*(cx*SimdTan(1.f/2.f*w)*vz+vx*az*SimdTan(1.f/2.f*w)- - vx*cz*SimdTan(1.f/2.f*w)+vx*s*tau)/(SimdTan(1.f/2.f*w)*vz))- - - (ax-ax*tau*tau-2.f*tau*ay); - - /*SimdScalar res = coefs[0]*tau*tau*tau+ - coefs[1]*tau*tau+ - coefs[2]*tau+ - coefs[3];*/ - - //lhs should be rhs ! - - if (0.<= mu && mu <=1 && 0.<=lambda && lambda <= 1) - { - - } else - { - //skip this solution, not really touching - continue; - } - - } - - SimdScalar t = 2.f*SimdAtan(tau)/screwAB.GetW(); - //tau = tan (wt/2) so 2*atan (tau)/w - if (t>=0.f && t<minTime) - { -#ifdef STATS_EDGE_EDGE - printf(" ax = %12.12f\n ay = %12.12f\n az = %12.12f\n",a.x(),a.y(),a.z()); - printf(" ux = %12.12f\n uy = %12.12f\n uz = %12.12f\n",u.x(),u.y(),u.z()); - printf(" cx = %12.12f\n cy = %12.12f\n cz = %12.12f\n",c.x(),c.y(),c.z()); - printf(" vx = %12.12f\n vy = %12.12f\n vz = %12.12f\n",v.x(),v.y(),v.z()); - printf(" s = %12.12f\n w = %12.12f\n", s, w); - - printf(" tau = %12.12f \n lambda = %12.12f \n mu = %f\n",tau,lambda,mu); - printf(" ---------------------------------------------\n"); - -#endif - - // v,u,a,c,s,w - - // BU_IntervalArithmeticPolynomialSolver iaSolver; - // int numroots2 = iaSolver.Solve3Cubic(coefs[0],coefs[1],coefs[2],coefs[3]); - - minTime = t; - hit = true; - } - } - - return hit; -} - - -//C -S -//S C - -bool BU_EdgeEdge::Calc2DRotationPointPoint(const SimdPoint3& rotPt, SimdScalar rotRadius, SimdScalar rotW,const SimdPoint3& intersectPt,SimdScalar& minTime) -{ - bool hit = false; - - // now calculate the planeEquation for the vertex motion, - // and check if the intersectionpoint is at the positive side - SimdPoint3 rotPt1(SimdCos(rotW)*rotPt.x()-SimdSin(rotW)*rotPt.y(), - SimdSin(rotW)*rotPt.x()+SimdCos(rotW)*rotPt.y(), - 0.f); - - SimdVector3 rotVec = rotPt1-rotPt; - - SimdVector3 planeNormal( -rotVec.y() , rotVec.x() ,0.f); - - //SimdPoint3 pt(a.x(),a.y());//for sake of readability,could write dot directly - SimdScalar planeD = planeNormal.dot(rotPt1); - - SimdScalar dist = (planeNormal.dot(intersectPt)-planeD); - hit = (dist >= -0.001); - - //if (hit) - { - // minTime = 0; - //calculate the time of impact, using the fact of - //toi = alpha / screwAB.getW(); - // cos (alpha) = adjacent/hypothenuse; - //adjacent = dotproduct(ipedge,point); - //hypothenuse = sqrt(r2); - SimdScalar adjacent = intersectPt.dot(rotPt)/rotRadius; - SimdScalar hypo = rotRadius; - SimdScalar alpha = SimdAcos(adjacent/hypo); - SimdScalar t = alpha / rotW; - if (t >= 0 && t < minTime) - { - hit = true; - minTime = t; - } else - { - hit = false; - } - - } - return hit; -} - -bool BU_EdgeEdge::GetTimeOfImpactVertexEdge( - const BU_Screwing& screwAB, - const SimdPoint3& a,//edge in object A - const SimdVector3& u, - const SimdPoint3& c,//edge in object B - const SimdVector3& v, - SimdScalar &minTime, - SimdScalar &lamda, - SimdScalar& mu - - ) -{ - return false; -} diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.h deleted file mode 100644 index 4823f1deec2..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_EdgeEdge.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BU_EDGEEDGE -#define BU_EDGEEDGE - -class BU_Screwing; -#include <SimdTransform.h> -#include <SimdPoint3.h> -#include <SimdVector3.h> - -//class BUM_Point2; - -#include <SimdScalar.h> - -///BU_EdgeEdge implements algebraic time of impact calculation between two (angular + linear) moving edges. -class BU_EdgeEdge -{ -public: - - - BU_EdgeEdge(); - bool GetTimeOfImpact( - const BU_Screwing& screwAB, - const SimdPoint3& a,//edge in object A - const SimdVector3& u, - const SimdPoint3& c,//edge in object B - const SimdVector3& v, - SimdScalar &minTime, - SimdScalar &lamda, - SimdScalar& mu - ); -private: - - bool Calc2DRotationPointPoint(const SimdPoint3& rotPt, SimdScalar rotRadius, SimdScalar rotW,const SimdPoint3& intersectPt,SimdScalar& minTime); - bool GetTimeOfImpactGeneralCase( - const BU_Screwing& screwAB, - const SimdPoint3& a,//edge in object A - const SimdVector3& u, - const SimdPoint3& c,//edge in object B - const SimdVector3& v, - SimdScalar &minTime, - SimdScalar &lamda, - SimdScalar& mu - - ); - - - bool GetTimeOfImpactVertexEdge( - const BU_Screwing& screwAB, - const SimdPoint3& a,//edge in object A - const SimdVector3& u, - const SimdPoint3& c,//edge in object B - const SimdVector3& v, - SimdScalar &minTime, - SimdScalar &lamda, - SimdScalar& mu - - ); - -}; - -#endif //BU_EDGEEDGE diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_MotionStateInterface.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_MotionStateInterface.h deleted file mode 100644 index d06a8fab094..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_MotionStateInterface.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BU_MOTIONSTATE -#define BU_MOTIONSTATE - - -#include <SimdTransform.h> -#include <SimdPoint3.h> -#include <SimdQuaternion.h> - -class BU_MotionStateInterface -{ -public: - virtual ~BU_MotionStateInterface(){}; - - virtual void SetTransform(const SimdTransform& trans) = 0; - virtual void GetTransform(SimdTransform& trans) const = 0; - - virtual void SetPosition(const SimdPoint3& position) = 0; - virtual void GetPosition(SimdPoint3& position) const = 0; - - virtual void SetOrientation(const SimdQuaternion& orientation) = 0; - virtual void GetOrientation(SimdQuaternion& orientation) const = 0; - - virtual void SetBasis(const SimdMatrix3x3& basis) = 0; - virtual void GetBasis(SimdMatrix3x3& basis) const = 0; - - virtual void SetLinearVelocity(const SimdVector3& linvel) = 0; - virtual void GetLinearVelocity(SimdVector3& linvel) const = 0; - - virtual void GetAngularVelocity(SimdVector3& angvel) const = 0; - virtual void SetAngularVelocity(const SimdVector3& angvel) = 0; - -}; - -#endif //BU_MOTIONSTATE diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_PolynomialSolverInterface.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_PolynomialSolverInterface.h deleted file mode 100644 index 15d67faee1c..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_PolynomialSolverInterface.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ -#ifndef BUM_POLYNOMIAL_SOLVER_INTERFACE -#define BUM_POLYNOMIAL_SOLVER_INTERFACE - -#include <SimdScalar.h> -// -//BUM_PolynomialSolverInterface is interface class for polynomial root finding. -//The number of roots is returned as a result, query GetRoot to get the actual solution. -// -class BUM_PolynomialSolverInterface -{ -public: - virtual ~BUM_PolynomialSolverInterface() {}; - - -// virtual int Solve2QuadraticFull(SimdScalar a,SimdScalar b, SimdScalar c) = 0; - - virtual int Solve3Cubic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c) = 0; - - virtual int Solve4Quartic(SimdScalar lead, SimdScalar a, SimdScalar b, SimdScalar c, SimdScalar d) = 0; - - virtual SimdScalar GetRoot(int i) const = 0; - -}; - -#endif //BUM_POLYNOMIAL_SOLVER_INTERFACE diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Screwing.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_Screwing.cpp deleted file mode 100644 index 997fcc3a9e6..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Screwing.cpp +++ /dev/null @@ -1,200 +0,0 @@ - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Stephane Redon / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "BU_Screwing.h" - - -BU_Screwing::BU_Screwing(const SimdVector3& relLinVel,const SimdVector3& relAngVel) { - - - const SimdScalar dx=relLinVel[0]; - const SimdScalar dy=relLinVel[1]; - const SimdScalar dz=relLinVel[2]; - const SimdScalar wx=relAngVel[0]; - const SimdScalar wy=relAngVel[1]; - const SimdScalar wz=relAngVel[2]; - - // Compute the screwing parameters : - // w : total amount of rotation - // s : total amount of translation - // u : vector along the screwing axis (||u||=1) - // o : point on the screwing axis - - m_w=SimdSqrt(wx*wx+wy*wy+wz*wz); - //if (!w) { - if (fabs(m_w)<SCREWEPSILON ) { - - assert(m_w == 0.f); - - m_w=0.; - m_s=SimdSqrt(dx*dx+dy*dy+dz*dz); - if (fabs(m_s)<SCREWEPSILON ) { - assert(m_s == 0.); - - m_s=0.; - m_u=SimdPoint3(0.,0.,1.); - m_o=SimdPoint3(0.,0.,0.); - } - else { - float t=1.f/m_s; - m_u=SimdPoint3(dx*t,dy*t,dz*t); - m_o=SimdPoint3(0.f,0.f,0.f); - } - } - else { // there is some rotation - - // we compute u - - float v(1.f/m_w); - m_u=SimdPoint3(wx*v,wy*v,wz*v); // normalization - - // decomposition of the translation along u and one orthogonal vector - - SimdPoint3 t(dx,dy,dz); - m_s=t.dot(m_u); // component along u - if (fabs(m_s)<SCREWEPSILON) - { - //printf("m_s component along u < SCREWEPSILION\n"); - m_s=0.f; - } - SimdPoint3 n1(t-(m_s*m_u)); // the remaining part (which is orthogonal to u) - - // now we have to compute o - - //SimdScalar len = n1.length2(); - //(len >= BUM_EPSILON2) { - if (n1[0] || n1[1] || n1[2]) { // n1 is not the zero vector - n1.normalize(); - SimdVector3 n1orth=m_u.cross(n1); - - float n2x=SimdCos(0.5f*m_w); - float n2y=SimdSin(0.5f*m_w); - - m_o=0.5f*t.dot(n1)*(n1+n2x/n2y*n1orth); - } - else - { - m_o=SimdPoint3(0.f,0.f,0.f); - } - - } - -} - -//Then, I need to compute Pa, the matrix from the reference (global) frame to -//the screwing frame : - - -void BU_Screwing::LocalMatrix(SimdTransform &t) const { -//So the whole computations do this : align the Oz axis along the -// screwing axis (thanks to u), and then find two others orthogonal axes to -// complete the basis. - - if ((m_u[0]>SCREWEPSILON)||(m_u[0]<-SCREWEPSILON)||(m_u[1]>SCREWEPSILON)||(m_u[1]<-SCREWEPSILON)) - { - // to avoid numerical problems - float n=SimdSqrt(m_u[0]*m_u[0]+m_u[1]*m_u[1]); - float invn=1.0f/n; - SimdMatrix3x3 mat; - - mat[0][0]=-m_u[1]*invn; - mat[0][1]=m_u[0]*invn; - mat[0][2]=0.f; - - mat[1][0]=-m_u[0]*invn*m_u[2]; - mat[1][1]=-m_u[1]*invn*m_u[2]; - mat[1][2]=n; - - mat[2][0]=m_u[0]; - mat[2][1]=m_u[1]; - mat[2][2]=m_u[2]; - - t.setOrigin(SimdPoint3( - m_o[0]*m_u[1]*invn-m_o[1]*m_u[0]*invn, - -(m_o[0]*mat[1][0]+m_o[1]*mat[1][1]+m_o[2]*n), - -(m_o[0]*m_u[0]+m_o[1]*m_u[1]+m_o[2]*m_u[2]))); - - t.setBasis(mat); - - } - else { - - SimdMatrix3x3 m; - - m[0][0]=1.; - m[1][0]=0.; - m[2][0]=0.; - - m[0][1]=0.f; - m[1][1]=float(SimdSign(m_u[2])); - m[2][1]=0.f; - - m[0][2]=0.f; - m[1][2]=0.f; - m[2][2]=float(SimdSign(m_u[2])); - - t.setOrigin(SimdPoint3( - -m_o[0], - -SimdSign(m_u[2])*m_o[1], - -SimdSign(m_u[2])*m_o[2] - )); - t.setBasis(m); - - } -} - -//gives interpolated transform for time in [0..1] in screwing frame -SimdTransform BU_Screwing::InBetweenTransform(const SimdTransform& tr,SimdScalar t) const -{ - SimdPoint3 org = tr.getOrigin(); - - SimdPoint3 neworg ( - org.x()*SimdCos(m_w*t)-org.y()*SimdSin(m_w*t), - org.x()*SimdSin(m_w*t)+org.y()*SimdCos(m_w*t), - org.z()+m_s*CalculateF(t)); - - SimdTransform newtr; - newtr.setOrigin(neworg); - SimdMatrix3x3 basis = tr.getBasis(); - SimdMatrix3x3 basisorg = tr.getBasis(); - - SimdQuaternion rot(SimdVector3(0.,0.,1.),m_w*t); - SimdQuaternion tmpOrn; - tr.getBasis().getRotation(tmpOrn); - rot = rot * tmpOrn; - - //to avoid numerical drift, normalize quaternion - rot.normalize(); - newtr.setBasis(SimdMatrix3x3(rot)); - return newtr; - -} - - -SimdScalar BU_Screwing::CalculateF(SimdScalar t) const -{ - SimdScalar result; - if (!m_w) - { - result = t; - } else - { - result = ( SimdTan((m_w*t)/2.f) / SimdTan(m_w/2.f)); - } - return result; -} - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Screwing.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_Screwing.h deleted file mode 100644 index 17603cec0b7..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_Screwing.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef B_SCREWING_H -#define B_SCREWING_H - - -#include <SimdVector3.h> -#include <SimdPoint3.h> -#include <SimdTransform.h> - - -#define SCREWEPSILON 0.00001f - -///BU_Screwing implements screwing motion interpolation. -class BU_Screwing -{ -public: - - - BU_Screwing(const SimdVector3& relLinVel,const SimdVector3& relAngVel); - - ~BU_Screwing() { - }; - - SimdScalar CalculateF(SimdScalar t) const; - //gives interpolated position for time in [0..1] in screwing frame - - inline SimdPoint3 InBetweenPosition(const SimdPoint3& pt,SimdScalar t) const - { - return SimdPoint3( - pt.x()*SimdCos(m_w*t)-pt.y()*SimdSin(m_w*t), - pt.x()*SimdSin(m_w*t)+pt.y()*SimdCos(m_w*t), - pt.z()+m_s*CalculateF(t)); - } - - inline SimdVector3 InBetweenVector(const SimdVector3& vec,SimdScalar t) const - { - return SimdVector3( - vec.x()*SimdCos(m_w*t)-vec.y()*SimdSin(m_w*t), - vec.x()*SimdSin(m_w*t)+vec.y()*SimdCos(m_w*t), - vec.z()); - } - - //gives interpolated transform for time in [0..1] in screwing frame - SimdTransform InBetweenTransform(const SimdTransform& tr,SimdScalar t) const; - - - //gives matrix from global frame into screwing frame - void LocalMatrix(SimdTransform &t) const; - - inline const SimdVector3& GetU() const { return m_u;} - inline const SimdVector3& GetO() const {return m_o;} - inline const SimdScalar GetS() const{ return m_s;} - inline const SimdScalar GetW() const { return m_w;} - -private: - float m_w; - float m_s; - SimdVector3 m_u; - SimdVector3 m_o; -}; - -#endif //B_SCREWING_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_StaticMotionState.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_StaticMotionState.h deleted file mode 100644 index 4202b3dde23..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_StaticMotionState.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BU_STATIC_MOTIONSTATE -#define BU_STATIC_MOTIONSTATE - - -#include <CollisionShapes/BU_MotionStateInterface.h> - -class BU_StaticMotionState :public BU_MotionStateInterface -{ -public: - virtual ~BU_StaticMotionState(){}; - - virtual void SetTransform(const SimdTransform& trans) - { - m_trans = trans; - } - virtual void GetTransform(SimdTransform& trans) const - { - trans = m_trans; - } - virtual void SetPosition(const SimdPoint3& position) - { - m_trans.setOrigin( position ); - } - virtual void GetPosition(SimdPoint3& position) const - { - position = m_trans.getOrigin(); - } - - virtual void SetOrientation(const SimdQuaternion& orientation) - { - m_trans.setRotation( orientation); - } - virtual void GetOrientation(SimdQuaternion& orientation) const - { - orientation = m_trans.getRotation(); - } - - virtual void SetBasis(const SimdMatrix3x3& basis) - { - m_trans.setBasis( basis); - } - virtual void GetBasis(SimdMatrix3x3& basis) const - { - basis = m_trans.getBasis(); - } - - virtual void SetLinearVelocity(const SimdVector3& linvel) - { - m_linearVelocity = linvel; - } - virtual void GetLinearVelocity(SimdVector3& linvel) const - { - linvel = m_linearVelocity; - } - - virtual void SetAngularVelocity(const SimdVector3& angvel) - { - m_angularVelocity = angvel; - } - virtual void GetAngularVelocity(SimdVector3& angvel) const - { - angvel = m_angularVelocity; - } - - - -protected: - - SimdTransform m_trans; - SimdVector3 m_angularVelocity; - SimdVector3 m_linearVelocity; - -}; - -#endif //BU_STATIC_MOTIONSTATE diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_VertexPoly.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/BU_VertexPoly.cpp deleted file mode 100644 index 71de3a284be..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_VertexPoly.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#include "BU_VertexPoly.h" -#include "BU_Screwing.h" -#include <SimdTransform.h> -#include <SimdPoint3.h> -#include <SimdVector3.h> - -#define USE_ALGEBRAIC -#ifdef USE_ALGEBRAIC - #include "BU_AlgebraicPolynomialSolver.h" - #define BU_Polynomial BU_AlgebraicPolynomialSolver -#else - #include "BU_IntervalArithmeticPolynomialSolver.h" - #define BU_Polynomial BU_IntervalArithmeticPolynomialSolver -#endif - -inline bool TestFuzzyZero(SimdScalar x) { return SimdFabs(x) < 0.0001f; } - - -BU_VertexPoly::BU_VertexPoly() -{ - -} -//return true if a collision will occur between [0..1] -//false otherwise. If true, minTime contains the time of impact -bool BU_VertexPoly::GetTimeOfImpact( - const BU_Screwing& screwAB, - const SimdPoint3& a, - const SimdVector4& planeEq, - SimdScalar &minTime,bool swapAB) -{ - - bool hit = false; - - // precondition: s=0 and w= 0 is catched by caller! - if (TestFuzzyZero(screwAB.GetS()) && - TestFuzzyZero(screwAB.GetW())) - { - return false; - } - - - //case w<>0 and s<> 0 - const SimdScalar w=screwAB.GetW(); - const SimdScalar s=screwAB.GetS(); - - SimdScalar coefs[4]; - const SimdScalar p=planeEq[0]; - const SimdScalar q=planeEq[1]; - const SimdScalar r=planeEq[2]; - const SimdScalar d=planeEq[3]; - - const SimdVector3 norm(p,q,r); - BU_Polynomial polynomialSolver; - int numroots = 0; - - //SimdScalar eps=1e-80f; - //SimdScalar eps2=1e-100f; - - if (TestFuzzyZero(screwAB.GetS()) ) - { - //S = 0 , W <> 0 - - //ax^3+bx^2+cx+d=0 - coefs[0]=0.; - coefs[1]=(-p*a.x()-q*a.y()+r*a.z()-d); - coefs[2]=-2*p*a.y()+2*q*a.x(); - coefs[3]=p*a.x()+q*a.y()+r*a.z()-d; - -// numroots = polynomialSolver.Solve3Cubic(coefs[0],coefs[1],coefs[2],coefs[3]); - numroots = polynomialSolver.Solve2QuadraticFull(coefs[1],coefs[2],coefs[3]); - - } else - { - if (TestFuzzyZero(screwAB.GetW())) - { - // W = 0 , S <> 0 - //pax+qay+r(az+st)=d - - SimdScalar dist = (d - a.dot(norm)); - - if (TestFuzzyZero(r)) - { - if (TestFuzzyZero(dist)) - { - // no hit - } else - { - // todo a a' might hit sides of polygon T - //printf("unhandled case, w=0,s<>0,r<>0, a a' might hit sides of polygon T \n"); - } - - } else - { - SimdScalar etoi = (dist)/(r*screwAB.GetS()); - if (swapAB) - etoi *= -1; - - if (etoi >= 0. && etoi <= minTime) - { - minTime = etoi; - hit = true; - } - } - - } else - { - //ax^3+bx^2+cx+d=0 - - //degenerate coefficients mess things up :( - SimdScalar ietsje = (r*s)/SimdTan(w/2.f); - if (ietsje*ietsje < 0.01f) - ietsje = 0.f; - - coefs[0]=ietsje;//(r*s)/tan(w/2.); - coefs[1]=(-p*a.x()-q*a.y()+r*a.z()-d); - coefs[2]=-2.f*p*a.y()+2.f*q*a.x()+ietsje;//((r*s)/(tan(w/2.))); - coefs[3]=p*a.x()+q*a.y()+r*a.z()-d; - - numroots = polynomialSolver.Solve3Cubic(coefs[0],coefs[1],coefs[2],coefs[3]); - } - } - - - for (int i=0;i<numroots;i++) - { - SimdScalar tau = polynomialSolver.GetRoot(i); - - SimdScalar t = 2.f*SimdAtan(tau)/w; - //tau = tan (wt/2) so 2*atan (tau)/w - if (swapAB) - { - t *= -1.; - } - if (t>=0 && t<minTime) - { - minTime = t; - hit = true; - } - } - - return hit; -} diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/BU_VertexPoly.h b/extern/bullet/Bullet/NarrowPhaseCollision/BU_VertexPoly.h deleted file mode 100644 index 96ac73c7aae..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/BU_VertexPoly.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef VERTEX_POLY_H -#define VERTEX_POLY_H - - -class BU_Screwing; -#include <SimdTransform.h> -#include <SimdPoint3.h> -#include <SimdScalar.h> - -///BU_VertexPoly implements algebraic time of impact calculation between vertex and a plane. -class BU_VertexPoly -{ -public: - BU_VertexPoly(); - bool GetTimeOfImpact( - const BU_Screwing& screwAB, - const SimdPoint3& vtx, - const SimdVector4& planeEq, - SimdScalar &minTime, - bool swapAB); - -private: - - //cached data (frame coherency etc.) here - -}; -#endif //VERTEX_POLY_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/CollisionMargin.h b/extern/bullet/Bullet/NarrowPhaseCollision/CollisionMargin.h deleted file mode 100644 index 377f0e506a2..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/CollisionMargin.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef COLLISION_MARGIN_H -#define COLLISION_MARGIN_H - -//used by Gjk and some other algorithms - -#define CONVEX_DISTANCE_MARGIN 0.04f// 0.1f//;//0.01f - - - -#endif //COLLISION_MARGIN_H - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ContinuousConvexCollision.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/ContinuousConvexCollision.cpp deleted file mode 100644 index 710208a916e..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/ContinuousConvexCollision.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "ContinuousConvexCollision.h" -#include "CollisionShapes/ConvexShape.h" -#include "CollisionShapes/MinkowskiSumShape.h" -#include "NarrowPhaseCollision/SimplexSolverInterface.h" -#include "SimdTransformUtil.h" -#include "CollisionShapes/SphereShape.h" - -#include "GjkPairDetector.h" -#include "PointCollector.h" - - - -ContinuousConvexCollision::ContinuousConvexCollision ( ConvexShape* convexA,ConvexShape* convexB,SimplexSolverInterface* simplexSolver, ConvexPenetrationDepthSolver* penetrationDepthSolver) -:m_simplexSolver(simplexSolver), -m_penetrationDepthSolver(penetrationDepthSolver), -m_convexA(convexA),m_convexB(convexB) -{ -} - -/// This maximum should not be necessary. It allows for untested/degenerate cases in production code. -/// You don't want your game ever to lock-up. -#define MAX_ITERATIONS 1000 - -bool ContinuousConvexCollision::calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result) -{ - - m_simplexSolver->reset(); - - /// compute linear and angular velocity for this interval, to interpolate - SimdVector3 linVelA,angVelA,linVelB,angVelB; - SimdTransformUtil::CalculateVelocity(fromA,toA,1.f,linVelA,angVelA); - SimdTransformUtil::CalculateVelocity(fromB,toB,1.f,linVelB,angVelB); - - SimdScalar boundingRadiusA = m_convexA->GetAngularMotionDisc(); - SimdScalar boundingRadiusB = m_convexB->GetAngularMotionDisc(); - - SimdScalar maxAngularProjectedVelocity = angVelA.length() * boundingRadiusA + angVelB.length() * boundingRadiusB; - - float radius = 0.001f; - - SimdScalar lambda = 0.f; - SimdVector3 v(1,0,0); - - int maxIter = MAX_ITERATIONS; - - SimdVector3 n; - n.setValue(0.f,0.f,0.f); - bool hasResult = false; - SimdVector3 c; - - float lastLambda = lambda; - //float epsilon = 0.001f; - - int numIter = 0; - //first solution, using GJK - - - SimdTransform identityTrans; - identityTrans.setIdentity(); - - SphereShape raySphere(0.0f); - raySphere.SetMargin(0.f); - - -// result.DrawCoordSystem(sphereTr); - - PointCollector pointCollector1; - - { - - GjkPairDetector gjk(m_convexA,m_convexB,m_simplexSolver,m_penetrationDepthSolver); - GjkPairDetector::ClosestPointInput input; - - //we don't use margins during CCD - gjk.SetIgnoreMargin(true); - - input.m_transformA = fromA; - input.m_transformB = fromB; - gjk.GetClosestPoints(input,pointCollector1,0); - - hasResult = pointCollector1.m_hasResult; - c = pointCollector1.m_pointInWorld; - } - - if (hasResult) - { - SimdScalar dist; - dist = pointCollector1.m_distance; - n = pointCollector1.m_normalOnBInWorld; - - //not close enough - while (dist > radius) - { - numIter++; - if (numIter > maxIter) - return false; //todo: report a failure - - float dLambda = 0.f; - - //calculate safe moving fraction from distance / (linear+rotational velocity) - - //float clippedDist = GEN_min(angularConservativeRadius,dist); - //float clippedDist = dist; - - float projectedLinearVelocity = (linVelB-linVelA).dot(n); - - dLambda = dist / (projectedLinearVelocity+ maxAngularProjectedVelocity); - - lambda = lambda + dLambda; - - if (lambda > 1.f) - return false; - - if (lambda < 0.f) - return false; - - //todo: next check with relative epsilon - if (lambda <= lastLambda) - break; - lastLambda = lambda; - - - - //interpolate to next lambda - SimdTransform interpolatedTransA,interpolatedTransB,relativeTrans; - - SimdTransformUtil::IntegrateTransform(fromA,linVelA,angVelA,lambda,interpolatedTransA); - SimdTransformUtil::IntegrateTransform(fromB,linVelB,angVelB,lambda,interpolatedTransB); - relativeTrans = interpolatedTransB.inverseTimes(interpolatedTransA); - - result.DebugDraw( lambda ); - - PointCollector pointCollector; - GjkPairDetector gjk(m_convexA,m_convexB,m_simplexSolver,m_penetrationDepthSolver); - GjkPairDetector::ClosestPointInput input; - input.m_transformA = interpolatedTransA; - input.m_transformB = interpolatedTransB; - gjk.GetClosestPoints(input,pointCollector,0); - if (pointCollector.m_hasResult) - { - if (pointCollector.m_distance < 0.f) - { - //degenerate ?! - result.m_fraction = lastLambda; - result.m_normal = n; - return true; - } - c = pointCollector.m_pointInWorld; - - dist = pointCollector.m_distance; - } else - { - //?? - return false; - } - - } - - result.m_fraction = lambda; - result.m_normal = n; - return true; - } - - return false; - -/* -//todo: - //if movement away from normal, discard result - SimdVector3 move = transBLocalTo.getOrigin() - transBLocalFrom.getOrigin(); - if (result.m_fraction < 1.f) - { - if (move.dot(result.m_normal) <= 0.f) - { - } - } -*/ - -} - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ContinuousConvexCollision.h b/extern/bullet/Bullet/NarrowPhaseCollision/ContinuousConvexCollision.h deleted file mode 100644 index 0128f19f657..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/ContinuousConvexCollision.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef CONTINUOUS_COLLISION_CONVEX_CAST_H -#define CONTINUOUS_COLLISION_CONVEX_CAST_H - -#include "ConvexCast.h" -#include "SimplexSolverInterface.h" -class ConvexPenetrationDepthSolver; -class ConvexShape; - -/// ContinuousConvexCollision implements angular and linear time of impact for convex objects. -/// Based on Brian Mirtich's Conservative Advancement idea (PhD thesis). -/// Algorithm operates in worldspace, in order to keep inbetween motion globally consistent. -/// It uses GJK at the moment. Future improvement would use minkowski sum / supporting vertex, merging innerloops -class ContinuousConvexCollision : public ConvexCast -{ - SimplexSolverInterface* m_simplexSolver; - ConvexPenetrationDepthSolver* m_penetrationDepthSolver; - ConvexShape* m_convexA; - ConvexShape* m_convexB; - - -public: - - ContinuousConvexCollision (ConvexShape* shapeA,ConvexShape* shapeB ,SimplexSolverInterface* simplexSolver,ConvexPenetrationDepthSolver* penetrationDepthSolver); - - virtual bool calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result); - - -}; - -#endif //CONTINUOUS_COLLISION_CONVEX_CAST_H - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ConvexCast.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/ConvexCast.cpp deleted file mode 100644 index 689655086be..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/ConvexCast.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "ConvexCast.h" - -ConvexCast::~ConvexCast() -{ -} diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ConvexCast.h b/extern/bullet/Bullet/NarrowPhaseCollision/ConvexCast.h deleted file mode 100644 index 22c0966df23..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/ConvexCast.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef CONVEX_CAST_H -#define CONVEX_CAST_H - -#include <SimdTransform.h> -#include <SimdVector3.h> -#include <SimdScalar.h> -class MinkowskiSumShape; -#include "IDebugDraw.h" - -/// ConvexCast is an interface for Casting -class ConvexCast -{ -public: - - - virtual ~ConvexCast(); - - ///RayResult stores the closest result - /// alternatively, add a callback method to decide about closest/all results - struct CastResult - { - //virtual bool addRayResult(const SimdVector3& normal,SimdScalar fraction) = 0; - - virtual void DebugDraw(SimdScalar fraction) {} - virtual void DrawCoordSystem(const SimdTransform& trans) {} - - CastResult() - :m_fraction(1e30f), - m_debugDrawer(0) - { - } - - - virtual ~CastResult() {}; - - SimdVector3 m_normal; - SimdScalar m_fraction; - SimdTransform m_hitTransformA; - SimdTransform m_hitTransformB; - - IDebugDraw* m_debugDrawer; - - }; - - - /// cast a convex against another convex object - virtual bool calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result) = 0; -}; - -#endif //CONVEX_CAST_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ConvexPenetrationDepthSolver.h b/extern/bullet/Bullet/NarrowPhaseCollision/ConvexPenetrationDepthSolver.h deleted file mode 100644 index 8f8c0a97e04..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/ConvexPenetrationDepthSolver.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef CONVEX_PENETRATION_DEPTH_H -#define CONVEX_PENETRATION_DEPTH_H - -class SimdVector3; -#include "SimplexSolverInterface.h" -class ConvexShape; -#include "SimdPoint3.h" -class SimdTransform; - -///ConvexPenetrationDepthSolver provides an interface for penetration depth calculation. -class ConvexPenetrationDepthSolver -{ -public: - - virtual ~ConvexPenetrationDepthSolver() {}; - virtual bool CalcPenDepth( SimplexSolverInterface& simplexSolver, - ConvexShape* convexA,ConvexShape* convexB, - const SimdTransform& transA,const SimdTransform& transB, - SimdVector3& v, SimdPoint3& pa, SimdPoint3& pb, - class IDebugDraw* debugDraw - ) = 0; - - -}; -#endif //CONVEX_PENETRATION_DEPTH_H - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.h b/extern/bullet/Bullet/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.h deleted file mode 100644 index da5ecc2d78b..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef DISCRETE_COLLISION_DETECTOR_INTERFACE_H -#define DISCRETE_COLLISION_DETECTOR_INTERFACE_H -#include "SimdTransform.h" -#include "SimdVector3.h" - - -/// This interface is made to be used by an iterative approach to do TimeOfImpact calculations -/// This interface allows to query for closest points and penetration depth between two (convex) objects -/// the closest point is on the second object (B), and the normal points from the surface on B towards A. -/// distance is between closest points on B and closest point on A. So you can calculate closest point on A -/// by taking closestPointInA = closestPointInB + m_distance * m_normalOnSurfaceB -struct DiscreteCollisionDetectorInterface -{ - void operator delete(void* ptr) {}; - - struct Result - { - void operator delete(void* ptr) {}; - - virtual ~Result(){} - - ///SetShapeIdentifiers provides experimental support for per-triangle material / custom material combiner - virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1)=0; - virtual void AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth)=0; - }; - - struct ClosestPointInput - { - ClosestPointInput() - :m_maximumDistanceSquared(1e30f) - { - } - - SimdTransform m_transformA; - SimdTransform m_transformB; - SimdScalar m_maximumDistanceSquared; - }; - - virtual ~DiscreteCollisionDetectorInterface() {}; - - // - // give either closest points (distance > 0) or penetration (distance) - // the normal always points from B towards A - // - virtual void GetClosestPoints(const ClosestPointInput& input,Result& output,class IDebugDraw* debugDraw) = 0; - - SimdScalar getCollisionMargin() { return 0.2f;} -}; - -struct StorageResult : public DiscreteCollisionDetectorInterface::Result -{ - SimdVector3 m_normalOnSurfaceB; - SimdVector3 m_closestPointInB; - SimdScalar m_distance; //negative means penetration ! - - StorageResult() : m_distance(1e30f) - { - - } - virtual ~StorageResult() {}; - - virtual void AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth) - { - if (depth < m_distance) - { - m_normalOnSurfaceB = normalOnBInWorld; - m_closestPointInB = pointInWorld; - m_distance = depth; - } - } -}; - -#endif //DISCRETE_COLLISION_DETECTOR_INTERFACE_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/GjkConvexCast.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/GjkConvexCast.cpp deleted file mode 100644 index 2b494e45954..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/GjkConvexCast.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#include "GjkConvexCast.h" -#include "CollisionShapes/SphereShape.h" -#include "CollisionShapes/MinkowskiSumShape.h" -#include "GjkPairDetector.h" -#include "PointCollector.h" - - -GjkConvexCast::GjkConvexCast(ConvexShape* convexA,ConvexShape* convexB,SimplexSolverInterface* simplexSolver) -:m_simplexSolver(simplexSolver), -m_convexA(convexA), -m_convexB(convexB) -{ -} - -bool GjkConvexCast::calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result) -{ - - - MinkowskiSumShape combi(m_convexA,m_convexB); - MinkowskiSumShape* convex = &combi; - - SimdTransform rayFromLocalA; - SimdTransform rayToLocalA; - - rayFromLocalA = fromA.inverse()* fromB; - rayToLocalA = toA.inverse()* toB; - - - SimdTransform trA,trB; - trA = SimdTransform(fromA); - trB = SimdTransform(fromB); - trA.setOrigin(SimdPoint3(0,0,0)); - trB.setOrigin(SimdPoint3(0,0,0)); - - convex->SetTransformA(trA); - convex->SetTransformB(trB); - - - - - float radius = 0.01f; - - SimdScalar lambda = 0.f; - SimdVector3 s = rayFromLocalA.getOrigin(); - SimdVector3 r = rayToLocalA.getOrigin()-rayFromLocalA.getOrigin(); - SimdVector3 x = s; - SimdVector3 n; - n.setValue(0,0,0); - bool hasResult = false; - SimdVector3 c; - - float lastLambda = lambda; - - //first solution, using GJK - - //no penetration support for now, perhaps pass a pointer when we really want it - ConvexPenetrationDepthSolver* penSolverPtr = 0; - - SimdTransform identityTrans; - identityTrans.setIdentity(); - - SphereShape raySphere(0.0f); - raySphere.SetMargin(0.f); - - SimdTransform sphereTr; - sphereTr.setIdentity(); - sphereTr.setOrigin( rayFromLocalA.getOrigin()); - - result.DrawCoordSystem(sphereTr); - { - PointCollector pointCollector1; - GjkPairDetector gjk(&raySphere,convex,m_simplexSolver,penSolverPtr); - - GjkPairDetector::ClosestPointInput input; - input.m_transformA = sphereTr; - input.m_transformB = identityTrans; - gjk.GetClosestPoints(input,pointCollector1,0); - - hasResult = pointCollector1.m_hasResult; - c = pointCollector1.m_pointInWorld; - n = pointCollector1.m_normalOnBInWorld; - } - - - - if (hasResult) - { - SimdScalar dist; - dist = (c-x).length(); - if (dist < radius) - { - //penetration - lastLambda = 1.f; - } - - //not close enough - while (dist > radius) - { - - n = x - c; - SimdScalar nDotr = n.dot(r); - - if (nDotr >= -(SIMD_EPSILON*SIMD_EPSILON)) - return false; - - lambda = lambda - n.dot(n) / nDotr; - if (lambda <= lastLambda) - break; - - lastLambda = lambda; - - x = s + lambda * r; - - sphereTr.setOrigin( x ); - result.DrawCoordSystem(sphereTr); - PointCollector pointCollector; - GjkPairDetector gjk(&raySphere,convex,m_simplexSolver,penSolverPtr); - GjkPairDetector::ClosestPointInput input; - input.m_transformA = sphereTr; - input.m_transformB = identityTrans; - gjk.GetClosestPoints(input,pointCollector,0); - if (pointCollector.m_hasResult) - { - if (pointCollector.m_distance < 0.f) - { - //degeneracy, report a hit - result.m_fraction = lastLambda; - result.m_normal = n; - return true; - } - c = pointCollector.m_pointInWorld; - dist = (c-x).length(); - } else - { - //?? - return false; - } - - } - - if (lastLambda < 1.f) - { - - result.m_fraction = lastLambda; - result.m_normal = n; - return true; - } - } - - return false; -} - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/GjkConvexCast.h b/extern/bullet/Bullet/NarrowPhaseCollision/GjkConvexCast.h deleted file mode 100644 index c83ffc12f59..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/GjkConvexCast.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef GJK_CONVEX_CAST_H -#define GJK_CONVEX_CAST_H - -#include <CollisionShapes/CollisionMargin.h> - -#include "SimdVector3.h" -#include "ConvexCast.h" -class ConvexShape; -class MinkowskiSumShape; -#include "SimplexSolverInterface.h" - -///GjkConvexCast performs a raycast on a convex object using support mapping. -class GjkConvexCast : public ConvexCast -{ - SimplexSolverInterface* m_simplexSolver; - ConvexShape* m_convexA; - ConvexShape* m_convexB; - -public: - - GjkConvexCast(ConvexShape* convexA,ConvexShape* convexB,SimplexSolverInterface* simplexSolver); - - /// cast a convex against another convex object - virtual bool calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result); - -}; - -#endif //GJK_CONVEX_CAST_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp deleted file mode 100644 index 0887ba71901..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "GjkPairDetector.h" -#include "CollisionShapes/ConvexShape.h" -#include "NarrowPhaseCollision/SimplexSolverInterface.h" -#include "NarrowPhaseCollision/ConvexPenetrationDepthSolver.h" - -#if defined(DEBUG) || defined (_DEBUG) -#include <stdio.h> //for debug printf -#endif - -static const SimdScalar rel_error = SimdScalar(1.0e-5); -SimdScalar rel_error2 = rel_error * rel_error; -float maxdist2 = 1.e30f; - - -int gGjkMaxIter=1000; - -GjkPairDetector::GjkPairDetector(ConvexShape* objectA,ConvexShape* objectB,SimplexSolverInterface* simplexSolver,ConvexPenetrationDepthSolver* penetrationDepthSolver) -:m_cachedSeparatingAxis(0.f,0.f,1.f), -m_penetrationDepthSolver(penetrationDepthSolver), -m_simplexSolver(simplexSolver), -m_minkowskiA(objectA), -m_minkowskiB(objectB), -m_ignoreMargin(false), -m_partId0(-1), -m_index0(-1), -m_partId1(-1), -m_index1(-1) -{ -} - -void GjkPairDetector::GetClosestPoints(const ClosestPointInput& input,Result& output,class IDebugDraw* debugDraw) -{ - SimdScalar distance=0.f; - SimdVector3 normalInB(0.f,0.f,0.f); - SimdVector3 pointOnA,pointOnB; - - float marginA = m_minkowskiA->GetMargin(); - float marginB = m_minkowskiB->GetMargin(); - - //for CCD we don't use margins - if (m_ignoreMargin) - { - marginA = 0.f; - marginB = 0.f; - } - -int curIter = 0; - - bool isValid = false; - bool checkSimplex = false; - bool checkPenetration = true; - - { - SimdScalar squaredDistance = SIMD_INFINITY; - SimdScalar delta = 0.f; - - SimdScalar margin = marginA + marginB; - - - - m_simplexSolver->reset(); - - while (true) - { - //rare failure case, perhaps deferate shapes? - if (curIter++ > gGjkMaxIter) - { - #if defined(DEBUG) || defined (_DEBUG) - printf("GjkPairDetector maxIter exceeded:%i\n",curIter); - printf("sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n", - m_cachedSeparatingAxis.getX(), - m_cachedSeparatingAxis.getY(), - m_cachedSeparatingAxis.getZ(), - squaredDistance, - m_minkowskiA->GetShapeType(), - m_minkowskiB->GetShapeType()); - #endif - break; - - } - - SimdVector3 seperatingAxisInA = (-m_cachedSeparatingAxis)* input.m_transformA.getBasis(); - SimdVector3 seperatingAxisInB = m_cachedSeparatingAxis* input.m_transformB.getBasis(); - - SimdVector3 pInA = m_minkowskiA->LocalGetSupportingVertexWithoutMargin(seperatingAxisInA); - SimdVector3 qInB = m_minkowskiB->LocalGetSupportingVertexWithoutMargin(seperatingAxisInB); - SimdPoint3 pWorld = input.m_transformA(pInA); - SimdPoint3 qWorld = input.m_transformB(qInB); - - SimdVector3 w = pWorld - qWorld; - delta = m_cachedSeparatingAxis.dot(w); - - // potential exit, they don't overlap - if ((delta > SimdScalar(0.0)) && (delta * delta > squaredDistance * input.m_maximumDistanceSquared)) - { - checkPenetration = false; - break; - } - - //exit 0: the new point is already in the simplex, or we didn't come any closer - if (m_simplexSolver->inSimplex(w)) - { - checkSimplex = true; - break; - } - // are we getting any closer ? - if (squaredDistance - delta <= squaredDistance * rel_error2) - { - checkSimplex = true; - break; - } - //add current vertex to simplex - m_simplexSolver->addVertex(w, pWorld, qWorld); - - //calculate the closest point to the origin (update vector v) - if (!m_simplexSolver->closest(m_cachedSeparatingAxis)) - { - checkSimplex = true; - break; - } - - SimdScalar previousSquaredDistance = squaredDistance; - squaredDistance = m_cachedSeparatingAxis.length2(); - - //redundant m_simplexSolver->compute_points(pointOnA, pointOnB); - - //are we getting any closer ? - if (previousSquaredDistance - squaredDistance <= SIMD_EPSILON * previousSquaredDistance) - { - m_simplexSolver->backup_closest(m_cachedSeparatingAxis); - checkSimplex = true; - break; - } - bool check = (!m_simplexSolver->fullSimplex()); - //bool check = (!m_simplexSolver->fullSimplex() && squaredDistance > SIMD_EPSILON * m_simplexSolver->maxVertex()); - - if (!check) - { - //do we need this backup_closest here ? - m_simplexSolver->backup_closest(m_cachedSeparatingAxis); - break; - } - } - - if (checkSimplex) - { - m_simplexSolver->compute_points(pointOnA, pointOnB); - normalInB = pointOnA-pointOnB; - float lenSqr = m_cachedSeparatingAxis.length2(); - //valid normal - if (lenSqr > (SIMD_EPSILON*SIMD_EPSILON)) - { - float rlen = 1.f / SimdSqrt(lenSqr ); - normalInB *= rlen; //normalize - SimdScalar s = SimdSqrt(squaredDistance); - ASSERT(s > SimdScalar(0.0)); - pointOnA -= m_cachedSeparatingAxis * (marginA / s); - pointOnB += m_cachedSeparatingAxis * (marginB / s); - distance = ((1.f/rlen) - margin); - isValid = true; - } - } - - if (checkPenetration && !isValid) - { - //penetration case - - //if there is no way to handle penetrations, bail out - if (m_penetrationDepthSolver) - { - // Penetration depth case. - isValid = m_penetrationDepthSolver->CalcPenDepth( - *m_simplexSolver, - m_minkowskiA,m_minkowskiB, - input.m_transformA,input.m_transformB, - m_cachedSeparatingAxis, pointOnA, pointOnB, - debugDraw - ); - - if (isValid) - { - normalInB = pointOnB-pointOnA; - float lenSqr = normalInB.length2(); - if (lenSqr > (SIMD_EPSILON*SIMD_EPSILON)) - { - normalInB /= SimdSqrt(lenSqr); - distance = -(pointOnA-pointOnB).length(); - } else - { - isValid = false; - } - } - } - } - } - - if (isValid) - { - output.SetShapeIdentifiers(m_partId0,m_index0,m_partId1,m_index1); - - output.AddContactPoint( - normalInB, - pointOnB, - distance); - //printf("gjk add:%f",distance); - } - - -} - - - - - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.h b/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.h deleted file mode 100644 index 5eee81e82c6..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - - -#ifndef GJK_PAIR_DETECTOR_H -#define GJK_PAIR_DETECTOR_H - -#include "DiscreteCollisionDetectorInterface.h" -#include "SimdPoint3.h" - -#include <CollisionShapes/CollisionMargin.h> - -class ConvexShape; -#include "SimplexSolverInterface.h" -class ConvexPenetrationDepthSolver; - -/// GjkPairDetector uses GJK to implement the DiscreteCollisionDetectorInterface -class GjkPairDetector : public DiscreteCollisionDetectorInterface -{ - - - SimdVector3 m_cachedSeparatingAxis; - ConvexPenetrationDepthSolver* m_penetrationDepthSolver; - SimplexSolverInterface* m_simplexSolver; - ConvexShape* m_minkowskiA; - ConvexShape* m_minkowskiB; - bool m_ignoreMargin; - - -public: - - //experimental feature information, per triangle, per convex etc. - //'material combiner' / contact added callback - int m_partId0; - int m_index0; - int m_partId1; - int m_index1; - - GjkPairDetector(ConvexShape* objectA,ConvexShape* objectB,SimplexSolverInterface* simplexSolver,ConvexPenetrationDepthSolver* penetrationDepthSolver); - virtual ~GjkPairDetector() {}; - - virtual void GetClosestPoints(const ClosestPointInput& input,Result& output,class IDebugDraw* debugDraw); - - void SetMinkowskiA(ConvexShape* minkA) - { - m_minkowskiA = minkA; - } - - void SetMinkowskiB(ConvexShape* minkB) - { - m_minkowskiB = minkB; - } - void SetCachedSeperatingAxis(const SimdVector3& seperatingAxis) - { - m_cachedSeparatingAxis = seperatingAxis; - } - - void SetPenetrationDepthSolver(ConvexPenetrationDepthSolver* penetrationDepthSolver) - { - m_penetrationDepthSolver = penetrationDepthSolver; - } - - void SetIgnoreMargin(bool ignoreMargin) - { - m_ignoreMargin = ignoreMargin; - } - -}; - -#endif //GJK_PAIR_DETECTOR_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp deleted file mode 100644 index ad97b9579b0..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "ManifoldContactAddResult.h" -#include "NarrowPhaseCollision/PersistentManifold.h" - -ManifoldContactAddResult::ManifoldContactAddResult(SimdTransform transA,SimdTransform transB,PersistentManifold* manifoldPtr) - :m_manifoldPtr(manifoldPtr) -{ - m_transAInv = transA.inverse(); - m_transBInv = transB.inverse(); - -} - - -void ManifoldContactAddResult::AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth) -{ - if (depth > m_manifoldPtr->GetContactBreakingTreshold()) - return; - - - SimdVector3 pointA = pointInWorld + normalOnBInWorld * depth; - SimdVector3 localA = m_transAInv(pointA ); - SimdVector3 localB = m_transBInv(pointInWorld); - ManifoldPoint newPt(localA,localB,normalOnBInWorld,depth); - - int insertIndex = m_manifoldPtr->GetCacheEntry(newPt); - if (insertIndex >= 0) - { - m_manifoldPtr->ReplaceContactPoint(newPt,insertIndex); - } else - { - m_manifoldPtr->AddManifoldPoint(newPt); - } -} - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.h b/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.h deleted file mode 100644 index 5dc9f3129b2..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldContactAddResult.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef MANIFOLD_CONTACT_ADD_RESULT_H -#define MANIFOLD_CONTACT_ADD_RESULT_H - -#include "NarrowPhaseCollision/DiscreteCollisionDetectorInterface.h" -class PersistentManifold; - -class ManifoldContactAddResult : public DiscreteCollisionDetectorInterface::Result -{ - PersistentManifold* m_manifoldPtr; - SimdTransform m_transAInv; - SimdTransform m_transBInv; - -public: - - ManifoldContactAddResult(SimdTransform transA,SimdTransform transB,PersistentManifold* manifoldPtr); - - virtual void AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth); - -}; - -#endif //MANIFOLD_CONTACT_ADD_RESULT_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldPoint.h b/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldPoint.h deleted file mode 100644 index 250d9a9a8b4..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/ManifoldPoint.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef MANIFOLD_CONTACT_POINT_H -#define MANIFOLD_CONTACT_POINT_H - -#include "SimdVector3.h" -#include "SimdTransformUtil.h" - - - - - -/// ManifoldContactPoint collects and maintains persistent contactpoints. -/// used to improve stability and performance of rigidbody dynamics response. -class ManifoldPoint - { - public: - ManifoldPoint() - :m_userPersistentData(0) - { - } - - ManifoldPoint( const SimdVector3 &pointA, const SimdVector3 &pointB, - const SimdVector3 &normal, - SimdScalar distance ) : - m_localPointA( pointA ), - m_localPointB( pointB ), - m_normalWorldOnB( normal ), - m_distance1( distance ), - m_combinedFriction(0.f), - m_combinedRestitution(0.f), - m_userPersistentData(0), - m_lifeTime(0) - { - - - } - - - - SimdVector3 m_localPointA; - SimdVector3 m_localPointB; - SimdVector3 m_positionWorldOnB; - ///m_positionWorldOnA is redundant information, see GetPositionWorldOnA(), but for clarity - SimdVector3 m_positionWorldOnA; - SimdVector3 m_normalWorldOnB; - - float m_distance1; - float m_combinedFriction; - float m_combinedRestitution; - - - void* m_userPersistentData; - - int m_lifeTime;//lifetime of the contactpoint in frames - - float GetDistance() const - { - return m_distance1; - } - int GetLifeTime() const - { - return m_lifeTime; - } - - SimdVector3 GetPositionWorldOnA() { - return m_positionWorldOnA; -// return m_positionWorldOnB + m_normalWorldOnB * m_distance1; - } - - const SimdVector3& GetPositionWorldOnB() - { - return m_positionWorldOnB; - } - - void SetDistance(float dist) - { - m_distance1 = dist; - } - - - - }; - -#endif //MANIFOLD_CONTACT_POINT_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp deleted file mode 100644 index 70b856c32a9..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "MinkowskiPenetrationDepthSolver.h" -#include "CollisionShapes/MinkowskiSumShape.h" -#include "NarrowPhaseCollision/SubSimplexConvexCast.h" -#include "NarrowPhaseCollision/VoronoiSimplexSolver.h" -#include "NarrowPhaseCollision/GjkPairDetector.h" - - -struct MyResult : public DiscreteCollisionDetectorInterface::Result -{ - - MyResult():m_hasResult(false) - { - } - - SimdVector3 m_normalOnBInWorld; - SimdVector3 m_pointInWorld; - float m_depth; - bool m_hasResult; - - virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1) - { - } - void AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth) - { - m_normalOnBInWorld = normalOnBInWorld; - m_pointInWorld = pointInWorld; - m_depth = depth; - m_hasResult = true; - } -}; - -#define NUM_UNITSPHERE_POINTS 42 -static SimdVector3 sPenetrationDirections[NUM_UNITSPHERE_POINTS] = -{ -SimdVector3(0.000000f , -0.000000f,-1.000000f), -SimdVector3(0.723608f , -0.525725f,-0.447219f), -SimdVector3(-0.276388f , -0.850649f,-0.447219f), -SimdVector3(-0.894426f , -0.000000f,-0.447216f), -SimdVector3(-0.276388f , 0.850649f,-0.447220f), -SimdVector3(0.723608f , 0.525725f,-0.447219f), -SimdVector3(0.276388f , -0.850649f,0.447220f), -SimdVector3(-0.723608f , -0.525725f,0.447219f), -SimdVector3(-0.723608f , 0.525725f,0.447219f), -SimdVector3(0.276388f , 0.850649f,0.447219f), -SimdVector3(0.894426f , 0.000000f,0.447216f), -SimdVector3(-0.000000f , 0.000000f,1.000000f), -SimdVector3(0.425323f , -0.309011f,-0.850654f), -SimdVector3(-0.162456f , -0.499995f,-0.850654f), -SimdVector3(0.262869f , -0.809012f,-0.525738f), -SimdVector3(0.425323f , 0.309011f,-0.850654f), -SimdVector3(0.850648f , -0.000000f,-0.525736f), -SimdVector3(-0.525730f , -0.000000f,-0.850652f), -SimdVector3(-0.688190f , -0.499997f,-0.525736f), -SimdVector3(-0.162456f , 0.499995f,-0.850654f), -SimdVector3(-0.688190f , 0.499997f,-0.525736f), -SimdVector3(0.262869f , 0.809012f,-0.525738f), -SimdVector3(0.951058f , 0.309013f,0.000000f), -SimdVector3(0.951058f , -0.309013f,0.000000f), -SimdVector3(0.587786f , -0.809017f,0.000000f), -SimdVector3(0.000000f , -1.000000f,0.000000f), -SimdVector3(-0.587786f , -0.809017f,0.000000f), -SimdVector3(-0.951058f , -0.309013f,-0.000000f), -SimdVector3(-0.951058f , 0.309013f,-0.000000f), -SimdVector3(-0.587786f , 0.809017f,-0.000000f), -SimdVector3(-0.000000f , 1.000000f,-0.000000f), -SimdVector3(0.587786f , 0.809017f,-0.000000f), -SimdVector3(0.688190f , -0.499997f,0.525736f), -SimdVector3(-0.262869f , -0.809012f,0.525738f), -SimdVector3(-0.850648f , 0.000000f,0.525736f), -SimdVector3(-0.262869f , 0.809012f,0.525738f), -SimdVector3(0.688190f , 0.499997f,0.525736f), -SimdVector3(0.525730f , 0.000000f,0.850652f), -SimdVector3(0.162456f , -0.499995f,0.850654f), -SimdVector3(-0.425323f , -0.309011f,0.850654f), -SimdVector3(-0.425323f , 0.309011f,0.850654f), -SimdVector3(0.162456f , 0.499995f,0.850654f) -}; - - -bool MinkowskiPenetrationDepthSolver::CalcPenDepth(SimplexSolverInterface& simplexSolver, - ConvexShape* convexA,ConvexShape* convexB, - const SimdTransform& transA,const SimdTransform& transB, - SimdVector3& v, SimdPoint3& pa, SimdPoint3& pb, - class IDebugDraw* debugDraw - ) -{ - - //just take fixed number of orientation, and sample the penetration depth in that direction - float minProj = 1e30f; - SimdVector3 minNorm; - SimdVector3 minVertex; - SimdVector3 minA,minB; - SimdVector3 seperatingAxisInA,seperatingAxisInB; - SimdVector3 pInA,qInB,pWorld,qWorld,w; - -#define USE_BATCHED_SUPPORT 1 -#ifdef USE_BATCHED_SUPPORT - SimdVector3 supportVerticesABatch[NUM_UNITSPHERE_POINTS]; - SimdVector3 supportVerticesBBatch[NUM_UNITSPHERE_POINTS]; - SimdVector3 seperatingAxisInABatch[NUM_UNITSPHERE_POINTS]; - SimdVector3 seperatingAxisInBBatch[NUM_UNITSPHERE_POINTS]; - int i; - - for (i=0;i<NUM_UNITSPHERE_POINTS;i++) - { - const SimdVector3& norm = sPenetrationDirections[i]; - seperatingAxisInABatch[i] = (-norm)* transA.getBasis(); - seperatingAxisInBBatch[i] = norm * transB.getBasis(); - } - - convexA->BatchedUnitVectorGetSupportingVertexWithoutMargin(seperatingAxisInABatch,supportVerticesABatch,NUM_UNITSPHERE_POINTS); - convexB->BatchedUnitVectorGetSupportingVertexWithoutMargin(seperatingAxisInBBatch,supportVerticesBBatch,NUM_UNITSPHERE_POINTS); - for (i=0;i<NUM_UNITSPHERE_POINTS;i++) - { - const SimdVector3& norm = sPenetrationDirections[i]; - seperatingAxisInA = seperatingAxisInABatch[i]; - seperatingAxisInB = seperatingAxisInBBatch[i]; - - pInA = supportVerticesABatch[i]; - qInB = supportVerticesBBatch[i]; - - pWorld = transA(pInA); - qWorld = transB(qInB); - w = qWorld - pWorld; - float delta = norm.dot(w); - //find smallest delta - if (delta < minProj) - { - minProj = delta; - minNorm = norm; - minA = pWorld; - minB = qWorld; - } - } -#else - for (int i=0;i<NUM_UNITSPHERE_POINTS;i++) - { - const SimdVector3& norm = sPenetrationDirections[i]; - seperatingAxisInA = (-norm)* transA.getBasis(); - seperatingAxisInB = norm* transB.getBasis(); - pInA = convexA->LocalGetSupportingVertexWithoutMargin(seperatingAxisInA); - qInB = convexB->LocalGetSupportingVertexWithoutMargin(seperatingAxisInB); - pWorld = transA(pInA); - qWorld = transB(qInB); - w = qWorld - pWorld; - float delta = norm.dot(w); - //find smallest delta - if (delta < minProj) - { - minProj = delta; - minNorm = norm; - minA = pWorld; - minB = qWorld; - } - } -#endif //USE_BATCHED_SUPPORT - - //add the margins - - minA += minNorm*convexA->GetMargin(); - minB -= minNorm*convexB->GetMargin(); - minProj += (convexA->GetMargin() + convexB->GetMargin()); - - - - -//#define DEBUG_DRAW 1 -#ifdef DEBUG_DRAW - if (debugDraw) - { - SimdVector3 color(0,1,0); - debugDraw->DrawLine(minA,minB,color); - color = SimdVector3 (1,1,1); - SimdVector3 vec = minB-minA; - float prj2 = minNorm.dot(vec); - debugDraw->DrawLine(minA,minA+(minNorm*minProj),color); - - } -#endif //DEBUG_DRAW - - - - GjkPairDetector gjkdet(convexA,convexB,&simplexSolver,0); - - SimdScalar offsetDist = minProj; - SimdVector3 offset = minNorm * offsetDist; - - - - GjkPairDetector::ClosestPointInput input; - - SimdVector3 newOrg = transA.getOrigin() + offset; - - SimdTransform displacedTrans = transA; - displacedTrans.setOrigin(newOrg); - - input.m_transformA = displacedTrans; - input.m_transformB = transB; - input.m_maximumDistanceSquared = 1e30f;//minProj; - - MyResult res; - gjkdet.GetClosestPoints(input,res,debugDraw); - - float correctedMinNorm = minProj - res.m_depth; - - - //the penetration depth is over-estimated, relax it - float penetration_relaxation= 1.f; - minNorm*=penetration_relaxation; - - if (res.m_hasResult) - { - - pa = res.m_pointInWorld - minNorm * correctedMinNorm; - pb = res.m_pointInWorld; - -#ifdef DEBUG_DRAW - if (debugDraw) - { - SimdVector3 color(1,0,0); - debugDraw->DrawLine(pa,pb,color); - } -#endif//DEBUG_DRAW - - - } - return res.m_hasResult; -} - - - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.h b/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.h deleted file mode 100644 index b7a0da3a024..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef MINKOWSKI_PENETRATION_DEPTH_SOLVER_H -#define MINKOWSKI_PENETRATION_DEPTH_SOLVER_H - -#include "ConvexPenetrationDepthSolver.h" - -///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation. -///Implementation is based on sampling the depth using support mapping, and using GJK step to get the witness points. -class MinkowskiPenetrationDepthSolver : public ConvexPenetrationDepthSolver -{ -public: - - virtual bool CalcPenDepth( SimplexSolverInterface& simplexSolver, - ConvexShape* convexA,ConvexShape* convexB, - const SimdTransform& transA,const SimdTransform& transB, - SimdVector3& v, SimdPoint3& pa, SimdPoint3& pb, - class IDebugDraw* debugDraw - ); - -}; - -#endif //MINKOWSKI_PENETRATION_DEPTH_SOLVER_H - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/PersistentManifold.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/PersistentManifold.cpp deleted file mode 100644 index 39227e3ead2..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/PersistentManifold.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "PersistentManifold.h" -#include "SimdTransform.h" -#include <assert.h> - -float gContactBreakingTreshold = 0.02f; -ContactDestroyedCallback gContactDestroyedCallback = 0; - - - -PersistentManifold::PersistentManifold() -:m_body0(0), -m_body1(0), -m_cachedPoints (0), -m_index1(0) -{ -} - - -void PersistentManifold::ClearManifold() -{ - int i; - for (i=0;i<m_cachedPoints;i++) - { - ClearUserCache(m_pointCache[i]); - } - m_cachedPoints = 0; -} - -#ifdef DEBUG_PERSISTENCY -#include <stdio.h> -void PersistentManifold::DebugPersistency() -{ - int i; - printf("DebugPersistency : numPoints %d\n",m_cachedPoints); - for (i=0;i<m_cachedPoints;i++) - { - printf("m_pointCache[%d].m_userPersistentData = %x\n",i,m_pointCache[i].m_userPersistentData); - } -} -#endif //DEBUG_PERSISTENCY - -void PersistentManifold::ClearUserCache(ManifoldPoint& pt) -{ - - void* oldPtr = pt.m_userPersistentData; - if (oldPtr) - { -#ifdef DEBUG_PERSISTENCY - int i; - int occurance = 0; - for (i=0;i<m_cachedPoints;i++) - { - if (m_pointCache[i].m_userPersistentData == oldPtr) - { - occurance++; - if (occurance>1) - printf("error in ClearUserCache\n"); - } - } - assert(occurance<=0); -#endif //DEBUG_PERSISTENCY - - if (pt.m_userPersistentData && gContactDestroyedCallback) - { - (*gContactDestroyedCallback)(pt.m_userPersistentData); - pt.m_userPersistentData = 0; - } - -#ifdef DEBUG_PERSISTENCY - DebugPersistency(); -#endif - } - - -} - - -int PersistentManifold::SortCachedPoints(const ManifoldPoint& pt) -{ - - //calculate 4 possible cases areas, and take biggest area - //also need to keep 'deepest' - - int maxPenetrationIndex = -1; -#define KEEP_DEEPEST_POINT 1 -#ifdef KEEP_DEEPEST_POINT - float maxPenetration = pt.GetDistance(); - for (int i=0;i<4;i++) - { - if (m_pointCache[i].GetDistance() < maxPenetration) - { - maxPenetrationIndex = i; - maxPenetration = m_pointCache[i].GetDistance(); - } - } -#endif //KEEP_DEEPEST_POINT - - SimdScalar res0(0.f),res1(0.f),res2(0.f),res3(0.f); - if (maxPenetrationIndex != 0) - { - SimdVector3 a0 = pt.m_localPointA-m_pointCache[1].m_localPointA; - SimdVector3 b0 = m_pointCache[3].m_localPointA-m_pointCache[2].m_localPointA; - SimdVector3 cross = a0.cross(b0); - res0 = cross.length2(); - } - if (maxPenetrationIndex != 1) - { - SimdVector3 a1 = pt.m_localPointA-m_pointCache[0].m_localPointA; - SimdVector3 b1 = m_pointCache[3].m_localPointA-m_pointCache[2].m_localPointA; - SimdVector3 cross = a1.cross(b1); - res1 = cross.length2(); - } - - if (maxPenetrationIndex != 2) - { - SimdVector3 a2 = pt.m_localPointA-m_pointCache[0].m_localPointA; - SimdVector3 b2 = m_pointCache[3].m_localPointA-m_pointCache[1].m_localPointA; - SimdVector3 cross = a2.cross(b2); - res2 = cross.length2(); - } - - if (maxPenetrationIndex != 3) - { - SimdVector3 a3 = pt.m_localPointA-m_pointCache[0].m_localPointA; - SimdVector3 b3 = m_pointCache[2].m_localPointA-m_pointCache[1].m_localPointA; - SimdVector3 cross = a3.cross(b3); - res3 = cross.length2(); - } - - SimdVector4 maxvec(res0,res1,res2,res3); - int biggestarea = maxvec.closestAxis4(); - return biggestarea; -} - - -int PersistentManifold::GetCacheEntry(const ManifoldPoint& newPoint) const -{ - SimdScalar shortestDist = GetContactBreakingTreshold() * GetContactBreakingTreshold(); - int size = GetNumContacts(); - int nearestPoint = -1; - for( int i = 0; i < size; i++ ) - { - const ManifoldPoint &mp = m_pointCache[i]; - - SimdVector3 diffA = mp.m_localPointA- newPoint.m_localPointA; - const SimdScalar distToManiPoint = diffA.dot(diffA); - if( distToManiPoint < shortestDist ) - { - shortestDist = distToManiPoint; - nearestPoint = i; - } - } - return nearestPoint; -} - -void PersistentManifold::AddManifoldPoint(const ManifoldPoint& newPoint) -{ - assert(ValidContactDistance(newPoint)); - - int insertIndex = GetNumContacts(); - if (insertIndex == MANIFOLD_CACHE_SIZE) - { -#if MANIFOLD_CACHE_SIZE >= 4 - //sort cache so best points come first, based on area - insertIndex = SortCachedPoints(newPoint); -#else - insertIndex = 0; -#endif - - - } else - { - m_cachedPoints++; - - - } - ReplaceContactPoint(newPoint,insertIndex); -} - -float PersistentManifold::GetContactBreakingTreshold() const -{ - return gContactBreakingTreshold; -} - -void PersistentManifold::RefreshContactPoints(const SimdTransform& trA,const SimdTransform& trB) -{ - int i; - - /// first refresh worldspace positions and distance - for (i=GetNumContacts()-1;i>=0;i--) - { - ManifoldPoint &manifoldPoint = m_pointCache[i]; - manifoldPoint.m_positionWorldOnA = trA( manifoldPoint.m_localPointA ); - manifoldPoint.m_positionWorldOnB = trB( manifoldPoint.m_localPointB ); - manifoldPoint.m_distance1 = (manifoldPoint.m_positionWorldOnA - manifoldPoint.m_positionWorldOnB).dot(manifoldPoint.m_normalWorldOnB); - manifoldPoint.m_lifeTime++; - } - - /// then - SimdScalar distance2d; - SimdVector3 projectedDifference,projectedPoint; - for (i=GetNumContacts()-1;i>=0;i--) - { - - ManifoldPoint &manifoldPoint = m_pointCache[i]; - //contact becomes invalid when signed distance exceeds margin (projected on contactnormal direction) - if (!ValidContactDistance(manifoldPoint)) - { - RemoveContactPoint(i); - } else - { - //contact also becomes invalid when relative movement orthogonal to normal exceeds margin - projectedPoint = manifoldPoint.m_positionWorldOnA - manifoldPoint.m_normalWorldOnB * manifoldPoint.m_distance1; - projectedDifference = manifoldPoint.m_positionWorldOnB - projectedPoint; - distance2d = projectedDifference.dot(projectedDifference); - if (distance2d > GetContactBreakingTreshold()*GetContactBreakingTreshold() ) - { - RemoveContactPoint(i); - } - } - } -#ifdef DEBUG_PERSISTENCY - DebugPersistency(); -#endif // -} - - - - - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/PersistentManifold.h b/extern/bullet/Bullet/NarrowPhaseCollision/PersistentManifold.h deleted file mode 100644 index 53895be9ade..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/PersistentManifold.h +++ /dev/null @@ -1,140 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef PERSISTENT_MANIFOLD_H -#define PERSISTENT_MANIFOLD_H - - -#include "SimdVector3.h" -#include "SimdTransform.h" -#include "ManifoldPoint.h" - -struct CollisionResult; - -///contact breaking and merging treshold -extern float gContactBreakingTreshold; - -typedef bool (*ContactDestroyedCallback)(void* userPersistentData); -extern ContactDestroyedCallback gContactDestroyedCallback; - - - - -#define MANIFOLD_CACHE_SIZE 4 - -///PersistentManifold maintains contact points, and reduces them to 4. -///It does contact filtering/contact reduction. -class PersistentManifold -{ - - ManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]; - - /// this two body pointers can point to the physics rigidbody class. - /// void* will allow any rigidbody class - void* m_body0; - void* m_body1; - int m_cachedPoints; - - - /// sort cached points so most isolated points come first - int SortCachedPoints(const ManifoldPoint& pt); - - int FindContactPoint(const ManifoldPoint* unUsed, int numUnused,const ManifoldPoint& pt); - -public: - - int m_index1; - - PersistentManifold(); - - PersistentManifold(void* body0,void* body1) - : m_body0(body0),m_body1(body1),m_cachedPoints(0) - { - } - - inline void* GetBody0() { return m_body0;} - inline void* GetBody1() { return m_body1;} - - inline const void* GetBody0() const { return m_body0;} - inline const void* GetBody1() const { return m_body1;} - - void SetBodies(void* body0,void* body1) - { - m_body0 = body0; - m_body1 = body1; - } - - void ClearUserCache(ManifoldPoint& pt); - -#ifdef DEBUG_PERSISTENCY - void DebugPersistency(); -#endif // - - inline int GetNumContacts() const { return m_cachedPoints;} - - inline const ManifoldPoint& GetContactPoint(int index) const - { - ASSERT(index < m_cachedPoints); - return m_pointCache[index]; - } - - inline ManifoldPoint& GetContactPoint(int index) - { - ASSERT(index < m_cachedPoints); - return m_pointCache[index]; - } - - /// todo: get this margin from the current physics / collision environment - float GetContactBreakingTreshold() const; - - int GetCacheEntry(const ManifoldPoint& newPoint) const; - - void AddManifoldPoint( const ManifoldPoint& newPoint); - - void RemoveContactPoint (int index) - { - ClearUserCache(m_pointCache[index]); - - int lastUsedIndex = GetNumContacts() - 1; - m_pointCache[index] = m_pointCache[lastUsedIndex]; - //get rid of duplicated userPersistentData pointer - m_pointCache[lastUsedIndex].m_userPersistentData = 0; - m_cachedPoints--; - } - void ReplaceContactPoint(const ManifoldPoint& newPoint,int insertIndex) - { - assert(ValidContactDistance(newPoint)); - - ClearUserCache(m_pointCache[insertIndex]); - - m_pointCache[insertIndex] = newPoint; - } - - bool ValidContactDistance(const ManifoldPoint& pt) const - { - return pt.m_distance1 <= GetContactBreakingTreshold(); - } - /// calculated new worldspace coordinates and depth, and reject points that exceed the collision margin - void RefreshContactPoints( const SimdTransform& trA,const SimdTransform& trB); - - void ClearManifold(); - - - -}; - - - -#endif //PERSISTENT_MANIFOLD_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/PointCollector.h b/extern/bullet/Bullet/NarrowPhaseCollision/PointCollector.h deleted file mode 100644 index 9d1daf01c46..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/PointCollector.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef POINT_COLLECTOR_H -#define POINT_COLLECTOR_H - -#include "DiscreteCollisionDetectorInterface.h" - - - -struct PointCollector : public DiscreteCollisionDetectorInterface::Result -{ - - - SimdVector3 m_normalOnBInWorld; - SimdVector3 m_pointInWorld; - SimdScalar m_distance;//negative means penetration - - bool m_hasResult; - - PointCollector () - : m_distance(1e30f),m_hasResult(false) - { - } - - virtual void SetShapeIdentifiers(int partId0,int index0, int partId1,int index1) - { - //?? - } - - virtual void AddContactPoint(const SimdVector3& normalOnBInWorld,const SimdVector3& pointInWorld,float depth) - { - if (depth< m_distance) - { - m_hasResult = true; - m_normalOnBInWorld = normalOnBInWorld; - m_pointInWorld = pointInWorld; - //negative means penetration - m_distance = depth; - } - } -}; - -#endif //POINT_COLLECTOR_H - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp deleted file mode 100644 index 209d9612bfd..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "RaycastCallback.h" - -TriangleRaycastCallback::TriangleRaycastCallback(const SimdVector3& from,const SimdVector3& to) - : - m_from(from), - m_to(to), - m_hitFraction(1.f) -{ - -} - - - -void TriangleRaycastCallback::ProcessTriangle(SimdVector3* triangle,int partId, int triangleIndex) -{ - - - const SimdVector3 &vert0=triangle[0]; - const SimdVector3 &vert1=triangle[1]; - const SimdVector3 &vert2=triangle[2]; - - SimdVector3 v10; v10 = vert1 - vert0 ; - SimdVector3 v20; v20 = vert2 - vert0 ; - - SimdVector3 triangleNormal; triangleNormal = v10.cross( v20 ); - - const float dist = vert0.dot(triangleNormal); - float dist_a = triangleNormal.dot(m_from) ; - dist_a-= dist; - float dist_b = triangleNormal.dot(m_to); - dist_b -= dist; - - if ( dist_a * dist_b >= 0.0f) - { - return ; // same sign - } - - const float proj_length=dist_a-dist_b; - const float distance = (dist_a)/(proj_length); - // Now we have the intersection point on the plane, we'll see if it's inside the triangle - // Add an epsilon as a tolerance for the raycast, - // in case the ray hits exacly on the edge of the triangle. - // It must be scaled for the triangle size. - - if(distance < m_hitFraction) - { - - - float edge_tolerance =triangleNormal.length2(); - edge_tolerance *= -0.0001f; - SimdVector3 point; point.setInterpolate3( m_from, m_to, distance); - { - SimdVector3 v0p; v0p = vert0 - point; - SimdVector3 v1p; v1p = vert1 - point; - SimdVector3 cp0; cp0 = v0p.cross( v1p ); - - if ( (float)(cp0.dot(triangleNormal)) >=edge_tolerance) - { - - - SimdVector3 v2p; v2p = vert2 - point; - SimdVector3 cp1; - cp1 = v1p.cross( v2p); - if ( (float)(cp1.dot(triangleNormal)) >=edge_tolerance) - { - SimdVector3 cp2; - cp2 = v2p.cross(v0p); - - if ( (float)(cp2.dot(triangleNormal)) >=edge_tolerance) - { - - if ( dist_a > 0 ) - { - m_hitFraction = ReportHit(triangleNormal,distance,partId,triangleIndex); - } - else - { - m_hitFraction = ReportHit(-triangleNormal,distance,partId,triangleIndex); - } - } - } - } - } - } -} diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h b/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h deleted file mode 100644 index 463c576c57e..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/RaycastCallback.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef RAYCAST_TRI_CALLBACK_H -#define RAYCAST_TRI_CALLBACK_H - -#include "CollisionShapes/TriangleCallback.h" -struct BroadphaseProxy; - - -class TriangleRaycastCallback: public TriangleCallback -{ -public: - - //input - SimdVector3 m_from; - SimdVector3 m_to; - - float m_hitFraction; - - TriangleRaycastCallback(const SimdVector3& from,const SimdVector3& to); - - virtual void ProcessTriangle(SimdVector3* triangle, int partId, int triangleIndex); - - virtual float ReportHit(const SimdVector3& hitNormalLocal, float hitFraction, int partId, int triangleIndex ) = 0; - -}; - -#endif //RAYCAST_TRI_CALLBACK_H - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/SimplexSolverInterface.h b/extern/bullet/Bullet/NarrowPhaseCollision/SimplexSolverInterface.h deleted file mode 100644 index 6a15d8e4f0c..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/SimplexSolverInterface.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef SIMPLEX_SOLVER_INTERFACE_H -#define SIMPLEX_SOLVER_INTERFACE_H - -#include "SimdVector3.h" -#include "SimdPoint3.h" - -#define NO_VIRTUAL_INTERFACE 1 -#ifdef NO_VIRTUAL_INTERFACE -#include "VoronoiSimplexSolver.h" -#define SimplexSolverInterface VoronoiSimplexSolver -#else - -/// SimplexSolverInterface can incrementally calculate distance between origin and up to 4 vertices -/// Used by GJK or Linear Casting. Can be implemented by the Johnson-algorithm or alternative approaches based on -/// voronoi regions or barycentric coordinates -class SimplexSolverInterface -{ - public: - virtual ~SimplexSolverInterface() {}; - - virtual void reset() = 0; - - virtual void addVertex(const SimdVector3& w, const SimdPoint3& p, const SimdPoint3& q) = 0; - - virtual bool closest(SimdVector3& v) = 0; - - virtual SimdScalar maxVertex() = 0; - - virtual bool fullSimplex() const = 0; - - virtual int getSimplex(SimdPoint3 *pBuf, SimdPoint3 *qBuf, SimdVector3 *yBuf) const = 0; - - virtual bool inSimplex(const SimdVector3& w) = 0; - - virtual void backup_closest(SimdVector3& v) = 0; - - virtual bool emptySimplex() const = 0; - - virtual void compute_points(SimdPoint3& p1, SimdPoint3& p2) = 0; - - virtual int numVertices() const =0; - - -}; -#endif -#endif //SIMPLEX_SOLVER_INTERFACE_H - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp deleted file mode 100644 index a913261988a..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "SubSimplexConvexCast.h" -#include "CollisionShapes/ConvexShape.h" -#include "CollisionShapes/MinkowskiSumShape.h" -#include "NarrowPhaseCollision/SimplexSolverInterface.h" - - -SubsimplexConvexCast::SubsimplexConvexCast (ConvexShape* convexA,ConvexShape* convexB,SimplexSolverInterface* simplexSolver) -:m_simplexSolver(simplexSolver), -m_convexA(convexA),m_convexB(convexB) -{ -} - - -#define MAX_ITERATIONS 1000 - -bool SubsimplexConvexCast::calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result) -{ - - MinkowskiSumShape combi(m_convexA,m_convexB); - MinkowskiSumShape* convex = &combi; - - SimdTransform rayFromLocalA; - SimdTransform rayToLocalA; - - rayFromLocalA = fromA.inverse()* fromB; - rayToLocalA = toA.inverse()* toB; - - - m_simplexSolver->reset(); - - convex->SetTransformB(SimdTransform(rayFromLocalA.getBasis())); - - //float radius = 0.01f; - - SimdScalar lambda = 0.f; - //todo: need to verify this: - //because of minkowski difference, we need the inverse direction - - SimdVector3 s = -rayFromLocalA.getOrigin(); - SimdVector3 r = -(rayToLocalA.getOrigin()-rayFromLocalA.getOrigin()); - SimdVector3 x = s; - SimdVector3 v; - SimdVector3 arbitraryPoint = convex->LocalGetSupportingVertex(r); - - v = x - arbitraryPoint; - - int maxIter = MAX_ITERATIONS; - - SimdVector3 n; - n.setValue(0.f,0.f,0.f); - bool hasResult = false; - SimdVector3 c; - - float lastLambda = lambda; - - - float dist2 = v.length2(); - float epsilon = 0.0001f; - - SimdVector3 w,p; - float VdotR; - - while ( (dist2 > epsilon) && maxIter--) - { - p = convex->LocalGetSupportingVertex( v); - w = x - p; - - float VdotW = v.dot(w); - - if ( VdotW > 0.f) - { - VdotR = v.dot(r); - - if (VdotR >= -(SIMD_EPSILON*SIMD_EPSILON)) - return false; - else - { - lambda = lambda - VdotW / VdotR; - x = s + lambda * r; - m_simplexSolver->reset(); - //check next line - w = x-p; - lastLambda = lambda; - n = v; - hasResult = true; - } - } - m_simplexSolver->addVertex( w, x , p); - if (m_simplexSolver->closest(v)) - { - dist2 = v.length2(); - hasResult = true; - //printf("V=%f , %f, %f\n",v[0],v[1],v[2]); - //printf("DIST2=%f\n",dist2); - //printf("numverts = %i\n",m_simplexSolver->numVertices()); - } else - { - dist2 = 0.f; - } - } - - //int numiter = MAX_ITERATIONS - maxIter; -// printf("number of iterations: %d", numiter); - result.m_fraction = lambda; - result.m_normal = n; - - return true; -} - - - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.h b/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.h deleted file mode 100644 index 9fc58e133df..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef SUBSIMPLEX_CONVEX_CAST_H -#define SUBSIMPLEX_CONVEX_CAST_H - -#include "ConvexCast.h" -#include "SimplexSolverInterface.h" -class ConvexShape; - -/// SubsimplexConvexCast implements Gino van den Bergens' paper -///"Ray Casting against General Convex Objects with Application to Continuous Collision Detection" -/// GJK based Ray Cast, optimized version -/// Objects should not start in overlap, otherwise results are not defined. -class SubsimplexConvexCast : public ConvexCast -{ - SimplexSolverInterface* m_simplexSolver; - ConvexShape* m_convexA; - ConvexShape* m_convexB; - -public: - - SubsimplexConvexCast (ConvexShape* shapeA,ConvexShape* shapeB,SimplexSolverInterface* simplexSolver); - - //virtual ~SubsimplexConvexCast(); - ///SimsimplexConvexCast calculateTimeOfImpact calculates the time of impact+normal for the linear cast (sweep) between two moving objects. - ///Precondition is that objects should not penetration/overlap at the start from the interval. Overlap can be tested using GjkPairDetector. - virtual bool calcTimeOfImpact( - const SimdTransform& fromA, - const SimdTransform& toA, - const SimdTransform& fromB, - const SimdTransform& toB, - CastResult& result); - -}; - -#endif //SUBSIMPLEX_CONVEX_CAST_H diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/VoronoiSimplexSolver.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/VoronoiSimplexSolver.cpp deleted file mode 100644 index f0b69cfe755..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/VoronoiSimplexSolver.cpp +++ /dev/null @@ -1,598 +0,0 @@ - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - - Elsevier CDROM license agreements grants nonexclusive license to use the software - for any purpose, commercial or non-commercial as long as the following credit is included - identifying the original source of the software: - - Parts of the source are "from the book Real-Time Collision Detection by - Christer Ericson, published by Morgan Kaufmann Publishers, - (c) 2005 Elsevier Inc." - -*/ - - -#include "VoronoiSimplexSolver.h" -#include <assert.h> -#include <stdio.h> - -#define VERTA 0 -#define VERTB 1 -#define VERTC 2 -#define VERTD 3 - -#define CATCH_DEGENERATE_TETRAHEDRON 1 -void VoronoiSimplexSolver::removeVertex(int index) -{ - - assert(m_numVertices>0); - m_numVertices--; - m_simplexVectorW[index] = m_simplexVectorW[m_numVertices]; - m_simplexPointsP[index] = m_simplexPointsP[m_numVertices]; - m_simplexPointsQ[index] = m_simplexPointsQ[m_numVertices]; -} - -void VoronoiSimplexSolver::ReduceVertices (const UsageBitfield& usedVerts) -{ - if ((numVertices() >= 4) && (!usedVerts.usedVertexD)) - removeVertex(3); - - if ((numVertices() >= 3) && (!usedVerts.usedVertexC)) - removeVertex(2); - - if ((numVertices() >= 2) && (!usedVerts.usedVertexB)) - removeVertex(1); - - if ((numVertices() >= 1) && (!usedVerts.usedVertexA)) - removeVertex(0); - -} - - - - - -//clear the simplex, remove all the vertices -void VoronoiSimplexSolver::reset() -{ - m_cachedValidClosest = false; - m_numVertices = 0; - m_needsUpdate = true; - m_lastW = SimdVector3(1e30f,1e30f,1e30f); - m_cachedBC.Reset(); -} - - - - //add a vertex -void VoronoiSimplexSolver::addVertex(const SimdVector3& w, const SimdPoint3& p, const SimdPoint3& q) -{ - m_lastW = w; - m_needsUpdate = true; - - m_simplexVectorW[m_numVertices] = w; - m_simplexPointsP[m_numVertices] = p; - m_simplexPointsQ[m_numVertices] = q; - - m_numVertices++; -} - -bool VoronoiSimplexSolver::UpdateClosestVectorAndPoints() -{ - - if (m_needsUpdate) - { - m_cachedBC.Reset(); - - m_needsUpdate = false; - - switch (numVertices()) - { - case 0: - m_cachedValidClosest = false; - break; - case 1: - { - m_cachedP1 = m_simplexPointsP[0]; - m_cachedP2 = m_simplexPointsQ[0]; - m_cachedV = m_cachedP1-m_cachedP2; //== m_simplexVectorW[0] - m_cachedBC.Reset(); - m_cachedBC.SetBarycentricCoordinates(1.f,0.f,0.f,0.f); - m_cachedValidClosest = m_cachedBC.IsValid(); - break; - }; - case 2: - { - //closest point origin from line segment - const SimdVector3& from = m_simplexVectorW[0]; - const SimdVector3& to = m_simplexVectorW[1]; - SimdVector3 nearest; - - SimdVector3 p (0.f,0.f,0.f); - SimdVector3 diff = p - from; - SimdVector3 v = to - from; - float t = v.dot(diff); - - if (t > 0) { - float dotVV = v.dot(v); - if (t < dotVV) { - t /= dotVV; - diff -= t*v; - m_cachedBC.m_usedVertices.usedVertexA = true; - m_cachedBC.m_usedVertices.usedVertexB = true; - } else { - t = 1; - diff -= v; - //reduce to 1 point - m_cachedBC.m_usedVertices.usedVertexB = true; - } - } else - { - t = 0; - //reduce to 1 point - m_cachedBC.m_usedVertices.usedVertexA = true; - } - m_cachedBC.SetBarycentricCoordinates(1-t,t); - nearest = from + t*v; - - m_cachedP1 = m_simplexPointsP[0] + t * (m_simplexPointsP[1] - m_simplexPointsP[0]); - m_cachedP2 = m_simplexPointsQ[0] + t * (m_simplexPointsQ[1] - m_simplexPointsQ[0]); - m_cachedV = m_cachedP1 - m_cachedP2; - - ReduceVertices(m_cachedBC.m_usedVertices); - - m_cachedValidClosest = m_cachedBC.IsValid(); - break; - } - case 3: - { - //closest point origin from triangle - SimdVector3 p (0.f,0.f,0.f); - - const SimdVector3& a = m_simplexVectorW[0]; - const SimdVector3& b = m_simplexVectorW[1]; - const SimdVector3& c = m_simplexVectorW[2]; - - ClosestPtPointTriangle(p,a,b,c,m_cachedBC); - m_cachedP1 = m_simplexPointsP[0] * m_cachedBC.m_barycentricCoords[0] + - m_simplexPointsP[1] * m_cachedBC.m_barycentricCoords[1] + - m_simplexPointsP[2] * m_cachedBC.m_barycentricCoords[2] + - m_simplexPointsP[3] * m_cachedBC.m_barycentricCoords[3]; - - m_cachedP2 = m_simplexPointsQ[0] * m_cachedBC.m_barycentricCoords[0] + - m_simplexPointsQ[1] * m_cachedBC.m_barycentricCoords[1] + - m_simplexPointsQ[2] * m_cachedBC.m_barycentricCoords[2] + - m_simplexPointsQ[3] * m_cachedBC.m_barycentricCoords[3]; - - m_cachedV = m_cachedP1-m_cachedP2; - - ReduceVertices (m_cachedBC.m_usedVertices); - m_cachedValidClosest = m_cachedBC.IsValid(); - - break; - } - case 4: - { - - - SimdVector3 p (0.f,0.f,0.f); - - const SimdVector3& a = m_simplexVectorW[0]; - const SimdVector3& b = m_simplexVectorW[1]; - const SimdVector3& c = m_simplexVectorW[2]; - const SimdVector3& d = m_simplexVectorW[3]; - - bool hasSeperation = ClosestPtPointTetrahedron(p,a,b,c,d,m_cachedBC); - - if (hasSeperation) - { - - m_cachedP1 = m_simplexPointsP[0] * m_cachedBC.m_barycentricCoords[0] + - m_simplexPointsP[1] * m_cachedBC.m_barycentricCoords[1] + - m_simplexPointsP[2] * m_cachedBC.m_barycentricCoords[2] + - m_simplexPointsP[3] * m_cachedBC.m_barycentricCoords[3]; - - m_cachedP2 = m_simplexPointsQ[0] * m_cachedBC.m_barycentricCoords[0] + - m_simplexPointsQ[1] * m_cachedBC.m_barycentricCoords[1] + - m_simplexPointsQ[2] * m_cachedBC.m_barycentricCoords[2] + - m_simplexPointsQ[3] * m_cachedBC.m_barycentricCoords[3]; - - m_cachedV = m_cachedP1-m_cachedP2; - ReduceVertices (m_cachedBC.m_usedVertices); - } else - { -// printf("sub distance got penetration\n"); - - if (m_cachedBC.m_degenerate) - { - m_cachedValidClosest = false; - } else - { - m_cachedValidClosest = true; - //degenerate case == false, penetration = true + zero - m_cachedV.setValue(0.f,0.f,0.f); - } - break; - } - - m_cachedValidClosest = m_cachedBC.IsValid(); - - //closest point origin from tetrahedron - break; - } - default: - { - m_cachedValidClosest = false; - } - }; - } - - return m_cachedValidClosest; - -} - -//return/calculate the closest vertex -bool VoronoiSimplexSolver::closest(SimdVector3& v) -{ - bool succes = UpdateClosestVectorAndPoints(); - v = m_cachedV; - return succes; -} - - - -SimdScalar VoronoiSimplexSolver::maxVertex() -{ - int i, numverts = numVertices(); - SimdScalar maxV = 0.f; - for (i=0;i<numverts;i++) - { - SimdScalar curLen2 = m_simplexVectorW[i].length2(); - if (maxV < curLen2) - maxV = curLen2; - } - return maxV; -} - - - - //return the current simplex -int VoronoiSimplexSolver::getSimplex(SimdPoint3 *pBuf, SimdPoint3 *qBuf, SimdVector3 *yBuf) const -{ - int i; - for (i=0;i<numVertices();i++) - { - yBuf[i] = m_simplexVectorW[i]; - pBuf[i] = m_simplexPointsP[i]; - qBuf[i] = m_simplexPointsQ[i]; - } - return numVertices(); -} - - - - -bool VoronoiSimplexSolver::inSimplex(const SimdVector3& w) -{ - bool found = false; - int i, numverts = numVertices(); - //SimdScalar maxV = 0.f; - - //w is in the current (reduced) simplex - for (i=0;i<numverts;i++) - { - if (m_simplexVectorW[i] == w) - found = true; - } - - //check in case lastW is already removed - if (w == m_lastW) - return true; - - return found; -} - -void VoronoiSimplexSolver::backup_closest(SimdVector3& v) -{ - v = m_cachedV; -} - - -bool VoronoiSimplexSolver::emptySimplex() const -{ - return (numVertices() == 0); - -} - -void VoronoiSimplexSolver::compute_points(SimdPoint3& p1, SimdPoint3& p2) -{ - UpdateClosestVectorAndPoints(); - p1 = m_cachedP1; - p2 = m_cachedP2; - -} - - - - -bool VoronoiSimplexSolver::ClosestPtPointTriangle(const SimdPoint3& p, const SimdPoint3& a, const SimdPoint3& b, const SimdPoint3& c,SubSimplexClosestResult& result) -{ - result.m_usedVertices.reset(); - - // Check if P in vertex region outside A - SimdVector3 ab = b - a; - SimdVector3 ac = c - a; - SimdVector3 ap = p - a; - float d1 = ab.dot(ap); - float d2 = ac.dot(ap); - if (d1 <= 0.0f && d2 <= 0.0f) - { - result.m_closestPointOnSimplex = a; - result.m_usedVertices.usedVertexA = true; - result.SetBarycentricCoordinates(1,0,0); - return true;// a; // barycentric coordinates (1,0,0) - } - - // Check if P in vertex region outside B - SimdVector3 bp = p - b; - float d3 = ab.dot(bp); - float d4 = ac.dot(bp); - if (d3 >= 0.0f && d4 <= d3) - { - result.m_closestPointOnSimplex = b; - result.m_usedVertices.usedVertexB = true; - result.SetBarycentricCoordinates(0,1,0); - - return true; // b; // barycentric coordinates (0,1,0) - } - // Check if P in edge region of AB, if so return projection of P onto AB - float vc = d1*d4 - d3*d2; - if (vc <= 0.0f && d1 >= 0.0f && d3 <= 0.0f) { - float v = d1 / (d1 - d3); - result.m_closestPointOnSimplex = a + v * ab; - result.m_usedVertices.usedVertexA = true; - result.m_usedVertices.usedVertexB = true; - result.SetBarycentricCoordinates(1-v,v,0); - return true; - //return a + v * ab; // barycentric coordinates (1-v,v,0) - } - - // Check if P in vertex region outside C - SimdVector3 cp = p - c; - float d5 = ab.dot(cp); - float d6 = ac.dot(cp); - if (d6 >= 0.0f && d5 <= d6) - { - result.m_closestPointOnSimplex = c; - result.m_usedVertices.usedVertexC = true; - result.SetBarycentricCoordinates(0,0,1); - return true;//c; // barycentric coordinates (0,0,1) - } - - // Check if P in edge region of AC, if so return projection of P onto AC - float vb = d5*d2 - d1*d6; - if (vb <= 0.0f && d2 >= 0.0f && d6 <= 0.0f) { - float w = d2 / (d2 - d6); - result.m_closestPointOnSimplex = a + w * ac; - result.m_usedVertices.usedVertexA = true; - result.m_usedVertices.usedVertexC = true; - result.SetBarycentricCoordinates(1-w,0,w); - return true; - //return a + w * ac; // barycentric coordinates (1-w,0,w) - } - - // Check if P in edge region of BC, if so return projection of P onto BC - float va = d3*d6 - d5*d4; - if (va <= 0.0f && (d4 - d3) >= 0.0f && (d5 - d6) >= 0.0f) { - float w = (d4 - d3) / ((d4 - d3) + (d5 - d6)); - - result.m_closestPointOnSimplex = b + w * (c - b); - result.m_usedVertices.usedVertexB = true; - result.m_usedVertices.usedVertexC = true; - result.SetBarycentricCoordinates(0,1-w,w); - return true; - // return b + w * (c - b); // barycentric coordinates (0,1-w,w) - } - - // P inside face region. Compute Q through its barycentric coordinates (u,v,w) - float denom = 1.0f / (va + vb + vc); - float v = vb * denom; - float w = vc * denom; - - result.m_closestPointOnSimplex = a + ab * v + ac * w; - result.m_usedVertices.usedVertexA = true; - result.m_usedVertices.usedVertexB = true; - result.m_usedVertices.usedVertexC = true; - result.SetBarycentricCoordinates(1-v-w,v,w); - - return true; -// return a + ab * v + ac * w; // = u*a + v*b + w*c, u = va * denom = 1.0f - v - w - -} - - - - - -/// Test if point p and d lie on opposite sides of plane through abc -int VoronoiSimplexSolver::PointOutsideOfPlane(const SimdPoint3& p, const SimdPoint3& a, const SimdPoint3& b, const SimdPoint3& c, const SimdPoint3& d) -{ - SimdVector3 normal = (b-a).cross(c-a); - - float signp = (p - a).dot(normal); // [AP AB AC] - float signd = (d - a).dot( normal); // [AD AB AC] - -#ifdef CATCH_DEGENERATE_TETRAHEDRON - if (signd * signd < (1e-4f * 1e-4f)) - { -// printf("affine dependent/degenerate\n");// - return -1; - } -#endif - // Points on opposite sides if expression signs are opposite - return signp * signd < 0.f; -} - - -bool VoronoiSimplexSolver::ClosestPtPointTetrahedron(const SimdPoint3& p, const SimdPoint3& a, const SimdPoint3& b, const SimdPoint3& c, const SimdPoint3& d, SubSimplexClosestResult& finalResult) -{ - SubSimplexClosestResult tempResult; - - // Start out assuming point inside all halfspaces, so closest to itself - finalResult.m_closestPointOnSimplex = p; - finalResult.m_usedVertices.reset(); - finalResult.m_usedVertices.usedVertexA = true; - finalResult.m_usedVertices.usedVertexB = true; - finalResult.m_usedVertices.usedVertexC = true; - finalResult.m_usedVertices.usedVertexD = true; - - int pointOutsideABC = PointOutsideOfPlane(p, a, b, c, d); - int pointOutsideACD = PointOutsideOfPlane(p, a, c, d, b); - int pointOutsideADB = PointOutsideOfPlane(p, a, d, b, c); - int pointOutsideBDC = PointOutsideOfPlane(p, b, d, c, a); - - if (pointOutsideABC < 0 || pointOutsideACD < 0 || pointOutsideADB < 0 || pointOutsideBDC < 0) - { - finalResult.m_degenerate = true; - return false; - } - - if (!pointOutsideABC && !pointOutsideACD && !pointOutsideADB && !pointOutsideBDC) - { - return false; - } - - - float bestSqDist = FLT_MAX; - // If point outside face abc then compute closest point on abc - if (pointOutsideABC) - { - ClosestPtPointTriangle(p, a, b, c,tempResult); - SimdPoint3 q = tempResult.m_closestPointOnSimplex; - - float sqDist = (q - p).dot( q - p); - // Update best closest point if (squared) distance is less than current best - if (sqDist < bestSqDist) { - bestSqDist = sqDist; - finalResult.m_closestPointOnSimplex = q; - //convert result bitmask! - finalResult.m_usedVertices.reset(); - finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA; - finalResult.m_usedVertices.usedVertexB = tempResult.m_usedVertices.usedVertexB; - finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexC; - finalResult.SetBarycentricCoordinates( - tempResult.m_barycentricCoords[VERTA], - tempResult.m_barycentricCoords[VERTB], - tempResult.m_barycentricCoords[VERTC], - 0 - ); - - } - } - - - // Repeat test for face acd - if (pointOutsideACD) - { - ClosestPtPointTriangle(p, a, c, d,tempResult); - SimdPoint3 q = tempResult.m_closestPointOnSimplex; - //convert result bitmask! - - float sqDist = (q - p).dot( q - p); - if (sqDist < bestSqDist) - { - bestSqDist = sqDist; - finalResult.m_closestPointOnSimplex = q; - finalResult.m_usedVertices.reset(); - finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA; - finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexB; - finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexC; - finalResult.SetBarycentricCoordinates( - tempResult.m_barycentricCoords[VERTA], - 0, - tempResult.m_barycentricCoords[VERTB], - tempResult.m_barycentricCoords[VERTC] - ); - - } - } - // Repeat test for face adb - - - if (pointOutsideADB) - { - ClosestPtPointTriangle(p, a, d, b,tempResult); - SimdPoint3 q = tempResult.m_closestPointOnSimplex; - //convert result bitmask! - - float sqDist = (q - p).dot( q - p); - if (sqDist < bestSqDist) - { - bestSqDist = sqDist; - finalResult.m_closestPointOnSimplex = q; - finalResult.m_usedVertices.reset(); - finalResult.m_usedVertices.usedVertexA = tempResult.m_usedVertices.usedVertexA; - finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexB; - finalResult.m_usedVertices.usedVertexB = tempResult.m_usedVertices.usedVertexC; - finalResult.SetBarycentricCoordinates( - tempResult.m_barycentricCoords[VERTA], - tempResult.m_barycentricCoords[VERTC], - 0, - tempResult.m_barycentricCoords[VERTB] - ); - - } - } - // Repeat test for face bdc - - - if (pointOutsideBDC) - { - ClosestPtPointTriangle(p, b, d, c,tempResult); - SimdPoint3 q = tempResult.m_closestPointOnSimplex; - //convert result bitmask! - float sqDist = (q - p).dot( q - p); - if (sqDist < bestSqDist) - { - bestSqDist = sqDist; - finalResult.m_closestPointOnSimplex = q; - finalResult.m_usedVertices.reset(); - finalResult.m_usedVertices.usedVertexB = tempResult.m_usedVertices.usedVertexA; - finalResult.m_usedVertices.usedVertexD = tempResult.m_usedVertices.usedVertexB; - finalResult.m_usedVertices.usedVertexC = tempResult.m_usedVertices.usedVertexC; - - finalResult.SetBarycentricCoordinates( - 0, - tempResult.m_barycentricCoords[VERTA], - tempResult.m_barycentricCoords[VERTC], - tempResult.m_barycentricCoords[VERTB] - ); - - } - } - - //help! we ended up full ! - - if (finalResult.m_usedVertices.usedVertexA && - finalResult.m_usedVertices.usedVertexB && - finalResult.m_usedVertices.usedVertexC && - finalResult.m_usedVertices.usedVertexD) - { - return true; - } - - return true; -} - diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/VoronoiSimplexSolver.h b/extern/bullet/Bullet/NarrowPhaseCollision/VoronoiSimplexSolver.h deleted file mode 100644 index defa071b996..00000000000 --- a/extern/bullet/Bullet/NarrowPhaseCollision/VoronoiSimplexSolver.h +++ /dev/null @@ -1,157 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef VoronoiSimplexSolver_H -#define VoronoiSimplexSolver_H - -#include "SimplexSolverInterface.h" - - - -#define VORONOI_SIMPLEX_MAX_VERTS 5 - -struct UsageBitfield{ - UsageBitfield() - { - reset(); - } - - void reset() - { - usedVertexA = false; - usedVertexB = false; - usedVertexC = false; - usedVertexD = false; - } - unsigned short usedVertexA : 1; - unsigned short usedVertexB : 1; - unsigned short usedVertexC : 1; - unsigned short usedVertexD : 1; - unsigned short unused1 : 1; - unsigned short unused2 : 1; - unsigned short unused3 : 1; - unsigned short unused4 : 1; -}; - - -struct SubSimplexClosestResult -{ - SimdPoint3 m_closestPointOnSimplex; - //MASK for m_usedVertices - //stores the simplex vertex-usage, using the MASK, - // if m_usedVertices & MASK then the related vertex is used - UsageBitfield m_usedVertices; - float m_barycentricCoords[4]; - bool m_degenerate; - - void Reset() - { - m_degenerate = false; - SetBarycentricCoordinates(); - m_usedVertices.reset(); - } - bool IsValid() - { - bool valid = (m_barycentricCoords[0] >= 0.f) && - (m_barycentricCoords[1] >= 0.f) && - (m_barycentricCoords[2] >= 0.f) && - (m_barycentricCoords[3] >= 0.f); - - - return valid; - } - void SetBarycentricCoordinates(float a=0.f,float b=0.f,float c=0.f,float d=0.f) - { - m_barycentricCoords[0] = a; - m_barycentricCoords[1] = b; - m_barycentricCoords[2] = c; - m_barycentricCoords[3] = d; - } - -}; - -/// VoronoiSimplexSolver is an implementation of the closest point distance algorithm from a 1-4 points simplex to the origin. -/// Can be used with GJK, as an alternative to Johnson distance algorithm. -#ifdef NO_VIRTUAL_INTERFACE -class VoronoiSimplexSolver -#else -class VoronoiSimplexSolver : public SimplexSolverInterface -#endif -{ -public: - - int m_numVertices; - - SimdVector3 m_simplexVectorW[VORONOI_SIMPLEX_MAX_VERTS]; - SimdPoint3 m_simplexPointsP[VORONOI_SIMPLEX_MAX_VERTS]; - SimdPoint3 m_simplexPointsQ[VORONOI_SIMPLEX_MAX_VERTS]; - - - - SimdPoint3 m_cachedP1; - SimdPoint3 m_cachedP2; - SimdVector3 m_cachedV; - SimdVector3 m_lastW; - bool m_cachedValidClosest; - - SubSimplexClosestResult m_cachedBC; - - bool m_needsUpdate; - - void removeVertex(int index); - void ReduceVertices (const UsageBitfield& usedVerts); - bool UpdateClosestVectorAndPoints(); - - bool ClosestPtPointTetrahedron(const SimdPoint3& p, const SimdPoint3& a, const SimdPoint3& b, const SimdPoint3& c, const SimdPoint3& d, SubSimplexClosestResult& finalResult); - int PointOutsideOfPlane(const SimdPoint3& p, const SimdPoint3& a, const SimdPoint3& b, const SimdPoint3& c, const SimdPoint3& d); - bool ClosestPtPointTriangle(const SimdPoint3& p, const SimdPoint3& a, const SimdPoint3& b, const SimdPoint3& c,SubSimplexClosestResult& result); - -public: - - void reset(); - - void addVertex(const SimdVector3& w, const SimdPoint3& p, const SimdPoint3& q); - - - bool closest(SimdVector3& v); - - SimdScalar maxVertex(); - - bool fullSimplex() const - { - return (m_numVertices == 4); - } - - int getSimplex(SimdPoint3 *pBuf, SimdPoint3 *qBuf, SimdVector3 *yBuf) const; - - bool inSimplex(const SimdVector3& w); - - void backup_closest(SimdVector3& v) ; - - bool emptySimplex() const ; - - void compute_points(SimdPoint3& p1, SimdPoint3& p2) ; - - int numVertices() const - { - return m_numVertices; - } - - -}; - -#endif //VoronoiSimplexSolver diff --git a/extern/bullet/BulletDynamics/BLI_BulletDynamics.dsp b/extern/bullet/BulletDynamics/BLI_BulletDynamics.dsp deleted file mode 100644 index 5ebbb63f2ae..00000000000 --- a/extern/bullet/BulletDynamics/BLI_BulletDynamics.dsp +++ /dev/null @@ -1,260 +0,0 @@ -# Microsoft Developer Studio Project File - Name="BulletDynamics" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=BulletDynamics - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "BLI_BulletDynamics.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "BLI_BulletDynamics.mak" CFG="BulletDynamics - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "BulletDynamics - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "BulletDynamics - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "BulletDynamics - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "BulletDynamics___Win32_Release" -# PROP BASE Intermediate_Dir "BulletDynamics___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "BulletDynamics___Win32_Release" -# PROP Intermediate_Dir "BulletDynamics___Win32_Release" -# PROP Target_Dir "" -MTL=midl.exe -LINK32=link.exe -lib -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../LinearMath" /I "../Bullet" /I "../BulletDynamics" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "BulletDynamics - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "BulletDynamics___Win32_Debug" -# PROP BASE Intermediate_Dir "BulletDynamics___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "BulletDynamics___Win32_Debug" -# PROP Intermediate_Dir "BulletDynamics___Win32_Debug" -# PROP Target_Dir "" -MTL=midl.exe -LINK32=link.exe -lib -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../LinearMath" /I "../Bullet" /I "../BulletDynamics" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "BulletDynamics - Win32 Release" -# Name "BulletDynamics - Win32 Debug" -# Begin Group "ConstraintSolver" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ConstraintSolver\ConstraintSolver.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\ContactConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\ContactConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\ContactSolverInfo.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Generic6DofConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Generic6DofConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\HingeConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\HingeConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\JacobianEntry.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Point2PointConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Point2PointConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\SequentialImpulseConstraintSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\SequentialImpulseConstraintSolver.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Solve2LinearConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Solve2LinearConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\TypedConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\TypedConstraint.h -# End Source File -# End Group -# Begin Group "Dynamics" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\Dynamics\BU_Joint.cpp -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\BU_Joint.h -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\ContactJoint.cpp -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\ContactJoint.h -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\MassProps.h -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\RigidBody.cpp -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\RigidBody.h -# End Source File -# End Group -# Begin Group "Vehicle" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\Vehicle\RaycastVehicle.cpp -# End Source File -# Begin Source File - -SOURCE=.\Vehicle\RaycastVehicle.h -# End Source File -# Begin Source File - -SOURCE=.\Vehicle\VehicleRaycaster.h -# End Source File -# Begin Source File - -SOURCE=.\Vehicle\WheelInfo.cpp -# End Source File -# Begin Source File - -SOURCE=.\Vehicle\WheelInfo.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_DynamicTypes.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_IMotionState.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_IMotionState.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_IPhysicsController.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_IPhysicsController.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_IPhysicsEnvironment.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_IPhysicsEnvironment.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_IVehicle.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_IVehicle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\source\gameengine\Physics\common\PHY_Pro.h -# End Source File -# End Group -# End Target -# End Project diff --git a/extern/bullet/BulletDynamics/BulletDynamics.dsp b/extern/bullet/BulletDynamics/BulletDynamics.dsp deleted file mode 100644 index 2e13283b512..00000000000 --- a/extern/bullet/BulletDynamics/BulletDynamics.dsp +++ /dev/null @@ -1,224 +0,0 @@ -# Microsoft Developer Studio Project File - Name="BulletDynamics" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=BulletDynamics - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "BulletDynamics.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "BulletDynamics.mak" CFG="BulletDynamics - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "BulletDynamics - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "BulletDynamics - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "BulletDynamics - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "BulletDynamics___Win32_Release" -# PROP BASE Intermediate_Dir "BulletDynamics___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "BulletDynamics___Win32_Release" -# PROP Intermediate_Dir "BulletDynamics___Win32_Release" -# PROP Target_Dir "" -LINK32=link.exe -lib -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../LinearMath" /I "../Bullet" /I "../BulletDynamics" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "BulletDynamics - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "BulletDynamics___Win32_Debug" -# PROP BASE Intermediate_Dir "BulletDynamics___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "BulletDynamics___Win32_Debug" -# PROP Intermediate_Dir "BulletDynamics___Win32_Debug" -# PROP Target_Dir "" -LINK32=link.exe -lib -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../LinearMath" /I "../Bullet" /I "../BulletDynamics" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "BulletDynamics - Win32 Release" -# Name "BulletDynamics - Win32 Debug" -# Begin Group "ConstraintSolver" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ConstraintSolver\ConstraintSolver.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\ContactConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\ContactConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\ContactSolverInfo.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\HingeConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\HingeConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\JacobianEntry.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\OdeConstraintSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\OdeConstraintSolver.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Point2PointConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Point2PointConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\SimpleConstraintSolver.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\SimpleConstraintSolver.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Solve2LinearConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\Solve2LinearConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\SorLcp.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\SorLcp.h -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\TypedConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\ConstraintSolver\TypedConstraint.h -# End Source File -# End Group -# Begin Group "Dynamics" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\Dynamics\BU_Joint.cpp -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\BU_Joint.h -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\ContactJoint.cpp -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\ContactJoint.h -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\MassProps.h -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\RigidBody.cpp -# End Source File -# Begin Source File - -SOURCE=.\Dynamics\RigidBody.h -# End Source File -# End Group -# Begin Group "Vehicle" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\Vehicle\RaycastVehicle.cpp -# End Source File -# Begin Source File - -SOURCE=.\Vehicle\RaycastVehicle.h -# End Source File -# Begin Source File - -SOURCE=.\Vehicle\VehicleRaycaster.h -# End Source File -# Begin Source File - -SOURCE=.\Vehicle\WheelInfo.cpp -# End Source File -# Begin Source File - -SOURCE=.\Vehicle\WheelInfo.h -# End Source File -# End Group -# End Target -# End Project diff --git a/extern/bullet/BulletDynamics/BulletDynamics_vc7.vcproj b/extern/bullet/BulletDynamics/BulletDynamics_vc7.vcproj deleted file mode 100644 index af96dc9cf88..00000000000 --- a/extern/bullet/BulletDynamics/BulletDynamics_vc7.vcproj +++ /dev/null @@ -1,190 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="Bullet3Dynamics" - ProjectGUID="{3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\LinearMath;..\Bullet;..\BulletDynamics" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/BulletDynamics.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\LinearMath;..\Bullet;..\BulletDynamics" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB" - RuntimeLibrary="4" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\build\msvc_7\libs\extern\BulletDynamics.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="ConstraintSolver" - Filter=""> - <File - RelativePath=".\ConstraintSolver\ConstraintSolver.h"> - </File> - <File - RelativePath=".\ConstraintSolver\ContactConstraint.cpp"> - </File> - <File - RelativePath=".\ConstraintSolver\ContactConstraint.h"> - </File> - <File - RelativePath=".\ConstraintSolver\ContactSolverInfo.h"> - </File> - <File - RelativePath=".\ConstraintSolver\HingeConstraint.cpp"> - </File> - <File - RelativePath=".\ConstraintSolver\HingeConstraint.h"> - </File> - <File - RelativePath=".\ConstraintSolver\JacobianEntry.h"> - </File> - <File - RelativePath=".\ConstraintSolver\OdeConstraintSolver.cpp"> - </File> - <File - RelativePath=".\ConstraintSolver\OdeConstraintSolver.h"> - </File> - <File - RelativePath=".\ConstraintSolver\Point2PointConstraint.cpp"> - </File> - <File - RelativePath=".\ConstraintSolver\Point2PointConstraint.h"> - </File> - <File - RelativePath=".\ConstraintSolver\SimpleConstraintSolver.cpp"> - </File> - <File - RelativePath=".\ConstraintSolver\SimpleConstraintSolver.h"> - </File> - <File - RelativePath=".\ConstraintSolver\Solve2LinearConstraint.cpp"> - </File> - <File - RelativePath=".\ConstraintSolver\Solve2LinearConstraint.h"> - </File> - <File - RelativePath=".\ConstraintSolver\SorLcp.cpp"> - </File> - <File - RelativePath=".\ConstraintSolver\SorLcp.h"> - </File> - <File - RelativePath=".\ConstraintSolver\TypedConstraint.cpp"> - </File> - <File - RelativePath=".\ConstraintSolver\TypedConstraint.h"> - </File> - </Filter> - <Filter - Name="Dynamics" - Filter=""> - <File - RelativePath=".\Dynamics\BU_Joint.cpp"> - </File> - <File - RelativePath=".\Dynamics\BU_Joint.h"> - </File> - <File - RelativePath=".\Dynamics\ContactJoint.cpp"> - </File> - <File - RelativePath=".\Dynamics\ContactJoint.h"> - </File> - <File - RelativePath=".\Dynamics\MassProps.h"> - </File> - <File - RelativePath=".\Dynamics\RigidBody.cpp"> - </File> - <File - RelativePath=".\Dynamics\RigidBody.h"> - </File> - </Filter> - <File - RelativePath=".\ReadMe.txt"> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/BulletDynamics/BulletDynamics_vc8.vcproj b/extern/bullet/BulletDynamics/BulletDynamics_vc8.vcproj deleted file mode 100644 index 943479dc623..00000000000 --- a/extern/bullet/BulletDynamics/BulletDynamics_vc8.vcproj +++ /dev/null @@ -1,265 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="Bullet3Dynamics" - ProjectGUID="{3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="4" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\LinearMath;..\Bullet;..\BulletDynamics" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/BulletDynamics.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="4" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\LinearMath;..\Bullet;..\BulletDynamics" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB" - RuntimeLibrary="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/BulletDynamics.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="ConstraintSolver" - > - <File - RelativePath=".\ConstraintSolver\ConstraintSolver.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\ContactConstraint.cpp" - > - </File> - <File - RelativePath=".\ConstraintSolver\ContactConstraint.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\ContactSolverInfo.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\HingeConstraint.cpp" - > - </File> - <File - RelativePath=".\ConstraintSolver\HingeConstraint.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\JacobianEntry.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\OdeConstraintSolver.cpp" - > - </File> - <File - RelativePath=".\ConstraintSolver\OdeConstraintSolver.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\Point2PointConstraint.cpp" - > - </File> - <File - RelativePath=".\ConstraintSolver\Point2PointConstraint.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\SimpleConstraintSolver.cpp" - > - </File> - <File - RelativePath=".\ConstraintSolver\SimpleConstraintSolver.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\Solve2LinearConstraint.cpp" - > - </File> - <File - RelativePath=".\ConstraintSolver\Solve2LinearConstraint.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\SorLcp.cpp" - > - </File> - <File - RelativePath=".\ConstraintSolver\SorLcp.h" - > - </File> - <File - RelativePath=".\ConstraintSolver\TypedConstraint.cpp" - > - </File> - <File - RelativePath=".\ConstraintSolver\TypedConstraint.h" - > - </File> - </Filter> - <Filter - Name="Dynamics" - > - <File - RelativePath=".\Dynamics\BU_Joint.cpp" - > - </File> - <File - RelativePath=".\Dynamics\BU_Joint.h" - > - </File> - <File - RelativePath=".\Dynamics\ContactJoint.cpp" - > - </File> - <File - RelativePath=".\Dynamics\ContactJoint.h" - > - </File> - <File - RelativePath=".\Dynamics\MassProps.h" - > - </File> - <File - RelativePath=".\Dynamics\RigidBody.cpp" - > - </File> - <File - RelativePath=".\Dynamics\RigidBody.h" - > - </File> - </Filter> - <File - RelativePath=".\ReadMe.txt" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/ConstraintSolver.h b/extern/bullet/BulletDynamics/ConstraintSolver/ConstraintSolver.h deleted file mode 100644 index a1975c187d2..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/ConstraintSolver.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONSTRAINT_SOLVER_H -#define CONSTRAINT_SOLVER_H - -class PersistentManifold; -class RigidBody; - -struct ContactSolverInfo; -struct BroadphaseProxy; -class IDebugDraw; - -/// ConstraintSolver provides solver interface -class ConstraintSolver -{ - -public: - - virtual ~ConstraintSolver() {} - - virtual float SolveGroup(PersistentManifold** manifold,int numManifolds,const ContactSolverInfo& info,class IDebugDraw* debugDrawer = 0) = 0; - -}; - - - - -#endif //CONSTRAINT_SOLVER_H diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/ContactConstraint.cpp b/extern/bullet/BulletDynamics/ConstraintSolver/ContactConstraint.cpp deleted file mode 100644 index 7b72784e721..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/ContactConstraint.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "ContactConstraint.h" -#include "Dynamics/RigidBody.h" -#include "SimdVector3.h" -#include "JacobianEntry.h" -#include "ContactSolverInfo.h" -#include "GEN_MinMax.h" -#include "NarrowPhaseCollision/ManifoldPoint.h" - -#define ASSERT2 assert - -//some values to find stable tresholds - -float useGlobalSettingContacts = false;//true; -SimdScalar contactDamping = 0.2f; -SimdScalar contactTau = .02f;//0.02f;//*0.02f; - - - - - - - -//bilateral constraint between two dynamic objects -void resolveSingleBilateral(RigidBody& body1, const SimdVector3& pos1, - RigidBody& body2, const SimdVector3& pos2, - SimdScalar distance, const SimdVector3& normal,SimdScalar& impulse ,float timeStep) -{ - float normalLenSqr = normal.length2(); - ASSERT2(fabs(normalLenSqr) < 1.1f); - if (normalLenSqr > 1.1f) - { - impulse = 0.f; - return; - } - SimdVector3 rel_pos1 = pos1 - body1.getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pos2 - body2.getCenterOfMassPosition(); - //this jacobian entry could be re-used for all iterations - - SimdVector3 vel1 = body1.getVelocityInLocalPoint(rel_pos1); - SimdVector3 vel2 = body2.getVelocityInLocalPoint(rel_pos2); - SimdVector3 vel = vel1 - vel2; - - - JacobianEntry jac(body1.getCenterOfMassTransform().getBasis().transpose(), - body2.getCenterOfMassTransform().getBasis().transpose(), - rel_pos1,rel_pos2,normal,body1.getInvInertiaDiagLocal(),body1.getInvMass(), - body2.getInvInertiaDiagLocal(),body2.getInvMass()); - - SimdScalar jacDiagAB = jac.getDiagonal(); - SimdScalar jacDiagABInv = 1.f / jacDiagAB; - - SimdScalar rel_vel = jac.getRelativeVelocity( - body1.getLinearVelocity(), - body1.getCenterOfMassTransform().getBasis().transpose() * body1.getAngularVelocity(), - body2.getLinearVelocity(), - body2.getCenterOfMassTransform().getBasis().transpose() * body2.getAngularVelocity()); - float a; - a=jacDiagABInv; - - - rel_vel = normal.dot(vel); - - -#ifdef ONLY_USE_LINEAR_MASS - SimdScalar massTerm = 1.f / (body1.getInvMass() + body2.getInvMass()); - impulse = - contactDamping * rel_vel * massTerm; -#else - SimdScalar velocityImpulse = -contactDamping * rel_vel * jacDiagABInv; - impulse = velocityImpulse; -#endif -} - - - - -//velocity + friction -//response between two dynamic objects with friction -float resolveSingleCollision( - RigidBody& body1, - RigidBody& body2, - ManifoldPoint& contactPoint, - const ContactSolverInfo& solverInfo - - ) -{ - - const SimdVector3& pos1 = contactPoint.GetPositionWorldOnA(); - const SimdVector3& pos2 = contactPoint.GetPositionWorldOnB(); - - -// printf("distance=%f\n",distance); - - const SimdVector3& normal = contactPoint.m_normalWorldOnB; - - SimdVector3 rel_pos1 = pos1 - body1.getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pos2 - body2.getCenterOfMassPosition(); - - SimdVector3 vel1 = body1.getVelocityInLocalPoint(rel_pos1); - SimdVector3 vel2 = body2.getVelocityInLocalPoint(rel_pos2); - SimdVector3 vel = vel1 - vel2; - SimdScalar rel_vel; - rel_vel = normal.dot(vel); - - - SimdScalar Kfps = 1.f / solverInfo.m_timeStep ; - - float damping = solverInfo.m_damping ; - float Kerp = solverInfo.m_erp; - - if (useGlobalSettingContacts) - { - damping = contactDamping; - Kerp = contactTau; - } - - float Kcor = Kerp *Kfps; - - //printf("dist=%f\n",distance); - - ConstraintPersistentData* cpd = (ConstraintPersistentData*) contactPoint.m_userPersistentData; - assert(cpd); - - SimdScalar distance = cpd->m_penetration;//contactPoint.GetDistance(); - - - //distance = 0.f; - SimdScalar positionalError = Kcor *-distance; - //jacDiagABInv; - SimdScalar velocityError = cpd->m_restitution - rel_vel;// * damping; - - - SimdScalar penetrationImpulse = positionalError * cpd->m_jacDiagABInv; - - SimdScalar velocityImpulse = velocityError * cpd->m_jacDiagABInv; - - SimdScalar normalImpulse = penetrationImpulse+velocityImpulse; - - // See Erin Catto's GDC 2006 paper: Clamp the accumulated impulse - float oldNormalImpulse = cpd->m_appliedImpulse; - float sum = oldNormalImpulse + normalImpulse; - cpd->m_appliedImpulse = 0.f > sum ? 0.f: sum; - - normalImpulse = cpd->m_appliedImpulse - oldNormalImpulse; - - body1.applyImpulse(normal*(normalImpulse), rel_pos1); - body2.applyImpulse(-normal*(normalImpulse), rel_pos2); - - return normalImpulse; -} - - -float resolveSingleFriction( - RigidBody& body1, - RigidBody& body2, - ManifoldPoint& contactPoint, - const ContactSolverInfo& solverInfo - - ) -{ - - const SimdVector3& pos1 = contactPoint.GetPositionWorldOnA(); - const SimdVector3& pos2 = contactPoint.GetPositionWorldOnB(); - const SimdVector3& normal = contactPoint.m_normalWorldOnB; - - SimdVector3 rel_pos1 = pos1 - body1.getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pos2 - body2.getCenterOfMassPosition(); - - ConstraintPersistentData* cpd = (ConstraintPersistentData*) contactPoint.m_userPersistentData; - assert(cpd); - - float combinedFriction = cpd->m_friction; - - SimdScalar limit = cpd->m_appliedImpulse * combinedFriction; - //if (contactPoint.m_appliedImpulse>0.f) - //friction - { - //apply friction in the 2 tangential directions - - SimdScalar relaxation = solverInfo.m_damping; - { - // 1st tangent - SimdVector3 vel1 = body1.getVelocityInLocalPoint(rel_pos1); - SimdVector3 vel2 = body2.getVelocityInLocalPoint(rel_pos2); - SimdVector3 vel = vel1 - vel2; - - SimdScalar vrel = cpd->m_frictionWorldTangential0.dot(vel); - - // calculate j that moves us to zero relative velocity - SimdScalar j = -vrel * cpd->m_jacDiagABInvTangent0; - float total = cpd->m_accumulatedTangentImpulse0 + j; - GEN_set_min(total, limit); - GEN_set_max(total, -limit); - j = total - cpd->m_accumulatedTangentImpulse0; - cpd->m_accumulatedTangentImpulse0 = total; - body1.applyImpulse(j * cpd->m_frictionWorldTangential0, rel_pos1); - body2.applyImpulse(j * -cpd->m_frictionWorldTangential0, rel_pos2); - } - - - { - // 2nd tangent - SimdVector3 vel1 = body1.getVelocityInLocalPoint(rel_pos1); - SimdVector3 vel2 = body2.getVelocityInLocalPoint(rel_pos2); - SimdVector3 vel = vel1 - vel2; - - SimdScalar vrel = cpd->m_frictionWorldTangential1.dot(vel); - - // calculate j that moves us to zero relative velocity - SimdScalar j = -vrel * cpd->m_jacDiagABInvTangent1; - float total = cpd->m_accumulatedTangentImpulse1 + j; - GEN_set_min(total, limit); - GEN_set_max(total, -limit); - j = total - cpd->m_accumulatedTangentImpulse1; - cpd->m_accumulatedTangentImpulse1 = total; - body1.applyImpulse(j * cpd->m_frictionWorldTangential1, rel_pos1); - body2.applyImpulse(j * -cpd->m_frictionWorldTangential1, rel_pos2); - } - } - return cpd->m_appliedImpulse; -} diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/ContactConstraint.h b/extern/bullet/BulletDynamics/ConstraintSolver/ContactConstraint.h deleted file mode 100644 index 8304d412d6f..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/ContactConstraint.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONTACT_CONSTRAINT_H -#define CONTACT_CONSTRAINT_H - -//todo: make into a proper class working with the iterative constraint solver - -class RigidBody; -#include "SimdVector3.h" -#include "SimdScalar.h" -struct ContactSolverInfo; -class ManifoldPoint; - -struct ConstraintPersistentData -{ - inline ConstraintPersistentData() - :m_appliedImpulse(0.f), - m_prevAppliedImpulse(0.f), - m_accumulatedTangentImpulse0(0.f), - m_accumulatedTangentImpulse1(0.f), - m_jacDiagABInv(0.f), - m_persistentLifeTime(0), - m_restitution(0.f), - m_friction(0.f), - m_penetration(0.f) - { - } - - - /// total applied impulse during most recent frame - float m_appliedImpulse; - float m_prevAppliedImpulse; - float m_accumulatedTangentImpulse0; - float m_accumulatedTangentImpulse1; - - float m_jacDiagABInv; - float m_jacDiagABInvTangent0; - float m_jacDiagABInvTangent1; - int m_persistentLifeTime; - float m_restitution; - float m_friction; - float m_penetration; - SimdVector3 m_frictionWorldTangential0; - SimdVector3 m_frictionWorldTangential1; - - -}; - -///bilateral constraint between two dynamic objects -///positive distance = separation, negative distance = penetration -void resolveSingleBilateral(RigidBody& body1, const SimdVector3& pos1, - RigidBody& body2, const SimdVector3& pos2, - SimdScalar distance, const SimdVector3& normal,SimdScalar& impulse ,float timeStep); - - -///contact constraint resolution: -///calculate and apply impulse to satisfy non-penetration and non-negative relative velocity constraint -///positive distance = separation, negative distance = penetration -float resolveSingleCollision( - RigidBody& body1, - RigidBody& body2, - ManifoldPoint& contactPoint, - const ContactSolverInfo& info); - -float resolveSingleFriction( - RigidBody& body1, - RigidBody& body2, - ManifoldPoint& contactPoint, - const ContactSolverInfo& solverInfo - ); - -#endif //CONTACT_CONSTRAINT_H diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/ContactSolverInfo.h b/extern/bullet/BulletDynamics/ConstraintSolver/ContactSolverInfo.h deleted file mode 100644 index 2ec9b7f6ca1..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/ContactSolverInfo.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONTACT_SOLVER_INFO -#define CONTACT_SOLVER_INFO - - -struct ContactSolverInfo -{ - - inline ContactSolverInfo() - { - m_tau = 0.6f; - m_damping = 1.0f; - m_friction = 0.3f; - m_restitution = 0.f; - m_maxErrorReduction = 20.f; - m_numIterations = 10; - m_erp = 0.4f; - m_sor = 1.3f; - } - - float m_tau; - float m_damping; - float m_friction; - float m_timeStep; - float m_restitution; - int m_numIterations; - float m_maxErrorReduction; - float m_sor; - float m_erp; - -}; - -#endif //CONTACT_SOLVER_INFO diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/Generic6DofConstraint.cpp b/extern/bullet/BulletDynamics/ConstraintSolver/Generic6DofConstraint.cpp deleted file mode 100644 index 9597f2721c4..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/Generic6DofConstraint.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "Generic6DofConstraint.h" -#include "Dynamics/RigidBody.h" -#include "Dynamics/MassProps.h" -#include "SimdTransformUtil.h" - -static const SimdScalar kSign[] = { 1.0f, -1.0f, 1.0f }; -static const int kAxisA[] = { 1, 0, 0 }; -static const int kAxisB[] = { 2, 2, 1 }; - -Generic6DofConstraint::Generic6DofConstraint() -{ -} - -Generic6DofConstraint::Generic6DofConstraint(RigidBody& rbA, RigidBody& rbB, const SimdTransform& frameInA, const SimdTransform& frameInB) -: TypedConstraint(rbA, rbB) -, m_frameInA(frameInA) -, m_frameInB(frameInB) -{ - //free means upper < lower, - //locked means upper == lower - //limited means upper > lower - //so start all locked - for (int i=0; i<6;++i) - { - m_lowerLimit[i] = 0.0f; - m_upperLimit[i] = 0.0f; - m_accumulatedImpulse[i] = 0.0f; - } - -} - - -void Generic6DofConstraint::BuildJacobian() -{ - SimdVector3 normal(0,0,0); - - const SimdVector3& pivotInA = m_frameInA.getOrigin(); - const SimdVector3& pivotInB = m_frameInB.getOrigin(); - - SimdVector3 pivotAInW = m_rbA.getCenterOfMassTransform() * m_frameInA.getOrigin(); - SimdVector3 pivotBInW = m_rbB.getCenterOfMassTransform() * m_frameInB.getOrigin(); - - SimdVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition(); - - int i; - //linear part - for (i=0;i<3;i++) - { - if (isLimited(i)) - { - normal[i] = 1; - - // Create linear atom - new (&m_jacLinear[i]) JacobianEntry( - m_rbA.getCenterOfMassTransform().getBasis().transpose(), - m_rbB.getCenterOfMassTransform().getBasis().transpose(), - m_rbA.getCenterOfMassTransform()*pivotInA - m_rbA.getCenterOfMassPosition(), - m_rbB.getCenterOfMassTransform()*pivotInB - m_rbB.getCenterOfMassPosition(), - normal, - m_rbA.getInvInertiaDiagLocal(), - m_rbA.getInvMass(), - m_rbB.getInvInertiaDiagLocal(), - m_rbB.getInvMass()); - - // Apply accumulated impulse - SimdVector3 impulse_vector = m_accumulatedImpulse[i] * normal; - - m_rbA.applyImpulse( impulse_vector, rel_pos1); - m_rbB.applyImpulse(-impulse_vector, rel_pos2); - - normal[i] = 0; - } - } - - // angular part - for (i=0;i<3;i++) - { - if (isLimited(i+3)) - { - SimdVector3 axisA = m_rbA.getCenterOfMassTransform().getBasis() * m_frameInA.getBasis().getColumn( kAxisA[i] ); - SimdVector3 axisB = m_rbB.getCenterOfMassTransform().getBasis() * m_frameInB.getBasis().getColumn( kAxisB[i] ); - - // Dirk: This is IMO mathematically the correct way, but we should consider axisA and axisB being near parallel maybe - SimdVector3 axis = kSign[i] * axisA.cross(axisB); - - // Create angular atom - new (&m_jacAng[i]) JacobianEntry(axis, - m_rbA.getCenterOfMassTransform().getBasis().transpose(), - m_rbB.getCenterOfMassTransform().getBasis().transpose(), - m_rbA.getInvInertiaDiagLocal(), - m_rbB.getInvInertiaDiagLocal()); - - // Apply accumulated impulse - SimdVector3 impulse_vector = m_accumulatedImpulse[i + 3] * axis; - - m_rbA.applyTorqueImpulse( impulse_vector); - m_rbB.applyTorqueImpulse(-impulse_vector); - } - } -} - -void Generic6DofConstraint::SolveConstraint(SimdScalar timeStep) -{ - SimdScalar tau = 0.1f; - SimdScalar damping = 1.0f; - - SimdVector3 pivotAInW = m_rbA.getCenterOfMassTransform() * m_frameInA.getOrigin(); - SimdVector3 pivotBInW = m_rbB.getCenterOfMassTransform() * m_frameInB.getOrigin(); - - SimdVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition(); - - SimdVector3 normal(0,0,0); - int i; - - // linear - for (i=0;i<3;i++) - { - if (isLimited(i)) - { - SimdVector3 angvelA = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity(); - SimdVector3 angvelB = m_rbB.getCenterOfMassTransform().getBasis().transpose() * m_rbB.getAngularVelocity(); - - - normal[i] = 1; - SimdScalar jacDiagABInv = 1.f / m_jacLinear[i].getDiagonal(); - - //velocity error (first order error) - SimdScalar rel_vel = m_jacLinear[i].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA, - m_rbB.getLinearVelocity(),angvelB); - - //positional error (zeroth order error) - SimdScalar depth = -(pivotAInW - pivotBInW).dot(normal); - - SimdScalar impulse = (tau*depth/timeStep - damping*rel_vel) * jacDiagABInv; - m_accumulatedImpulse[i] += impulse; - - SimdVector3 impulse_vector = normal * impulse; - m_rbA.applyImpulse( impulse_vector, rel_pos1); - m_rbB.applyImpulse(-impulse_vector, rel_pos2); - - normal[i] = 0; - } - } - - // angular - for (i=0;i<3;i++) - { - if (isLimited(i+3)) - { - SimdVector3 angvelA = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity(); - SimdVector3 angvelB = m_rbB.getCenterOfMassTransform().getBasis().transpose() * m_rbB.getAngularVelocity(); - - SimdScalar jacDiagABInv = 1.f / m_jacAng[i].getDiagonal(); - - //velocity error (first order error) - SimdScalar rel_vel = m_jacAng[i].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA, - m_rbB.getLinearVelocity(),angvelB); - - //positional error (zeroth order error) - SimdVector3 axisA = m_rbA.getCenterOfMassTransform().getBasis() * m_frameInA.getBasis().getColumn( kAxisA[i] ); - SimdVector3 axisB = m_rbB.getCenterOfMassTransform().getBasis() * m_frameInB.getBasis().getColumn( kAxisB[i] ); - - SimdScalar rel_pos = kSign[i] * axisA.dot(axisB); - - //impulse - SimdScalar impulse = -(tau*rel_pos/timeStep + damping*rel_vel) * jacDiagABInv; - m_accumulatedImpulse[i + 3] += impulse; - - // Dirk: Not needed - we could actually project onto Jacobian entry here (same as above) - SimdVector3 axis = kSign[i] * axisA.cross(axisB); - SimdVector3 impulse_vector = axis * impulse; - - m_rbA.applyTorqueImpulse( impulse_vector); - m_rbB.applyTorqueImpulse(-impulse_vector); - } - } -} - -void Generic6DofConstraint::UpdateRHS(SimdScalar timeStep) -{ - -} - -SimdScalar Generic6DofConstraint::ComputeAngle(int axis) const - { - SimdScalar angle; - - switch (axis) - { - case 0: - { - SimdVector3 v1 = m_rbA.getCenterOfMassTransform().getBasis() * m_frameInA.getBasis().getColumn(1); - SimdVector3 v2 = m_rbB.getCenterOfMassTransform().getBasis() * m_frameInB.getBasis().getColumn(1); - SimdVector3 w2 = m_rbB.getCenterOfMassTransform().getBasis() * m_frameInB.getBasis().getColumn(2); - - SimdScalar s = v1.dot(w2); - SimdScalar c = v1.dot(v2); - - angle = SimdAtan2( s, c ); - } - break; - - case 1: - { - SimdVector3 w1 = m_rbA.getCenterOfMassTransform().getBasis() * m_frameInA.getBasis().getColumn(2); - SimdVector3 w2 = m_rbB.getCenterOfMassTransform().getBasis() * m_frameInB.getBasis().getColumn(2); - SimdVector3 u2 = m_rbB.getCenterOfMassTransform().getBasis() * m_frameInB.getBasis().getColumn(0); - - SimdScalar s = w1.dot(u2); - SimdScalar c = w1.dot(w2); - - angle = SimdAtan2( s, c ); - } - break; - - case 2: - { - SimdVector3 u1 = m_rbA.getCenterOfMassTransform().getBasis() * m_frameInA.getBasis().getColumn(0); - SimdVector3 u2 = m_rbB.getCenterOfMassTransform().getBasis() * m_frameInB.getBasis().getColumn(0); - SimdVector3 v2 = m_rbB.getCenterOfMassTransform().getBasis() * m_frameInB.getBasis().getColumn(1); - - SimdScalar s = u1.dot(v2); - SimdScalar c = u1.dot(u2); - - angle = SimdAtan2( s, c ); - } - break; - } - - return angle; - } - diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/Generic6DofConstraint.h b/extern/bullet/BulletDynamics/ConstraintSolver/Generic6DofConstraint.h deleted file mode 100644 index 7a77253509c..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/Generic6DofConstraint.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef GENERIC_6DOF_CONSTRAINT_H -#define GENERIC_6DOF_CONSTRAINT_H - -#include "SimdVector3.h" - -#include "ConstraintSolver/JacobianEntry.h" -#include "TypedConstraint.h" - -class RigidBody; - - - -/// Generic6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis location in local space -/// Generic6DofConstraint can leave any of the 6 degree of freedom 'free' or 'locked' -/// Work in progress (is still a Hinge actually) -class Generic6DofConstraint : public TypedConstraint -{ - JacobianEntry m_jacLinear[3]; // 3 orthogonal linear constraints - JacobianEntry m_jacAng[3]; // 3 orthogonal angular constraints - - SimdTransform m_frameInA; // the constraint space w.r.t body A - SimdTransform m_frameInB; // the constraint space w.r.t body B - - SimdScalar m_lowerLimit[6]; // the constraint lower limits - SimdScalar m_upperLimit[6]; // the constraint upper limits - - SimdScalar m_accumulatedImpulse[6]; - - -public: - Generic6DofConstraint(RigidBody& rbA, RigidBody& rbB, const SimdTransform& frameInA, const SimdTransform& frameInB ); - - Generic6DofConstraint(); - - virtual void BuildJacobian(); - - virtual void SolveConstraint(SimdScalar timeStep); - - void UpdateRHS(SimdScalar timeStep); - - SimdScalar ComputeAngle(int axis) const; - - void setLinearLowerLimit(const SimdVector3& linearLower) - { - m_lowerLimit[0] = linearLower.getX(); - m_lowerLimit[1] = linearLower.getY(); - m_lowerLimit[2] = linearLower.getZ(); - } - - void setLinearUpperLimit(const SimdVector3& linearUpper) - { - m_upperLimit[0] = linearUpper.getX(); - m_upperLimit[1] = linearUpper.getY(); - m_upperLimit[2] = linearUpper.getZ(); - } - - void setAngularLowerLimit(const SimdVector3& angularLower) - { - m_lowerLimit[3] = angularLower.getX(); - m_lowerLimit[4] = angularLower.getY(); - m_lowerLimit[5] = angularLower.getZ(); - } - - void setAngularUpperLimit(const SimdVector3& angularUpper) - { - m_upperLimit[3] = angularUpper.getX(); - m_upperLimit[4] = angularUpper.getY(); - m_upperLimit[5] = angularUpper.getZ(); - } - - //first 3 are linear, next 3 are angular - void SetLimit(int axis, SimdScalar lo, SimdScalar hi) - { - m_lowerLimit[axis] = lo; - m_upperLimit[axis] = hi; - } - - //free means upper < lower, - //locked means upper == lower - //limited means upper > lower - //limitIndex: first 3 are linear, next 3 are angular - bool isLimited(int limitIndex) - { - return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]); - } - - const RigidBody& GetRigidBodyA() const - { - return m_rbA; - } - const RigidBody& GetRigidBodyB() const - { - return m_rbB; - } - - -}; - -#endif //GENERIC_6DOF_CONSTRAINT_H diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/HingeConstraint.cpp b/extern/bullet/BulletDynamics/ConstraintSolver/HingeConstraint.cpp deleted file mode 100644 index fb7f1f47cd7..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/HingeConstraint.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "HingeConstraint.h" -#include "Dynamics/RigidBody.h" -#include "Dynamics/MassProps.h" -#include "SimdTransformUtil.h" - - -HingeConstraint::HingeConstraint() -{ -} - -HingeConstraint::HingeConstraint(RigidBody& rbA,RigidBody& rbB, const SimdVector3& pivotInA,const SimdVector3& pivotInB, - SimdVector3& axisInA,SimdVector3& axisInB) -:TypedConstraint(rbA,rbB),m_pivotInA(pivotInA),m_pivotInB(pivotInB), -m_axisInA(axisInA), -m_axisInB(-axisInB), -m_angularOnly(false) -{ - -} - - -HingeConstraint::HingeConstraint(RigidBody& rbA,const SimdVector3& pivotInA,SimdVector3& axisInA) -:TypedConstraint(rbA),m_pivotInA(pivotInA),m_pivotInB(rbA.getCenterOfMassTransform()(pivotInA)), -m_axisInA(axisInA), -//fixed axis in worldspace -m_axisInB(rbA.getCenterOfMassTransform().getBasis() * -axisInA), -m_angularOnly(false) -{ - -} - -void HingeConstraint::BuildJacobian() -{ - m_appliedImpulse = 0.f; - - SimdVector3 normal(0,0,0); - - if (!m_angularOnly) - { - for (int i=0;i<3;i++) - { - normal[i] = 1; - new (&m_jac[i]) JacobianEntry( - m_rbA.getCenterOfMassTransform().getBasis().transpose(), - m_rbB.getCenterOfMassTransform().getBasis().transpose(), - m_rbA.getCenterOfMassTransform()*m_pivotInA - m_rbA.getCenterOfMassPosition(), - m_rbB.getCenterOfMassTransform()*m_pivotInB - m_rbB.getCenterOfMassPosition(), - normal, - m_rbA.getInvInertiaDiagLocal(), - m_rbA.getInvMass(), - m_rbB.getInvInertiaDiagLocal(), - m_rbB.getInvMass()); - normal[i] = 0; - } - } - - //calculate two perpendicular jointAxis, orthogonal to hingeAxis - //these two jointAxis require equal angular velocities for both bodies - - //this is unused for now, it's a todo - SimdVector3 axisWorldA = GetRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA; - SimdVector3 jointAxis0; - SimdVector3 jointAxis1; - SimdPlaneSpace1(axisWorldA,jointAxis0,jointAxis1); - - new (&m_jacAng[0]) JacobianEntry(jointAxis0, - m_rbA.getCenterOfMassTransform().getBasis().transpose(), - m_rbB.getCenterOfMassTransform().getBasis().transpose(), - m_rbA.getInvInertiaDiagLocal(), - m_rbB.getInvInertiaDiagLocal()); - - new (&m_jacAng[1]) JacobianEntry(jointAxis1, - m_rbA.getCenterOfMassTransform().getBasis().transpose(), - m_rbB.getCenterOfMassTransform().getBasis().transpose(), - m_rbA.getInvInertiaDiagLocal(), - m_rbB.getInvInertiaDiagLocal()); - - -} - -void HingeConstraint::SolveConstraint(SimdScalar timeStep) -{ -//#define NEW_IMPLEMENTATION - -#ifdef NEW_IMPLEMENTATION - SimdScalar tau = 0.3f; - SimdScalar damping = 1.f; - - SimdVector3 pivotAInW = m_rbA.getCenterOfMassTransform()*m_pivotInA; - SimdVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_pivotInB; - - // Dirk: Don't we need to update this after each applied impulse - SimdVector3 angvelA; // = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity(); - SimdVector3 angvelB; // = m_rbB.getCenterOfMassTransform().getBasis().transpose() * m_rbB.getAngularVelocity(); - - - if (!m_angularOnly) - { - SimdVector3 normal(0,0,0); - - for (int i=0;i<3;i++) - { - normal[i] = 1; - SimdScalar jacDiagABInv = 1.f / m_jac[i].getDiagonal(); - - SimdVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition(); - - SimdVector3 vel1 = m_rbA.getVelocityInLocalPoint(rel_pos1); - SimdVector3 vel2 = m_rbB.getVelocityInLocalPoint(rel_pos2); - SimdVector3 vel = vel1 - vel2; - - // Dirk: Get new angular velocity since it changed after applying an impulse - angvelA = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity(); - angvelB = m_rbB.getCenterOfMassTransform().getBasis().transpose() * m_rbB.getAngularVelocity(); - - //velocity error (first order error) - SimdScalar rel_vel = m_jac[i].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA, - m_rbB.getLinearVelocity(),angvelB); - - //positional error (zeroth order error) - SimdScalar depth = -(pivotAInW - pivotBInW).dot(normal); - - SimdScalar impulse = tau*depth/timeStep * jacDiagABInv - damping * rel_vel * jacDiagABInv; - - SimdVector3 impulse_vector = normal * impulse; - m_rbA.applyImpulse( impulse_vector, pivotAInW - m_rbA.getCenterOfMassPosition()); - m_rbB.applyImpulse(-impulse_vector, pivotBInW - m_rbB.getCenterOfMassPosition()); - - normal[i] = 0; - } - } - - ///solve angular part - - // get axes in world space - SimdVector3 axisA = GetRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA; - SimdVector3 axisB = GetRigidBodyB().getCenterOfMassTransform().getBasis() * m_axisInB; - - // constraint axes in world space - SimdVector3 jointAxis0; - SimdVector3 jointAxis1; - SimdPlaneSpace1(axisA,jointAxis0,jointAxis1); - - - // Dirk: Get new angular velocity since it changed after applying an impulse - angvelA = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity(); - angvelB = m_rbB.getCenterOfMassTransform().getBasis().transpose() * m_rbB.getAngularVelocity(); - - SimdScalar jacDiagABInv0 = 1.f / m_jacAng[0].getDiagonal(); - SimdScalar rel_vel0 = m_jacAng[0].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA, - m_rbB.getLinearVelocity(),angvelB); - float tau1 = tau;//0.f; - - SimdScalar impulse0 = (tau1 * axisB.dot(jointAxis1) / timeStep - damping * rel_vel0) * jacDiagABInv0; - SimdVector3 angular_impulse0 = jointAxis0 * impulse0; - - m_rbA.applyTorqueImpulse( angular_impulse0); - m_rbB.applyTorqueImpulse(-angular_impulse0); - - - - // Dirk: Get new angular velocity since it changed after applying an impulse - angvelA = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity(); - angvelB = m_rbB.getCenterOfMassTransform().getBasis().transpose() * m_rbB.getAngularVelocity(); - - SimdScalar jacDiagABInv1 = 1.f / m_jacAng[1].getDiagonal(); - SimdScalar rel_vel1 = m_jacAng[1].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA, - m_rbB.getLinearVelocity(),angvelB);; - - SimdScalar impulse1 = -(tau1 * axisB.dot(jointAxis0) / timeStep + damping * rel_vel1) * jacDiagABInv1; - SimdVector3 angular_impulse1 = jointAxis1 * impulse1; - - m_rbA.applyTorqueImpulse( angular_impulse1); - m_rbB.applyTorqueImpulse(-angular_impulse1); - -#else - - - SimdVector3 pivotAInW = m_rbA.getCenterOfMassTransform()*m_pivotInA; - SimdVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_pivotInB; - - SimdVector3 normal(0,0,0); - SimdScalar tau = 0.3f; - SimdScalar damping = 1.f; - -//linear part - { - for (int i=0;i<3;i++) - { - normal[i] = 1; - SimdScalar jacDiagABInv = 1.f / m_jac[i].getDiagonal(); - - SimdVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition(); - - SimdVector3 vel1 = m_rbA.getVelocityInLocalPoint(rel_pos1); - SimdVector3 vel2 = m_rbB.getVelocityInLocalPoint(rel_pos2); - SimdVector3 vel = vel1 - vel2; - SimdScalar rel_vel; - rel_vel = normal.dot(vel); - //positional error (zeroth order error) - SimdScalar depth = -(pivotAInW - pivotBInW).dot(normal); //this is the error projected on the normal - SimdScalar impulse = depth*tau/timeStep * jacDiagABInv - damping * rel_vel * jacDiagABInv * damping; - m_appliedImpulse += impulse; - SimdVector3 impulse_vector = normal * impulse; - m_rbA.applyImpulse(impulse_vector, pivotAInW - m_rbA.getCenterOfMassPosition()); - m_rbB.applyImpulse(-impulse_vector, pivotBInW - m_rbB.getCenterOfMassPosition()); - - normal[i] = 0; - } - } - - ///solve angular part - - // get axes in world space - SimdVector3 axisA = GetRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA; - SimdVector3 axisB = GetRigidBodyB().getCenterOfMassTransform().getBasis() * m_axisInB; - - const SimdVector3& angVelA = GetRigidBodyA().getAngularVelocity(); - const SimdVector3& angVelB = GetRigidBodyB().getAngularVelocity(); - SimdVector3 angA = angVelA - axisA * axisA.dot(angVelA); - SimdVector3 angB = angVelB - axisB * axisB.dot(angVelB); - SimdVector3 velrel = angA-angB; - - //solve angular velocity correction - float relaxation = 1.f; - float len = velrel.length(); - if (len > 0.00001f) - { - SimdVector3 normal = velrel.normalized(); - float denom = GetRigidBodyA().ComputeAngularImpulseDenominator(normal) + - GetRigidBodyB().ComputeAngularImpulseDenominator(normal); - // scale for mass and relaxation - velrel *= (1.f/denom) * 0.9; - } - - //solve angular positional correction - SimdVector3 angularError = -axisA.cross(axisB) *(1.f/timeStep); - float len2 = angularError.length(); - if (len2>0.00001f) - { - SimdVector3 normal2 = angularError.normalized(); - float denom2 = GetRigidBodyA().ComputeAngularImpulseDenominator(normal2) + - GetRigidBodyB().ComputeAngularImpulseDenominator(normal2); - angularError *= (1.f/denom2) * relaxation; - } - - m_rbA.applyTorqueImpulse(-velrel+angularError); - m_rbB.applyTorqueImpulse(velrel-angularError); - -#endif - -} - -void HingeConstraint::UpdateRHS(SimdScalar timeStep) -{ - -} - diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/HingeConstraint.h b/extern/bullet/BulletDynamics/ConstraintSolver/HingeConstraint.h deleted file mode 100644 index a43463511b1..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/HingeConstraint.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef HINGECONSTRAINT_H -#define HINGECONSTRAINT_H - -#include "SimdVector3.h" - -#include "ConstraintSolver/JacobianEntry.h" -#include "TypedConstraint.h" - -class RigidBody; - - -/// hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in local space -/// axis defines the orientation of the hinge axis -class HingeConstraint : public TypedConstraint -{ - JacobianEntry m_jac[3]; //3 orthogonal linear constraints - JacobianEntry m_jacAng[2]; //2 orthogonal angular constraints - - SimdVector3 m_pivotInA; - SimdVector3 m_pivotInB; - SimdVector3 m_axisInA; - SimdVector3 m_axisInB; - - bool m_angularOnly; - -public: - - HingeConstraint(RigidBody& rbA,RigidBody& rbB, const SimdVector3& pivotInA,const SimdVector3& pivotInB,SimdVector3& axisInA,SimdVector3& axisInB); - - HingeConstraint(RigidBody& rbA,const SimdVector3& pivotInA,SimdVector3& axisInA); - - HingeConstraint(); - - virtual void BuildJacobian(); - - virtual void SolveConstraint(SimdScalar timeStep); - - void UpdateRHS(SimdScalar timeStep); - - const RigidBody& GetRigidBodyA() const - { - return m_rbA; - } - const RigidBody& GetRigidBodyB() const - { - return m_rbB; - } - - void setAngularOnly(bool angularOnly) - { - m_angularOnly = angularOnly; - } - - - -}; - -#endif //HINGECONSTRAINT_H diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/JacobianEntry.h b/extern/bullet/BulletDynamics/ConstraintSolver/JacobianEntry.h deleted file mode 100644 index d1dd367a012..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/JacobianEntry.h +++ /dev/null @@ -1,156 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef JACOBIAN_ENTRY_H -#define JACOBIAN_ENTRY_H - -#include "SimdVector3.h" -#include "Dynamics/RigidBody.h" - - -//notes: -// Another memory optimization would be to store m_1MinvJt in the remaining 3 w components -// which makes the JacobianEntry memory layout 16 bytes -// if you only are interested in angular part, just feed massInvA and massInvB zero - -/// Jacobian entry is an abstraction that allows to describe constraints -/// it can be used in combination with a constraint solver -/// Can be used to relate the effect of an impulse to the constraint error -class JacobianEntry -{ -public: - JacobianEntry() {}; - //constraint between two different rigidbodies - JacobianEntry( - const SimdMatrix3x3& world2A, - const SimdMatrix3x3& world2B, - const SimdVector3& rel_pos1,const SimdVector3& rel_pos2, - const SimdVector3& jointAxis, - const SimdVector3& inertiaInvA, - const SimdScalar massInvA, - const SimdVector3& inertiaInvB, - const SimdScalar massInvB) - :m_linearJointAxis(jointAxis) - { - m_aJ = world2A*(rel_pos1.cross(m_linearJointAxis)); - m_bJ = world2B*(rel_pos2.cross(-m_linearJointAxis)); - m_0MinvJt = inertiaInvA * m_aJ; - m_1MinvJt = inertiaInvB * m_bJ; - m_Adiag = massInvA + m_0MinvJt.dot(m_aJ) + massInvB + m_1MinvJt.dot(m_bJ); - - ASSERT(m_Adiag > 0.0f); - } - - //angular constraint between two different rigidbodies - JacobianEntry(const SimdVector3& jointAxis, - const SimdMatrix3x3& world2A, - const SimdMatrix3x3& world2B, - const SimdVector3& inertiaInvA, - const SimdVector3& inertiaInvB) - :m_linearJointAxis(SimdVector3(0.f,0.f,0.f)) - { - m_aJ= world2A*jointAxis; - m_bJ = world2B*-jointAxis; - m_0MinvJt = inertiaInvA * m_aJ; - m_1MinvJt = inertiaInvB * m_bJ; - m_Adiag = m_0MinvJt.dot(m_aJ) + m_1MinvJt.dot(m_bJ); - - ASSERT(m_Adiag > 0.0f); - } - - //angular constraint between two different rigidbodies - JacobianEntry(const SimdVector3& axisInA, - const SimdVector3& axisInB, - const SimdVector3& inertiaInvA, - const SimdVector3& inertiaInvB) - : m_linearJointAxis(SimdVector3(0.f,0.f,0.f)) - , m_aJ(axisInA) - , m_bJ(-axisInB) - { - m_0MinvJt = inertiaInvA * m_aJ; - m_1MinvJt = inertiaInvB * m_bJ; - m_Adiag = m_0MinvJt.dot(m_aJ) + m_1MinvJt.dot(m_bJ); - - ASSERT(m_Adiag > 0.0f); - } - - //constraint on one rigidbody - JacobianEntry( - const SimdMatrix3x3& world2A, - const SimdVector3& rel_pos1,const SimdVector3& rel_pos2, - const SimdVector3& jointAxis, - const SimdVector3& inertiaInvA, - const SimdScalar massInvA) - :m_linearJointAxis(jointAxis) - { - m_aJ= world2A*(rel_pos1.cross(jointAxis)); - m_bJ = world2A*(rel_pos2.cross(-jointAxis)); - m_0MinvJt = inertiaInvA * m_aJ; - m_1MinvJt = SimdVector3(0.f,0.f,0.f); - m_Adiag = massInvA + m_0MinvJt.dot(m_aJ); - - ASSERT(m_Adiag > 0.0f); - } - - SimdScalar getDiagonal() const { return m_Adiag; } - - // for two constraints on the same rigidbody (for example vehicle friction) - SimdScalar getNonDiagonal(const JacobianEntry& jacB, const SimdScalar massInvA) const - { - const JacobianEntry& jacA = *this; - SimdScalar lin = massInvA * jacA.m_linearJointAxis.dot(jacB.m_linearJointAxis); - SimdScalar ang = jacA.m_0MinvJt.dot(jacB.m_aJ); - return lin + ang; - } - - - - // for two constraints on sharing two same rigidbodies (for example two contact points between two rigidbodies) - SimdScalar getNonDiagonal(const JacobianEntry& jacB,const SimdScalar massInvA,const SimdScalar massInvB) const - { - const JacobianEntry& jacA = *this; - SimdVector3 lin = jacA.m_linearJointAxis * jacB.m_linearJointAxis; - SimdVector3 ang0 = jacA.m_0MinvJt * jacB.m_aJ; - SimdVector3 ang1 = jacA.m_1MinvJt * jacB.m_bJ; - SimdVector3 lin0 = massInvA * lin ; - SimdVector3 lin1 = massInvB * lin; - SimdVector3 sum = ang0+ang1+lin0+lin1; - return sum[0]+sum[1]+sum[2]; - } - - SimdScalar getRelativeVelocity(const SimdVector3& linvelA,const SimdVector3& angvelA,const SimdVector3& linvelB,const SimdVector3& angvelB) - { - SimdVector3 linrel = linvelA - linvelB; - SimdVector3 angvela = angvelA * m_aJ; - SimdVector3 angvelb = angvelB * m_bJ; - linrel *= m_linearJointAxis; - angvela += angvelb; - angvela += linrel; - SimdScalar rel_vel2 = angvela[0]+angvela[1]+angvela[2]; - return rel_vel2 + SIMD_EPSILON; - } -//private: - - SimdVector3 m_linearJointAxis; - SimdVector3 m_aJ; - SimdVector3 m_bJ; - SimdVector3 m_0MinvJt; - SimdVector3 m_1MinvJt; - //Optimization: can be stored in the w/last component of one of the vectors - SimdScalar m_Adiag; - -}; - -#endif //JACOBIAN_ENTRY_H diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp b/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp deleted file mode 100644 index b3e25e0fb45..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "Point2PointConstraint.h" -#include "Dynamics/RigidBody.h" -#include "Dynamics/MassProps.h" - - - - -Point2PointConstraint::Point2PointConstraint() -{ -} - -Point2PointConstraint::Point2PointConstraint(RigidBody& rbA,RigidBody& rbB, const SimdVector3& pivotInA,const SimdVector3& pivotInB) -:TypedConstraint(rbA,rbB),m_pivotInA(pivotInA),m_pivotInB(pivotInB) -{ - -} - - -Point2PointConstraint::Point2PointConstraint(RigidBody& rbA,const SimdVector3& pivotInA) -:TypedConstraint(rbA),m_pivotInA(pivotInA),m_pivotInB(rbA.getCenterOfMassTransform()(pivotInA)) -{ - -} - -void Point2PointConstraint::BuildJacobian() -{ - m_appliedImpulse = 0.f; - - SimdVector3 normal(0,0,0); - - for (int i=0;i<3;i++) - { - normal[i] = 1; - new (&m_jac[i]) JacobianEntry( - m_rbA.getCenterOfMassTransform().getBasis().transpose(), - m_rbB.getCenterOfMassTransform().getBasis().transpose(), - m_rbA.getCenterOfMassTransform()*m_pivotInA - m_rbA.getCenterOfMassPosition(), - m_rbB.getCenterOfMassTransform()*m_pivotInB - m_rbB.getCenterOfMassPosition(), - normal, - m_rbA.getInvInertiaDiagLocal(), - m_rbA.getInvMass(), - m_rbB.getInvInertiaDiagLocal(), - m_rbB.getInvMass()); - normal[i] = 0; - } - -} - -void Point2PointConstraint::SolveConstraint(SimdScalar timeStep) -{ - SimdVector3 pivotAInW = m_rbA.getCenterOfMassTransform()*m_pivotInA; - SimdVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_pivotInB; - - - SimdVector3 normal(0,0,0); - - -// SimdVector3 angvelA = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity(); -// SimdVector3 angvelB = m_rbB.getCenterOfMassTransform().getBasis().transpose() * m_rbB.getAngularVelocity(); - - for (int i=0;i<3;i++) - { - normal[i] = 1; - SimdScalar jacDiagABInv = 1.f / m_jac[i].getDiagonal(); - - SimdVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition(); - //this jacobian entry could be re-used for all iterations - - SimdVector3 vel1 = m_rbA.getVelocityInLocalPoint(rel_pos1); - SimdVector3 vel2 = m_rbB.getVelocityInLocalPoint(rel_pos2); - SimdVector3 vel = vel1 - vel2; - - SimdScalar rel_vel; - rel_vel = normal.dot(vel); - - /* - //velocity error (first order error) - SimdScalar rel_vel = m_jac[i].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA, - m_rbB.getLinearVelocity(),angvelB); - */ - - //positional error (zeroth order error) - SimdScalar depth = -(pivotAInW - pivotBInW).dot(normal); //this is the error projected on the normal - - SimdScalar impulse = depth*m_setting.m_tau/timeStep * jacDiagABInv - m_setting.m_damping * rel_vel * jacDiagABInv; - m_appliedImpulse+=impulse; - SimdVector3 impulse_vector = normal * impulse; - m_rbA.applyImpulse(impulse_vector, pivotAInW - m_rbA.getCenterOfMassPosition()); - m_rbB.applyImpulse(-impulse_vector, pivotBInW - m_rbB.getCenterOfMassPosition()); - - normal[i] = 0; - } -} - -void Point2PointConstraint::UpdateRHS(SimdScalar timeStep) -{ - -} - diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h b/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h deleted file mode 100644 index bd28ac7b1e5..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef POINT2POINTCONSTRAINT_H -#define POINT2POINTCONSTRAINT_H - -#include "SimdVector3.h" - -#include "ConstraintSolver/JacobianEntry.h" -#include "TypedConstraint.h" - -class RigidBody; - -struct ConstraintSetting -{ - ConstraintSetting() : - m_tau(0.3f), - m_damping(1.f) - { - } - float m_tau; - float m_damping; -}; - -/// point to point constraint between two rigidbodies each with a pivotpoint that descibes the 'ballsocket' location in local space -class Point2PointConstraint : public TypedConstraint -{ - JacobianEntry m_jac[3]; //3 orthogonal linear constraints - - SimdVector3 m_pivotInA; - SimdVector3 m_pivotInB; - - - -public: - - ConstraintSetting m_setting; - - Point2PointConstraint(RigidBody& rbA,RigidBody& rbB, const SimdVector3& pivotInA,const SimdVector3& pivotInB); - - Point2PointConstraint(RigidBody& rbA,const SimdVector3& pivotInA); - - Point2PointConstraint(); - - virtual void BuildJacobian(); - - - virtual void SolveConstraint(SimdScalar timeStep); - - void UpdateRHS(SimdScalar timeStep); - - void SetPivotA(const SimdVector3& pivotA) - { - m_pivotInA = pivotA; - } - - void SetPivotB(const SimdVector3& pivotB) - { - m_pivotInB = pivotB; - } - - - -}; - -#endif //POINT2POINTCONSTRAINT_H diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/SequentialImpulseConstraintSolver.cpp b/extern/bullet/BulletDynamics/ConstraintSolver/SequentialImpulseConstraintSolver.cpp deleted file mode 100644 index 26637bb9932..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/SequentialImpulseConstraintSolver.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "SequentialImpulseConstraintSolver.h" -#include "NarrowPhaseCollision/PersistentManifold.h" -#include "Dynamics/RigidBody.h" -#include "ContactConstraint.h" -#include "Solve2LinearConstraint.h" -#include "ContactSolverInfo.h" -#include "Dynamics/BU_Joint.h" -#include "Dynamics/ContactJoint.h" -#include "IDebugDraw.h" -#include "JacobianEntry.h" -#include "GEN_MinMax.h" - -#ifdef USE_PROFILE -#include "quickprof.h" -#endif //USE_PROFILE - -int totalCpd = 0; - - - -bool MyContactDestroyedCallback(void* userPersistentData) -{ - assert (userPersistentData); - ConstraintPersistentData* cpd = (ConstraintPersistentData*)userPersistentData; - delete cpd; - totalCpd--; - //printf("totalCpd = %i. DELETED Ptr %x\n",totalCpd,userPersistentData); - return true; -} - - -SequentialImpulseConstraintSolver::SequentialImpulseConstraintSolver() -{ - gContactDestroyedCallback = &MyContactDestroyedCallback; -} - - -/// SequentialImpulseConstraintSolver Sequentially applies impulses -float SequentialImpulseConstraintSolver::SolveGroup(PersistentManifold** manifoldPtr, int numManifolds,const ContactSolverInfo& infoGlobal,IDebugDraw* debugDrawer) -{ - - ContactSolverInfo info = infoGlobal; - - int numiter = infoGlobal.m_numIterations; -#ifdef USE_PROFILE - Profiler::beginBlock("Solve"); -#endif //USE_PROFILE - - //should traverse the contacts random order... - int i; - for ( i = 0;i<numiter;i++) - { - int j; - for (j=0;j<numManifolds;j++) - { - int k=j; - if (i&1) - k=numManifolds-j-1; - - Solve(manifoldPtr[k],info,i,debugDrawer); - } - - } -#ifdef USE_PROFILE - Profiler::endBlock("Solve"); - - Profiler::beginBlock("SolveFriction"); -#endif //USE_PROFILE - - //now solve the friction - for (i = 0;i<numiter;i++) - { - int j; - for (j=0;j<numManifolds;j++) - { - int k = j; - if (i&1) - k=numManifolds-j-1; - SolveFriction(manifoldPtr[k],info,i,debugDrawer); - } - } -#ifdef USE_PROFILE - Profiler::endBlock("SolveFriction"); -#endif //USE_PROFILE - - return 0.f; -} - - -float penetrationResolveFactor = 0.9f; -SimdScalar restitutionCurve(SimdScalar rel_vel, SimdScalar restitution) -{ - SimdScalar rest = restitution * -rel_vel; - return rest; -} - - - - -float SequentialImpulseConstraintSolver::Solve(PersistentManifold* manifoldPtr, const ContactSolverInfo& info,int iter,IDebugDraw* debugDrawer) -{ - - RigidBody* body0 = (RigidBody*)manifoldPtr->GetBody0(); - RigidBody* body1 = (RigidBody*)manifoldPtr->GetBody1(); - - float maxImpulse = 0.f; - - //only necessary to refresh the manifold once (first iteration). The integration is done outside the loop - if (iter == 0) - { - manifoldPtr->RefreshContactPoints(body0->getCenterOfMassTransform(),body1->getCenterOfMassTransform()); - - int numpoints = manifoldPtr->GetNumContacts(); - - SimdVector3 color(0,1,0); - for (int i=0;i<numpoints ;i++) - { - ManifoldPoint& cp = manifoldPtr->GetContactPoint(i); - if (cp.GetDistance() <= 0.f) - { - const SimdVector3& pos1 = cp.GetPositionWorldOnA(); - const SimdVector3& pos2 = cp.GetPositionWorldOnB(); - - SimdVector3 rel_pos1 = pos1 - body0->getCenterOfMassPosition(); - SimdVector3 rel_pos2 = pos2 - body1->getCenterOfMassPosition(); - - - //this jacobian entry is re-used for all iterations - JacobianEntry jac(body0->getCenterOfMassTransform().getBasis().transpose(), - body1->getCenterOfMassTransform().getBasis().transpose(), - rel_pos1,rel_pos2,cp.m_normalWorldOnB,body0->getInvInertiaDiagLocal(),body0->getInvMass(), - body1->getInvInertiaDiagLocal(),body1->getInvMass()); - - - SimdScalar jacDiagAB = jac.getDiagonal(); - - ConstraintPersistentData* cpd = (ConstraintPersistentData*) cp.m_userPersistentData; - if (cpd) - { - //might be invalid - cpd->m_persistentLifeTime++; - if (cpd->m_persistentLifeTime != cp.GetLifeTime()) - { - //printf("Invalid: cpd->m_persistentLifeTime = %i cp.GetLifeTime() = %i\n",cpd->m_persistentLifeTime,cp.GetLifeTime()); - new (cpd) ConstraintPersistentData; - cpd->m_persistentLifeTime = cp.GetLifeTime(); - - } else - { - //printf("Persistent: cpd->m_persistentLifeTime = %i cp.GetLifeTime() = %i\n",cpd->m_persistentLifeTime,cp.GetLifeTime()); - - } - } else - { - - cpd = new ConstraintPersistentData(); - totalCpd ++; - //printf("totalCpd = %i Created Ptr %x\n",totalCpd,cpd); - cp.m_userPersistentData = cpd; - cpd->m_persistentLifeTime = cp.GetLifeTime(); - //printf("CREATED: %x . cpd->m_persistentLifeTime = %i cp.GetLifeTime() = %i\n",cpd,cpd->m_persistentLifeTime,cp.GetLifeTime()); - - } - assert(cpd); - - cpd->m_jacDiagABInv = 1.f / jacDiagAB; - - - SimdVector3 vel1 = body0->getVelocityInLocalPoint(rel_pos1); - SimdVector3 vel2 = body1->getVelocityInLocalPoint(rel_pos2); - SimdVector3 vel = vel1 - vel2; - SimdScalar rel_vel; - rel_vel = cp.m_normalWorldOnB.dot(vel); - - float combinedRestitution = cp.m_combinedRestitution; - - cpd->m_penetration = cp.GetDistance(); - cpd->m_friction = cp.m_combinedFriction; - cpd->m_restitution = restitutionCurve(rel_vel, combinedRestitution); - if (cpd->m_restitution <= 0.) //0.f) - { - cpd->m_restitution = 0.0f; - - }; - - //restitution and penetration work in same direction so - //rel_vel - - SimdScalar penVel = -cpd->m_penetration/info.m_timeStep; - - if (cpd->m_restitution >= penVel) - { - cpd->m_penetration = 0.f; - } - - - float relaxation = info.m_damping; - cpd->m_appliedImpulse *= relaxation; - //for friction - cpd->m_prevAppliedImpulse = cpd->m_appliedImpulse; - - //re-calculate friction direction every frame, todo: check if this is really needed - SimdPlaneSpace1(cp.m_normalWorldOnB,cpd->m_frictionWorldTangential0,cpd->m_frictionWorldTangential1); - - -#define NO_FRICTION_WARMSTART 1 - - #ifdef NO_FRICTION_WARMSTART - cpd->m_accumulatedTangentImpulse0 = 0.f; - cpd->m_accumulatedTangentImpulse1 = 0.f; - #endif //NO_FRICTION_WARMSTART - float denom0 = body0->ComputeImpulseDenominator(pos1,cpd->m_frictionWorldTangential0); - float denom1 = body1->ComputeImpulseDenominator(pos2,cpd->m_frictionWorldTangential0); - float denom = relaxation/(denom0+denom1); - cpd->m_jacDiagABInvTangent0 = denom; - - - denom0 = body0->ComputeImpulseDenominator(pos1,cpd->m_frictionWorldTangential1); - denom1 = body1->ComputeImpulseDenominator(pos2,cpd->m_frictionWorldTangential1); - denom = relaxation/(denom0+denom1); - cpd->m_jacDiagABInvTangent1 = denom; - - SimdVector3 totalImpulse = - #ifndef NO_FRICTION_WARMSTART - cp.m_frictionWorldTangential0*cp.m_accumulatedTangentImpulse0+ - cp.m_frictionWorldTangential1*cp.m_accumulatedTangentImpulse1+ - #endif //NO_FRICTION_WARMSTART - cp.m_normalWorldOnB*cpd->m_appliedImpulse; - - //apply previous frames impulse on both bodies - body0->applyImpulse(totalImpulse, rel_pos1); - body1->applyImpulse(-totalImpulse, rel_pos2); - } - - } - } - - { - const int numpoints = manifoldPtr->GetNumContacts(); - - SimdVector3 color(0,1,0); - for (int i=0;i<numpoints ;i++) - { - - int j=i; - if (iter % 2) - j = numpoints-1-i; - else - j=i; - - ManifoldPoint& cp = manifoldPtr->GetContactPoint(j); - if (cp.GetDistance() <= 0.f) - { - - if (iter == 0) - { - if (debugDrawer) - debugDrawer->DrawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.GetDistance(),cp.GetLifeTime(),color); - } - - { - - - //float dist = cp.GetDistance(); - //printf("dist(%i)=%f\n",j,dist); - float impulse = resolveSingleCollision( - *body0,*body1, - cp, - info); - - if (maxImpulse < impulse) - maxImpulse = impulse; - - } - } - } - } - return maxImpulse; -} - -float SequentialImpulseConstraintSolver::SolveFriction(PersistentManifold* manifoldPtr, const ContactSolverInfo& info,int iter,IDebugDraw* debugDrawer) -{ - RigidBody* body0 = (RigidBody*)manifoldPtr->GetBody0(); - RigidBody* body1 = (RigidBody*)manifoldPtr->GetBody1(); - - - { - const int numpoints = manifoldPtr->GetNumContacts(); - - SimdVector3 color(0,1,0); - for (int i=0;i<numpoints ;i++) - { - - int j=i; - //if (iter % 2) - // j = numpoints-1-i; - - ManifoldPoint& cp = manifoldPtr->GetContactPoint(j); - if (cp.GetDistance() <= 0.f) - { - - resolveSingleFriction( - *body0,*body1, - cp, - info); - - } - } - - - } - return 0.f; -} diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/SequentialImpulseConstraintSolver.h b/extern/bullet/BulletDynamics/ConstraintSolver/SequentialImpulseConstraintSolver.h deleted file mode 100644 index 598a4cfa903..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/SequentialImpulseConstraintSolver.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H -#define SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H - -#include "ConstraintSolver.h" -class IDebugDraw; - -/// SequentialImpulseConstraintSolver uses a Propagation Method and Sequentially applies impulses -/// The approach is the 3D version of Erin Catto's GDC 2006 tutorial. See http://www.gphysics.com -/// Although Sequential Impulse is more intuitive, it is mathematically equivalent to Projected Successive Overrelaxation (iterative LCP) -/// Applies impulses for combined restitution and penetration recovery and to simulate friction -class SequentialImpulseConstraintSolver : public ConstraintSolver -{ - float Solve(PersistentManifold* manifold, const ContactSolverInfo& info,int iter,IDebugDraw* debugDrawer); - float SolveFriction(PersistentManifold* manifoldPtr, const ContactSolverInfo& info,int iter,IDebugDraw* debugDrawer); - - -public: - - SequentialImpulseConstraintSolver(); - - virtual ~SequentialImpulseConstraintSolver() {} - - virtual float SolveGroup(PersistentManifold** manifold,int numManifolds,const ContactSolverInfo& info, IDebugDraw* debugDrawer=0); - -}; - -#endif //SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H - diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/Solve2LinearConstraint.cpp b/extern/bullet/BulletDynamics/ConstraintSolver/Solve2LinearConstraint.cpp deleted file mode 100644 index 34bf3e48862..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/Solve2LinearConstraint.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#include "Solve2LinearConstraint.h" - -#include "Dynamics/RigidBody.h" -#include "SimdVector3.h" -#include "JacobianEntry.h" - - -void Solve2LinearConstraint::resolveUnilateralPairConstraint( - RigidBody* body1, - RigidBody* body2, - - const SimdMatrix3x3& world2A, - const SimdMatrix3x3& world2B, - - const SimdVector3& invInertiaADiag, - const SimdScalar invMassA, - const SimdVector3& linvelA,const SimdVector3& angvelA, - const SimdVector3& rel_posA1, - const SimdVector3& invInertiaBDiag, - const SimdScalar invMassB, - const SimdVector3& linvelB,const SimdVector3& angvelB, - const SimdVector3& rel_posA2, - - SimdScalar depthA, const SimdVector3& normalA, - const SimdVector3& rel_posB1,const SimdVector3& rel_posB2, - SimdScalar depthB, const SimdVector3& normalB, - SimdScalar& imp0,SimdScalar& imp1) -{ - - imp0 = 0.f; - imp1 = 0.f; - - SimdScalar len = fabs(normalA.length())-1.f; - if (fabs(len) >= SIMD_EPSILON) - return; - - ASSERT(len < SIMD_EPSILON); - - - //this jacobian entry could be re-used for all iterations - JacobianEntry jacA(world2A,world2B,rel_posA1,rel_posA2,normalA,invInertiaADiag,invMassA, - invInertiaBDiag,invMassB); - JacobianEntry jacB(world2A,world2B,rel_posB1,rel_posB2,normalB,invInertiaADiag,invMassA, - invInertiaBDiag,invMassB); - - //const SimdScalar vel0 = jacA.getRelativeVelocity(linvelA,angvelA,linvelB,angvelB); - //const SimdScalar vel1 = jacB.getRelativeVelocity(linvelA,angvelA,linvelB,angvelB); - - const SimdScalar vel0 = normalA.dot(body1->getVelocityInLocalPoint(rel_posA1)-body2->getVelocityInLocalPoint(rel_posA1)); - const SimdScalar vel1 = normalB.dot(body1->getVelocityInLocalPoint(rel_posB1)-body2->getVelocityInLocalPoint(rel_posB1)); - -// SimdScalar penetrationImpulse = (depth*contactTau*timeCorrection) * massTerm;//jacDiagABInv - SimdScalar massTerm = 1.f / (invMassA + invMassB); - - - // calculate rhs (or error) terms - const SimdScalar dv0 = depthA * m_tau * massTerm - vel0 * m_damping; - const SimdScalar dv1 = depthB * m_tau * massTerm - vel1 * m_damping; - - - // dC/dv * dv = -C - - // jacobian * impulse = -error - // - - //impulse = jacobianInverse * -error - - // inverting 2x2 symmetric system (offdiagonal are equal!) - // - - - SimdScalar nonDiag = jacA.getNonDiagonal(jacB,invMassA,invMassB); - SimdScalar invDet = 1.0f / (jacA.getDiagonal() * jacB.getDiagonal() - nonDiag * nonDiag ); - - //imp0 = dv0 * jacA.getDiagonal() * invDet + dv1 * -nonDiag * invDet; - //imp1 = dv1 * jacB.getDiagonal() * invDet + dv0 * - nonDiag * invDet; - - imp0 = dv0 * jacA.getDiagonal() * invDet + dv1 * -nonDiag * invDet; - imp1 = dv1 * jacB.getDiagonal() * invDet + dv0 * - nonDiag * invDet; - - //[a b] [d -c] - //[c d] inverse = (1 / determinant) * [-b a] where determinant is (ad - bc) - - //[jA nD] * [imp0] = [dv0] - //[nD jB] [imp1] [dv1] - -} - - - -void Solve2LinearConstraint::resolveBilateralPairConstraint( - RigidBody* body1, - RigidBody* body2, - const SimdMatrix3x3& world2A, - const SimdMatrix3x3& world2B, - - const SimdVector3& invInertiaADiag, - const SimdScalar invMassA, - const SimdVector3& linvelA,const SimdVector3& angvelA, - const SimdVector3& rel_posA1, - const SimdVector3& invInertiaBDiag, - const SimdScalar invMassB, - const SimdVector3& linvelB,const SimdVector3& angvelB, - const SimdVector3& rel_posA2, - - SimdScalar depthA, const SimdVector3& normalA, - const SimdVector3& rel_posB1,const SimdVector3& rel_posB2, - SimdScalar depthB, const SimdVector3& normalB, - SimdScalar& imp0,SimdScalar& imp1) -{ - - imp0 = 0.f; - imp1 = 0.f; - - SimdScalar len = fabs(normalA.length())-1.f; - if (fabs(len) >= SIMD_EPSILON) - return; - - ASSERT(len < SIMD_EPSILON); - - - //this jacobian entry could be re-used for all iterations - JacobianEntry jacA(world2A,world2B,rel_posA1,rel_posA2,normalA,invInertiaADiag,invMassA, - invInertiaBDiag,invMassB); - JacobianEntry jacB(world2A,world2B,rel_posB1,rel_posB2,normalB,invInertiaADiag,invMassA, - invInertiaBDiag,invMassB); - - //const SimdScalar vel0 = jacA.getRelativeVelocity(linvelA,angvelA,linvelB,angvelB); - //const SimdScalar vel1 = jacB.getRelativeVelocity(linvelA,angvelA,linvelB,angvelB); - - const SimdScalar vel0 = normalA.dot(body1->getVelocityInLocalPoint(rel_posA1)-body2->getVelocityInLocalPoint(rel_posA1)); - const SimdScalar vel1 = normalB.dot(body1->getVelocityInLocalPoint(rel_posB1)-body2->getVelocityInLocalPoint(rel_posB1)); - - // calculate rhs (or error) terms - const SimdScalar dv0 = depthA * m_tau - vel0 * m_damping; - const SimdScalar dv1 = depthB * m_tau - vel1 * m_damping; - - // dC/dv * dv = -C - - // jacobian * impulse = -error - // - - //impulse = jacobianInverse * -error - - // inverting 2x2 symmetric system (offdiagonal are equal!) - // - - - SimdScalar nonDiag = jacA.getNonDiagonal(jacB,invMassA,invMassB); - SimdScalar invDet = 1.0f / (jacA.getDiagonal() * jacB.getDiagonal() - nonDiag * nonDiag ); - - //imp0 = dv0 * jacA.getDiagonal() * invDet + dv1 * -nonDiag * invDet; - //imp1 = dv1 * jacB.getDiagonal() * invDet + dv0 * - nonDiag * invDet; - - imp0 = dv0 * jacA.getDiagonal() * invDet + dv1 * -nonDiag * invDet; - imp1 = dv1 * jacB.getDiagonal() * invDet + dv0 * - nonDiag * invDet; - - //[a b] [d -c] - //[c d] inverse = (1 / determinant) * [-b a] where determinant is (ad - bc) - - //[jA nD] * [imp0] = [dv0] - //[nD jB] [imp1] [dv1] - - if ( imp0 > 0.0f) - { - if ( imp1 > 0.0f ) - { - //both positive - } - else - { - imp1 = 0.f; - - // now imp0>0 imp1<0 - imp0 = dv0 / jacA.getDiagonal(); - if ( imp0 > 0.0f ) - { - } else - { - imp0 = 0.f; - } - } - } - else - { - imp0 = 0.f; - - imp1 = dv1 / jacB.getDiagonal(); - if ( imp1 <= 0.0f ) - { - imp1 = 0.f; - // now imp0>0 imp1<0 - imp0 = dv0 / jacA.getDiagonal(); - if ( imp0 > 0.0f ) - { - } else - { - imp0 = 0.f; - } - } else - { - } - } -} - - - -void Solve2LinearConstraint::resolveAngularConstraint( const SimdMatrix3x3& invInertiaAWS, - const SimdScalar invMassA, - const SimdVector3& linvelA,const SimdVector3& angvelA, - const SimdVector3& rel_posA1, - const SimdMatrix3x3& invInertiaBWS, - const SimdScalar invMassB, - const SimdVector3& linvelB,const SimdVector3& angvelB, - const SimdVector3& rel_posA2, - - SimdScalar depthA, const SimdVector3& normalA, - const SimdVector3& rel_posB1,const SimdVector3& rel_posB2, - SimdScalar depthB, const SimdVector3& normalB, - SimdScalar& imp0,SimdScalar& imp1) -{ - -} - diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/Solve2LinearConstraint.h b/extern/bullet/BulletDynamics/ConstraintSolver/Solve2LinearConstraint.h deleted file mode 100644 index 4a0986abfc7..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/Solve2LinearConstraint.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SOLVE_2LINEAR_CONSTRAINT_H -#define SOLVE_2LINEAR_CONSTRAINT_H - -#include "SimdMatrix3x3.h" -#include "SimdVector3.h" - - -class RigidBody; - - - -/// constraint class used for lateral tyre friction. -class Solve2LinearConstraint -{ - SimdScalar m_tau; - SimdScalar m_damping; - -public: - - Solve2LinearConstraint(SimdScalar tau,SimdScalar damping) - { - m_tau = tau; - m_damping = damping; - } - // - // solve unilateral constraint (equality, direct method) - // - void resolveUnilateralPairConstraint( - RigidBody* body0, - RigidBody* body1, - - const SimdMatrix3x3& world2A, - const SimdMatrix3x3& world2B, - - const SimdVector3& invInertiaADiag, - const SimdScalar invMassA, - const SimdVector3& linvelA,const SimdVector3& angvelA, - const SimdVector3& rel_posA1, - const SimdVector3& invInertiaBDiag, - const SimdScalar invMassB, - const SimdVector3& linvelB,const SimdVector3& angvelB, - const SimdVector3& rel_posA2, - - SimdScalar depthA, const SimdVector3& normalA, - const SimdVector3& rel_posB1,const SimdVector3& rel_posB2, - SimdScalar depthB, const SimdVector3& normalB, - SimdScalar& imp0,SimdScalar& imp1); - - - // - // solving 2x2 lcp problem (inequality, direct solution ) - // - void resolveBilateralPairConstraint( - RigidBody* body0, - RigidBody* body1, - const SimdMatrix3x3& world2A, - const SimdMatrix3x3& world2B, - - const SimdVector3& invInertiaADiag, - const SimdScalar invMassA, - const SimdVector3& linvelA,const SimdVector3& angvelA, - const SimdVector3& rel_posA1, - const SimdVector3& invInertiaBDiag, - const SimdScalar invMassB, - const SimdVector3& linvelB,const SimdVector3& angvelB, - const SimdVector3& rel_posA2, - - SimdScalar depthA, const SimdVector3& normalA, - const SimdVector3& rel_posB1,const SimdVector3& rel_posB2, - SimdScalar depthB, const SimdVector3& normalB, - SimdScalar& imp0,SimdScalar& imp1); - - - void resolveAngularConstraint( const SimdMatrix3x3& invInertiaAWS, - const SimdScalar invMassA, - const SimdVector3& linvelA,const SimdVector3& angvelA, - const SimdVector3& rel_posA1, - const SimdMatrix3x3& invInertiaBWS, - const SimdScalar invMassB, - const SimdVector3& linvelB,const SimdVector3& angvelB, - const SimdVector3& rel_posA2, - - SimdScalar depthA, const SimdVector3& normalA, - const SimdVector3& rel_posB1,const SimdVector3& rel_posB2, - SimdScalar depthB, const SimdVector3& normalB, - SimdScalar& imp0,SimdScalar& imp1); - - -}; - -#endif //SOLVE_2LINEAR_CONSTRAINT_H diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/TypedConstraint.cpp b/extern/bullet/BulletDynamics/ConstraintSolver/TypedConstraint.cpp deleted file mode 100644 index 61ea8ace7d6..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/TypedConstraint.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "TypedConstraint.h" -#include "Dynamics/RigidBody.h" -#include "Dynamics/MassProps.h" - -static RigidBody s_fixed(MassProps(0,SimdVector3(0.f,0.f,0.f)),0.f,0.f,1.f,1.f); - -TypedConstraint::TypedConstraint() -: m_userConstraintType(-1), -m_userConstraintId(-1), -m_rbA(s_fixed), -m_rbB(s_fixed), -m_appliedImpulse(0.f) -{ - s_fixed.setMassProps(0.f,SimdVector3(0.f,0.f,0.f)); -} -TypedConstraint::TypedConstraint(RigidBody& rbA) -: m_userConstraintType(-1), -m_userConstraintId(-1), -m_rbA(rbA), -m_rbB(s_fixed), -m_appliedImpulse(0.f) -{ - s_fixed.setMassProps(0.f,SimdVector3(0.f,0.f,0.f)); - -} - - -TypedConstraint::TypedConstraint(RigidBody& rbA,RigidBody& rbB) -: m_userConstraintType(-1), -m_userConstraintId(-1), -m_rbA(rbA), -m_rbB(rbB), -m_appliedImpulse(0.f) -{ - s_fixed.setMassProps(0.f,SimdVector3(0.f,0.f,0.f)); - -} - diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/TypedConstraint.h b/extern/bullet/BulletDynamics/ConstraintSolver/TypedConstraint.h deleted file mode 100755 index bc90814de44..00000000000 --- a/extern/bullet/BulletDynamics/ConstraintSolver/TypedConstraint.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef TYPED_CONSTRAINT_H -#define TYPED_CONSTRAINT_H - -class RigidBody; -#include "SimdScalar.h" - -//TypedConstraint is the baseclass for Bullet constraints and vehicles -class TypedConstraint -{ - int m_userConstraintType; - int m_userConstraintId; - - -protected: - RigidBody& m_rbA; - RigidBody& m_rbB; - float m_appliedImpulse; - - -public: - - TypedConstraint(); - virtual ~TypedConstraint() {}; - TypedConstraint(RigidBody& rbA); - - TypedConstraint(RigidBody& rbA,RigidBody& rbB); - - virtual void BuildJacobian() = 0; - - virtual void SolveConstraint(SimdScalar timeStep) = 0; - - const RigidBody& GetRigidBodyA() const - { - return m_rbA; - } - const RigidBody& GetRigidBodyB() const - { - return m_rbB; - } - - RigidBody& GetRigidBodyA() - { - return m_rbA; - } - RigidBody& GetRigidBodyB() - { - return m_rbB; - } - - int GetUserConstraintType() const - { - return m_userConstraintType ; - } - - void SetUserConstraintType(int userConstraintType) - { - m_userConstraintType = userConstraintType; - }; - - void SetUserConstraintId(int uid) - { - m_userConstraintId = uid; - } - - int GetUserConstraintId() - { - return m_userConstraintId; - } - float GetAppliedImpulse() - { - return m_appliedImpulse; - } -}; - -#endif //TYPED_CONSTRAINT_H diff --git a/extern/bullet/BulletDynamics/Dynamics/BU_Joint.cpp b/extern/bullet/BulletDynamics/Dynamics/BU_Joint.cpp deleted file mode 100644 index ab2a755703b..00000000000 --- a/extern/bullet/BulletDynamics/Dynamics/BU_Joint.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "BU_Joint.h" - -BU_Joint::BU_Joint() -{ - -} -BU_Joint::~BU_Joint() -{ - -} diff --git a/extern/bullet/BulletDynamics/Dynamics/BU_Joint.h b/extern/bullet/BulletDynamics/Dynamics/BU_Joint.h deleted file mode 100644 index 5c790bd0296..00000000000 --- a/extern/bullet/BulletDynamics/Dynamics/BU_Joint.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef BU_Joint_H -#define BU_Joint_H - -class RigidBody; -class BU_Joint; -#include "SimdScalar.h" - -struct BU_ContactJointNode { - BU_Joint *joint; // pointer to enclosing BU_Joint object - RigidBody*body; // *other* body this joint is connected to -}; -typedef SimdScalar dVector3[4]; - - -class BU_Joint { - -public: - // naming convention: the "first" body this is connected to is node[0].body, - // and the "second" body is node[1].body. if this joint is only connected - // to one body then the second body is 0. - - // info returned by getInfo1 function. the constraint dimension is m (<=6). - // i.e. that is the total number of rows in the jacobian. `nub' is the - // number of unbounded variables (which have lo,hi = -/+ infinity). - - BU_Joint(); - virtual ~BU_Joint(); - - - struct Info1 { - int m,nub; - }; - - // info returned by getInfo2 function - - struct Info2 { - // integrator parameters: frames per second (1/stepsize), default error - // reduction parameter (0..1). - SimdScalar fps,erp; - - // for the first and second body, pointers to two (linear and angular) - // n*3 jacobian sub matrices, stored by rows. these matrices will have - // been initialized to 0 on entry. if the second body is zero then the - // J2xx pointers may be 0. - SimdScalar *J1l,*J1a,*J2l,*J2a; - - // elements to jump from one row to the next in J's - int rowskip; - - // right hand sides of the equation J*v = c + cfm * lambda. cfm is the - // "constraint force mixing" vector. c is set to zero on entry, cfm is - // set to a constant value (typically very small or zero) value on entry. - SimdScalar *c,*cfm; - - // lo and hi limits for variables (set to -/+ infinity on entry). - SimdScalar *lo,*hi; - - // findex vector for variables. see the LCP solver interface for a - // description of what this does. this is set to -1 on entry. - // note that the returned indexes are relative to the first index of - // the constraint. - int *findex; - }; - - // virtual function table: size of the joint structure, function pointers. - // we do it this way instead of using C++ virtual functions because - // sometimes we need to allocate joints ourself within a memory pool. - - virtual void GetInfo1 (Info1 *info)=0; - virtual void GetInfo2 (Info2 *info)=0; - - int flags; // dJOINT_xxx flags - BU_ContactJointNode node[2]; // connections to bodies. node[1].body can be 0 - SimdScalar lambda[6]; // lambda generated by last step -}; - - -#endif //BU_Joint_H diff --git a/extern/bullet/BulletDynamics/Dynamics/ContactJoint.cpp b/extern/bullet/BulletDynamics/Dynamics/ContactJoint.cpp deleted file mode 100644 index cab71449f52..00000000000 --- a/extern/bullet/BulletDynamics/Dynamics/ContactJoint.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ -#include "ContactJoint.h" -#include "RigidBody.h" -#include "NarrowPhaseCollision/PersistentManifold.h" - - -//this constant needs to be set up so different solvers give 'similar' results -#define FRICTION_CONSTANT 120.f - - -ContactJoint::ContactJoint(PersistentManifold* manifold,int index,bool swap,RigidBody* body0,RigidBody* body1) -:m_manifold(manifold), -m_index(index), -m_swapBodies(swap), -m_body0(body0), -m_body1(body1) -{ -} - -int m_numRows = 3; - - -void ContactJoint::GetInfo1(Info1 *info) -{ - info->m = m_numRows; - //friction adds another 2... - - info->nub = 0; -} - -#define dCROSS(a,op,b,c) \ - (a)[0] op ((b)[1]*(c)[2] - (b)[2]*(c)[1]); \ - (a)[1] op ((b)[2]*(c)[0] - (b)[0]*(c)[2]); \ - (a)[2] op ((b)[0]*(c)[1] - (b)[1]*(c)[0]); - -#define M_SQRT12 SimdScalar(0.7071067811865475244008443621048490) - -#define dRecipSqrt(x) ((float)(1.0f/SimdSqrt(float(x)))) /* reciprocal square root */ - - - -void dPlaneSpace1 (const dVector3 n, dVector3 p, dVector3 q) -{ - if (SimdFabs(n[2]) > M_SQRT12) { - // choose p in y-z plane - SimdScalar a = n[1]*n[1] + n[2]*n[2]; - SimdScalar k = dRecipSqrt (a); - p[0] = 0; - p[1] = -n[2]*k; - p[2] = n[1]*k; - // set q = n x p - q[0] = a*k; - q[1] = -n[0]*p[2]; - q[2] = n[0]*p[1]; - } - else { - // choose p in x-y plane - SimdScalar a = n[0]*n[0] + n[1]*n[1]; - SimdScalar k = dRecipSqrt (a); - p[0] = -n[1]*k; - p[1] = n[0]*k; - p[2] = 0; - // set q = n x p - q[0] = -n[2]*p[1]; - q[1] = n[2]*p[0]; - q[2] = a*k; - } -} - - - -void ContactJoint::GetInfo2(Info2 *info) -{ - - int s = info->rowskip; - int s2 = 2*s; - - float swapFactor = m_swapBodies ? -1.f : 1.f; - - // get normal, with sign adjusted for body1/body2 polarity - dVector3 normal; - - - ManifoldPoint& point = m_manifold->GetContactPoint(m_index); - - normal[0] = swapFactor*point.m_normalWorldOnB[0]; - normal[1] = swapFactor*point.m_normalWorldOnB[1]; - normal[2] = swapFactor*point.m_normalWorldOnB[2]; - normal[3] = 0; // @@@ hmmm - - // if (GetBody0()) - SimdVector3 relativePositionA; - { - relativePositionA = point.GetPositionWorldOnA() - m_body0->getCenterOfMassPosition(); - dVector3 c1; - c1[0] = relativePositionA[0]; - c1[1] = relativePositionA[1]; - c1[2] = relativePositionA[2]; - - // set jacobian for normal - info->J1l[0] = normal[0]; - info->J1l[1] = normal[1]; - info->J1l[2] = normal[2]; - dCROSS (info->J1a,=,c1,normal); - - } - // if (GetBody1()) - SimdVector3 relativePositionB; - { - dVector3 c2; - relativePositionB = point.GetPositionWorldOnB() - m_body1->getCenterOfMassPosition(); - - // for (i=0; i<3; i++) c2[i] = j->contact.geom.pos[i] - - // j->node[1].body->pos[i]; - c2[0] = relativePositionB[0]; - c2[1] = relativePositionB[1]; - c2[2] = relativePositionB[2]; - - info->J2l[0] = -normal[0]; - info->J2l[1] = -normal[1]; - info->J2l[2] = -normal[2]; - dCROSS (info->J2a,= -,c2,normal); - } - - SimdScalar k = info->fps * info->erp; - - float depth = -point.GetDistance(); -// if (depth < 0.f) -// depth = 0.f; - - info->c[0] = k * depth; - //float maxvel = .2f; - -// if (info->c[0] > maxvel) -// info->c[0] = maxvel; - - - //can override it, not necessary -// info->cfm[0] = 0.f; -// info->cfm[1] = 0.f; -// info->cfm[2] = 0.f; - - - - // set LCP limits for normal - info->lo[0] = 0; - info->hi[0] = 1e30f;//dInfinity; - info->lo[1] = 0; - info->hi[1] = 0.f; - info->lo[2] = 0.f; - info->hi[2] = 0.f; - -#define DO_THE_FRICTION_2 -#ifdef DO_THE_FRICTION_2 - // now do jacobian for tangential forces - dVector3 t1,t2; // two vectors tangential to normal - - dVector3 c1; - c1[0] = relativePositionA[0]; - c1[1] = relativePositionA[1]; - c1[2] = relativePositionA[2]; - - dVector3 c2; - c2[0] = relativePositionB[0]; - c2[1] = relativePositionB[1]; - c2[2] = relativePositionB[2]; - - //combined friction is available in the contact point - float friction = FRICTION_CONSTANT*m_body0->getFriction() * m_body1->getFriction(); - - // first friction direction - if (m_numRows >= 2) - { - - - - dPlaneSpace1 (normal,t1,t2); - - info->J1l[s+0] = t1[0]; - info->J1l[s+1] = t1[1]; - info->J1l[s+2] = t1[2]; - dCROSS (info->J1a+s,=,c1,t1); - if (1) { //j->node[1].body) { - info->J2l[s+0] = -t1[0]; - info->J2l[s+1] = -t1[1]; - info->J2l[s+2] = -t1[2]; - dCROSS (info->J2a+s,= -,c2,t1); - } - // set right hand side - if (0) {//j->contact.surface.mode & dContactMotion1) { - //info->c[1] = j->contact.surface.motion1; - } - // set LCP bounds and friction index. this depends on the approximation - // mode - //1e30f - - - info->lo[1] = -friction;//-j->contact.surface.mu; - info->hi[1] = friction;//j->contact.surface.mu; - if (1)//j->contact.surface.mode & dContactApprox1_1) - info->findex[1] = 0; - - // set slip (constraint force mixing) - if (0)//j->contact.surface.mode & dContactSlip1) - { - // info->cfm[1] = j->contact.surface.slip1; - } else - { - //info->cfm[1] = 0.f; - } - } - - // second friction direction - if (m_numRows >= 3) { - info->J1l[s2+0] = t2[0]; - info->J1l[s2+1] = t2[1]; - info->J1l[s2+2] = t2[2]; - dCROSS (info->J1a+s2,=,c1,t2); - if (1) { //j->node[1].body) { - info->J2l[s2+0] = -t2[0]; - info->J2l[s2+1] = -t2[1]; - info->J2l[s2+2] = -t2[2]; - dCROSS (info->J2a+s2,= -,c2,t2); - } - - // set right hand side - if (0){//j->contact.surface.mode & dContactMotion2) { - //info->c[2] = j->contact.surface.motion2; - } - // set LCP bounds and friction index. this depends on the approximation - // mode - if (0){//j->contact.surface.mode & dContactMu2) { - //info->lo[2] = -j->contact.surface.mu2; - //info->hi[2] = j->contact.surface.mu2; - } - else { - info->lo[2] = -friction; - info->hi[2] = friction; - } - if (0)//j->contact.surface.mode & dContactApprox1_2) - - { - info->findex[2] = 0; - } - // set slip (constraint force mixing) - if (0) //j->contact.surface.mode & dContactSlip2) - - { - //info->cfm[2] = j->contact.surface.slip2; - - } - } - -#endif //DO_THE_FRICTION_2 - -} - diff --git a/extern/bullet/BulletDynamics/Dynamics/ContactJoint.h b/extern/bullet/BulletDynamics/Dynamics/ContactJoint.h deleted file mode 100644 index f8727d937a5..00000000000 --- a/extern/bullet/BulletDynamics/Dynamics/ContactJoint.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CONTACT_JOINT_H -#define CONTACT_JOINT_H - -#include "BU_Joint.h" -class RigidBody; -class PersistentManifold; - -class ContactJoint : public BU_Joint -{ - PersistentManifold* m_manifold; - int m_index; - bool m_swapBodies; - RigidBody* m_body0; - RigidBody* m_body1; - - -public: - - ContactJoint() {}; - - ContactJoint(PersistentManifold* manifold,int index,bool swap,RigidBody* body0,RigidBody* body1); - - //BU_Joint interface for solver - - virtual void GetInfo1(Info1 *info); - - virtual void GetInfo2(Info2 *info); - - - - -}; - -#endif //CONTACT_JOINT_H - diff --git a/extern/bullet/BulletDynamics/Dynamics/MassProps.h b/extern/bullet/BulletDynamics/Dynamics/MassProps.h deleted file mode 100644 index b98010a680d..00000000000 --- a/extern/bullet/BulletDynamics/Dynamics/MassProps.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef MASS_PROPS_H -#define MASS_PROPS_H - -#include <SimdVector3.h> - -struct MassProps { - MassProps(float mass,const SimdVector3& inertiaLocal): - m_mass(mass), - m_inertiaLocal(inertiaLocal) - { - } - float m_mass; - SimdVector3 m_inertiaLocal; -}; - - -#endif - diff --git a/extern/bullet/BulletDynamics/Dynamics/RigidBody.cpp b/extern/bullet/BulletDynamics/Dynamics/RigidBody.cpp deleted file mode 100644 index c268515e327..00000000000 --- a/extern/bullet/BulletDynamics/Dynamics/RigidBody.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "RigidBody.h" -#include "MassProps.h" -#include "CollisionShapes/ConvexShape.h" -#include "GEN_MinMax.h" -#include <SimdTransformUtil.h> - -float gLinearAirDamping = 1.f; - -static int uniqueId = 0; - -RigidBody::RigidBody( const MassProps& massProps,SimdScalar linearDamping,SimdScalar angularDamping,SimdScalar friction,SimdScalar restitution) -: - m_gravity(0.0f, 0.0f, 0.0f), - m_totalForce(0.0f, 0.0f, 0.0f), - m_totalTorque(0.0f, 0.0f, 0.0f), - m_linearVelocity(0.0f, 0.0f, 0.0f), - m_angularVelocity(0.f,0.f,0.f), - m_linearDamping(0.f), - m_angularDamping(0.5f), - m_kinematicTimeStep(0.f) -{ - - //moved to CollisionObject - m_friction = friction; - m_restitution = restitution; - - m_debugBodyId = uniqueId++; - - setMassProps(massProps.m_mass, massProps.m_inertiaLocal); - setDamping(linearDamping, angularDamping); - m_worldTransform.setIdentity(); - updateInertiaTensor(); - -} - - -void RigidBody::setLinearVelocity(const SimdVector3& lin_vel) -{ - - m_linearVelocity = lin_vel; -} - - -void RigidBody::predictIntegratedTransform(SimdScalar timeStep,SimdTransform& predictedTransform) const -{ - SimdTransformUtil::IntegrateTransform(m_worldTransform,m_linearVelocity,m_angularVelocity,timeStep,predictedTransform); -} - -void RigidBody::saveKinematicState(SimdScalar timeStep) -{ - - if (m_kinematicTimeStep) - { - SimdVector3 linVel,angVel; - SimdTransformUtil::CalculateVelocity(m_interpolationWorldTransform,m_worldTransform,m_kinematicTimeStep,m_linearVelocity,m_angularVelocity); - //printf("angular = %f %f %f\n",m_angularVelocity.getX(),m_angularVelocity.getY(),m_angularVelocity.getZ()); - } - - - m_interpolationWorldTransform = m_worldTransform; - - m_kinematicTimeStep = timeStep; -} - -void RigidBody::getAabb(SimdVector3& aabbMin,SimdVector3& aabbMax) const -{ - GetCollisionShape()->GetAabb(m_worldTransform,aabbMin,aabbMax); -} - - - - -void RigidBody::setGravity(const SimdVector3& acceleration) -{ - if (m_inverseMass != 0.0f) - { - m_gravity = acceleration * (1.0f / m_inverseMass); - } -} - - - - - - -void RigidBody::setDamping(SimdScalar lin_damping, SimdScalar ang_damping) -{ - m_linearDamping = GEN_clamped(lin_damping, 0.0f, 1.0f); - m_angularDamping = GEN_clamped(ang_damping, 0.0f, 1.0f); -} - - - -#include <stdio.h> - - -void RigidBody::applyForces(SimdScalar step) -{ - if (IsStatic()) - return; - - - applyCentralForce(m_gravity); - - m_linearVelocity *= GEN_clamped((1.f - step * gLinearAirDamping * m_linearDamping), 0.0f, 1.0f); - m_angularVelocity *= GEN_clamped((1.f - step * m_angularDamping), 0.0f, 1.0f); - -#define FORCE_VELOCITY_DAMPING 1 -#ifdef FORCE_VELOCITY_DAMPING - float speed = m_linearVelocity.length(); - if (speed < m_linearDamping) - { - float dampVel = 0.005f; - if (speed > dampVel) - { - SimdVector3 dir = m_linearVelocity.normalized(); - m_linearVelocity -= dir * dampVel; - } else - { - m_linearVelocity.setValue(0.f,0.f,0.f); - } - } - - float angSpeed = m_angularVelocity.length(); - if (angSpeed < m_angularDamping) - { - float angDampVel = 0.005f; - if (angSpeed > angDampVel) - { - SimdVector3 dir = m_angularVelocity.normalized(); - m_angularVelocity -= dir * angDampVel; - } else - { - m_angularVelocity.setValue(0.f,0.f,0.f); - } - } -#endif //FORCE_VELOCITY_DAMPING - -} - -void RigidBody::proceedToTransform(const SimdTransform& newTrans) -{ - setCenterOfMassTransform( newTrans ); -} - - -void RigidBody::setMassProps(SimdScalar mass, const SimdVector3& inertia) -{ - if (mass == 0.f) - { - m_collisionFlags = CollisionObject::isStatic; - m_inverseMass = 0.f; - } else - { - m_collisionFlags = 0; - m_inverseMass = 1.0f / mass; - } - - - m_invInertiaLocal.setValue(inertia[0] != 0.0f ? 1.0f / inertia[0]: 0.0f, - inertia[1] != 0.0f ? 1.0f / inertia[1]: 0.0f, - inertia[2] != 0.0f ? 1.0f / inertia[2]: 0.0f); - -} - - - -void RigidBody::updateInertiaTensor() -{ - m_invInertiaTensorWorld = m_worldTransform.getBasis().scaled(m_invInertiaLocal) * m_worldTransform.getBasis().transpose(); -} - - -void RigidBody::integrateVelocities(SimdScalar step) -{ - if (IsStatic()) - return; - - m_linearVelocity += m_totalForce * (m_inverseMass * step); - m_angularVelocity += m_invInertiaTensorWorld * m_totalTorque * step; - -#define MAX_ANGVEL SIMD_HALF_PI - /// clamp angular velocity. collision calculations will fail on higher angular velocities - float angvel = m_angularVelocity.length(); - if (angvel*step > MAX_ANGVEL) - { - m_angularVelocity *= (MAX_ANGVEL/step) /angvel; - } - - clearForces(); -} - -SimdQuaternion RigidBody::getOrientation() const -{ - SimdQuaternion orn; - m_worldTransform.getBasis().getRotation(orn); - return orn; -} - - -void RigidBody::setCenterOfMassTransform(const SimdTransform& xform) -{ - m_worldTransform = xform; - updateInertiaTensor(); -} - - - diff --git a/extern/bullet/BulletDynamics/Dynamics/RigidBody.h b/extern/bullet/BulletDynamics/Dynamics/RigidBody.h deleted file mode 100644 index ba2399d2da4..00000000000 --- a/extern/bullet/BulletDynamics/Dynamics/RigidBody.h +++ /dev/null @@ -1,258 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef RIGIDBODY_H -#define RIGIDBODY_H - -#include <vector> -#include <SimdPoint3.h> -#include <SimdTransform.h> -#include "BroadphaseCollision/BroadphaseProxy.h" - - -#include "CollisionDispatch/CollisionObject.h" - -class CollisionShape; -struct MassProps; -typedef SimdScalar dMatrix3[4*3]; - -extern float gLinearAirDamping; -extern bool gUseEpa; - - - -/// RigidBody class for RigidBody Dynamics -/// -class RigidBody : public CollisionObject -{ -public: - - RigidBody(const MassProps& massProps,SimdScalar linearDamping,SimdScalar angularDamping,SimdScalar friction,SimdScalar restitution); - - void proceedToTransform(const SimdTransform& newTrans); - - - /// continuous collision detection needs prediction - void predictIntegratedTransform(SimdScalar step, SimdTransform& predictedTransform) const; - - void saveKinematicState(SimdScalar step); - - - void applyForces(SimdScalar step); - - void setGravity(const SimdVector3& acceleration); - - void setDamping(SimdScalar lin_damping, SimdScalar ang_damping); - - inline const CollisionShape* GetCollisionShape() const { - return m_collisionShape; - } - - inline CollisionShape* GetCollisionShape() { - return m_collisionShape; - } - - void setMassProps(SimdScalar mass, const SimdVector3& inertia); - - SimdScalar getInvMass() const { return m_inverseMass; } - const SimdMatrix3x3& getInvInertiaTensorWorld() const { - return m_invInertiaTensorWorld; - } - - void integrateVelocities(SimdScalar step); - - void setCenterOfMassTransform(const SimdTransform& xform); - - void applyCentralForce(const SimdVector3& force) - { - m_totalForce += force; - } - - const SimdVector3& getInvInertiaDiagLocal() - { - return m_invInertiaLocal; - }; - - void setInvInertiaDiagLocal(const SimdVector3& diagInvInertia) - { - m_invInertiaLocal = diagInvInertia; - } - - void applyTorque(const SimdVector3& torque) - { - m_totalTorque += torque; - } - - void applyForce(const SimdVector3& force, const SimdVector3& rel_pos) - { - applyCentralForce(force); - applyTorque(rel_pos.cross(force)); - } - - void applyCentralImpulse(const SimdVector3& impulse) - { - m_linearVelocity += impulse * m_inverseMass; - } - - void applyTorqueImpulse(const SimdVector3& torque) - { - if (!IsStatic()) - m_angularVelocity += m_invInertiaTensorWorld * torque; - - } - - void applyImpulse(const SimdVector3& impulse, const SimdVector3& rel_pos) - { - if (m_inverseMass != 0.f) - { - applyCentralImpulse(impulse); - applyTorqueImpulse(rel_pos.cross(impulse)); - } - } - - void clearForces() - { - m_totalForce.setValue(0.0f, 0.0f, 0.0f); - m_totalTorque.setValue(0.0f, 0.0f, 0.0f); - } - - void updateInertiaTensor(); - - const SimdPoint3& getCenterOfMassPosition() const { - return m_worldTransform.getOrigin(); - } - SimdQuaternion getOrientation() const; - - const SimdTransform& getCenterOfMassTransform() const { - return m_worldTransform; - } - const SimdVector3& getLinearVelocity() const { - return m_linearVelocity; - } - const SimdVector3& getAngularVelocity() const { - return m_angularVelocity; - } - - - void setLinearVelocity(const SimdVector3& lin_vel); - void setAngularVelocity(const SimdVector3& ang_vel) { - if (!IsStatic()) - { - m_angularVelocity = ang_vel; - } - } - - SimdVector3 getVelocityInLocalPoint(const SimdVector3& rel_pos) const - { - //we also calculate lin/ang velocity for kinematic objects - return m_linearVelocity + m_angularVelocity.cross(rel_pos); - - //for kinematic objects, we could also use use: - // return (m_worldTransform(rel_pos) - m_interpolationWorldTransform(rel_pos)) / m_kinematicTimeStep; - } - - void translate(const SimdVector3& v) - { - m_worldTransform.getOrigin() += v; - } - - - void getAabb(SimdVector3& aabbMin,SimdVector3& aabbMax) const; - - - - - - inline float ComputeImpulseDenominator(const SimdPoint3& pos, const SimdVector3& normal) const - { - SimdVector3 r0 = pos - getCenterOfMassPosition(); - - SimdVector3 c0 = (r0).cross(normal); - - SimdVector3 vec = (c0 * getInvInertiaTensorWorld()).cross(r0); - - return m_inverseMass + normal.dot(vec); - - } - - inline float ComputeAngularImpulseDenominator(const SimdVector3& axis) const - { - SimdVector3 vec = axis * getInvInertiaTensorWorld(); - return axis.dot(vec); - } - - - -private: - - SimdMatrix3x3 m_invInertiaTensorWorld; - SimdVector3 m_gravity; - SimdVector3 m_invInertiaLocal; - SimdVector3 m_totalForce; - SimdVector3 m_totalTorque; -// SimdQuaternion m_orn1; - - SimdVector3 m_linearVelocity; - - SimdVector3 m_angularVelocity; - - SimdScalar m_linearDamping; - SimdScalar m_angularDamping; - SimdScalar m_inverseMass; - - - SimdScalar m_kinematicTimeStep; - - BroadphaseProxy* m_broadphaseProxy; - - - - - - -public: - const BroadphaseProxy* GetBroadphaseProxy() const - { - return m_broadphaseProxy; - } - BroadphaseProxy* GetBroadphaseProxy() - { - return m_broadphaseProxy; - } - void SetBroadphaseProxy(BroadphaseProxy* broadphaseProxy) - { - m_broadphaseProxy = broadphaseProxy; - } - - - - /// for ode solver-binding - dMatrix3 m_R;//temp - dMatrix3 m_I; - dMatrix3 m_invI; - - int m_odeTag; - - SimdVector3 m_tacc;//temp - SimdVector3 m_facc; - - - - int m_debugBodyId; -}; - - - -#endif diff --git a/extern/bullet/BulletDynamics/Makefile b/extern/bullet/BulletDynamics/Makefile deleted file mode 100644 index a2cdbe513ec..00000000000 --- a/extern/bullet/BulletDynamics/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. The Blender -# Foundation also sells licenses for use in proprietary software under -# the Blender License. See http://www.blender.org/BL/ for information -# about this. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# 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. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL/BL DUAL LICENSE BLOCK ***** -# opennl intern Makefile -# - -LIBNAME = bulletdyn -SOURCEDIR = extern/bullet/BulletDynamics -DIR = $(OCGDIR)/$(SOURCEDIR) - -CCSRCS = $(wildcard Vehicle/*.cpp) -CCSRCS += $(wildcard ConstraintSolver/*.cpp) -CCSRCS += $(wildcard Dynamics/*.cpp) - -CPPFLAGS += -DUSE_DOUBLES -DQHULL -D_LIB -CPPFLAGS += -I../Bullet -I../BulletDynamics -I../LinearMath - -all debug:: objdirs - -include nan_compile.mk - -.PHONY: objdirs -objdirs: - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR) - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)Vehicle - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)ConstraintSolver - @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)Dynamics - -optclean:: - @-[ ! -d $(DIR)/Vehicle ] || (cd $(DIR)/Vehicle && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/ConstraintSolver ] || (cd $(DIR)/ConstraintSolver && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/Dynamics ] || (cd $(DIR)/Dynamics && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - -debugclean:: - @-[ ! -d $(DIR)/debug/Vehicle ] || (cd $(DIR)/debug/Vehicle && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/debug/ConstraintSolver ] || (cd $(DIR)/debug/ConstraintSolver && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) - @-[ ! -d $(DIR)/debug/Dynamics ] || (cd $(DIR)/debug/Dynamics && $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h) diff --git a/extern/bullet/BulletDynamics/Vehicle/RaycastVehicle.cpp b/extern/bullet/BulletDynamics/Vehicle/RaycastVehicle.cpp deleted file mode 100755 index 362720483dd..00000000000 --- a/extern/bullet/BulletDynamics/Vehicle/RaycastVehicle.cpp +++ /dev/null @@ -1,605 +0,0 @@ -/* - * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies. - * Erwin Coumans makes no representations about the suitability - * of this software for any purpose. - * It is provided "as is" without express or implied warranty. -*/ - -#include "RaycastVehicle.h" -#include "ConstraintSolver/Solve2LinearConstraint.h" -#include "ConstraintSolver/JacobianEntry.h" -#include "SimdQuaternion.h" -#include "SimdVector3.h" -#include "VehicleRaycaster.h" -#include "WheelInfo.h" - - -#include "Dynamics/MassProps.h" -#include "ConstraintSolver/ContactConstraint.h" - - - -static RigidBody s_fixedObject( MassProps ( 0.0f, SimdVector3(0,0,0) ),0.f,0.f,0.f,0.f); - -RaycastVehicle::RaycastVehicle(const VehicleTuning& tuning,RigidBody* chassis, VehicleRaycaster* raycaster ) -:m_vehicleRaycaster(raycaster), -m_pitchControl(0.f) -{ - m_chassisBody = chassis; - m_indexRightAxis = 0; - m_indexUpAxis = 2; - m_indexForwardAxis = 1; - DefaultInit(tuning); -} - - -void RaycastVehicle::DefaultInit(const VehicleTuning& tuning) -{ - m_currentVehicleSpeedKmHour = 0.f; - m_steeringValue = 0.f; - -} - - - -RaycastVehicle::~RaycastVehicle() -{ -} - - -// -// basically most of the code is general for 2 or 4 wheel vehicles, but some of it needs to be reviewed -// -WheelInfo& RaycastVehicle::AddWheel( const SimdVector3& connectionPointCS, const SimdVector3& wheelDirectionCS0,const SimdVector3& wheelAxleCS, SimdScalar suspensionRestLength, SimdScalar wheelRadius,const VehicleTuning& tuning, bool isFrontWheel) -{ - - WheelInfoConstructionInfo ci; - - ci.m_chassisConnectionCS = connectionPointCS; - ci.m_wheelDirectionCS = wheelDirectionCS0; - ci.m_wheelAxleCS = wheelAxleCS; - ci.m_suspensionRestLength = suspensionRestLength; - ci.m_wheelRadius = wheelRadius; - ci.m_suspensionStiffness = tuning.m_suspensionStiffness; - ci.m_wheelsDampingCompression = tuning.m_suspensionCompression; - ci.m_wheelsDampingRelaxation = tuning.m_suspensionDamping; - ci.m_frictionSlip = tuning.m_frictionSlip; - ci.m_bIsFrontWheel = isFrontWheel; - ci.m_maxSuspensionTravelCm = tuning.m_maxSuspensionTravelCm; - - m_wheelInfo.push_back( WheelInfo(ci)); - - WheelInfo& wheel = m_wheelInfo[GetNumWheels()-1]; - - UpdateWheelTransformsWS( wheel ); - return wheel; -} - - - - -const SimdTransform& RaycastVehicle::GetWheelTransformWS( int wheelIndex ) const -{ - assert(wheelIndex < GetNumWheels()); - const WheelInfo& wheel = m_wheelInfo[wheelIndex]; - return wheel.m_worldTransform; - -} - -void RaycastVehicle::UpdateWheelTransform( int wheelIndex ) -{ - - WheelInfo& wheel = m_wheelInfo[ wheelIndex ]; - UpdateWheelTransformsWS(wheel); - SimdVector3 up = -wheel.m_raycastInfo.m_wheelDirectionWS; - const SimdVector3& right = wheel.m_raycastInfo.m_wheelAxleWS; - SimdVector3 fwd = up.cross(right); - fwd = fwd.normalize(); - //rotate around steering over de wheelAxleWS - float steering = wheel.m_steering; - - SimdQuaternion steeringOrn(up,steering);//wheel.m_steering); - SimdMatrix3x3 steeringMat(steeringOrn); - - SimdQuaternion rotatingOrn(right,wheel.m_rotation); - SimdMatrix3x3 rotatingMat(rotatingOrn); - - SimdMatrix3x3 basis2( - right[0],fwd[0],up[0], - right[1],fwd[1],up[1], - right[2],fwd[2],up[2] - ); - - wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * basis2); - wheel.m_worldTransform.setOrigin( - wheel.m_raycastInfo.m_hardPointWS + wheel.m_raycastInfo.m_wheelDirectionWS * wheel.m_raycastInfo.m_suspensionLength - ); -} - -void RaycastVehicle::ResetSuspension() -{ - - std::vector<WheelInfo>::iterator wheelIt; - for (wheelIt = m_wheelInfo.begin(); - !(wheelIt == m_wheelInfo.end());wheelIt++) - { - WheelInfo& wheel = *wheelIt; - wheel.m_raycastInfo.m_suspensionLength = wheel.GetSuspensionRestLength(); - wheel.m_suspensionRelativeVelocity = 0.0f; - - wheel.m_raycastInfo.m_contactNormalWS = - wheel.m_raycastInfo.m_wheelDirectionWS; - //wheel_info.setContactFriction(0.0f); - wheel.m_clippedInvContactDotSuspension = 1.0f; - } -} - -void RaycastVehicle::UpdateWheelTransformsWS(WheelInfo& wheel ) -{ - wheel.m_raycastInfo.m_isInContact = false; - - const SimdTransform& chassisTrans = GetRigidBody()->getCenterOfMassTransform(); - - wheel.m_raycastInfo.m_hardPointWS = chassisTrans( wheel.m_chassisConnectionPointCS ); - wheel.m_raycastInfo.m_wheelDirectionWS = chassisTrans.getBasis() * wheel.m_wheelDirectionCS ; - wheel.m_raycastInfo.m_wheelAxleWS = chassisTrans.getBasis() * wheel.m_wheelAxleCS; -} - -SimdScalar RaycastVehicle::Raycast(WheelInfo& wheel) -{ - UpdateWheelTransformsWS( wheel ); - - - SimdScalar depth = -1; - - SimdScalar raylen = wheel.GetSuspensionRestLength()+wheel.m_wheelsRadius; - - SimdVector3 rayvector = wheel.m_raycastInfo.m_wheelDirectionWS * (raylen); - const SimdVector3& source = wheel.m_raycastInfo.m_hardPointWS; - wheel.m_raycastInfo.m_contactPointWS = source + rayvector; - const SimdVector3& target = wheel.m_raycastInfo.m_contactPointWS; - - SimdScalar param = 0.f; - - VehicleRaycaster::VehicleRaycasterResult rayResults; - - void* object = m_vehicleRaycaster->CastRay(source,target,rayResults); - - wheel.m_raycastInfo.m_groundObject = 0; - - if (object) - { - param = rayResults.m_distFraction; - depth = raylen * rayResults.m_distFraction; - wheel.m_raycastInfo.m_contactNormalWS = rayResults.m_hitNormalInWorld; - wheel.m_raycastInfo.m_isInContact = true; - - wheel.m_raycastInfo.m_groundObject = &s_fixedObject;//todo for driving on dynamic/movable objects!; - //wheel.m_raycastInfo.m_groundObject = object; - - - SimdScalar hitDistance = param*raylen; - wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelsRadius; - //clamp on max suspension travel - - float minSuspensionLength = wheel.GetSuspensionRestLength() - wheel.m_maxSuspensionTravelCm*0.01f; - float maxSuspensionLength = wheel.GetSuspensionRestLength()+ wheel.m_maxSuspensionTravelCm*0.01f; - if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength) - { - wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength; - } - if (wheel.m_raycastInfo.m_suspensionLength > maxSuspensionLength) - { - wheel.m_raycastInfo.m_suspensionLength = maxSuspensionLength; - } - - wheel.m_raycastInfo.m_contactPointWS = rayResults.m_hitPointInWorld; - - SimdScalar denominator= wheel.m_raycastInfo.m_contactNormalWS.dot( wheel.m_raycastInfo.m_wheelDirectionWS ); - - SimdVector3 chassis_velocity_at_contactPoint; - SimdVector3 relpos = wheel.m_raycastInfo.m_contactPointWS-GetRigidBody()->getCenterOfMassPosition(); - - chassis_velocity_at_contactPoint = GetRigidBody()->getVelocityInLocalPoint(relpos); - - SimdScalar projVel = wheel.m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint ); - - if ( denominator >= -0.1f) - { - wheel.m_suspensionRelativeVelocity = 0.0f; - wheel.m_clippedInvContactDotSuspension = 1.0f / 0.1f; - } - else - { - SimdScalar inv = -1.f / denominator; - wheel.m_suspensionRelativeVelocity = projVel * inv; - wheel.m_clippedInvContactDotSuspension = inv; - } - - } else - { - //put wheel info as in rest position - wheel.m_raycastInfo.m_suspensionLength = wheel.GetSuspensionRestLength(); - wheel.m_suspensionRelativeVelocity = 0.0f; - wheel.m_raycastInfo.m_contactNormalWS = - wheel.m_raycastInfo.m_wheelDirectionWS; - wheel.m_clippedInvContactDotSuspension = 1.0f; - } - - return depth; -} - - -void RaycastVehicle::UpdateVehicle( SimdScalar step ) -{ - - m_currentVehicleSpeedKmHour = 3.6f * GetRigidBody()->getLinearVelocity().length(); - - const SimdTransform& chassisTrans = GetRigidBody()->getCenterOfMassTransform(); - SimdVector3 forwardW ( - chassisTrans.getBasis()[0][m_indexForwardAxis], - chassisTrans.getBasis()[1][m_indexForwardAxis], - chassisTrans.getBasis()[2][m_indexForwardAxis]); - - if (forwardW.dot(GetRigidBody()->getLinearVelocity()) < 0.f) - { - m_currentVehicleSpeedKmHour *= -1.f; - } - - // - // simulate suspension - // - std::vector<WheelInfo>::iterator wheelIt; - int i=0; - for (wheelIt = m_wheelInfo.begin(); - !(wheelIt == m_wheelInfo.end());wheelIt++,i++) - { - WheelInfo& wheelInfo = *wheelIt; - - SimdScalar depth; - depth = Raycast( *wheelIt ); - } - - UpdateSuspension(step); - - - for (wheelIt = m_wheelInfo.begin(); - !(wheelIt == m_wheelInfo.end());wheelIt++) - { - //apply suspension force - WheelInfo& wheel = *wheelIt; - - float suspensionForce = wheel.m_wheelsSuspensionForce; - - float gMaxSuspensionForce = 6000.f; - if (suspensionForce > gMaxSuspensionForce) - { - suspensionForce = gMaxSuspensionForce; - } - SimdVector3 impulse = wheel.m_raycastInfo.m_contactNormalWS * suspensionForce * step; - SimdVector3 relpos = wheel.m_raycastInfo.m_contactPointWS - GetRigidBody()->getCenterOfMassPosition(); - - GetRigidBody()->applyImpulse(impulse, relpos); - - } - - - - UpdateFriction( step); - - - for (wheelIt = m_wheelInfo.begin(); - !(wheelIt == m_wheelInfo.end());wheelIt++) - { - WheelInfo& wheel = *wheelIt; - SimdVector3 relpos = wheel.m_raycastInfo.m_hardPointWS - GetRigidBody()->getCenterOfMassPosition(); - SimdVector3 vel = GetRigidBody()->getVelocityInLocalPoint( relpos ); - - if (wheel.m_raycastInfo.m_isInContact) - { - SimdVector3 fwd ( - GetRigidBody()->getCenterOfMassTransform().getBasis()[0][m_indexForwardAxis], - GetRigidBody()->getCenterOfMassTransform().getBasis()[1][m_indexForwardAxis], - GetRigidBody()->getCenterOfMassTransform().getBasis()[2][m_indexForwardAxis]); - - SimdScalar proj = fwd.dot(wheel.m_raycastInfo.m_contactNormalWS); - fwd -= wheel.m_raycastInfo.m_contactNormalWS * proj; - - SimdScalar proj2 = fwd.dot(vel); - - wheel.m_deltaRotation = (proj2 * step) / (wheel.m_wheelsRadius); - wheel.m_rotation += wheel.m_deltaRotation; - - } else - { - wheel.m_rotation += wheel.m_deltaRotation; - } - - wheel.m_deltaRotation *= 0.99f;//damping of rotation when not in contact - - } - - - -} - - -void RaycastVehicle::SetSteeringValue(SimdScalar steering,int wheel) -{ - assert(wheel>=0 && wheel < GetNumWheels()); - - WheelInfo& wheelInfo = GetWheelInfo(wheel); - wheelInfo.m_steering = steering; -} - - - -SimdScalar RaycastVehicle::GetSteeringValue(int wheel) const -{ - return GetWheelInfo(wheel).m_steering; -} - - -void RaycastVehicle::ApplyEngineForce(SimdScalar force, int wheel) -{ - for (int i=0;i<GetNumWheels();i++) - { - WheelInfo& wheelInfo = GetWheelInfo(i); - - bool applyOnFrontWheel = !wheel; - - if (applyOnFrontWheel == wheelInfo.m_bIsFrontWheel) - { - wheelInfo.m_engineForce = force; - } - } -} - - -const WheelInfo& RaycastVehicle::GetWheelInfo(int index) const -{ - ASSERT((index >= 0) && (index < GetNumWheels())); - - return m_wheelInfo[index]; -} - -WheelInfo& RaycastVehicle::GetWheelInfo(int index) -{ - ASSERT((index >= 0) && (index < GetNumWheels())); - - return m_wheelInfo[index]; -} - -void RaycastVehicle::SetBrake(float brake,int wheelIndex) -{ - ASSERT((wheelIndex >= 0) && (wheelIndex < GetNumWheels())); - GetWheelInfo(wheelIndex).m_brake; -} - - -void RaycastVehicle::UpdateSuspension(SimdScalar deltaTime) -{ - - SimdScalar chassisMass = 1.f / m_chassisBody->getInvMass(); - - for (int w_it=0; w_it<GetNumWheels(); w_it++) - { - WheelInfo &wheel_info = m_wheelInfo[w_it]; - - if ( wheel_info.m_raycastInfo.m_isInContact ) - { - SimdScalar force; - // Spring - { - SimdScalar susp_length = wheel_info.GetSuspensionRestLength(); - SimdScalar current_length = wheel_info.m_raycastInfo.m_suspensionLength; - - SimdScalar length_diff = (susp_length - current_length); - - force = wheel_info.m_suspensionStiffness - * length_diff * wheel_info.m_clippedInvContactDotSuspension; - } - - // Damper - { - SimdScalar projected_rel_vel = wheel_info.m_suspensionRelativeVelocity; - { - SimdScalar susp_damping; - if ( projected_rel_vel < 0.0f ) - { - susp_damping = wheel_info.m_wheelsDampingCompression; - } - else - { - susp_damping = wheel_info.m_wheelsDampingRelaxation; - } - force -= susp_damping * projected_rel_vel; - } - } - - // RESULT - wheel_info.m_wheelsSuspensionForce = force * chassisMass; - if (wheel_info.m_wheelsSuspensionForce < 0.f) - { - wheel_info.m_wheelsSuspensionForce = 0.f; - } - } - else - { - wheel_info.m_wheelsSuspensionForce = 0.0f; - } - } - -} - -float sideFrictionStiffness2 = 1.0f; -void RaycastVehicle::UpdateFriction(SimdScalar timeStep) -{ - - //calculate the impulse, so that the wheels don't move sidewards - int numWheel = GetNumWheels(); - if (!numWheel) - return; - - - SimdVector3* forwardWS = new SimdVector3[numWheel]; - SimdVector3* axle = new SimdVector3[numWheel]; - SimdScalar* forwardImpulse = new SimdScalar[numWheel]; - SimdScalar* sideImpulse = new SimdScalar[numWheel]; - - int numWheelsOnGround = 0; - - - //collapse all those loops into one! - for (int i=0;i<GetNumWheels();i++) - { - WheelInfo& wheelInfo = m_wheelInfo[i]; - class RigidBody* groundObject = (class RigidBody*) wheelInfo.m_raycastInfo.m_groundObject; - if (groundObject) - numWheelsOnGround++; - sideImpulse[i] = 0.f; - forwardImpulse[i] = 0.f; - - } - - { - - for (int i=0;i<GetNumWheels();i++) - { - - WheelInfo& wheelInfo = m_wheelInfo[i]; - - class RigidBody* groundObject = (class RigidBody*) wheelInfo.m_raycastInfo.m_groundObject; - - if (groundObject) - { - - const SimdTransform& wheelTrans = GetWheelTransformWS( i ); - - SimdMatrix3x3 wheelBasis0 = wheelTrans.getBasis(); - axle[i] = SimdVector3( - wheelBasis0[0][m_indexRightAxis], - wheelBasis0[1][m_indexRightAxis], - wheelBasis0[2][m_indexRightAxis]); - - const SimdVector3& surfNormalWS = wheelInfo.m_raycastInfo.m_contactNormalWS; - SimdScalar proj = axle[i].dot(surfNormalWS); - axle[i] -= surfNormalWS * proj; - axle[i] = axle[i].normalize(); - - forwardWS[i] = surfNormalWS.cross(axle[i]); - forwardWS[i].normalize(); - - - resolveSingleBilateral(*m_chassisBody, wheelInfo.m_raycastInfo.m_contactPointWS, - *groundObject, wheelInfo.m_raycastInfo.m_contactPointWS, - 0.f, axle[i],sideImpulse[i],timeStep); - - sideImpulse[i] *= sideFrictionStiffness2; - - } - - - } - } - - SimdScalar sideFactor = 1.f; - SimdScalar fwdFactor = 0.5; - - bool sliding = false; - { - for (int wheel =0;wheel <GetNumWheels();wheel++) - { - WheelInfo& wheelInfo = m_wheelInfo[wheel]; - class RigidBody* groundObject = (class RigidBody*) wheelInfo.m_raycastInfo.m_groundObject; - - - forwardImpulse[wheel] = 0.f; - m_wheelInfo[wheel].m_skidInfo= 1.f; - - if (groundObject) - { - m_wheelInfo[wheel].m_skidInfo= 1.f; - - SimdScalar maximp = wheelInfo.m_wheelsSuspensionForce * timeStep * wheelInfo.m_frictionSlip; - SimdScalar maximpSide = maximp; - - SimdScalar maximpSquared = maximp * maximpSide; - - forwardImpulse[wheel] = wheelInfo.m_engineForce* timeStep; - - float x = (forwardImpulse[wheel] ) * fwdFactor; - float y = (sideImpulse[wheel] ) * sideFactor; - - float impulseSquared = (x*x + y*y); - - if (impulseSquared > maximpSquared) - { - sliding = true; - - SimdScalar factor = maximp / SimdSqrt(impulseSquared); - - m_wheelInfo[wheel].m_skidInfo *= factor; - } - } - - } - } - - - - - if (sliding) - { - for (int wheel = 0;wheel < GetNumWheels(); wheel++) - { - if (sideImpulse[wheel] != 0.f) - { - if (m_wheelInfo[wheel].m_skidInfo< 1.f) - { - forwardImpulse[wheel] *= m_wheelInfo[wheel].m_skidInfo; - sideImpulse[wheel] *= m_wheelInfo[wheel].m_skidInfo; - } - } - } - } - - // apply the impulses - { - for (int wheel = 0;wheel<GetNumWheels() ; wheel++) - { - WheelInfo& wheelInfo = m_wheelInfo[wheel]; - - SimdVector3 rel_pos = wheelInfo.m_raycastInfo.m_contactPointWS - - m_chassisBody->getCenterOfMassPosition(); - - if (forwardImpulse[wheel] != 0.f) - { - m_chassisBody->applyImpulse(forwardWS[wheel]*(forwardImpulse[wheel]),rel_pos); - } - if (sideImpulse[wheel] != 0.f) - { - class RigidBody* groundObject = (class RigidBody*) m_wheelInfo[wheel].m_raycastInfo.m_groundObject; - - SimdVector3 rel_pos2 = wheelInfo.m_raycastInfo.m_contactPointWS - - groundObject->getCenterOfMassPosition(); - - - SimdVector3 sideImp = axle[wheel] * sideImpulse[wheel]; - - rel_pos[2] *= wheelInfo.m_rollInfluence; - m_chassisBody->applyImpulse(sideImp,rel_pos); - - //apply friction impulse on the ground - groundObject->applyImpulse(-sideImp,rel_pos2); - } - } - } - - delete []forwardWS; - delete [] axle; - delete[]forwardImpulse; - delete[] sideImpulse; -} diff --git a/extern/bullet/BulletDynamics/Vehicle/RaycastVehicle.h b/extern/bullet/BulletDynamics/Vehicle/RaycastVehicle.h deleted file mode 100755 index 09b8354fc70..00000000000 --- a/extern/bullet/BulletDynamics/Vehicle/RaycastVehicle.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies. - * Erwin Coumans makes no representations about the suitability - * of this software for any purpose. - * It is provided "as is" without express or implied warranty. -*/ -#ifndef RAYCASTVEHICLE_H -#define RAYCASTVEHICLE_H - -#include "Dynamics/RigidBody.h" -#include "ConstraintSolver/TypedConstraint.h" - -struct MassProps; -#include "WheelInfo.h" - -struct VehicleRaycaster; -class VehicleTuning; - -///Raycast vehicle, very special constraint that turn a rigidbody into a vehicle. -class RaycastVehicle : public TypedConstraint -{ -public: - class VehicleTuning - { - public: - - VehicleTuning() - :m_suspensionStiffness(5.88f), - m_suspensionCompression(0.83f), - m_suspensionDamping(0.88f), - m_maxSuspensionTravelCm(500.f), - m_frictionSlip(10.5f) - { - } - float m_suspensionStiffness; - float m_suspensionCompression; - float m_suspensionDamping; - float m_maxSuspensionTravelCm; - float m_frictionSlip; - - }; -private: - - SimdScalar m_tau; - SimdScalar m_damping; - VehicleRaycaster* m_vehicleRaycaster; - float m_pitchControl; - float m_steeringValue; - float m_currentVehicleSpeedKmHour; - - RigidBody* m_chassisBody; - - int m_indexRightAxis; - int m_indexUpAxis; - int m_indexForwardAxis; - - void DefaultInit(const VehicleTuning& tuning); - -public: - - //constructor to create a car from an existing rigidbody - RaycastVehicle(const VehicleTuning& tuning,RigidBody* chassis, VehicleRaycaster* raycaster ); - - virtual ~RaycastVehicle() ; - - - - - - SimdScalar Raycast(WheelInfo& wheel); - - virtual void UpdateVehicle(SimdScalar step); - - void ResetSuspension(); - - SimdScalar GetSteeringValue(int wheel) const; - - void SetSteeringValue(SimdScalar steering,int wheel); - - - void ApplyEngineForce(SimdScalar force, int wheel); - - const SimdTransform& GetWheelTransformWS( int wheelIndex ) const; - - void UpdateWheelTransform( int wheelIndex ); - - void SetRaycastWheelInfo( int wheelIndex , bool isInContact, const SimdVector3& hitPoint, const SimdVector3& hitNormal,SimdScalar depth); - - WheelInfo& AddWheel( const SimdVector3& connectionPointCS0, const SimdVector3& wheelDirectionCS0,const SimdVector3& wheelAxleCS,SimdScalar suspensionRestLength,SimdScalar wheelRadius,const VehicleTuning& tuning, bool isFrontWheel); - - inline int GetNumWheels() const { - return m_wheelInfo.size(); - } - - std::vector<WheelInfo> m_wheelInfo; - - - const WheelInfo& GetWheelInfo(int index) const; - - WheelInfo& GetWheelInfo(int index); - - void UpdateWheelTransformsWS(WheelInfo& wheel ); - - - void SetBrake(float brake,int wheelIndex); - - void SetPitchControl(float pitch) - { - m_pitchControl = pitch; - } - - void UpdateSuspension(SimdScalar deltaTime); - - void UpdateFriction(SimdScalar timeStep); - - - - inline RigidBody* GetRigidBody() - { - return m_chassisBody; - } - - const RigidBody* GetRigidBody() const - { - return m_chassisBody; - } - - inline int GetRightAxis() const - { - return m_indexRightAxis; - } - inline int GetUpAxis() const - { - return m_indexUpAxis; - } - - inline int GetForwardAxis() const - { - return m_indexForwardAxis; - } - - virtual void BuildJacobian() - { - //not yet - } - - virtual void SolveConstraint(SimdScalar timeStep) - { - //not yet - } - - -}; - -#endif //RAYCASTVEHICLE_H - diff --git a/extern/bullet/BulletDynamics/Vehicle/VehicleRaycaster.h b/extern/bullet/BulletDynamics/Vehicle/VehicleRaycaster.h deleted file mode 100755 index ddbb02e31bd..00000000000 --- a/extern/bullet/BulletDynamics/Vehicle/VehicleRaycaster.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies. - * Erwin Coumans makes no representations about the suitability - * of this software for any purpose. - * It is provided "as is" without express or implied warranty. -*/ -#ifndef VEHICLE_RAYCASTER_H -#define VEHICLE_RAYCASTER_H - -#include "SimdVector3.h" - -/// VehicleRaycaster is provides interface for between vehicle simulation and raycasting -struct VehicleRaycaster -{ - struct VehicleRaycasterResult - { - VehicleRaycasterResult() :m_distFraction(-1.f){}; - SimdVector3 m_hitPointInWorld; - SimdVector3 m_hitNormalInWorld; - SimdScalar m_distFraction; - }; - - virtual void* CastRay(const SimdVector3& from,const SimdVector3& to, VehicleRaycasterResult& result) = 0; - -}; - -#endif //VEHICLE_RAYCASTER_H - diff --git a/extern/bullet/BulletDynamics/Vehicle/WheelInfo.cpp b/extern/bullet/BulletDynamics/Vehicle/WheelInfo.cpp deleted file mode 100755 index 480fb484671..00000000000 --- a/extern/bullet/BulletDynamics/Vehicle/WheelInfo.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies. - * Erwin Coumans makes no representations about the suitability - * of this software for any purpose. - * It is provided "as is" without express or implied warranty. -*/ -#include "WheelInfo.h" -#include "Dynamics/RigidBody.h" // for pointvelocity - - -SimdScalar WheelInfo::GetSuspensionRestLength() const -{ - - return m_suspensionRestLength1; - -} - -void WheelInfo::UpdateWheel(const RigidBody& chassis,RaycastInfo& raycastInfo) -{ - - - if (m_raycastInfo.m_isInContact) - - { - SimdScalar project= m_raycastInfo.m_contactNormalWS.dot( m_raycastInfo.m_wheelDirectionWS ); - SimdVector3 chassis_velocity_at_contactPoint; - SimdVector3 relpos = m_raycastInfo.m_contactPointWS - chassis.getCenterOfMassPosition(); - chassis_velocity_at_contactPoint = chassis.getVelocityInLocalPoint( relpos ); - SimdScalar projVel = m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint ); - if ( project >= -0.1f) - { - m_suspensionRelativeVelocity = 0.0f; - m_clippedInvContactDotSuspension = 1.0f / 0.1f; - } - else - { - SimdScalar inv = -1.f / project; - m_suspensionRelativeVelocity = projVel * inv; - m_clippedInvContactDotSuspension = inv; - } - - } - - else // Not in contact : position wheel in a nice (rest length) position - { - m_raycastInfo.m_suspensionLength = this->GetSuspensionRestLength(); - m_suspensionRelativeVelocity = 0.0f; - m_raycastInfo.m_contactNormalWS = -m_raycastInfo.m_wheelDirectionWS; - m_clippedInvContactDotSuspension = 1.0f; - } -} diff --git a/extern/bullet/BulletDynamics/Vehicle/WheelInfo.h b/extern/bullet/BulletDynamics/Vehicle/WheelInfo.h deleted file mode 100755 index 5d7c70c1e06..00000000000 --- a/extern/bullet/BulletDynamics/Vehicle/WheelInfo.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies. - * Erwin Coumans makes no representations about the suitability - * of this software for any purpose. - * It is provided "as is" without express or implied warranty. -*/ -#ifndef WHEEL_INFO_H -#define WHEEL_INFO_H - -#include "SimdVector3.h" -#include "SimdTransform.h" - -class RigidBody; - -struct WheelInfoConstructionInfo -{ - SimdVector3 m_chassisConnectionCS; - SimdVector3 m_wheelDirectionCS; - SimdVector3 m_wheelAxleCS; - SimdScalar m_suspensionRestLength; - SimdScalar m_maxSuspensionTravelCm; - SimdScalar m_wheelRadius; - - float m_suspensionStiffness; - float m_wheelsDampingCompression; - float m_wheelsDampingRelaxation; - float m_frictionSlip; - bool m_bIsFrontWheel; - -}; - -/// WheelInfo contains information per wheel about friction and suspension. -struct WheelInfo -{ - struct RaycastInfo - { - //set by raycaster - SimdVector3 m_contactNormalWS;//contactnormal - SimdVector3 m_contactPointWS;//raycast hitpoint - SimdScalar m_suspensionLength; - SimdVector3 m_hardPointWS;//raycast starting point - SimdVector3 m_wheelDirectionWS; //direction in worldspace - SimdVector3 m_wheelAxleWS; // axle in worldspace - bool m_isInContact; - void* m_groundObject; //could be general void* ptr - }; - - RaycastInfo m_raycastInfo; - - SimdTransform m_worldTransform; - - SimdVector3 m_chassisConnectionPointCS; //const - SimdVector3 m_wheelDirectionCS;//const - SimdVector3 m_wheelAxleCS; // const or modified by steering - SimdScalar m_suspensionRestLength1;//const - SimdScalar m_maxSuspensionTravelCm; - SimdScalar GetSuspensionRestLength() const; - SimdScalar m_wheelsRadius;//const - SimdScalar m_suspensionStiffness;//const - SimdScalar m_wheelsDampingCompression;//const - SimdScalar m_wheelsDampingRelaxation;//const - SimdScalar m_frictionSlip; - SimdScalar m_steering; - SimdScalar m_rotation; - SimdScalar m_deltaRotation; - SimdScalar m_rollInfluence; - - SimdScalar m_engineForce; - - SimdScalar m_brake; - - bool m_bIsFrontWheel; - - void* m_clientInfo;//can be used to store pointer to sync transforms... - - WheelInfo(WheelInfoConstructionInfo& ci) - - { - - m_suspensionRestLength1 = ci.m_suspensionRestLength; - m_maxSuspensionTravelCm = ci.m_maxSuspensionTravelCm; - - m_wheelsRadius = ci.m_wheelRadius; - m_suspensionStiffness = ci.m_suspensionStiffness; - m_wheelsDampingCompression = ci.m_wheelsDampingCompression; - m_wheelsDampingRelaxation = ci.m_wheelsDampingRelaxation; - m_chassisConnectionPointCS = ci.m_chassisConnectionCS; - m_wheelDirectionCS = ci.m_wheelDirectionCS; - m_wheelAxleCS = ci.m_wheelAxleCS; - m_frictionSlip = ci.m_frictionSlip; - m_steering = 0.f; - m_engineForce = 0.f; - m_rotation = 0.f; - m_deltaRotation = 0.f; - m_brake = 0.f; - m_rollInfluence = 0.1f; - m_bIsFrontWheel = ci.m_bIsFrontWheel; - - } - - void UpdateWheel(const RigidBody& chassis,RaycastInfo& raycastInfo); - - SimdScalar m_clippedInvContactDotSuspension; - SimdScalar m_suspensionRelativeVelocity; - //calculated by suspension - SimdScalar m_wheelsSuspensionForce; - SimdScalar m_skidInfo; - -}; - -#endif //WHEEL_INFO_H - diff --git a/extern/bullet/BulletLicense.txt b/extern/bullet/BulletLicense.txt deleted file mode 100644 index c3ec68c21fd..00000000000 --- a/extern/bullet/BulletLicense.txt +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -Free for commercial use, but please mail bullet@erwincoumans.com to report projects, and join the forum at -www.continuousphysics.com/Bullet/phpBB2 diff --git a/extern/bullet/CMakeLists.txt b/extern/bullet/CMakeLists.txt deleted file mode 100644 index f8722a6113c..00000000000 --- a/extern/bullet/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# $Id$ -# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. The Blender -# Foundation also sells licenses for use in proprietary software under -# the Blender License. See http://www.blender.org/BL/ for information -# about this. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# 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. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL/BL DUAL LICENSE BLOCK ***** - -SET(INC . Bullet BulletDynamics LinearMath) - -FILE(GLOB SRC - Bullet/BroadphaseCollision/*.cpp - Bullet/CollisionShapes/*.cpp - Bullet/NarrowPhaseCollision/*.cpp - Bullet/CollisionDispatch/*.cpp - BulletDynamics/ConstraintSolver/*.cpp - BulletDynamics/Vehicle/*.cpp - BulletDynamics/Dynamics/*.cpp -) - -ADD_DEFINITIONS(-DUSE_DOUBLES -DQHULL -D_LIB) - -BLENDERLIB(extern_bullet "${SRC}" "${INC}") -#, libtype=['game2', 'player'], priority=[20, 170], compileflags=cflags ) diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics.dsp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics.dsp deleted file mode 100644 index 48d42617d3d..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="CcdPhysics" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=CcdPhysics - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "CcdPhysics.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "CcdPhysics.mak" CFG="CcdPhysics - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "CcdPhysics - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "CcdPhysics - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "CcdPhysics - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "CcdPhysics___Win32_Release" -# PROP BASE Intermediate_Dir "CcdPhysics___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "CcdPhysics___Win32_Release" -# PROP Intermediate_Dir "CcdPhysics___Win32_Release" -# PROP Target_Dir "" -LINK32=link.exe -lib -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\Bullet" /I "..\..\..\LinearMath" /I "..\..\..\BulletDynamics" /I "..\..\..\Extras\PhysicsInterface\Common" /I "..\..\..\Extras\PhysicsInterface\CcdPhysics" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "CcdPhysics - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "CcdPhysics___Win32_Debug" -# PROP BASE Intermediate_Dir "CcdPhysics___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "CcdPhysics___Win32_Debug" -# PROP Intermediate_Dir "CcdPhysics___Win32_Debug" -# PROP Target_Dir "" -LINK32=link.exe -lib -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\Bullet" /I "..\..\..\LinearMath" /I "..\..\..\BulletDynamics" /I "..\..\..\Extras\PhysicsInterface\Common" /I "..\..\..\Extras\PhysicsInterface\CcdPhysics" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "CcdPhysics - Win32 Release" -# Name "CcdPhysics - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\CcdPhysicsController.cpp -# End Source File -# Begin Source File - -SOURCE=.\CcdPhysicsEnvironment.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\CcdPhysicsController.h -# End Source File -# Begin Source File - -SOURCE=.\CcdPhysicsEnvironment.h -# End Source File -# End Group -# End Target -# End Project diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp deleted file mode 100644 index 83bddc8ee1e..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.cpp +++ /dev/null @@ -1,585 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CcdPhysicsController.h" - -#include "Dynamics/RigidBody.h" -#include "PHY_IMotionState.h" -#include "BroadphaseCollision/BroadphaseProxy.h" -#include "BroadphaseCollision/BroadphaseInterface.h" -#include "CollisionShapes/ConvexShape.h" -#include "CcdPhysicsEnvironment.h" -#include "SimdTransformUtil.h" - -#include "CollisionShapes/SphereShape.h" -#include "CollisionShapes/ConeShape.h" - -class BP_Proxy; - -///todo: fill all the empty CcdPhysicsController methods, hook them up to the RigidBody class - -//'temporarily' global variables -float gDeactivationTime = 2.f; -bool gDisableDeactivation = false; - -float gLinearSleepingTreshold = 0.8f; -float gAngularSleepingTreshold = 1.0f; - -#include "Dynamics/MassProps.h" - -SimdVector3 startVel(0,0,0);//-10000); -CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci) -:m_cci(ci) -{ - m_collisionDelay = 0; - m_newClientInfo = 0; - - m_MotionState = ci.m_MotionState; - - - - CreateRigidbody(); - - - - #ifdef WIN32 - if (m_body->getInvMass()) - m_body->setLinearVelocity(startVel); - #endif - -} - -SimdTransform CcdPhysicsController::GetTransformFromMotionState(PHY_IMotionState* motionState) -{ - SimdTransform trans; - float tmp[3]; - motionState->getWorldPosition(tmp[0],tmp[1],tmp[2]); - trans.setOrigin(SimdVector3(tmp[0],tmp[1],tmp[2])); - - SimdQuaternion orn; - motionState->getWorldOrientation(orn[0],orn[1],orn[2],orn[3]); - trans.setRotation(orn); - return trans; - -} - -void CcdPhysicsController::CreateRigidbody() -{ - - SimdTransform trans = GetTransformFromMotionState(m_cci.m_MotionState); - - MassProps mp(m_cci.m_mass, m_cci.m_localInertiaTensor); - - m_body = new RigidBody(mp,0,0,m_cci.m_friction,m_cci.m_restitution); - m_body->m_collisionShape = m_cci.m_collisionShape; - - - // - // init the rigidbody properly - // - - m_body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); - //setMassProps this also sets collisionFlags - m_body->m_collisionFlags = m_cci.m_collisionFlags; - - m_body->setGravity( m_cci.m_gravity); - m_body->setDamping(m_cci.m_linearDamping, m_cci.m_angularDamping); - m_body->setCenterOfMassTransform( trans ); - - -} - -CcdPhysicsController::~CcdPhysicsController() -{ - //will be reference counted, due to sharing - m_cci.m_physicsEnv->removeCcdPhysicsController(this); - delete m_MotionState; - delete m_body; -} - - /** - SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ -bool CcdPhysicsController::SynchronizeMotionStates(float time) -{ - //sync non-static to motionstate, and static from motionstate (todo: add kinematic etc.) - - if (!m_body->IsStatic()) - { - const SimdVector3& worldPos = m_body->getCenterOfMassPosition(); - m_MotionState->setWorldPosition(worldPos[0],worldPos[1],worldPos[2]); - - const SimdQuaternion& worldquat = m_body->getOrientation(); - m_MotionState->setWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]); - - m_MotionState->calculateWorldTransformations(); - - float scale[3]; - m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]); - SimdVector3 scaling(scale[0],scale[1],scale[2]); - GetCollisionShape()->setLocalScaling(scaling); - } else - { - SimdVector3 worldPos; - SimdQuaternion worldquat; - - m_MotionState->getWorldPosition(worldPos[0],worldPos[1],worldPos[2]); - m_MotionState->getWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]); - SimdTransform oldTrans = m_body->getCenterOfMassTransform(); - SimdTransform newTrans(worldquat,worldPos); - - m_body->setCenterOfMassTransform(newTrans); - //need to keep track of previous position for friction effects... - - m_MotionState->calculateWorldTransformations(); - - float scale[3]; - m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]); - SimdVector3 scaling(scale[0],scale[1],scale[2]); - GetCollisionShape()->setLocalScaling(scaling); - } - return true; - -} - - /** - WriteMotionStateToDynamics synchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - -void CcdPhysicsController::WriteMotionStateToDynamics(bool nondynaonly) -{ - -} -void CcdPhysicsController::WriteDynamicsToMotionState() -{ -} - // controller replication -void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl) -{ - m_MotionState = motionstate; - - - - m_body = 0; - CreateRigidbody(); - - m_cci.m_physicsEnv->addCcdPhysicsController(this); - - -/* SM_Object* dynaparent=0; - SumoPhysicsController* sumoparentctrl = (SumoPhysicsController* )parentctrl; - - if (sumoparentctrl) - { - dynaparent = sumoparentctrl->GetSumoObject(); - } - - SM_Object* orgsumoobject = m_sumoObj; - - - m_sumoObj = new SM_Object( - orgsumoobject->getShapeHandle(), - orgsumoobject->getMaterialProps(), - orgsumoobject->getShapeProps(), - dynaparent); - - m_sumoObj->setRigidBody(orgsumoobject->isRigidBody()); - - m_sumoObj->setMargin(orgsumoobject->getMargin()); - m_sumoObj->setPosition(orgsumoobject->getPosition()); - m_sumoObj->setOrientation(orgsumoobject->getOrientation()); - //if it is a dyna, register for a callback - m_sumoObj->registerCallback(*this); - - m_sumoScene->add(* (m_sumoObj)); - */ - - - -} - - // kinematic methods -void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local) -{ - if (m_body) - { - m_body->activate(); - - SimdVector3 dloc(dlocX,dlocY,dlocZ); - SimdTransform xform = m_body->getCenterOfMassTransform(); - - if (local) - { - dloc = xform.getBasis()*dloc; - } - - xform.setOrigin(xform.getOrigin() + dloc); - m_body->setCenterOfMassTransform(xform); - } - -} - -void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local) -{ - if (m_body ) - { - m_body->activate(); - - SimdMatrix3x3 drotmat( rotval[0],rotval[1],rotval[2], - rotval[4],rotval[5],rotval[6], - rotval[8],rotval[9],rotval[10]); - - - SimdMatrix3x3 currentOrn; - GetWorldOrientation(currentOrn); - - SimdTransform xform = m_body->getCenterOfMassTransform(); - - xform.setBasis(xform.getBasis()*(local ? - drotmat : (currentOrn.inverse() * drotmat * currentOrn))); - - m_body->setCenterOfMassTransform(xform); - } - -} - -void CcdPhysicsController::GetWorldOrientation(SimdMatrix3x3& mat) -{ - float orn[4]; - m_MotionState->getWorldOrientation(orn[0],orn[1],orn[2],orn[3]); - SimdQuaternion quat(orn[0],orn[1],orn[2],orn[3]); - mat.setRotation(quat); -} - -void CcdPhysicsController::getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal) -{ - SimdQuaternion q = m_body->getCenterOfMassTransform().getRotation(); - quatImag0 = q[0]; - quatImag1 = q[1]; - quatImag2 = q[2]; - quatReal = q[3]; -} -void CcdPhysicsController::setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal) -{ - m_body->activate(); - - SimdTransform xform = m_body->getCenterOfMassTransform(); - xform.setRotation(SimdQuaternion(quatImag0,quatImag1,quatImag2,quatReal)); - m_body->setCenterOfMassTransform(xform); - -} - -void CcdPhysicsController::setPosition(float posX,float posY,float posZ) -{ - m_body->activate(); - - SimdTransform xform = m_body->getCenterOfMassTransform(); - xform.setOrigin(SimdVector3(posX,posY,posZ)); - m_body->setCenterOfMassTransform(xform); - -} -void CcdPhysicsController::resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) -{ -} - -void CcdPhysicsController::getPosition(PHY__Vector3& pos) const -{ - const SimdTransform& xform = m_body->getCenterOfMassTransform(); - pos[0] = xform.getOrigin().x(); - pos[1] = xform.getOrigin().y(); - pos[2] = xform.getOrigin().z(); -} - -void CcdPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ) -{ - if (!SimdFuzzyZero(m_cci.m_scaling.x()-scaleX) || - !SimdFuzzyZero(m_cci.m_scaling.y()-scaleY) || - !SimdFuzzyZero(m_cci.m_scaling.z()-scaleZ)) - { - m_cci.m_scaling = SimdVector3(scaleX,scaleY,scaleZ); - - if (m_body && m_body->GetCollisionShape()) - { - m_body->GetCollisionShape()->setLocalScaling(m_cci.m_scaling); - m_body->GetCollisionShape()->CalculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); - m_body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); - } - } -} - - // physics methods -void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local) -{ - SimdVector3 torque(torqueX,torqueY,torqueZ); - SimdTransform xform = m_body->getCenterOfMassTransform(); - if (local) - { - torque = xform.getBasis()*torque; - } - m_body->applyTorque(torque); -} - -void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bool local) -{ - SimdVector3 force(forceX,forceY,forceZ); - SimdTransform xform = m_body->getCenterOfMassTransform(); - if (local) - { - force = xform.getBasis()*force; - } - m_body->applyCentralForce(force); -} -void CcdPhysicsController::SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local) -{ - SimdVector3 angvel(ang_velX,ang_velY,ang_velZ); - if (angvel.length2() > (SIMD_EPSILON*SIMD_EPSILON)) - { - m_body->activate(); - } - - { - SimdTransform xform = m_body->getCenterOfMassTransform(); - if (local) - { - angvel = xform.getBasis()*angvel; - } - - m_body->setAngularVelocity(angvel); - } - -} -void CcdPhysicsController::SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local) -{ - - SimdVector3 linVel(lin_velX,lin_velY,lin_velZ); - if (linVel.length2() > (SIMD_EPSILON*SIMD_EPSILON)) - { - m_body->activate(); - } - - { - SimdTransform xform = m_body->getCenterOfMassTransform(); - if (local) - { - linVel = xform.getBasis()*linVel; - } - m_body->setLinearVelocity(linVel); - } -} -void CcdPhysicsController::applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ) -{ - SimdVector3 impulse(impulseX,impulseY,impulseZ); - - if (impulse.length2() > (SIMD_EPSILON*SIMD_EPSILON)) - { - m_body->activate(); - - SimdVector3 pos(attachX,attachY,attachZ); - - m_body->activate(); - - m_body->applyImpulse(impulse,pos); - } - -} -void CcdPhysicsController::SetActive(bool active) -{ -} - // reading out information from physics -void CcdPhysicsController::GetLinearVelocity(float& linvX,float& linvY,float& linvZ) -{ - const SimdVector3& linvel = this->m_body->getLinearVelocity(); - linvX = linvel.x(); - linvY = linvel.y(); - linvZ = linvel.z(); - -} - -void CcdPhysicsController::GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ) -{ - const SimdVector3& angvel= m_body->getAngularVelocity(); - angVelX = angvel.x(); - angVelY = angvel.y(); - angVelZ = angvel.z(); -} - -void CcdPhysicsController::GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ) -{ - SimdVector3 pos(posX,posY,posZ); - SimdVector3 rel_pos = pos-m_body->getCenterOfMassPosition(); - SimdVector3 linvel = m_body->getVelocityInLocalPoint(rel_pos); - linvX = linvel.x(); - linvY = linvel.y(); - linvZ = linvel.z(); -} -void CcdPhysicsController::getReactionForce(float& forceX,float& forceY,float& forceZ) -{ -} - - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted -void CcdPhysicsController::setRigidBody(bool rigid) -{ - if (!rigid) - { - //fake it for now - SimdVector3 inertia = m_body->getInvInertiaDiagLocal(); - inertia[1] = 0.f; - m_body->setInvInertiaDiagLocal(inertia); - m_body->updateInertiaTensor(); - } -} - - // clientinfo for raycasts for example -void* CcdPhysicsController::getNewClientInfo() -{ - return m_newClientInfo; -} -void CcdPhysicsController::setNewClientInfo(void* clientinfo) -{ - m_newClientInfo = clientinfo; -} - - -void CcdPhysicsController::UpdateDeactivation(float timeStep) -{ - if ( (m_body->GetActivationState() == ISLAND_SLEEPING) || (m_body->GetActivationState() == DISABLE_DEACTIVATION)) - return; - - if ((m_body->getLinearVelocity().length2() < gLinearSleepingTreshold*gLinearSleepingTreshold) && - (m_body->getAngularVelocity().length2() < gAngularSleepingTreshold*gAngularSleepingTreshold)) - { - m_body->m_deactivationTime += timeStep; - } else - { - m_body->m_deactivationTime=0.f; - m_body->SetActivationState(0); - } - -} - -bool CcdPhysicsController::wantsSleeping() -{ - - if (m_body->GetActivationState() == DISABLE_DEACTIVATION) - return false; - - //disable deactivation - if (gDisableDeactivation || (gDeactivationTime == 0.f)) - return false; - - if ( (m_body->GetActivationState() == ISLAND_SLEEPING) || (m_body->GetActivationState() == WANTS_DEACTIVATION)) - return true; - - if (m_body->m_deactivationTime> gDeactivationTime) - { - return true; - } - return false; -} - -PHY_IPhysicsController* CcdPhysicsController::GetReplica() -{ - //very experimental, shape sharing is not implemented yet. - //just support SphereShape/ConeShape for now - - CcdConstructionInfo cinfo = m_cci; - if (cinfo.m_collisionShape) - { - switch (cinfo.m_collisionShape->GetShapeType()) - { - case SPHERE_SHAPE_PROXYTYPE: - { - SphereShape* orgShape = (SphereShape*)cinfo.m_collisionShape; - cinfo.m_collisionShape = new SphereShape(*orgShape); - break; - } - - case CONE_SHAPE_PROXYTYPE: - { - ConeShape* orgShape = (ConeShape*)cinfo.m_collisionShape; - cinfo.m_collisionShape = new ConeShape(*orgShape); - break; - } - - - default: - { - return 0; - } - } - } - - cinfo.m_MotionState = new DefaultMotionState(); - - CcdPhysicsController* replica = new CcdPhysicsController(cinfo); - return replica; -} - -/////////////////////////////////////////////////////////// -///A small utility class, DefaultMotionState -/// -/////////////////////////////////////////////////////////// - -DefaultMotionState::DefaultMotionState() -{ - m_worldTransform.setIdentity(); - m_localScaling.setValue(1.f,1.f,1.f); -} - - -DefaultMotionState::~DefaultMotionState() -{ - -} - -void DefaultMotionState::getWorldPosition(float& posX,float& posY,float& posZ) -{ - posX = m_worldTransform.getOrigin().x(); - posY = m_worldTransform.getOrigin().y(); - posZ = m_worldTransform.getOrigin().z(); -} - -void DefaultMotionState::getWorldScaling(float& scaleX,float& scaleY,float& scaleZ) -{ - scaleX = m_localScaling.getX(); - scaleY = m_localScaling.getY(); - scaleZ = m_localScaling.getZ(); -} - -void DefaultMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal) -{ - quatIma0 = m_worldTransform.getRotation().x(); - quatIma1 = m_worldTransform.getRotation().y(); - quatIma2 = m_worldTransform.getRotation().z(); - quatReal = m_worldTransform.getRotation()[3]; -} - -void DefaultMotionState::setWorldPosition(float posX,float posY,float posZ) -{ - SimdPoint3 pos(posX,posY,posZ); - m_worldTransform.setOrigin( pos ); -} - -void DefaultMotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal) -{ - SimdQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal); - m_worldTransform.setRotation( orn ); -} - -void DefaultMotionState::calculateWorldTransformations() -{ - -} - diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h deleted file mode 100644 index 632d5d776d2..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsController.h +++ /dev/null @@ -1,254 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BULLET2_PHYSICSCONTROLLER_H -#define BULLET2_PHYSICSCONTROLLER_H - -#include "PHY_IPhysicsController.h" - -/// PHY_IPhysicsController is the abstract simplified Interface to a physical object. -/// It contains the IMotionState and IDeformableMesh Interfaces. -#include "SimdVector3.h" -#include "SimdScalar.h" -#include "SimdMatrix3x3.h" -#include "SimdTransform.h" -#include "Dynamics/RigidBody.h" - -#include "PHY_IMotionState.h" - -#include "BroadphaseCollision/BroadphaseProxy.h" //for CollisionShape access -class CollisionShape; - -extern float gDeactivationTime; -extern float gLinearSleepingTreshold; -extern float gAngularSleepingTreshold; -extern bool gDisableDeactivation; -class CcdPhysicsEnvironment; - - - - -struct CcdConstructionInfo -{ - - ///CollisionFilterGroups provides some optional usage of basic collision filtering - ///this is done during broadphase, so very early in the pipeline - ///more advanced collision filtering should be done in CollisionDispatcher::NeedsCollision - enum CollisionFilterGroups - { - DefaultFilter = 1, - StaticFilter = 2, - KinematicFilter = 4, - DebrisFilter = 8, - AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter, - }; - - - CcdConstructionInfo() - : m_gravity(0,0,0), - m_scaling(1.f,1.f,1.f), - m_mass(0.f), - m_restitution(0.1f), - m_friction(0.5f), - m_linearDamping(0.1f), - m_angularDamping(0.1f), - m_collisionFlags(0), - m_collisionFilterGroup(DefaultFilter), - m_collisionFilterMask(AllFilter), - m_MotionState(0), - m_physicsEnv(0), - m_inertiaFactor(1.f) - { - } - - SimdVector3 m_localInertiaTensor; - SimdVector3 m_gravity; - SimdVector3 m_scaling; - SimdScalar m_mass; - SimdScalar m_restitution; - SimdScalar m_friction; - SimdScalar m_linearDamping; - SimdScalar m_angularDamping; - int m_collisionFlags; - - ///optional use of collision group/mask: - ///only collision with object goups that match the collision mask. - ///this is very basic early out. advanced collision filtering should be - ///done in the CollisionDispatcher::NeedsCollision and NeedsResponse - ///both values default to 1 - short int m_collisionFilterGroup; - short int m_collisionFilterMask; - - - CollisionShape* m_collisionShape; - class PHY_IMotionState* m_MotionState; - - CcdPhysicsEnvironment* m_physicsEnv; //needed for self-replication - float m_inertiaFactor;//tweak the inertia (hooked up to Blender 'formfactor' -}; - - -class RigidBody; - -///CcdPhysicsController is a physics object that supports continuous collision detection and time of impact based physics resolution. -class CcdPhysicsController : public PHY_IPhysicsController -{ - RigidBody* m_body; - class PHY_IMotionState* m_MotionState; - - - void* m_newClientInfo; - - CcdConstructionInfo m_cci;//needed for replication - void GetWorldOrientation(SimdMatrix3x3& mat); - - void CreateRigidbody(); - - public: - - int m_collisionDelay; - - - CcdPhysicsController (const CcdConstructionInfo& ci); - - virtual ~CcdPhysicsController(); - - - RigidBody* GetRigidBody() { return m_body;} - - CollisionShape* GetCollisionShape() { - return m_body->GetCollisionShape(); - } - //////////////////////////////////// - // PHY_IPhysicsController interface - //////////////////////////////////// - - - /** - SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - virtual bool SynchronizeMotionStates(float time); - /** - WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - - virtual void WriteMotionStateToDynamics(bool nondynaonly); - virtual void WriteDynamicsToMotionState(); - // controller replication - virtual void PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl); - - // kinematic methods - virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local); - virtual void RelativeRotate(const float drot[9],bool local); - virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal); - virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal); - virtual void setPosition(float posX,float posY,float posZ); - virtual void getPosition(PHY__Vector3& pos) const; - - virtual void setScaling(float scaleX,float scaleY,float scaleZ); - - // physics methods - virtual void ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local); - virtual void ApplyForce(float forceX,float forceY,float forceZ,bool local); - virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local); - virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local); - virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ); - virtual void SetActive(bool active); - - // reading out information from physics - virtual void GetLinearVelocity(float& linvX,float& linvY,float& linvZ); - virtual void GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ); - virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ); - virtual void getReactionForce(float& forceX,float& forceY,float& forceZ); - - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted - virtual void setRigidBody(bool rigid); - - - virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ); - - // clientinfo for raycasts for example - virtual void* getNewClientInfo(); - virtual void setNewClientInfo(void* clientinfo); - virtual PHY_IPhysicsController* GetReplica(); - - ///There should be no 'SetCollisionFilterGroup' method, as changing this during run-time is will result in errors - short int GetCollisionFilterGroup() const - { - return m_cci.m_collisionFilterGroup; - } - ///There should be no 'SetCollisionFilterGroup' method, as changing this during run-time is will result in errors - short int GetCollisionFilterMask() const - { - return m_cci.m_collisionFilterMask; - } - - - virtual void calcXform() {} ; - virtual void SetMargin(float margin) {}; - virtual float GetMargin() const {return 0.f;}; - - - bool wantsSleeping(); - - void UpdateDeactivation(float timeStep); - - static SimdTransform GetTransformFromMotionState(PHY_IMotionState* motionState); - - void SetAabb(const SimdVector3& aabbMin,const SimdVector3& aabbMax); - - - class PHY_IMotionState* GetMotionState() - { - return m_MotionState; - } - - const class PHY_IMotionState* GetMotionState() const - { - return m_MotionState; - } - - -}; - - - - -///DefaultMotionState implements standard motionstate, using SimdTransform -class DefaultMotionState : public PHY_IMotionState - -{ - public: - DefaultMotionState(); - - virtual ~DefaultMotionState(); - - virtual void getWorldPosition(float& posX,float& posY,float& posZ); - virtual void getWorldScaling(float& scaleX,float& scaleY,float& scaleZ); - virtual void getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal); - - virtual void setWorldPosition(float posX,float posY,float posZ); - virtual void setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal); - - virtual void calculateWorldTransformations(); - - SimdTransform m_worldTransform; - SimdVector3 m_localScaling; - -}; - - -#endif //BULLET2_PHYSICSCONTROLLER_H diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp deleted file mode 100644 index 9362595170d..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp +++ /dev/null @@ -1,1851 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - - -#include "CcdPhysicsEnvironment.h" -#include "CcdPhysicsController.h" - -#include <algorithm> -#include "SimdTransform.h" -#include "Dynamics/RigidBody.h" -#include "BroadphaseCollision/BroadphaseInterface.h" -#include "BroadphaseCollision/SimpleBroadphase.h" -#include "BroadphaseCollision/AxisSweep3.h" - -#include "CollisionDispatch/CollisionWorld.h" - -#include "CollisionShapes/ConvexShape.h" -#include "CollisionShapes/ConeShape.h" -#include "CollisionDispatch/SimulationIslandManager.h" - -#include "BroadphaseCollision/Dispatcher.h" -#include "NarrowPhaseCollision/PersistentManifold.h" -#include "CollisionShapes/TriangleMeshShape.h" -#include "ConstraintSolver/SequentialImpulseConstraintSolver.h" - - -//profiling/timings -#include "quickprof.h" - - -#include "IDebugDraw.h" - -#include "NarrowPhaseCollision/VoronoiSimplexSolver.h" -#include "NarrowPhaseCollision/SubSimplexConvexCast.h" -#include "NarrowPhaseCollision/GjkConvexCast.h" -#include "NarrowPhaseCollision/ContinuousConvexCollision.h" - - -#include "CollisionDispatch/CollisionDispatcher.h" -#include "PHY_IMotionState.h" - -#include "CollisionDispatch/EmptyCollisionAlgorithm.h" - - - -#include "CollisionShapes/SphereShape.h" - -bool useIslands = true; - -#ifdef NEW_BULLET_VEHICLE_SUPPORT -#include "Vehicle/RaycastVehicle.h" -#include "Vehicle/VehicleRaycaster.h" - -#include "Vehicle/WheelInfo.h" -#include "PHY_IVehicle.h" -RaycastVehicle::VehicleTuning gTuning; - -#endif //NEW_BULLET_VEHICLE_SUPPORT -#include "AabbUtil2.h" - -#include "ConstraintSolver/ConstraintSolver.h" -#include "ConstraintSolver/Point2PointConstraint.h" -#include "ConstraintSolver/HingeConstraint.h" -#include "ConstraintSolver/Generic6DofConstraint.h" - - -//#include "BroadphaseCollision/QueryDispatcher.h" -//#include "BroadphaseCollision/QueryBox.h" -//todo: change this to allow dynamic registration of types! - -#ifdef WIN32 -void DrawRasterizerLine(const float* from,const float* to,int color); -#endif - - -#include "ConstraintSolver/ContactConstraint.h" - - -#include <stdio.h> - -#ifdef NEW_BULLET_VEHICLE_SUPPORT -class WrapperVehicle : public PHY_IVehicle -{ - - RaycastVehicle* m_vehicle; - PHY_IPhysicsController* m_chassis; - -public: - - WrapperVehicle(RaycastVehicle* vehicle,PHY_IPhysicsController* chassis) - :m_vehicle(vehicle), - m_chassis(chassis) - { - } - - RaycastVehicle* GetVehicle() - { - return m_vehicle; - } - - PHY_IPhysicsController* GetChassis() - { - return m_chassis; - } - - virtual void AddWheel( - PHY_IMotionState* motionState, - PHY__Vector3 connectionPoint, - PHY__Vector3 downDirection, - PHY__Vector3 axleDirection, - float suspensionRestLength, - float wheelRadius, - bool hasSteering - ) - { - SimdVector3 connectionPointCS0(connectionPoint[0],connectionPoint[1],connectionPoint[2]); - SimdVector3 wheelDirectionCS0(downDirection[0],downDirection[1],downDirection[2]); - SimdVector3 wheelAxle(axleDirection[0],axleDirection[1],axleDirection[2]); - - - WheelInfo& info = m_vehicle->AddWheel(connectionPointCS0,wheelDirectionCS0,wheelAxle, - suspensionRestLength,wheelRadius,gTuning,hasSteering); - info.m_clientInfo = motionState; - - } - - void SyncWheels() - { - int numWheels = GetNumWheels(); - int i; - for (i=0;i<numWheels;i++) - { - WheelInfo& info = m_vehicle->GetWheelInfo(i); - PHY_IMotionState* motionState = (PHY_IMotionState*)info.m_clientInfo ; - m_vehicle->UpdateWheelTransform(i); - SimdTransform trans = m_vehicle->GetWheelTransformWS(i); - SimdQuaternion orn = trans.getRotation(); - const SimdVector3& pos = trans.getOrigin(); - motionState->setWorldOrientation(orn.x(),orn.y(),orn.z(),orn[3]); - motionState->setWorldPosition(pos.x(),pos.y(),pos.z()); - - } - } - - virtual int GetNumWheels() const - { - return m_vehicle->GetNumWheels(); - } - - virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const - { - SimdTransform trans = m_vehicle->GetWheelTransformWS(wheelIndex); - posX = trans.getOrigin().x(); - posY = trans.getOrigin().y(); - posZ = trans.getOrigin().z(); - } - virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const - { - SimdTransform trans = m_vehicle->GetWheelTransformWS(wheelIndex); - SimdQuaternion quat = trans.getRotation(); - SimdMatrix3x3 orn2(quat); - - quatX = trans.getRotation().x(); - quatY = trans.getRotation().y(); - quatZ = trans.getRotation().z(); - quatW = trans.getRotation()[3]; - - - //printf("test"); - - - } - - virtual float GetWheelRotation(int wheelIndex) const - { - float rotation = 0.f; - - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) - { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); - rotation = info.m_rotation; - } - return rotation; - - } - - - - virtual int GetUserConstraintId() const - { - return m_vehicle->GetUserConstraintId(); - } - - virtual int GetUserConstraintType() const - { - return m_vehicle->GetUserConstraintType(); - } - - virtual void SetSteeringValue(float steering,int wheelIndex) - { - m_vehicle->SetSteeringValue(steering,wheelIndex); - } - - virtual void ApplyEngineForce(float force,int wheelIndex) - { - m_vehicle->ApplyEngineForce(force,wheelIndex); - } - - virtual void ApplyBraking(float braking,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) - { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); - info.m_brake = braking; - } - } - - virtual void SetWheelFriction(float friction,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) - { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); - info.m_frictionSlip = friction; - } - - } - - virtual void SetSuspensionStiffness(float suspensionStiffness,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) - { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); - info.m_suspensionStiffness = suspensionStiffness; - - } - } - - virtual void SetSuspensionDamping(float suspensionDamping,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) - { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); - info.m_wheelsDampingRelaxation = suspensionDamping; - } - } - - virtual void SetSuspensionCompression(float suspensionCompression,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) - { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); - info.m_wheelsDampingCompression = suspensionCompression; - } - } - - - - virtual void SetRollInfluence(float rollInfluence,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) - { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); - info.m_rollInfluence = rollInfluence; - } - } - - - -}; -#endif //NEW_BULLET_VEHICLE_SUPPORT - - - -static void DrawAabb(IDebugDraw* debugDrawer,const SimdVector3& from,const SimdVector3& to,const SimdVector3& color) -{ - SimdVector3 halfExtents = (to-from)* 0.5f; - SimdVector3 center = (to+from) *0.5f; - int i,j; - - SimdVector3 edgecoord(1.f,1.f,1.f),pa,pb; - for (i=0;i<4;i++) - { - for (j=0;j<3;j++) - { - pa = SimdVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], - edgecoord[2]*halfExtents[2]); - pa+=center; - - int othercoord = j%3; - edgecoord[othercoord]*=-1.f; - pb = SimdVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], - edgecoord[2]*halfExtents[2]); - pb+=center; - - debugDrawer->DrawLine(pa,pb,color); - } - edgecoord = SimdVector3(-1.f,-1.f,-1.f); - if (i<3) - edgecoord[i]*=-1.f; - } - - -} - - - - - - -CcdPhysicsEnvironment::CcdPhysicsEnvironment(Dispatcher* dispatcher,OverlappingPairCache* pairCache) -:m_scalingPropagated(false), -m_numIterations(10), -m_numTimeSubSteps(1), -m_ccdMode(0), -m_solverType(-1), -m_profileTimings(0), -m_enableSatCollisionDetection(false) -{ - - for (int i=0;i<PHY_NUM_RESPONSE;i++) - { - m_triggerCallbacks[i] = 0; - } - if (!dispatcher) - dispatcher = new CollisionDispatcher(); - - - if(!pairCache) - { - - //todo: calculate/let user specify this world sizes - SimdVector3 worldMin(-10000,-10000,-10000); - SimdVector3 worldMax(10000,10000,10000); - - pairCache = new AxisSweep3(worldMin,worldMax); - - //broadphase = new SimpleBroadphase(); - } - - - setSolverType(1);//issues with quickstep and memory allocations - - m_collisionWorld = new CollisionWorld(dispatcher,pairCache); - - m_debugDrawer = 0; - m_gravity = SimdVector3(0.f,-10.f,0.f); - - m_islandManager = new SimulationIslandManager(); - - -} - -void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl) -{ - RigidBody* body = ctrl->GetRigidBody(); - - //this m_userPointer is just used for triggers, see CallbackTriggers - body->m_userPointer = ctrl; - - body->setGravity( m_gravity ); - m_controllers.push_back(ctrl); - - m_collisionWorld->AddCollisionObject(body,ctrl->GetCollisionFilterGroup(),ctrl->GetCollisionFilterMask()); - - assert(body->m_broadphaseHandle); - - BroadphaseInterface* scene = GetBroadphase(); - - - CollisionShape* shapeinterface = ctrl->GetCollisionShape(); - - assert(shapeinterface); - - const SimdTransform& t = ctrl->GetRigidBody()->getCenterOfMassTransform(); - - body->m_cachedInvertedWorldTransform = body->m_worldTransform.inverse(); - - SimdPoint3 minAabb,maxAabb; - - shapeinterface->GetAabb(t,minAabb,maxAabb); - - float timeStep = 0.02f; - - - //extent it with the motion - - SimdVector3 linMotion = body->getLinearVelocity()*timeStep; - - float maxAabbx = maxAabb.getX(); - float maxAabby = maxAabb.getY(); - float maxAabbz = maxAabb.getZ(); - float minAabbx = minAabb.getX(); - float minAabby = minAabb.getY(); - float minAabbz = minAabb.getZ(); - - if (linMotion.x() > 0.f) - maxAabbx += linMotion.x(); - else - minAabbx += linMotion.x(); - if (linMotion.y() > 0.f) - maxAabby += linMotion.y(); - else - minAabby += linMotion.y(); - if (linMotion.z() > 0.f) - maxAabbz += linMotion.z(); - else - minAabbz += linMotion.z(); - - - minAabb = SimdVector3(minAabbx,minAabby,minAabbz); - maxAabb = SimdVector3(maxAabbx,maxAabby,maxAabbz); - - - - -} - -void CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctrl) -{ - - //also remove constraint - - { - std::vector<TypedConstraint*>::iterator i; - - for (i=m_constraints.begin(); - !(i==m_constraints.end()); i++) - { - TypedConstraint* constraint = (*i); - if ((&constraint->GetRigidBodyA() == ctrl->GetRigidBody() || - (&constraint->GetRigidBodyB() == ctrl->GetRigidBody()))) - { - removeConstraint(constraint->GetUserConstraintId()); - //only 1 constraint per constroller - break; - } - } - } - - { - std::vector<TypedConstraint*>::iterator i; - - for (i=m_constraints.begin(); - !(i==m_constraints.end()); i++) - { - TypedConstraint* constraint = (*i); - if ((&constraint->GetRigidBodyA() == ctrl->GetRigidBody() || - (&constraint->GetRigidBodyB() == ctrl->GetRigidBody()))) - { - removeConstraint(constraint->GetUserConstraintId()); - //only 1 constraint per constroller - break; - } - } - } - - - m_collisionWorld->RemoveCollisionObject(ctrl->GetRigidBody()); - - - { - std::vector<CcdPhysicsController*>::iterator i = - std::find(m_controllers.begin(), m_controllers.end(), ctrl); - if (!(i == m_controllers.end())) - { - std::swap(*i, m_controllers.back()); - m_controllers.pop_back(); - } - } - - //remove it from the triggers - { - std::vector<CcdPhysicsController*>::iterator i = - std::find(m_triggerControllers.begin(), m_triggerControllers.end(), ctrl); - if (!(i == m_triggerControllers.end())) - { - std::swap(*i, m_triggerControllers.back()); - m_triggerControllers.pop_back(); - } - } - - -} - - -void CcdPhysicsEnvironment::beginFrame() -{ - -} - - -bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep) -{ - //don't simulate without timesubsteps - if (m_numTimeSubSteps<1) - return true; - - //printf("proceedDeltaTime\n"); - - -#ifdef USE_QUICKPROF - //toggle Profiler - if ( m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_ProfileTimings) - { - if (!m_profileTimings) - { - m_profileTimings = 1; - // To disable profiling, simply comment out the following line. - static int counter = 0; - - char filename[128]; - sprintf(filename,"quickprof_bullet_timings%i.csv",counter++); - Profiler::init(filename, Profiler::BLOCK_CYCLE_SECONDS);//BLOCK_TOTAL_MICROSECONDS - - } - } else - { - if (m_profileTimings) - { - m_profileTimings = 0; - Profiler::destroy(); - } - } -#endif //USE_QUICKPROF - - - - if (!SimdFuzzyZero(timeStep)) - { - - { - //do the kinematic calculation here, over the full timestep - std::vector<CcdPhysicsController*>::iterator i; - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - - CcdPhysicsController* ctrl = *i; - - SimdTransform predictedTrans; - RigidBody* body = ctrl->GetRigidBody(); - if (body->GetActivationState() != ISLAND_SLEEPING) - { - - if (body->IsStatic()) - { - //to calculate velocities next frame - body->saveKinematicState(timeStep); - } - } - } - } - - - int i; - float subTimeStep = timeStep / float(m_numTimeSubSteps); - - for (i=0;i<this->m_numTimeSubSteps;i++) - { - proceedDeltaTimeOneStep(subTimeStep); - } - } else - { - //todo: interpolate - } - - return true; -} - - - - - - - - - - - - - -/// Perform an integration step of duration 'timeStep'. -bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep) -{ - - - //printf("CcdPhysicsEnvironment::proceedDeltaTime\n"); - - if (SimdFuzzyZero(timeStep)) - return true; - - if (m_debugDrawer) - { - gDisableDeactivation = (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_NoDeactivation); - } - - -#ifdef USE_QUICKPROF - Profiler::beginBlock("SyncMotionStates"); -#endif //USE_QUICKPROF - - - //this is needed because scaling is not known in advance, and scaling has to propagate to the shape - if (!m_scalingPropagated) - { - SyncMotionStates(timeStep); - m_scalingPropagated = true; - } - - -#ifdef USE_QUICKPROF - Profiler::endBlock("SyncMotionStates"); - - Profiler::beginBlock("predictIntegratedTransform"); -#endif //USE_QUICKPROF - - { - // std::vector<CcdPhysicsController*>::iterator i; - - - - int k; - for (k=0;k<GetNumControllers();k++) - { - CcdPhysicsController* ctrl = m_controllers[k]; - // SimdTransform predictedTrans; - RigidBody* body = ctrl->GetRigidBody(); - - body->m_cachedInvertedWorldTransform = body->m_worldTransform.inverse(); - - if (body->IsActive()) - { - if (!body->IsStatic()) - { - body->applyForces( timeStep); - body->integrateVelocities( timeStep); - body->predictIntegratedTransform(timeStep,body->m_interpolationWorldTransform); - } - } - - } - } - -#ifdef USE_QUICKPROF - Profiler::endBlock("predictIntegratedTransform"); -#endif //USE_QUICKPROF - - OverlappingPairCache* scene = m_collisionWorld->GetPairCache(); - - - // - // collision detection (?) - // - - -#ifdef USE_QUICKPROF - Profiler::beginBlock("DispatchAllCollisionPairs"); -#endif //USE_QUICKPROF - - - int numsubstep = m_numIterations; - - - DispatcherInfo dispatchInfo; - dispatchInfo.m_timeStep = timeStep; - dispatchInfo.m_stepCount = 0; - dispatchInfo.m_enableSatConvex = m_enableSatCollisionDetection; - dispatchInfo.m_debugDraw = this->m_debugDrawer; - - scene->RefreshOverlappingPairs(); - GetCollisionWorld()->GetDispatcher()->DispatchAllCollisionPairs(&scene->GetOverlappingPair(0),scene->GetNumOverlappingPairs(),dispatchInfo); - - -#ifdef USE_QUICKPROF - Profiler::endBlock("DispatchAllCollisionPairs"); -#endif //USE_QUICKPROF - - - int numRigidBodies = m_controllers.size(); - - - m_islandManager->UpdateActivationState(GetCollisionWorld(),GetCollisionWorld()->GetDispatcher()); - - { - int i; - int numConstraints = m_constraints.size(); - for (i=0;i< numConstraints ; i++ ) - { - TypedConstraint* constraint = m_constraints[i]; - - const RigidBody* colObj0 = &constraint->GetRigidBodyA(); - const RigidBody* colObj1 = &constraint->GetRigidBodyB(); - - if (((colObj0) && ((colObj0)->mergesSimulationIslands())) && - ((colObj1) && ((colObj1)->mergesSimulationIslands()))) - { - if (colObj0->IsActive() || colObj1->IsActive()) - { - - m_islandManager->GetUnionFind().unite((colObj0)->m_islandTag1, - (colObj1)->m_islandTag1); - } - } - } - } - - m_islandManager->StoreIslandActivationState(GetCollisionWorld()); - - - //contacts -#ifdef USE_QUICKPROF - Profiler::beginBlock("SolveConstraint"); -#endif //USE_QUICKPROF - - - //solve the regular constraints (point 2 point, hinge, etc) - - for (int g=0;g<numsubstep;g++) - { - // - // constraint solving - // - - - int i; - int numConstraints = m_constraints.size(); - - //point to point constraints - for (i=0;i< numConstraints ; i++ ) - { - TypedConstraint* constraint = m_constraints[i]; - - constraint->BuildJacobian(); - constraint->SolveConstraint( timeStep ); - - } - - - } - -#ifdef USE_QUICKPROF - Profiler::endBlock("SolveConstraint"); -#endif //USE_QUICKPROF - - //solve the vehicles - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - //vehicles - int numVehicles = m_wrapperVehicles.size(); - for (int i=0;i<numVehicles;i++) - { - WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - RaycastVehicle* vehicle = wrapperVehicle->GetVehicle(); - vehicle->UpdateVehicle( timeStep); - } -#endif //NEW_BULLET_VEHICLE_SUPPORT - - - struct InplaceSolverIslandCallback : public SimulationIslandManager::IslandCallback - { - - ContactSolverInfo& m_solverInfo; - ConstraintSolver* m_solver; - IDebugDraw* m_debugDrawer; - - InplaceSolverIslandCallback( - ContactSolverInfo& solverInfo, - ConstraintSolver* solver, - IDebugDraw* debugDrawer) - :m_solverInfo(solverInfo), - m_solver(solver), - m_debugDrawer(debugDrawer) - { - - } - - virtual void ProcessIsland(PersistentManifold** manifolds,int numManifolds) - { - m_solver->SolveGroup( manifolds, numManifolds,m_solverInfo,m_debugDrawer); - } - - }; - - - m_solverInfo.m_friction = 0.9f; - m_solverInfo.m_numIterations = m_numIterations; - m_solverInfo.m_timeStep = timeStep; - m_solverInfo.m_restitution = 0.f;//m_restitution; - - InplaceSolverIslandCallback solverCallback( - m_solverInfo, - m_solver, - m_debugDrawer); - -#ifdef USE_QUICKPROF - Profiler::beginBlock("BuildAndProcessIslands"); -#endif //USE_QUICKPROF - - /// solve all the contact points and contact friction - m_islandManager->BuildAndProcessIslands(GetCollisionWorld()->GetDispatcher(),m_collisionWorld->GetCollisionObjectArray(),&solverCallback); - -#ifdef USE_QUICKPROF - Profiler::endBlock("BuildAndProcessIslands"); - - Profiler::beginBlock("CallbackTriggers"); -#endif //USE_QUICKPROF - - CallbackTriggers(); - -#ifdef USE_QUICKPROF - Profiler::endBlock("CallbackTriggers"); - - - Profiler::beginBlock("proceedToTransform"); - -#endif //USE_QUICKPROF - { - - - - { - - - - UpdateAabbs(timeStep); - - - float toi = 1.f; - - - - if (m_ccdMode == 3) - { - DispatcherInfo dispatchInfo; - dispatchInfo.m_timeStep = timeStep; - dispatchInfo.m_stepCount = 0; - dispatchInfo.m_dispatchFunc = DispatcherInfo::DISPATCH_CONTINUOUS; - - //pairCache->RefreshOverlappingPairs();//?? - GetCollisionWorld()->GetDispatcher()->DispatchAllCollisionPairs(&scene->GetOverlappingPair(0),scene->GetNumOverlappingPairs(),dispatchInfo); - - toi = dispatchInfo.m_timeOfImpact; - - } - - - - // - // integrating solution - // - - { - - std::vector<CcdPhysicsController*>::iterator i; - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - - CcdPhysicsController* ctrl = *i; - - SimdTransform predictedTrans; - RigidBody* body = ctrl->GetRigidBody(); - - if (body->IsActive()) - { - - if (!body->IsStatic()) - { - if (body->m_hitFraction < 1.f) - { - //set velocity to zero... until we have proper CCD integrated - body->setLinearVelocity(body->getLinearVelocity()*0.5f); - } - body->predictIntegratedTransform(timeStep* toi, predictedTrans); - body->proceedToTransform( predictedTrans); - } - - } - } - - } - - - - - - // - // disable sleeping physics objects - // - - std::vector<CcdPhysicsController*> m_sleepingControllers; - - std::vector<CcdPhysicsController*>::iterator i; - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - CcdPhysicsController* ctrl = (*i); - RigidBody* body = ctrl->GetRigidBody(); - - ctrl->UpdateDeactivation(timeStep); - - - if (ctrl->wantsSleeping()) - { - if (body->GetActivationState() == ACTIVE_TAG) - body->SetActivationState( WANTS_DEACTIVATION ); - } else - { - if (body->GetActivationState() != DISABLE_DEACTIVATION) - body->SetActivationState( ACTIVE_TAG ); - } - - if (useIslands) - { - if (body->GetActivationState() == ISLAND_SLEEPING) - { - m_sleepingControllers.push_back(ctrl); - } - } else - { - if (ctrl->wantsSleeping()) - { - m_sleepingControllers.push_back(ctrl); - } - } - } - - - - - } - - -#ifdef USE_QUICKPROF - Profiler::endBlock("proceedToTransform"); - - Profiler::beginBlock("SyncMotionStates"); -#endif //USE_QUICKPROF - - SyncMotionStates(timeStep); - -#ifdef USE_QUICKPROF - Profiler::endBlock("SyncMotionStates"); - - Profiler::endProfilingCycle(); -#endif //USE_QUICKPROF - - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - //sync wheels for vehicles - int numVehicles = m_wrapperVehicles.size(); - for (int i=0;i<numVehicles;i++) - { - WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - - wrapperVehicle->SyncWheels(); - } -#endif //NEW_BULLET_VEHICLE_SUPPORT - } - - return true; -} - -void CcdPhysicsEnvironment::setDebugMode(int debugMode) -{ - if (m_debugDrawer){ - m_debugDrawer->SetDebugMode(debugMode); - } -} - -void CcdPhysicsEnvironment::setNumIterations(int numIter) -{ - m_numIterations = numIter; -} -void CcdPhysicsEnvironment::setDeactivationTime(float dTime) -{ - gDeactivationTime = dTime; -} -void CcdPhysicsEnvironment::setDeactivationLinearTreshold(float linTresh) -{ - gLinearSleepingTreshold = linTresh; -} -void CcdPhysicsEnvironment::setDeactivationAngularTreshold(float angTresh) -{ - gAngularSleepingTreshold = angTresh; -} -void CcdPhysicsEnvironment::setContactBreakingTreshold(float contactBreakingTreshold) -{ - gContactBreakingTreshold = contactBreakingTreshold; - -} - - -void CcdPhysicsEnvironment::setCcdMode(int ccdMode) -{ - m_ccdMode = ccdMode; -} - - -void CcdPhysicsEnvironment::setSolverSorConstant(float sor) -{ - m_solverInfo.m_sor = sor; -} - -void CcdPhysicsEnvironment::setSolverTau(float tau) -{ - m_solverInfo.m_tau = tau; -} -void CcdPhysicsEnvironment::setSolverDamping(float damping) -{ - m_solverInfo.m_damping = damping; -} - - -void CcdPhysicsEnvironment::setLinearAirDamping(float damping) -{ - gLinearAirDamping = damping; -} - -void CcdPhysicsEnvironment::setUseEpa(bool epa) -{ - gUseEpa = epa; -} - -void CcdPhysicsEnvironment::setSolverType(int solverType) -{ - - switch (solverType) - { - case 1: - { - if (m_solverType != solverType) - { - - m_solver = new SequentialImpulseConstraintSolver(); - - break; - } - } - - case 0: - default: - if (m_solverType != solverType) - { -// m_solver = new OdeConstraintSolver(); - - break; - } - - }; - - m_solverType = solverType ; -} - - - - - -void CcdPhysicsEnvironment::SyncMotionStates(float timeStep) -{ - std::vector<CcdPhysicsController*>::iterator i; - - // - // synchronize the physics and graphics transformations - // - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - CcdPhysicsController* ctrl = (*i); - ctrl->SynchronizeMotionStates(timeStep); - - } - -} -void CcdPhysicsEnvironment::setGravity(float x,float y,float z) -{ - m_gravity = SimdVector3(x,y,z); - - std::vector<CcdPhysicsController*>::iterator i; - - //todo: review this gravity stuff - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - - CcdPhysicsController* ctrl = (*i); - ctrl->GetRigidBody()->setGravity(m_gravity); - - } -} - - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - -class DefaultVehicleRaycaster : public VehicleRaycaster -{ - CcdPhysicsEnvironment* m_physEnv; - PHY_IPhysicsController* m_chassis; - -public: - DefaultVehicleRaycaster(CcdPhysicsEnvironment* physEnv,PHY_IPhysicsController* chassis): - m_physEnv(physEnv), - m_chassis(chassis) - { - } - - /* struct VehicleRaycasterResult - { - VehicleRaycasterResult() :m_distFraction(-1.f){}; - SimdVector3 m_hitPointInWorld; - SimdVector3 m_hitNormalInWorld; - SimdScalar m_distFraction; - }; - */ - virtual void* CastRay(const SimdVector3& from,const SimdVector3& to, VehicleRaycasterResult& result) - { - - - float hit[3]; - float normal[3]; - - PHY_IPhysicsController* ignore = m_chassis; - void* hitObject = m_physEnv->rayTest(ignore,from.x(),from.y(),from.z(),to.x(),to.y(),to.z(),hit[0],hit[1],hit[2],normal[0],normal[1],normal[2]); - if (hitObject) - { - result.m_hitPointInWorld[0] = hit[0]; - result.m_hitPointInWorld[1] = hit[1]; - result.m_hitPointInWorld[2] = hit[2]; - result.m_hitNormalInWorld[0] = normal[0]; - result.m_hitNormalInWorld[1] = normal[1]; - result.m_hitNormalInWorld[2] = normal[2]; - result.m_hitNormalInWorld.normalize(); - //calc fraction? or put it in the interface? - //calc for now - - result.m_distFraction = (result.m_hitPointInWorld-from).length() / (to-from).length(); - //some safety for 'explosion' due to sudden penetration of the full 'ray' - /* if (result.m_distFraction<0.1) - { - printf("Vehicle Raycast: avoided instability due to penetration. Consider moving the connection points deeper inside vehicle chassis"); - result.m_distFraction = 1.f; - hitObject = 0; - } - */ - - /* if (result.m_distFraction>1.) - { - printf("Vehicle Raycast: avoided instability 1Consider moving the connection points deeper inside vehicle chassis"); - result.m_distFraction = 1.f; - hitObject = 0; - } - */ - - - - } - //? - return hitObject; - } -}; -#endif //NEW_BULLET_VEHICLE_SUPPORT - -static int gConstraintUid = 1; - -int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl0,class PHY_IPhysicsController* ctrl1,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ, - float axisX,float axisY,float axisZ) -{ - - - CcdPhysicsController* c0 = (CcdPhysicsController*)ctrl0; - CcdPhysicsController* c1 = (CcdPhysicsController*)ctrl1; - - RigidBody* rb0 = c0 ? c0->GetRigidBody() : 0; - RigidBody* rb1 = c1 ? c1->GetRigidBody() : 0; - - ASSERT(rb0); - - SimdVector3 pivotInA(pivotX,pivotY,pivotZ); - SimdVector3 pivotInB = rb1 ? rb1->getCenterOfMassTransform().inverse()(rb0->getCenterOfMassTransform()(pivotInA)) : pivotInA; - SimdVector3 axisInA(axisX,axisY,axisZ); - SimdVector3 axisInB = rb1 ? - (rb1->getCenterOfMassTransform().getBasis().inverse()*(rb0->getCenterOfMassTransform().getBasis() * axisInA)) : - rb0->getCenterOfMassTransform().getBasis() * axisInA; - - bool angularOnly = false; - - switch (type) - { - case PHY_POINT2POINT_CONSTRAINT: - { - - Point2PointConstraint* p2p = 0; - - if (rb1) - { - p2p = new Point2PointConstraint(*rb0, - *rb1,pivotInA,pivotInB); - } else - { - p2p = new Point2PointConstraint(*rb0, - pivotInA); - } - - m_constraints.push_back(p2p); - p2p->SetUserConstraintId(gConstraintUid++); - p2p->SetUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return p2p->GetUserConstraintId(); - - break; - } - - case PHY_GENERIC_6DOF_CONSTRAINT: - { - Generic6DofConstraint* genericConstraint = 0; - - if (rb1) - { - SimdTransform frameInA; - SimdTransform frameInB; - - SimdVector3 axis1, axis2; - SimdPlaneSpace1( axisInA, axis1, axis2 ); - - frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), - axisInA.y(), axis1.y(), axis2.y(), - axisInA.z(), axis1.z(), axis2.z() ); - - - SimdPlaneSpace1( axisInB, axis1, axis2 ); - frameInB.getBasis().setValue( axisInB.x(), axis1.x(), axis2.x(), - axisInB.y(), axis1.y(), axis2.y(), - axisInB.z(), axis1.z(), axis2.z() ); - - frameInA.setOrigin( pivotInA ); - frameInB.setOrigin( pivotInB ); - - genericConstraint = new Generic6DofConstraint( - *rb0,*rb1, - frameInA,frameInB); - - - } else - { - // TODO: Implement single body case... - - } - - - m_constraints.push_back(genericConstraint); - genericConstraint->SetUserConstraintId(gConstraintUid++); - genericConstraint->SetUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return genericConstraint->GetUserConstraintId(); - - break; - } - case PHY_ANGULAR_CONSTRAINT: - angularOnly = true; - - - case PHY_LINEHINGE_CONSTRAINT: - { - HingeConstraint* hinge = 0; - - if (rb1) - { - hinge = new HingeConstraint( - *rb0, - *rb1,pivotInA,pivotInB,axisInA,axisInB); - - - } else - { - hinge = new HingeConstraint(*rb0, - pivotInA,axisInA); - - } - hinge->setAngularOnly(angularOnly); - - m_constraints.push_back(hinge); - hinge->SetUserConstraintId(gConstraintUid++); - hinge->SetUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return hinge->GetUserConstraintId(); - break; - } -#ifdef NEW_BULLET_VEHICLE_SUPPORT - - case PHY_VEHICLE_CONSTRAINT: - { - RaycastVehicle::VehicleTuning* tuning = new RaycastVehicle::VehicleTuning(); - RigidBody* chassis = rb0; - DefaultVehicleRaycaster* raycaster = new DefaultVehicleRaycaster(this,ctrl0); - RaycastVehicle* vehicle = new RaycastVehicle(*tuning,chassis,raycaster); - WrapperVehicle* wrapperVehicle = new WrapperVehicle(vehicle,ctrl0); - m_wrapperVehicles.push_back(wrapperVehicle); - vehicle->SetUserConstraintId(gConstraintUid++); - vehicle->SetUserConstraintType(type); - return vehicle->GetUserConstraintId(); - - break; - }; -#endif //NEW_BULLET_VEHICLE_SUPPORT - - default: - { - } - }; - - //RigidBody& rbA,RigidBody& rbB, const SimdVector3& pivotInA,const SimdVector3& pivotInB - - return 0; - -} - - - - -//Following the COLLADA physics specification for constraints -int CcdPhysicsEnvironment::createUniversalD6Constraint( - class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther, - SimdTransform& frameInA, - SimdTransform& frameInB, - const SimdVector3& linearMinLimits, - const SimdVector3& linearMaxLimits, - const SimdVector3& angularMinLimits, - const SimdVector3& angularMaxLimits -) -{ - - //we could either add some logic to recognize ball-socket and hinge, or let that up to the user - //perhaps some warning or hint that hinge/ball-socket is more efficient? - - Generic6DofConstraint* genericConstraint = 0; - CcdPhysicsController* ctrl0 = (CcdPhysicsController*) ctrlRef; - CcdPhysicsController* ctrl1 = (CcdPhysicsController*) ctrlOther; - - RigidBody* rb0 = ctrl0->GetRigidBody(); - RigidBody* rb1 = ctrl1->GetRigidBody(); - - if (rb1) - { - - - genericConstraint = new Generic6DofConstraint( - *rb0,*rb1, - frameInA,frameInB); - genericConstraint->setLinearLowerLimit(linearMinLimits); - genericConstraint->setLinearUpperLimit(linearMaxLimits); - genericConstraint->setAngularLowerLimit(angularMinLimits); - genericConstraint->setAngularUpperLimit(angularMaxLimits); - } else - { - // TODO: Implement single body case... - //No, we can use a fixed rigidbody in above code, rather then unnecessary duplation of code - - } - - if (genericConstraint) - { - m_constraints.push_back(genericConstraint); - genericConstraint->SetUserConstraintId(gConstraintUid++); - genericConstraint->SetUserConstraintType(PHY_GENERIC_6DOF_CONSTRAINT); - //64 bit systems can't cast pointer to int. could use size_t instead. - return genericConstraint->GetUserConstraintId(); - } - return 0; -} - - - -void CcdPhysicsEnvironment::removeConstraint(int constraintId) -{ - std::vector<TypedConstraint*>::iterator i; - - for (i=m_constraints.begin(); - !(i==m_constraints.end()); i++) - { - TypedConstraint* constraint = (*i); - if (constraint->GetUserConstraintId() == constraintId) - { - std::swap(*i, m_constraints.back()); - m_constraints.pop_back(); - break; - } - } - -} - - - struct FilterClosestRayResultCallback : public CollisionWorld::ClosestRayResultCallback - { - PHY_IPhysicsController* m_ignoreClient; - - FilterClosestRayResultCallback (PHY_IPhysicsController* ignoreClient,const SimdVector3& rayFrom,const SimdVector3& rayTo) - : CollisionWorld::ClosestRayResultCallback(rayFrom,rayTo), - m_ignoreClient(ignoreClient) - { - - } - - virtual ~FilterClosestRayResultCallback() - { - } - - virtual float AddSingleResult(const CollisionWorld::LocalRayResult& rayResult) - { - CcdPhysicsController* curHit = static_cast<CcdPhysicsController*>(rayResult.m_collisionObject->m_userPointer); - //ignore client... - if (curHit != m_ignoreClient) - { - //if valid - return ClosestRayResultCallback::AddSingleResult(rayResult); - } - return m_closestHitFraction; - } - - }; - -PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, - float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ) -{ - - - float minFraction = 1.f; - - SimdVector3 rayFrom(fromX,fromY,fromZ); - SimdVector3 rayTo(toX,toY,toZ); - - SimdVector3 hitPointWorld,normalWorld; - - //Either Ray Cast with or without filtering - - //CollisionWorld::ClosestRayResultCallback rayCallback(rayFrom,rayTo); - FilterClosestRayResultCallback rayCallback(ignoreClient,rayFrom,rayTo); - - - PHY_IPhysicsController* nearestHit = 0; - - m_collisionWorld->RayTest(rayFrom,rayTo,rayCallback); - if (rayCallback.HasHit()) - { - nearestHit = static_cast<CcdPhysicsController*>(rayCallback.m_collisionObject->m_userPointer); - hitX = rayCallback.m_hitPointWorld.getX(); - hitY = rayCallback.m_hitPointWorld.getY(); - hitZ = rayCallback.m_hitPointWorld.getZ(); - - normalX = rayCallback.m_hitNormalWorld.getX(); - normalY = rayCallback.m_hitNormalWorld.getY(); - normalZ = rayCallback.m_hitNormalWorld.getZ(); - - } - - - return nearestHit; -} - - - -int CcdPhysicsEnvironment::getNumContactPoints() -{ - return 0; -} - -void CcdPhysicsEnvironment::getContactPoint(int i,float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ) -{ - -} - - - - -BroadphaseInterface* CcdPhysicsEnvironment::GetBroadphase() -{ - return m_collisionWorld->GetBroadphase(); -} - - - - -CcdPhysicsEnvironment::~CcdPhysicsEnvironment() -{ - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - m_wrapperVehicles.clear(); -#endif //NEW_BULLET_VEHICLE_SUPPORT - - //m_broadphase->DestroyScene(); - //delete broadphase ? release reference on broadphase ? - - //first delete scene, then dispatcher, because pairs have to release manifolds on the dispatcher - //delete m_dispatcher; - delete m_collisionWorld; - - delete m_islandManager; - -} - - -int CcdPhysicsEnvironment::GetNumControllers() -{ - return m_controllers.size(); -} - - -CcdPhysicsController* CcdPhysicsEnvironment::GetPhysicsController( int index) -{ - return m_controllers[index]; -} - - - - - - -TypedConstraint* CcdPhysicsEnvironment::getConstraintById(int constraintId) -{ - int numConstraint = m_constraints.size(); - int i; - for (i=0;i<numConstraint;i++) - { - TypedConstraint* constraint = m_constraints[i]; - if (constraint->GetUserConstraintId()==constraintId) - { - return constraint; - } - } - return 0; -} - - -void CcdPhysicsEnvironment::addSensor(PHY_IPhysicsController* ctrl) -{ - - CcdPhysicsController* ctrl1 = (CcdPhysicsController* )ctrl; - std::vector<CcdPhysicsController*>::iterator i = - std::find(m_controllers.begin(), m_controllers.end(), ctrl); - if ((i == m_controllers.end())) - { - addCcdPhysicsController(ctrl1); - } - - requestCollisionCallback(ctrl); - //printf("addSensor\n"); -} - -void CcdPhysicsEnvironment::removeCollisionCallback(PHY_IPhysicsController* ctrl) -{ - std::vector<CcdPhysicsController*>::iterator i = - std::find(m_triggerControllers.begin(), m_triggerControllers.end(), ctrl); - if (!(i == m_triggerControllers.end())) - { - std::swap(*i, m_triggerControllers.back()); - m_triggerControllers.pop_back(); - } -} - - -void CcdPhysicsEnvironment::removeSensor(PHY_IPhysicsController* ctrl) -{ - removeCollisionCallback(ctrl); - //printf("removeSensor\n"); -} -void CcdPhysicsEnvironment::addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user) -{ - /* printf("addTouchCallback\n(response class = %i)\n",response_class); - - //map PHY_ convention into SM_ convention - switch (response_class) - { - case PHY_FH_RESPONSE: - printf("PHY_FH_RESPONSE\n"); - break; - case PHY_SENSOR_RESPONSE: - printf("PHY_SENSOR_RESPONSE\n"); - break; - case PHY_CAMERA_RESPONSE: - printf("PHY_CAMERA_RESPONSE\n"); - break; - case PHY_OBJECT_RESPONSE: - printf("PHY_OBJECT_RESPONSE\n"); - break; - case PHY_STATIC_RESPONSE: - printf("PHY_STATIC_RESPONSE\n"); - break; - default: - assert(0); - return; - } - */ - - m_triggerCallbacks[response_class] = callback; - m_triggerCallbacksUserPtrs[response_class] = user; - -} -void CcdPhysicsEnvironment::requestCollisionCallback(PHY_IPhysicsController* ctrl) -{ - CcdPhysicsController* ccdCtrl = static_cast<CcdPhysicsController*>(ctrl); - - //printf("requestCollisionCallback\n"); - m_triggerControllers.push_back(ccdCtrl); -} - - -void CcdPhysicsEnvironment::CallbackTriggers() -{ - - CcdPhysicsController* ctrl0=0,*ctrl1=0; - - if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawContactPoints))) - { - //walk over all overlapping pairs, and if one of the involved bodies is registered for trigger callback, perform callback - int numManifolds = m_collisionWorld->GetDispatcher()->GetNumManifolds(); - for (int i=0;i<numManifolds;i++) - { - PersistentManifold* manifold = m_collisionWorld->GetDispatcher()->GetManifoldByIndexInternal(i); - int numContacts = manifold->GetNumContacts(); - if (numContacts) - { - if (m_debugDrawer && (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawContactPoints)) - { - for (int j=0;j<numContacts;j++) - { - SimdVector3 color(1,0,0); - const ManifoldPoint& cp = manifold->GetContactPoint(j); - if (m_debugDrawer) - m_debugDrawer->DrawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.GetDistance(),cp.GetLifeTime(),color); - } - } - RigidBody* obj0 = static_cast<RigidBody* >(manifold->GetBody0()); - RigidBody* obj1 = static_cast<RigidBody* >(manifold->GetBody1()); - - //m_userPointer is set in 'addPhysicsController - CcdPhysicsController* ctrl0 = static_cast<CcdPhysicsController*>(obj0->m_userPointer); - CcdPhysicsController* ctrl1 = static_cast<CcdPhysicsController*>(obj1->m_userPointer); - - std::vector<CcdPhysicsController*>::iterator i = - std::find(m_triggerControllers.begin(), m_triggerControllers.end(), ctrl0); - if (i == m_triggerControllers.end()) - { - i = std::find(m_triggerControllers.begin(), m_triggerControllers.end(), ctrl1); - } - - if (!(i == m_triggerControllers.end())) - { - m_triggerCallbacks[PHY_OBJECT_RESPONSE](m_triggerCallbacksUserPtrs[PHY_OBJECT_RESPONSE], - ctrl0,ctrl1,0); - } - } - } - - - - } - - -} - - - - - - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - -//complex constraint for vehicles -PHY_IVehicle* CcdPhysicsEnvironment::getVehicleConstraint(int constraintId) -{ - int i; - - int numVehicles = m_wrapperVehicles.size(); - for (i=0;i<numVehicles;i++) - { - WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - if (wrapperVehicle->GetVehicle()->GetUserConstraintId() == constraintId) - return wrapperVehicle; - } - - return 0; -} - -#endif //NEW_BULLET_VEHICLE_SUPPORT - - - -void CcdPhysicsEnvironment::UpdateAabbs(float timeStep) -{ - std::vector<CcdPhysicsController*>::iterator i; - BroadphaseInterface* scene = GetBroadphase(); - - // - // update aabbs, only for moving objects (!) - // - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - CcdPhysicsController* ctrl = (*i); - RigidBody* body = ctrl->GetRigidBody(); - - - SimdPoint3 minAabb,maxAabb; - CollisionShape* shapeinterface = ctrl->GetCollisionShape(); - - - - shapeinterface->CalculateTemporalAabb(body->getCenterOfMassTransform(), - body->getLinearVelocity(), - //body->getAngularVelocity(), - SimdVector3(0.f,0.f,0.f),//no angular effect for now //body->getAngularVelocity(), - timeStep,minAabb,maxAabb); - - - SimdVector3 manifoldExtraExtents(gContactBreakingTreshold,gContactBreakingTreshold,gContactBreakingTreshold); - minAabb -= manifoldExtraExtents; - maxAabb += manifoldExtraExtents; - - BroadphaseProxy* bp = body->m_broadphaseHandle; - if (bp) - { - - SimdVector3 color (1,1,0); - - if (m_debugDrawer) - { - //draw aabb - switch (body->GetActivationState()) - { - case ISLAND_SLEEPING: - { - color.setValue(1,1,1); - break; - } - case WANTS_DEACTIVATION: - { - color.setValue(0,0,1); - break; - } - case ACTIVE_TAG: - { - break; - } - case DISABLE_DEACTIVATION: - { - color.setValue(1,0,1); - }; - - }; - - if (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawAabb) - { - DrawAabb(m_debugDrawer,minAabb,maxAabb,color); - } - } - - - if ( (maxAabb-minAabb).length2() < 1e12f) - { - scene->SetAabb(bp,minAabb,maxAabb); - } else - { - //something went wrong, investigate - //removeCcdPhysicsController(ctrl); - body->SetActivationState(DISABLE_SIMULATION); - - static bool reportMe = true; - if (reportMe) - { - reportMe = false; - printf("Overflow in AABB, object removed from simulation \n"); - printf("If you can reproduce this, please email bugs@continuousphysics.com\n"); - printf("Please include above information, your Platform, version of OS.\n"); - printf("Thanks.\n"); - } - - } - - } - } -} - -PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const PHY__Vector3& position) -{ - - CcdConstructionInfo cinfo; - cinfo.m_collisionShape = new SphereShape(radius); - cinfo.m_MotionState = 0; - cinfo.m_physicsEnv = this; - cinfo.m_collisionFlags |= CollisionObject::noContactResponse; - DefaultMotionState* motionState = new DefaultMotionState(); - cinfo.m_MotionState = motionState; - motionState->m_worldTransform.setIdentity(); - motionState->m_worldTransform.setOrigin(SimdVector3(position[0],position[1],position[2])); - - CcdPhysicsController* sphereController = new CcdPhysicsController(cinfo); - - - return sphereController; -} - - -PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float coneradius,float coneheight) -{ - CcdConstructionInfo cinfo; - cinfo.m_collisionShape = new ConeShape(coneradius,coneheight); - cinfo.m_MotionState = 0; - cinfo.m_physicsEnv = this; - DefaultMotionState* motionState = new DefaultMotionState(); - cinfo.m_MotionState = motionState; - motionState->m_worldTransform.setIdentity(); -// motionState->m_worldTransform.setOrigin(SimdVector3(position[0],position[1],position[2])); - - CcdPhysicsController* sphereController = new CcdPhysicsController(cinfo); - - - return sphereController; -} - -float CcdPhysicsEnvironment::getAppliedImpulse(int constraintid) -{ - std::vector<TypedConstraint*>::iterator i; - - for (i=m_constraints.begin(); - !(i==m_constraints.end()); i++) - { - TypedConstraint* constraint = (*i); - if (constraint->GetUserConstraintId() == constraintid) - { - return constraint->GetAppliedImpulse(); - } - } - return 0.f; -} diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h deleted file mode 100644 index 053abcbd3e7..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.h +++ /dev/null @@ -1,261 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CCDPHYSICSENVIRONMENT -#define CCDPHYSICSENVIRONMENT - -#include "PHY_IPhysicsEnvironment.h" -#include <vector> -class CcdPhysicsController; -#include "SimdVector3.h" -#include "SimdTransform.h" - - - - -class TypedConstraint; -class SimulationIslandManager; -class CollisionDispatcher; -class Dispatcher; -//#include "BroadphaseInterface.h" - -//switch on/off new vehicle support -#define NEW_BULLET_VEHICLE_SUPPORT 1 - -#include "ConstraintSolver/ContactSolverInfo.h" - -class WrapperVehicle; -class PersistentManifold; -class BroadphaseInterface; -class OverlappingPairCache; -class IDebugDraw; -class PHY_IVehicle; - -/// CcdPhysicsEnvironment is experimental mainloop for physics simulation using optional continuous collision detection. -/// Physics Environment takes care of stepping the simulation and is a container for physics entities. -/// It stores rigidbodies,constraints, materials etc. -/// A derived class may be able to 'construct' entities by loading and/or converting -class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment -{ - SimdVector3 m_gravity; - - - -protected: - IDebugDraw* m_debugDrawer; - //solver iterations - int m_numIterations; - - //timestep subdivisions - int m_numTimeSubSteps; - - - int m_ccdMode; - int m_solverType; - int m_profileTimings; - bool m_enableSatCollisionDetection; - - ContactSolverInfo m_solverInfo; - - SimulationIslandManager* m_islandManager; - - public: - CcdPhysicsEnvironment(Dispatcher* dispatcher=0, OverlappingPairCache* pairCache=0); - - virtual ~CcdPhysicsEnvironment(); - - ///////////////////////////////////// - //PHY_IPhysicsEnvironment interface - ///////////////////////////////////// - - /// Perform an integration step of duration 'timeStep'. - - virtual void setDebugDrawer(IDebugDraw* debugDrawer) - { - m_debugDrawer = debugDrawer; - } - - virtual void setNumIterations(int numIter); - virtual void setNumTimeSubSteps(int numTimeSubSteps) - { - m_numTimeSubSteps = numTimeSubSteps; - } - virtual void setDeactivationTime(float dTime); - virtual void setDeactivationLinearTreshold(float linTresh) ; - virtual void setDeactivationAngularTreshold(float angTresh) ; - virtual void setContactBreakingTreshold(float contactBreakingTreshold) ; - virtual void setCcdMode(int ccdMode); - virtual void setSolverType(int solverType); - virtual void setSolverSorConstant(float sor); - virtual void setSolverTau(float tau); - virtual void setSolverDamping(float damping); - virtual void setLinearAirDamping(float damping); - virtual void setUseEpa(bool epa) ; - - virtual void beginFrame(); - virtual void endFrame() {}; - /// Perform an integration step of duration 'timeStep'. - virtual bool proceedDeltaTime(double curTime,float timeStep); - virtual bool proceedDeltaTimeOneStep(float timeStep); - - virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep){}; - //returns 0.f if no fixed timestep is used - - virtual float getFixedTimeStep(){ return 0.f;}; - - virtual void setDebugMode(int debugMode); - - virtual void setGravity(float x,float y,float z); - - virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ, - float axisX,float axisY,float axisZ); - - - //Following the COLLADA physics specification for constraints - virtual int createUniversalD6Constraint( - class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther, - SimdTransform& localAttachmentFrameRef, - SimdTransform& localAttachmentOther, - const SimdVector3& linearMinLimits, - const SimdVector3& linearMaxLimits, - const SimdVector3& angularMinLimits, - const SimdVector3& angularMaxLimits - ); - - - virtual void removeConstraint(int constraintid); - - virtual float getAppliedImpulse(int constraintid); - - - virtual void CallbackTriggers(); - - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - //complex constraint for vehicles - virtual PHY_IVehicle* getVehicleConstraint(int constraintId); -#else - virtual class PHY_IVehicle* getVehicleConstraint(int constraintId) - { - return 0; - } -#endif //NEW_BULLET_VEHICLE_SUPPORT - - TypedConstraint* getConstraintById(int constraintId); - - virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, - float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ); - - - //Methods for gamelogic collision/physics callbacks - virtual void addSensor(PHY_IPhysicsController* ctrl); - virtual void removeSensor(PHY_IPhysicsController* ctrl); - virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user); - virtual void requestCollisionCallback(PHY_IPhysicsController* ctrl); - virtual void removeCollisionCallback(PHY_IPhysicsController* ctrl); - - virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position); - virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight); - - - virtual int getNumContactPoints(); - - virtual void getContactPoint(int i,float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ); - - ////////////////////// - //CcdPhysicsEnvironment interface - //////////////////////// - - void addCcdPhysicsController(CcdPhysicsController* ctrl); - - void removeCcdPhysicsController(CcdPhysicsController* ctrl); - - BroadphaseInterface* GetBroadphase(); - - - - - - bool IsSatCollisionDetectionEnabled() const - { - return m_enableSatCollisionDetection; - } - - void EnableSatCollisionDetection(bool enableSat) - { - m_enableSatCollisionDetection = enableSat; - } - - void UpdateAabbs(float timeStep); - - int GetNumControllers(); - - CcdPhysicsController* GetPhysicsController( int index); - - - - const PersistentManifold* GetManifold(int index) const; - - std::vector<TypedConstraint*> m_constraints; - - void SyncMotionStates(float timeStep); - - - class CollisionWorld* GetCollisionWorld() - { - return m_collisionWorld; - } - - const class CollisionWorld* GetCollisionWorld() const - { - return m_collisionWorld; - } - - SimulationIslandManager* GetSimulationIslandManager() - { - return m_islandManager; - } - - const SimulationIslandManager* GetSimulationIslandManager() const - { - return m_islandManager; - } - - protected: - - - - - std::vector<CcdPhysicsController*> m_controllers; - - std::vector<CcdPhysicsController*> m_triggerControllers; - - PHY_ResponseCallback m_triggerCallbacks[PHY_NUM_RESPONSE]; - void* m_triggerCallbacksUserPtrs[PHY_NUM_RESPONSE]; - - std::vector<WrapperVehicle*> m_wrapperVehicles; - - class CollisionWorld* m_collisionWorld; - - class ConstraintSolver* m_solver; - - bool m_scalingPropagated; - - - -}; - -#endif //CCDPHYSICSENVIRONMENT diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics_vc7.vcproj b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics_vc7.vcproj deleted file mode 100644 index ad85f1cd523..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics_vc7.vcproj +++ /dev/null @@ -1,131 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="CcdPhysics" - ProjectGUID="{E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\Common;..\..\..\LinearMath;..\..\..\Bullet;..\..\..\BulletDynamics" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/CcdPhysics.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\Common;..\..\..\LinearMath;..\..\..\Bullet;..\..\..\BulletDynamics" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB" - RuntimeLibrary="4" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/CcdPhysics.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - <File - RelativePath=".\CcdPhysicsController.cpp"> - </File> - <File - RelativePath=".\CcdPhysicsEnvironment.cpp"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> - <File - RelativePath=".\CcdPhysicsController.h"> - </File> - <File - RelativePath=".\CcdPhysicsEnvironment.h"> - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> - </Filter> - <File - RelativePath=".\ReadMe.txt"> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics_vc8.vcproj b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics_vc8.vcproj deleted file mode 100644 index 8f85c50cf9f..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysics_vc8.vcproj +++ /dev/null @@ -1,191 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="CcdPhysics" - ProjectGUID="{E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="4" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\Common;..\..\..\LinearMath;..\..\..\Bullet;..\..\..\BulletDynamics" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/CcdPhysics.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="4" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\Common;..\..\..\LinearMath;..\..\..\Bullet;..\..\..\BulletDynamics" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB" - RuntimeLibrary="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/CcdPhysics.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\CcdPhysicsController.cpp" - > - </File> - <File - RelativePath=".\CcdPhysicsEnvironment.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\CcdPhysicsController.h" - > - </File> - <File - RelativePath=".\CcdPhysicsEnvironment.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - <File - RelativePath=".\VTune\CcdPhysics.vpj" - > - </File> - <File - RelativePath=".\ReadMe.txt" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelIslandDispatcher.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelIslandDispatcher.cpp deleted file mode 100644 index 1e3e44a8785..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelIslandDispatcher.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "ParallelIslandDispatcher.h" - - -#include "BroadphaseCollision/CollisionAlgorithm.h" -#include "CollisionDispatch/ConvexConvexAlgorithm.h" -#include "CollisionDispatch/EmptyCollisionAlgorithm.h" -#include "CollisionDispatch/ConvexConcaveCollisionAlgorithm.h" -#include "CollisionDispatch/CompoundCollisionAlgorithm.h" - -#include "CollisionShapes/CollisionShape.h" -#include "CollisionDispatch/CollisionObject.h" -#include <algorithm> - -static int gNumManifold2 = 0; - - - - - -ParallelIslandDispatcher::ParallelIslandDispatcher (): - m_useIslands(true), - m_defaultManifoldResult(0,0,0), - m_count(0) -{ - int i; - - for (i=0;i<MAX_BROADPHASE_COLLISION_TYPES;i++) - { - for (int j=0;j<MAX_BROADPHASE_COLLISION_TYPES;j++) - { - m_doubleDispatch[i][j] = 0; - } - } - - -}; - -PersistentManifold* ParallelIslandDispatcher::GetNewManifold(void* b0,void* b1) -{ - gNumManifold2++; - - //ASSERT(gNumManifold < 65535); - - - CollisionObject* body0 = (CollisionObject*)b0; - CollisionObject* body1 = (CollisionObject*)b1; - - PersistentManifold* manifold = new PersistentManifold (body0,body1); - m_manifoldsPtr.push_back(manifold); - - return manifold; -} - -void ParallelIslandDispatcher::ClearManifold(PersistentManifold* manifold) -{ - manifold->ClearManifold(); -} - - -void ParallelIslandDispatcher::ReleaseManifold(PersistentManifold* manifold) -{ - - gNumManifold2--; - - //printf("ReleaseManifold: gNumManifold2 %d\n",gNumManifold2); - - ClearManifold(manifold); - - std::vector<PersistentManifold*>::iterator i = - std::find(m_manifoldsPtr.begin(), m_manifoldsPtr.end(), manifold); - if (!(i == m_manifoldsPtr.end())) - { - std::swap(*i, m_manifoldsPtr.back()); - m_manifoldsPtr.pop_back(); - delete manifold; - - } - - -} - - -// -// todo: this is random access, it can be walked 'cache friendly'! -// -void ParallelIslandDispatcher::BuildAndProcessIslands(CollisionObjectArray& collisionObjects, IslandCallback* callback) -{ - int numBodies = collisionObjects.size(); - - for (int islandId=0;islandId<numBodies;islandId++) - { - - std::vector<PersistentManifold*> islandmanifold; - - //int numSleeping = 0; - - bool allSleeping = true; - - int i; - for (i=0;i<numBodies;i++) - { - CollisionObject* colObj0 = collisionObjects[i]; - if (colObj0->m_islandTag1 == islandId) - { - if (colObj0->GetActivationState()== ACTIVE_TAG) - { - allSleeping = false; - } - if (colObj0->GetActivationState()== DISABLE_DEACTIVATION) - { - allSleeping = false; - } - } - } - - - for (i=0;i<GetNumManifolds();i++) - { - PersistentManifold* manifold = this->GetManifoldByIndexInternal(i); - - //filtering for response - - CollisionObject* colObj0 = static_cast<CollisionObject*>(manifold->GetBody0()); - CollisionObject* colObj1 = static_cast<CollisionObject*>(manifold->GetBody1()); - { - if (((colObj0) && (colObj0)->m_islandTag1 == (islandId)) || - ((colObj1) && (colObj1)->m_islandTag1 == (islandId))) - { - - if (NeedsResponse(*colObj0,*colObj1)) - islandmanifold.push_back(manifold); - } - } - } - if (allSleeping) - { - int i; - for (i=0;i<numBodies;i++) - { - CollisionObject* colObj0 = collisionObjects[i]; - if (colObj0->m_islandTag1 == islandId) - { - colObj0->SetActivationState( ISLAND_SLEEPING ); - } - } - - - } else - { - - int i; - for (i=0;i<numBodies;i++) - { - CollisionObject* colObj0 = collisionObjects[i]; - if (colObj0->m_islandTag1 == islandId) - { - if ( colObj0->GetActivationState() == ISLAND_SLEEPING) - { - colObj0->SetActivationState( WANTS_DEACTIVATION); - } - } - } - - /// Process the actual simulation, only if not sleeping/deactivated - if (islandmanifold.size()) - { - callback->ProcessIsland(&islandmanifold[0],islandmanifold.size()); - } - - } - } -} - - - -CollisionAlgorithm* ParallelIslandDispatcher::InternalFindAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) -{ - m_count++; - CollisionObject* body0 = (CollisionObject*)proxy0.m_clientObject; - CollisionObject* body1 = (CollisionObject*)proxy1.m_clientObject; - - CollisionAlgorithmConstructionInfo ci; - ci.m_dispatcher = this; - - if (body0->m_collisionShape->IsConvex() && body1->m_collisionShape->IsConvex() ) - { - return new ConvexConvexAlgorithm(0,ci,&proxy0,&proxy1); - } - - if (body0->m_collisionShape->IsConvex() && body1->m_collisionShape->IsConcave()) - { - return new ConvexConcaveCollisionAlgorithm(ci,&proxy0,&proxy1); - } - - if (body1->m_collisionShape->IsConvex() && body0->m_collisionShape->IsConcave()) - { - return new ConvexConcaveCollisionAlgorithm(ci,&proxy1,&proxy0); - } - - if (body0->m_collisionShape->IsCompound()) - { - return new CompoundCollisionAlgorithm(ci,&proxy0,&proxy1); - } else - { - if (body1->m_collisionShape->IsCompound()) - { - return new CompoundCollisionAlgorithm(ci,&proxy1,&proxy0); - } - } - - - //failed to find an algorithm - return new EmptyAlgorithm(ci); - -} - -bool ParallelIslandDispatcher::NeedsResponse(const CollisionObject& colObj0,const CollisionObject& colObj1) -{ - - - //here you can do filtering - bool hasResponse = - (!(colObj0.m_collisionFlags & CollisionObject::noContactResponse)) && - (!(colObj1.m_collisionFlags & CollisionObject::noContactResponse)); - hasResponse = hasResponse && - (colObj0.IsActive() || colObj1.IsActive()); - return hasResponse; -} - -bool ParallelIslandDispatcher::NeedsCollision(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) -{ - - CollisionObject* body0 = (CollisionObject*)proxy0.m_clientObject; - CollisionObject* body1 = (CollisionObject*)proxy1.m_clientObject; - - assert(body0); - assert(body1); - - bool needsCollision = true; - - if ((body0->m_collisionFlags & CollisionObject::isStatic) && - (body1->m_collisionFlags & CollisionObject::isStatic)) - needsCollision = false; - - if ((!body0->IsActive()) && (!body1->IsActive())) - needsCollision = false; - - return needsCollision ; - -} - -///allows the user to get contact point callbacks -ManifoldResult* ParallelIslandDispatcher::GetNewManifoldResult(CollisionObject* obj0,CollisionObject* obj1,PersistentManifold* manifold) -{ - - - //in-place, this prevents parallel dispatching, but just adding a list would fix that. - ManifoldResult* manifoldResult = new (&m_defaultManifoldResult) ManifoldResult(obj0,obj1,manifold); - return manifoldResult; -} - -///allows the user to get contact point callbacks -void ParallelIslandDispatcher::ReleaseManifoldResult(ManifoldResult*) -{ - -} - - -void ParallelIslandDispatcher::DispatchAllCollisionPairs(BroadphasePair* pairs,int numPairs,DispatcherInfo& dispatchInfo) -{ - //m_blockedForChanges = true; - - int i; - - int dispatcherId = GetUniqueId(); - - - - for (i=0;i<numPairs;i++) - { - - BroadphasePair& pair = pairs[i]; - - if (dispatcherId>= 0) - { - //dispatcher will keep algorithms persistent in the collision pair - if (!pair.m_algorithms[dispatcherId]) - { - pair.m_algorithms[dispatcherId] = FindAlgorithm( - *pair.m_pProxy0, - *pair.m_pProxy1); - } - - if (pair.m_algorithms[dispatcherId]) - { - if (dispatchInfo.m_dispatchFunc == DispatcherInfo::DISPATCH_DISCRETE) - { - pair.m_algorithms[dispatcherId]->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo); - } else - { - float toi = pair.m_algorithms[dispatcherId]->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo); - if (dispatchInfo.m_timeOfImpact > toi) - dispatchInfo.m_timeOfImpact = toi; - - } - } - } else - { - //non-persistent algorithm dispatcher - CollisionAlgorithm* algo = FindAlgorithm( - *pair.m_pProxy0, - *pair.m_pProxy1); - - if (algo) - { - if (dispatchInfo.m_dispatchFunc == DispatcherInfo::DISPATCH_DISCRETE) - { - algo->ProcessCollision(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo); - } else - { - float toi = algo->CalculateTimeOfImpact(pair.m_pProxy0,pair.m_pProxy1,dispatchInfo); - if (dispatchInfo.m_timeOfImpact > toi) - dispatchInfo.m_timeOfImpact = toi; - } - } - } - - } - - //m_blockedForChanges = false; - -} - diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelIslandDispatcher.h b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelIslandDispatcher.h deleted file mode 100644 index e1e055f65b3..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelIslandDispatcher.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef PARALLEL_ISLAND_DISPATCHER_H -#define PARALLEL_ISLAND_DISPATCHER_H - -#include "BroadphaseCollision/Dispatcher.h" -#include "NarrowPhaseCollision/PersistentManifold.h" -#include "CollisionDispatch/UnionFind.h" -#include "CollisionDispatch/ManifoldResult.h" - -#include "BroadphaseCollision/BroadphaseProxy.h" -#include <vector> - -class IDebugDraw; - - -#include "CollisionDispatch/CollisionCreateFunc.h" - - - - -///ParallelIslandDispatcher dispatches entire simulation islands in parallel. -///For both collision detection and constraint solving. -///This development heads toward multi-core, CELL SPU and GPU approach -class ParallelIslandDispatcher : public Dispatcher -{ - - std::vector<PersistentManifold*> m_manifoldsPtr; - - UnionFind m_unionFind; - - bool m_useIslands; - - ManifoldResult m_defaultManifoldResult; - - CollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLLISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES]; - -public: - - UnionFind& GetUnionFind() { return m_unionFind;} - - struct IslandCallback - { - virtual ~IslandCallback() {}; - - virtual void ProcessIsland(PersistentManifold** manifolds,int numManifolds) = 0; - }; - - - int GetNumManifolds() const - { - return m_manifoldsPtr.size(); - } - - PersistentManifold* GetManifoldByIndexInternal(int index) - { - return m_manifoldsPtr[index]; - } - - const PersistentManifold* GetManifoldByIndexInternal(int index) const - { - return m_manifoldsPtr[index]; - } - - void InitUnionFind(int n) - { - if (m_useIslands) - m_unionFind.reset(n); - } - - void FindUnions(); - - int m_count; - - ParallelIslandDispatcher (); - virtual ~ParallelIslandDispatcher() {}; - - virtual PersistentManifold* GetNewManifold(void* b0,void* b1); - - virtual void ReleaseManifold(PersistentManifold* manifold); - - - virtual void BuildAndProcessIslands(CollisionObjectArray& collisionObjects, IslandCallback* callback); - - ///allows the user to get contact point callbacks - virtual ManifoldResult* GetNewManifoldResult(CollisionObject* obj0,CollisionObject* obj1,PersistentManifold* manifold); - - ///allows the user to get contact point callbacks - virtual void ReleaseManifoldResult(ManifoldResult*); - - virtual void ClearManifold(PersistentManifold* manifold); - - - CollisionAlgorithm* FindAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1) - { - CollisionAlgorithm* algo = InternalFindAlgorithm(proxy0,proxy1); - return algo; - } - - CollisionAlgorithm* InternalFindAlgorithm(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1); - - virtual bool NeedsCollision(BroadphaseProxy& proxy0,BroadphaseProxy& proxy1); - - virtual bool NeedsResponse(const CollisionObject& colObj0,const CollisionObject& colObj1); - - virtual int GetUniqueId() { return RIGIDBODY_DISPATCHER;} - - virtual void DispatchAllCollisionPairs(BroadphasePair* pairs,int numPairs,DispatcherInfo& dispatchInfo); - - - -}; - -#endif //PARALLEL_ISLAND_DISPATCHER_H - diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelPhysicsEnvironment.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelPhysicsEnvironment.cpp deleted file mode 100644 index 452fa10a3f0..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelPhysicsEnvironment.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#include "ParallelPhysicsEnvironment.h" -#include "CcdPhysicsController.h" -#include "ParallelIslandDispatcher.h" -#include "CollisionDispatch/CollisionWorld.h" -#include "ConstraintSolver/TypedConstraint.h" -#include "CollisionDispatch/SimulationIslandManager.h" -#include "SimulationIsland.h" - - -ParallelPhysicsEnvironment::ParallelPhysicsEnvironment(ParallelIslandDispatcher* dispatcher, OverlappingPairCache* pairCache): -CcdPhysicsEnvironment(dispatcher,pairCache) -{ - -} - -ParallelPhysicsEnvironment::~ParallelPhysicsEnvironment() -{ - -} - - - -/// Perform an integration step of duration 'timeStep'. -bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep) -{ - // Make sure the broadphase / overlapping AABB paircache is up-to-date - OverlappingPairCache* scene = m_collisionWorld->GetPairCache(); - scene->RefreshOverlappingPairs(); - - // Find the connected sets that can be simulated in parallel - // Using union find - -#ifdef USE_QUICKPROF - Profiler::beginBlock("IslandUnionFind"); -#endif //USE_QUICKPROF - - GetSimulationIslandManager()->UpdateActivationState(GetCollisionWorld(),GetCollisionWorld()->GetDispatcher()); - - { - int i; - int numConstraints = m_constraints.size(); - for (i=0;i< numConstraints ; i++ ) - { - TypedConstraint* constraint = m_constraints[i]; - - const RigidBody* colObj0 = &constraint->GetRigidBodyA(); - const RigidBody* colObj1 = &constraint->GetRigidBodyB(); - - if (((colObj0) && ((colObj0)->mergesSimulationIslands())) && - ((colObj1) && ((colObj1)->mergesSimulationIslands()))) - { - if (colObj0->IsActive() || colObj1->IsActive()) - { - - GetSimulationIslandManager()->GetUnionFind().unite((colObj0)->m_islandTag1, - (colObj1)->m_islandTag1); - } - } - } - } - - //Store the island id in each body - GetSimulationIslandManager()->StoreIslandActivationState(GetCollisionWorld()); - -#ifdef USE_QUICKPROF - Profiler::endBlock("IslandUnionFind"); -#endif //USE_QUICKPROF - - - - ///build simulation islands - -#ifdef USE_QUICKPROF - Profiler::beginBlock("BuildIslands"); -#endif //USE_QUICKPROF - - std::vector<SimulationIsland> simulationIslands; - simulationIslands.resize(GetNumControllers()); - - int k; - for (k=0;k<GetNumControllers();k++) - { - CcdPhysicsController* ctrl = m_controllers[k]; - int tag = ctrl->GetRigidBody()->m_islandTag1; - if (tag>=0) - { - simulationIslands[tag].m_controllers.push_back(ctrl); - } - } - - Dispatcher* dispatcher = GetCollisionWorld()->GetDispatcher(); - - - //this is a brute force approach, will rethink later about more subtle ways - int i; - for (i=0;i< scene->GetNumOverlappingPairs();i++) - { - BroadphasePair* pair = &scene->GetOverlappingPair(i); - - CollisionObject* col0 = static_cast<CollisionObject*>(pair->m_pProxy0->m_clientObject); - CollisionObject* col1 = static_cast<CollisionObject*>(pair->m_pProxy1->m_clientObject); - - if (col0->m_islandTag1 > col1->m_islandTag1) - { - simulationIslands[col0->m_islandTag1].m_overlappingPairIndices.push_back(i); - } else - { - simulationIslands[col1->m_islandTag1].m_overlappingPairIndices.push_back(i); - } - } - - //store constraint indices for each island - for (i=0;i<m_constraints.size();i++) - { - TypedConstraint& constraint = *m_constraints[i]; - if (constraint.GetRigidBodyA().m_islandTag1 > constraint.GetRigidBodyB().m_islandTag1) - { - simulationIslands[constraint.GetRigidBodyA().m_islandTag1].m_constraintIndices.push_back(i); - } else - { - simulationIslands[constraint.GetRigidBodyB().m_islandTag1].m_constraintIndices.push_back(i); - } - - } - - //add all overlapping pairs for each island - - for (i=0;i<dispatcher->GetNumManifolds();i++) - { - PersistentManifold* manifold = dispatcher->GetManifoldByIndexInternal(i); - - //filtering for response - - CollisionObject* colObj0 = static_cast<CollisionObject*>(manifold->GetBody0()); - CollisionObject* colObj1 = static_cast<CollisionObject*>(manifold->GetBody1()); - { - int islandTag = colObj0->m_islandTag1; - if (colObj1->m_islandTag1 > islandTag) - islandTag = colObj1->m_islandTag1; - - if (dispatcher->NeedsResponse(*colObj0,*colObj1)) - simulationIslands[islandTag].m_manifolds.push_back(manifold); - - } - } - - #ifdef USE_QUICKPROF - Profiler::endBlock("BuildIslands"); - #endif //USE_QUICKPROF - - -#ifdef USE_QUICKPROF - Profiler::beginBlock("SimulateIsland"); -#endif //USE_QUICKPROF - - TypedConstraint** constraintBase = 0; - if (m_constraints.size()) - constraintBase = &m_constraints[0]; - - - - //Each simulation island can be processed in parallel (will be put on a job queue) - for (k=0;k<simulationIslands.size();k++) - { - if (simulationIslands[k].m_controllers.size()) - { - simulationIslands[k].Simulate(m_debugDrawer,m_numIterations, constraintBase ,&scene->GetOverlappingPair(0),dispatcher,GetBroadphase(),m_solver,timeStep); - } - } - -#ifdef USE_QUICKPROF - Profiler::endBlock("SimulateIsland"); -#endif //USE_QUICKPROF - - return true; - -}
\ No newline at end of file diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelPhysicsEnvironment.h b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelPhysicsEnvironment.h deleted file mode 100644 index 530ba5845e5..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/ParallelPhysicsEnvironment.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef PARALLELPHYSICSENVIRONMENT -#define PARALLELPHYSICSENVIRONMENT - -#include "CcdPhysicsEnvironment.h" -class ParallelIslandDispatcher; - - -/// ParallelPhysicsEnvironment is experimental parallel mainloop for physics simulation -/// Physics Environment takes care of stepping the simulation and is a container for physics entities. -/// It stores rigidbodies,constraints, materials etc. -/// A derived class may be able to 'construct' entities by loading and/or converting -class ParallelPhysicsEnvironment : public CcdPhysicsEnvironment -{ - - - public: - ParallelPhysicsEnvironment(ParallelIslandDispatcher* dispatcher=0, OverlappingPairCache* pairCache=0); - - virtual ~ParallelPhysicsEnvironment(); - - - /// Perform an integration step of duration 'timeStep'. - virtual bool proceedDeltaTimeOneStep(float timeStep); - - //void BuildSimulationIslands(); - -}; - -#endif //PARALLELPHYSICSENVIRONMENT diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.cpp deleted file mode 100644 index 47c3094ca05..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "SimulationIsland.h" -#include "SimdTransform.h" -#include "CcdPhysicsController.h" -#include "BroadphaseCollision/OverlappingPairCache.h" -#include "CollisionShapes/CollisionShape.h" -#include "BroadphaseCollision/Dispatcher.h" -#include "ConstraintSolver/ContactSolverInfo.h" -#include "ConstraintSolver/ConstraintSolver.h" -#include "ConstraintSolver/TypedConstraint.h" -#include "IDebugDraw.h" - -extern float gContactBreakingTreshold; - -bool SimulationIsland::Simulate(IDebugDraw* debugDrawer,int numSolverIterations,TypedConstraint** constraintsBaseAddress,BroadphasePair* overlappingPairBaseAddress, Dispatcher* dispatcher,BroadphaseInterface* broadphase,class ConstraintSolver* solver,float timeStep) -{ - - -#ifdef USE_QUICKPROF - - Profiler::beginBlock("predictIntegratedTransform"); -#endif //USE_QUICKPROF - - { - // std::vector<CcdPhysicsController*>::iterator i; - - - - int k; - for (k=0;k<GetNumControllers();k++) - { - CcdPhysicsController* ctrl = m_controllers[k]; - // SimdTransform predictedTrans; - RigidBody* body = ctrl->GetRigidBody(); - //todo: only do this when necessary, it's used for contact points - body->m_cachedInvertedWorldTransform = body->m_worldTransform.inverse(); - - if (body->IsActive()) - { - if (!body->IsStatic()) - { - body->applyForces( timeStep); - body->integrateVelocities( timeStep); - body->predictIntegratedTransform(timeStep,body->m_interpolationWorldTransform); - } - } - - } - } - -#ifdef USE_QUICKPROF - Profiler::endBlock("predictIntegratedTransform"); -#endif //USE_QUICKPROF - - //BroadphaseInterface* scene = GetBroadphase(); - - - // - // collision detection (?) - // - - - #ifdef USE_QUICKPROF - Profiler::beginBlock("DispatchAllCollisionPairs"); - #endif //USE_QUICKPROF - - -// int numsubstep = m_numIterations; - - - DispatcherInfo dispatchInfo; - dispatchInfo.m_timeStep = timeStep; - dispatchInfo.m_stepCount = 0; - dispatchInfo.m_enableSatConvex = false;//m_enableSatCollisionDetection; - dispatchInfo.m_debugDraw = debugDrawer; - - std::vector<BroadphasePair> overlappingPairs; - overlappingPairs.resize(this->m_overlappingPairIndices.size()); - - //gather overlapping pair info - int i; - for (i=0;i<m_overlappingPairIndices.size();i++) - { - overlappingPairs[i] = overlappingPairBaseAddress[m_overlappingPairIndices[i]]; - } - - - //pairCache->RefreshOverlappingPairs(); - if (overlappingPairs.size()) - { - dispatcher->DispatchAllCollisionPairs(&overlappingPairs[0],overlappingPairs.size(),dispatchInfo);///numsubstep,g); - } - - //scatter overlapping pair info, mainly the created algorithms/contact caches - - for (i=0;i<m_overlappingPairIndices.size();i++) - { - overlappingPairBaseAddress[m_overlappingPairIndices[i]] = overlappingPairs[i]; - } - - - #ifdef USE_QUICKPROF - Profiler::endBlock("DispatchAllCollisionPairs"); - #endif //USE_QUICKPROF - - - - - int numRigidBodies = m_controllers.size(); - - - - - //contacts - #ifdef USE_QUICKPROF - Profiler::beginBlock("SolveConstraint"); - #endif //USE_QUICKPROF - - - //solve the regular constraints (point 2 point, hinge, etc) - - for (int g=0;g<numSolverIterations;g++) - { - // - // constraint solving - // - - int i; - int numConstraints = m_constraintIndices.size(); - - //point to point constraints - for (i=0;i< numConstraints ; i++ ) - { - TypedConstraint* constraint = constraintsBaseAddress[m_constraintIndices[i]]; - constraint->BuildJacobian(); - constraint->SolveConstraint( timeStep ); - - } - - - } - - #ifdef USE_QUICKPROF - Profiler::endBlock("SolveConstraint"); - #endif //USE_QUICKPROF - - /* - - //solve the vehicles - - #ifdef NEW_BULLET_VEHICLE_SUPPORT - //vehicles - int numVehicles = m_wrapperVehicles.size(); - for (int i=0;i<numVehicles;i++) - { - WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - RaycastVehicle* vehicle = wrapperVehicle->GetVehicle(); - vehicle->UpdateVehicle( timeStep); - } - #endif //NEW_BULLET_VEHICLE_SUPPORT -*/ - - /* - - Profiler::beginBlock("CallbackTriggers"); - #endif //USE_QUICKPROF - - CallbackTriggers(); - - #ifdef USE_QUICKPROF - Profiler::endBlock("CallbackTriggers"); - - } - */ - - //OverlappingPairCache* scene = GetCollisionWorld()->GetPairCache(); - - ContactSolverInfo solverInfo; - - solverInfo.m_friction = 0.9f; - solverInfo.m_numIterations = numSolverIterations; - solverInfo.m_timeStep = timeStep; - solverInfo.m_restitution = 0.f;//m_restitution; - - - if (m_manifolds.size()) - { - solver->SolveGroup( &m_manifolds[0],m_manifolds.size(),solverInfo,0); - } - - -#ifdef USE_QUICKPROF - Profiler::beginBlock("proceedToTransform"); -#endif //USE_QUICKPROF - { - - - - { - - - UpdateAabbs(debugDrawer,broadphase,timeStep); - - - float toi = 1.f; - - //experimental continuous collision detection - - /* if (m_ccdMode == 3) - { - DispatcherInfo dispatchInfo; - dispatchInfo.m_timeStep = timeStep; - dispatchInfo.m_stepCount = 0; - dispatchInfo.m_dispatchFunc = DispatcherInfo::DISPATCH_CONTINUOUS; - - // GetCollisionWorld()->GetDispatcher()->DispatchAllCollisionPairs(scene,dispatchInfo); - toi = dispatchInfo.m_timeOfImpact; - - } - */ - - - - // - // integrating solution - // - - { - - std::vector<CcdPhysicsController*>::iterator i; - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - - CcdPhysicsController* ctrl = *i; - - SimdTransform predictedTrans; - RigidBody* body = ctrl->GetRigidBody(); - - if (body->IsActive()) - { - - if (!body->IsStatic()) - { - body->predictIntegratedTransform(timeStep* toi, predictedTrans); - body->proceedToTransform( predictedTrans); - } - - } - } - - } - - - - - - // - // disable sleeping physics objects - // - - std::vector<CcdPhysicsController*> m_sleepingControllers; - - std::vector<CcdPhysicsController*>::iterator i; - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - CcdPhysicsController* ctrl = (*i); - RigidBody* body = ctrl->GetRigidBody(); - - ctrl->UpdateDeactivation(timeStep); - - - if (ctrl->wantsSleeping()) - { - if (body->GetActivationState() == ACTIVE_TAG) - body->SetActivationState( WANTS_DEACTIVATION ); - } else - { - if (body->GetActivationState() != DISABLE_DEACTIVATION) - body->SetActivationState( ACTIVE_TAG ); - } - - if (true) - { - if (body->GetActivationState() == ISLAND_SLEEPING) - { - m_sleepingControllers.push_back(ctrl); - } - } else - { - if (ctrl->wantsSleeping()) - { - m_sleepingControllers.push_back(ctrl); - } - } - } - - - - - } - - -#ifdef USE_QUICKPROF - Profiler::endBlock("proceedToTransform"); - - Profiler::beginBlock("SyncMotionStates"); -#endif //USE_QUICKPROF - - SyncMotionStates(timeStep); - -#ifdef USE_QUICKPROF - Profiler::endBlock("SyncMotionStates"); - -#endif //USE_QUICKPROF - - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - //sync wheels for vehicles - int numVehicles = m_wrapperVehicles.size(); - for (int i=0;i<numVehicles;i++) - { - WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - - wrapperVehicle->SyncWheels(); - } -#endif //NEW_BULLET_VEHICLE_SUPPORT - - return true; - } -} - - - -void SimulationIsland::SyncMotionStates(float timeStep) -{ - std::vector<CcdPhysicsController*>::iterator i; - - // - // synchronize the physics and graphics transformations - // - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - CcdPhysicsController* ctrl = (*i); - ctrl->SynchronizeMotionStates(timeStep); - - } - -} - - - -void SimulationIsland::UpdateAabbs(IDebugDraw* debugDrawer,BroadphaseInterface* scene,float timeStep) -{ - std::vector<CcdPhysicsController*>::iterator i; - - - // - // update aabbs, only for moving objects (!) - // - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - CcdPhysicsController* ctrl = (*i); - RigidBody* body = ctrl->GetRigidBody(); - - - SimdPoint3 minAabb,maxAabb; - CollisionShape* shapeinterface = ctrl->GetCollisionShape(); - - - - shapeinterface->CalculateTemporalAabb(body->getCenterOfMassTransform(), - body->getLinearVelocity(), - //body->getAngularVelocity(), - SimdVector3(0.f,0.f,0.f),//no angular effect for now //body->getAngularVelocity(), - timeStep,minAabb,maxAabb); - - - SimdVector3 manifoldExtraExtents(gContactBreakingTreshold,gContactBreakingTreshold,gContactBreakingTreshold); - minAabb -= manifoldExtraExtents; - maxAabb += manifoldExtraExtents; - - BroadphaseProxy* bp = body->m_broadphaseHandle; - if (bp) - { - - SimdVector3 color (1,1,0); - - class IDebugDraw* m_debugDrawer = 0; -/* - if (m_debugDrawer) - { - //draw aabb - switch (body->GetActivationState()) - { - case ISLAND_SLEEPING: - { - color.setValue(1,1,1); - break; - } - case WANTS_DEACTIVATION: - { - color.setValue(0,0,1); - break; - } - case ACTIVE_TAG: - { - break; - } - case DISABLE_DEACTIVATION: - { - color.setValue(1,0,1); - }; - - }; - - if (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawAabb) - { - DrawAabb(m_debugDrawer,minAabb,maxAabb,color); - } - } -*/ - - - if ( (maxAabb-minAabb).length2() < 1e12f) - { - scene->SetAabb(bp,minAabb,maxAabb); - } else - { - //something went wrong, investigate - //removeCcdPhysicsController(ctrl); - body->SetActivationState(DISABLE_SIMULATION); - - static bool reportMe = true; - if (reportMe) - { - reportMe = false; - printf("Overflow in AABB, object removed from simulation \n"); - printf("If you can reproduce this, please email bugs@continuousphysics.com\n"); - printf("Please include above information, your Platform, version of OS.\n"); - printf("Thanks.\n"); - } - - } - - } - } -}
\ No newline at end of file diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.h b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.h deleted file mode 100644 index c4c41bf03c4..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/SimulationIsland.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SIMULATION_ISLAND_H -#define SIMULATION_ISLAND_H - -#include <vector> -class BroadphaseInterface; -class Dispatcher; -class IDebugDraw; - -///SimulationIsland groups all computations and data (for collision detection and dynamics) that can execute in parallel with other SimulationIsland's -///The ParallelPhysicsEnvironment and ParallelIslandDispatcher will dispatch SimulationIsland's -///At the start of the simulation timestep the simulation islands are re-calculated -///During one timestep there is no merging or splitting of Simulation Islands -class SimulationIsland -{ - - public: - std::vector<class CcdPhysicsController*> m_controllers; - std::vector<class PersistentManifold*> m_manifolds; - - std::vector<int> m_overlappingPairIndices; - std::vector<int> m_constraintIndices; - - bool Simulate(IDebugDraw* debugDrawer,int numSolverIterations,class TypedConstraint** constraintsBaseAddress,struct BroadphasePair* overlappingPairBaseAddress, Dispatcher* dispatcher,BroadphaseInterface* broadphase, class ConstraintSolver* solver, float timeStep); - - - int GetNumControllers() - { - return m_controllers.size(); - } - - - - - void SyncMotionStates(float timeStep); - void UpdateAabbs(IDebugDraw* debugDrawer,BroadphaseInterface* broadphase,float timeStep); -}; - -#endif //SIMULATION_ISLAND_H
\ No newline at end of file diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_DynamicTypes.h b/extern/bullet/Extras/PhysicsInterface/Common/PHY_DynamicTypes.h deleted file mode 100644 index 3952377181a..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_DynamicTypes.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef __PHY_DYNAMIC_TYPES -#define __PHY_DYNAMIC_TYPES - - - -class PHY_ResponseTable; - -class PHY_Shape; - -struct PHY__Vector3 -{ - float m_vec[4]; - operator const float* () const - { - return &m_vec[0]; - } - operator float* () - { - return &m_vec[0]; - } -}; -//typedef float PHY__Vector3[4]; - -typedef enum -{ - PHY_FH_RESPONSE, - PHY_SENSOR_RESPONSE, /* Touch Sensors */ - PHY_CAMERA_RESPONSE, /* Visibility Culling */ - PHY_OBJECT_RESPONSE, /* Object Dynamic Geometry Response */ - PHY_STATIC_RESPONSE, /* Static Geometry Response */ - - PHY_NUM_RESPONSE -}; - - typedef struct PHY_CollData { - PHY__Vector3 m_point1; /* Point in object1 in world coordinates */ - PHY__Vector3 m_point2; /* Point in object2 in world coordinates */ - PHY__Vector3 m_normal; /* point2 - point1 */ - } PHY_CollData; - - - typedef bool (*PHY_ResponseCallback)(void *client_data, - void *client_object1, - void *client_object2, - const PHY_CollData *coll_data); - - - -/// PHY_PhysicsType enumerates all possible Physics Entities. -/// It is mainly used to create/add Physics Objects - -typedef enum PHY_PhysicsType { - PHY_CONVEX_RIGIDBODY=16386, - PHY_CONCAVE_RIGIDBODY=16399, - PHY_CONVEX_FIXEDBODY=16388,//'collision object' - PHY_CONCAVE_FIXEDBODY=16401, - PHY_CONVEX_KINEMATICBODY=16387,// - PHY_CONCAVE_KINEMATICBODY=16400, - PHY_CONVEX_PHANTOMBODY=16398, - PHY_CONCAVE_PHANTOMBODY=16402 -} PHY_PhysicsType; - -/// PHY_ConstraintType enumerates all supported Constraint Types -typedef enum PHY_ConstraintType { - PHY_POINT2POINT_CONSTRAINT=1, - PHY_LINEHINGE_CONSTRAINT=2, - PHY_ANGULAR_CONSTRAINT = 3,//hinge without ball socket - PHY_VEHICLE_CONSTRAINT=11,//complex 'constraint' that turns a rigidbody into a vehicle - PHY_GENERIC_6DOF_CONSTRAINT=12,//can leave any of the 6 degree of freedom 'free' or 'locked' - -} PHY_ConstraintType; - -typedef float PHY_Vector3[3]; - -#endif //__PHY_DYNAMIC_TYPES - diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IMotionState.cpp b/extern/bullet/Extras/PhysicsInterface/Common/PHY_IMotionState.cpp deleted file mode 100644 index c3fd6353018..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IMotionState.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "PHY_IMotionState.h" - -PHY_IMotionState::~PHY_IMotionState() -{ - -} diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IMotionState.h b/extern/bullet/Extras/PhysicsInterface/Common/PHY_IMotionState.h deleted file mode 100644 index 23dfdebaee0..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IMotionState.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef PHY__MOTIONSTATE_H -#define PHY__MOTIONSTATE_H - -/** - PHY_IMotionState is the Interface to explicitly synchronize the world transformation. - Default implementations for mayor graphics libraries like OpenGL and DirectX can be provided. -*/ -class PHY_IMotionState - -{ - public: - - virtual ~PHY_IMotionState(); - - virtual void getWorldPosition(float& posX,float& posY,float& posZ)=0; - virtual void getWorldScaling(float& scaleX,float& scaleY,float& scaleZ)=0; - virtual void getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)=0; - - virtual void setWorldPosition(float posX,float posY,float posZ)=0; - virtual void setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)=0; - - virtual void calculateWorldTransformations()=0; -}; - -#endif //PHY__MOTIONSTATE_H - diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsController.cpp b/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsController.cpp deleted file mode 100644 index 1ef7118ec46..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsController.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "PHY_IPhysicsController.h" - -PHY_IPhysicsController::~PHY_IPhysicsController() -{ - -} - diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsController.h b/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsController.h deleted file mode 100644 index 822cf4e7ff1..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsController.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef PHY_IPHYSICSCONTROLLER_H -#define PHY_IPHYSICSCONTROLLER_H - -#include "PHY_DynamicTypes.h" - -/** - PHY_IPhysicsController is the abstract simplified Interface to a physical object. - It contains the IMotionState and IDeformableMesh Interfaces. -*/ - - -class PHY_IPhysicsController -{ - - public: - - virtual ~PHY_IPhysicsController(); - /** - SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - virtual bool SynchronizeMotionStates(float time)=0; - /** - WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - - virtual void WriteMotionStateToDynamics(bool nondynaonly)=0; - virtual void WriteDynamicsToMotionState()=0; - // controller replication - virtual void PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl)=0; - - // kinematic methods - virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local)=0; - virtual void RelativeRotate(const float drot[12],bool local)=0; - virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal)=0; - virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)=0; - virtual void setPosition(float posX,float posY,float posZ)=0; - virtual void getPosition(PHY__Vector3& pos) const=0; - virtual void setScaling(float scaleX,float scaleY,float scaleZ)=0; - - // physics methods - virtual void ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local)=0; - virtual void ApplyForce(float forceX,float forceY,float forceZ,bool local)=0; - virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local)=0; - virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local)=0; - - virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ)=0; - virtual void SetActive(bool active)=0; - - // reading out information from physics - virtual void GetLinearVelocity(float& linvX,float& linvY,float& linvZ)=0; - virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ)=0; - virtual void getReactionForce(float& forceX,float& forceY,float& forceZ)=0; - - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted - virtual void setRigidBody(bool rigid)=0; - - - // clientinfo for raycasts for example - virtual void* getNewClientInfo()=0; - virtual void setNewClientInfo(void* clientinfo)=0; - virtual PHY_IPhysicsController* GetReplica() {return 0;} - - virtual void calcXform() =0; - virtual void SetMargin(float margin) =0; - virtual float GetMargin() const=0; - virtual float GetRadius() const { return 0.f;} - PHY__Vector3 GetWorldPosition(PHY__Vector3& localpos); - -}; - -#endif //PHY_IPHYSICSCONTROLLER_H - diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsEnvironment.cpp b/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsEnvironment.cpp deleted file mode 100644 index f59efad561a..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsEnvironment.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2001-2005 Erwin Coumans <phy@erwincoumans.com> - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "PHY_IPhysicsEnvironment.h" - -/** -* Physics Environment takes care of stepping the simulation and is a container for physics entities (rigidbodies,constraints, materials etc.) -* A derived class may be able to 'construct' entities by loading and/or converting -*/ - - - -PHY_IPhysicsEnvironment::~PHY_IPhysicsEnvironment() -{ - -} diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsEnvironment.h b/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsEnvironment.h deleted file mode 100644 index cbf9094037f..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IPhysicsEnvironment.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef _IPHYSICSENVIRONMENT -#define _IPHYSICSENVIRONMENT - -#include <vector> -#include "PHY_DynamicTypes.h" - -/** -* Physics Environment takes care of stepping the simulation and is a container for physics entities (rigidbodies,constraints, materials etc.) -* A derived class may be able to 'construct' entities by loading and/or converting -*/ -class PHY_IPhysicsEnvironment -{ - public: - virtual ~PHY_IPhysicsEnvironment(); - /// Perform an integration step of duration 'timeStep'. - virtual bool proceedDeltaTime(double curTime,float timeStep)=0; - - - virtual void setGravity(float x,float y,float z)=0; - - virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ, - float axisX,float axisY,float axisZ)=0; - virtual void removeConstraint(int constraintid)=0; - - virtual float getAppliedImpulse(int constraintid){ return 0.f;} - - virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, - float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ)=0; - - - //Methods for gamelogic collision/physics callbacks - //todo: - virtual void addSensor(PHY_IPhysicsController* ctrl)=0; - virtual void removeSensor(PHY_IPhysicsController* ctrl)=0; - virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)=0; - virtual void requestCollisionCallback(PHY_IPhysicsController* ctrl)=0; - virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position) =0; - virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight)=0; - -}; - -#endif //_IPHYSICSENVIRONMENT - diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IVehicle.cpp b/extern/bullet/Extras/PhysicsInterface/Common/PHY_IVehicle.cpp deleted file mode 100644 index e22b7fd1a8e..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IVehicle.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#include "PHY_IVehicle.h" - -PHY_IVehicle::~PHY_IVehicle() -{ - -} diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IVehicle.h b/extern/bullet/Extras/PhysicsInterface/Common/PHY_IVehicle.h deleted file mode 100644 index 6d2cb66843e..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_IVehicle.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef PHY_IVEHICLE_H -#define PHY_IVEHICLE_H - -//PHY_IVehicle provides a generic interface for (raycast based) vehicles. Mostly targetting 4 wheel cars and 2 wheel motorbikes. - -class PHY_IMotionState; -#include "PHY_DynamicTypes.h" - -class PHY_IVehicle -{ -public: - - virtual ~PHY_IVehicle(); - - virtual void AddWheel( - PHY_IMotionState* motionState, - PHY__Vector3 connectionPoint, - PHY__Vector3 downDirection, - PHY__Vector3 axleDirection, - float suspensionRestLength, - float wheelRadius, - bool hasSteering - ) = 0; - - - virtual int GetNumWheels() const = 0; - - virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const = 0; - virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const = 0; - virtual float GetWheelRotation(int wheelIndex) const = 0; - - virtual int GetUserConstraintId() const =0; - virtual int GetUserConstraintType() const =0; - - //some basic steering/braking/tuning/balancing (bikes) - - virtual void SetSteeringValue(float steering,int wheelIndex) = 0; - - virtual void ApplyEngineForce(float force,int wheelIndex) = 0; - - virtual void ApplyBraking(float braking,int wheelIndex) = 0; - -}; - -#endif //PHY_IVEHICLE_H diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PHY_Pro.h b/extern/bullet/Extras/PhysicsInterface/Common/PHY_Pro.h deleted file mode 100644 index aa455164dcb..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PHY_Pro.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef PHY_PROPSH -#define PHY_PROPSH - - -class CollisionShape; - -// Properties of dynamic objects -struct PHY_ShapeProps { - float m_mass; // Total mass - float m_inertia; // Inertia, should be a tensor some time - float m_lin_drag; // Linear drag (air, water) 0 = concrete, 1 = vacuum - float m_ang_drag; // Angular drag - float m_friction_scaling[3]; // Scaling for anisotropic friction. Component in range [0, 1] - bool m_do_anisotropic; // Should I do anisotropic friction? - bool m_do_fh; // Should the object have a linear Fh spring? - bool m_do_rot_fh; // Should the object have an angular Fh spring? - CollisionShape* m_shape; -}; - - -// Properties of collidable objects (non-ghost objects) -struct PHY_MaterialProps { - float m_restitution; // restitution of energie after a collision 0 = inelastic, 1 = elastic - float m_friction; // Coulomb friction (= ratio between the normal en maximum friction force) - float m_fh_spring; // Spring constant (both linear and angular) - float m_fh_damping; // Damping factor (linear and angular) in range [0, 1] - float m_fh_distance; // The range above the surface where Fh is active. - bool m_fh_normal; // Should the object slide off slopes? -}; - -#endif //PHY_PROPSH - diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterface.dsp b/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterface.dsp deleted file mode 100644 index 7617570f4a7..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterface.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="PhysicsInterface" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=PhysicsInterface - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "PhysicsInterface.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "PhysicsInterface.mak" CFG="PhysicsInterface - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "PhysicsInterface - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "PhysicsInterface - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "PhysicsInterface - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -LINK32=link.exe -lib -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\LinearMath" /I "..\..\..\Extras\PhysicsInterface\Common" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "PhysicsInterface - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -LINK32=link.exe -lib -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\LinearMath" /I "..\..\..\Extras\PhysicsInterface\Common" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "PhysicsInterface - Win32 Release" -# Name "PhysicsInterface - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\PHY_IMotionState.cpp -# End Source File -# Begin Source File - -SOURCE=.\PHY_IPhysicsController.cpp -# End Source File -# Begin Source File - -SOURCE=.\PHY_IPhysicsEnvironment.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\PHY_DynamicTypes.h -# End Source File -# Begin Source File - -SOURCE=.\PHY_IMotionState.h -# End Source File -# Begin Source File - -SOURCE=.\PHY_IPhysicsController.h -# End Source File -# Begin Source File - -SOURCE=.\PHY_IPhysicsEnvironment.h -# End Source File -# Begin Source File - -SOURCE=.\PHY_Pro.h -# End Source File -# End Group -# End Target -# End Project diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterfaceCommon/PhysicsInterfaceCommon_vc7.vcproj b/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterfaceCommon/PhysicsInterfaceCommon_vc7.vcproj deleted file mode 100644 index c47e8b1b4e1..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterfaceCommon/PhysicsInterfaceCommon_vc7.vcproj +++ /dev/null @@ -1,143 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="PhysicsInterfaceCommon" - ProjectGUID="{87D8C006-6DCC-4156-A03E-8CEA1B4C0580}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\..\..\LinearMath" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/PhysicsInterfaceCommon.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\..\LinearMath" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB" - RuntimeLibrary="4" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/PhysicsInterfaceCommon.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - <File - RelativePath="..\PHY_IMotionState.cpp"> - </File> - <File - RelativePath="..\PHY_IPhysicsController.cpp"> - </File> - <File - RelativePath="..\PHY_IPhysicsEnvironment.cpp"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> - <File - RelativePath="..\PHY_DynamicTypes.h"> - </File> - <File - RelativePath="..\PHY_IMotionState.h"> - </File> - <File - RelativePath="..\PHY_IPhysicsController.h"> - </File> - <File - RelativePath="..\PHY_IPhysicsEnvironment.h"> - </File> - <File - RelativePath="..\PHY_Pro.h"> - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> - </Filter> - <File - RelativePath=".\ReadMe.txt"> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterfaceCommon/PhysicsInterfaceCommon_vc8.vcproj b/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterfaceCommon/PhysicsInterfaceCommon_vc8.vcproj deleted file mode 100644 index b0c5fe09eaf..00000000000 --- a/extern/bullet/Extras/PhysicsInterface/Common/PhysicsInterfaceCommon/PhysicsInterfaceCommon_vc8.vcproj +++ /dev/null @@ -1,211 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="PhysicsInterfaceCommon" - ProjectGUID="{87D8C006-6DCC-4156-A03E-8CEA1B4C0580}" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="4" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\..\..\LinearMath" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/PhysicsInterfaceCommon.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="4" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\..\LinearMath" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB" - RuntimeLibrary="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/PhysicsInterfaceCommon.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath="..\PHY_IMotionState.cpp" - > - </File> - <File - RelativePath="..\PHY_IPhysicsController.cpp" - > - </File> - <File - RelativePath="..\PHY_IPhysicsEnvironment.cpp" - > - </File> - <File - RelativePath="..\PHY_IVehicle.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="..\PHY_DynamicTypes.h" - > - </File> - <File - RelativePath="..\PHY_IMotionState.h" - > - </File> - <File - RelativePath="..\PHY_IPhysicsController.h" - > - </File> - <File - RelativePath="..\PHY_IPhysicsEnvironment.h" - > - </File> - <File - RelativePath="..\PHY_IVehicle.h" - > - </File> - <File - RelativePath="..\PHY_Pro.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - <File - RelativePath=".\ReadMe.txt" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/LinearMath/AabbUtil2.h b/extern/bullet/LinearMath/AabbUtil2.h deleted file mode 100644 index dab39b8a47e..00000000000 --- a/extern/bullet/LinearMath/AabbUtil2.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef AABB_UTIL2 -#define AABB_UTIL2 - -#include "SimdVector3.h" - -#define SimdMin(a,b) ((a < b ? a : b)) -#define SimdMax(a,b) ((a > b ? a : b)) - - -/// conservative test for overlap between two aabbs -SIMD_FORCE_INLINE bool TestAabbAgainstAabb2(const SimdVector3 &aabbMin1, const SimdVector3 &aabbMax1, - const SimdVector3 &aabbMin2, const SimdVector3 &aabbMax2) -{ - bool overlap = true; - overlap = (aabbMin1[0] > aabbMax2[0] || aabbMax1[0] < aabbMin2[0]) ? false : overlap; - overlap = (aabbMin1[2] > aabbMax2[2] || aabbMax1[2] < aabbMin2[2]) ? false : overlap; - overlap = (aabbMin1[1] > aabbMax2[1] || aabbMax1[1] < aabbMin2[1]) ? false : overlap; - return overlap; -} - -/// conservative test for overlap between triangle and aabb -SIMD_FORCE_INLINE bool TestTriangleAgainstAabb2(const SimdVector3 *vertices, - const SimdVector3 &aabbMin, const SimdVector3 &aabbMax) -{ - const SimdVector3 &p1 = vertices[0]; - const SimdVector3 &p2 = vertices[1]; - const SimdVector3 &p3 = vertices[2]; - - if (SimdMin(SimdMin(p1[0], p2[0]), p3[0]) > aabbMax[0]) return false; - if (SimdMax(SimdMax(p1[0], p2[0]), p3[0]) < aabbMin[0]) return false; - - if (SimdMin(SimdMin(p1[2], p2[2]), p3[2]) > aabbMax[2]) return false; - if (SimdMax(SimdMax(p1[2], p2[2]), p3[2]) < aabbMin[2]) return false; - - if (SimdMin(SimdMin(p1[1], p2[1]), p3[1]) > aabbMax[1]) return false; - if (SimdMax(SimdMax(p1[1], p2[1]), p3[1]) < aabbMin[1]) return false; - return true; -} - -#endif - diff --git a/extern/bullet/LinearMath/GEN_List.h b/extern/bullet/LinearMath/GEN_List.h deleted file mode 100644 index 9fc2a5233b7..00000000000 --- a/extern/bullet/LinearMath/GEN_List.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef GEN_LIST_H -#define GEN_LIST_H - -class GEN_Link { -public: - GEN_Link() : m_next(0), m_prev(0) {} - GEN_Link(GEN_Link *next, GEN_Link *prev) : m_next(next), m_prev(prev) {} - - GEN_Link *getNext() const { return m_next; } - GEN_Link *getPrev() const { return m_prev; } - - bool isHead() const { return m_prev == 0; } - bool isTail() const { return m_next == 0; } - - void insertBefore(GEN_Link *link) { - m_next = link; - m_prev = link->m_prev; - m_next->m_prev = this; - m_prev->m_next = this; - } - - void insertAfter(GEN_Link *link) { - m_next = link->m_next; - m_prev = link; - m_next->m_prev = this; - m_prev->m_next = this; - } - - void remove() { - m_next->m_prev = m_prev; - m_prev->m_next = m_next; - } - -private: - GEN_Link *m_next; - GEN_Link *m_prev; -}; - -class GEN_List { -public: - GEN_List() : m_head(&m_tail, 0), m_tail(0, &m_head) {} - - GEN_Link *getHead() const { return m_head.getNext(); } - GEN_Link *getTail() const { return m_tail.getPrev(); } - - void addHead(GEN_Link *link) { link->insertAfter(&m_head); } - void addTail(GEN_Link *link) { link->insertBefore(&m_tail); } - -private: - GEN_Link m_head; - GEN_Link m_tail; -}; - -#endif - - - diff --git a/extern/bullet/LinearMath/GEN_MinMax.h b/extern/bullet/LinearMath/GEN_MinMax.h deleted file mode 100644 index 1b8a3633f38..00000000000 --- a/extern/bullet/LinearMath/GEN_MinMax.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef GEN_MINMAX_H -#define GEN_MINMAX_H - -template <class T> -SIMD_FORCE_INLINE const T& GEN_min(const T& a, const T& b) -{ - return b < a ? b : a; -} - -template <class T> -SIMD_FORCE_INLINE const T& GEN_max(const T& a, const T& b) -{ - return a < b ? b : a; -} - -template <class T> -SIMD_FORCE_INLINE const T& GEN_clamped(const T& a, const T& lb, const T& ub) -{ - return a < lb ? lb : (ub < a ? ub : a); -} - -template <class T> -SIMD_FORCE_INLINE void GEN_set_min(T& a, const T& b) -{ - if (b < a) - { - a = b; - } -} - -template <class T> -SIMD_FORCE_INLINE void GEN_set_max(T& a, const T& b) -{ - if (a < b) - { - a = b; - } -} - -template <class T> -SIMD_FORCE_INLINE void GEN_clamp(T& a, const T& lb, const T& ub) -{ - if (a < lb) - { - a = lb; - } - else if (ub < a) - { - a = ub; - } -} - -#endif diff --git a/extern/bullet/LinearMath/GEN_random.h b/extern/bullet/LinearMath/GEN_random.h deleted file mode 100644 index fdf65e01caf..00000000000 --- a/extern/bullet/LinearMath/GEN_random.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef GEN_RANDOM_H -#define GEN_RANDOM_H - -#ifdef MT19937 - -#include <limits.h> -#include <mt19937.h> - -#define GEN_RAND_MAX UINT_MAX - -SIMD_FORCE_INLINE void GEN_srand(unsigned int seed) { init_genrand(seed); } -SIMD_FORCE_INLINE unsigned int GEN_rand() { return genrand_int32(); } - -#else - -#include <stdlib.h> - -#define GEN_RAND_MAX RAND_MAX - -SIMD_FORCE_INLINE void GEN_srand(unsigned int seed) { srand(seed); } -SIMD_FORCE_INLINE unsigned int GEN_rand() { return rand(); } - -#endif - -#endif - diff --git a/extern/bullet/LinearMath/IDebugDraw.h b/extern/bullet/LinearMath/IDebugDraw.h deleted file mode 100644 index be6c3fd4fbb..00000000000 --- a/extern/bullet/LinearMath/IDebugDraw.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright (c) 2005 Gino van den Bergen / Erwin Coumans http://continuousphysics.com - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - - -#ifndef IDEBUG_DRAW__H -#define IDEBUG_DRAW__H - -#include "SimdVector3.h" - - -class IDebugDraw -{ - public: - - enum DebugDrawModes - { - DBG_NoDebug=0, - DBG_DrawAabb=1, - DBG_DrawText=2, - DBG_DrawFeaturesText=4, - DBG_DrawContactPoints=8, - DBG_NoDeactivation=16, - DBG_NoHelpText = 32, - DBG_DrawWireframe = 64, - DBG_ProfileTimings = 128, - DBG_EnableSatComparison = 256, - DBG_DisableBulletLCP = 512, - DBG_EnableCCD = 1024, - DBG_MAX_DEBUG_DRAW_MODE - }; - - virtual ~IDebugDraw() {}; - - virtual void DrawLine(const SimdVector3& from,const SimdVector3& to,const SimdVector3& color)=0; - - virtual void DrawContactPoint(const SimdVector3& PointOnB,const SimdVector3& normalOnB,float distance,int lifeTime,const SimdVector3& color)=0; - - virtual void SetDebugMode(int debugMode) =0; - - virtual int GetDebugMode() const = 0; - - -}; - -#endif //IDEBUG_DRAW__H - diff --git a/extern/bullet/LinearMath/SimdMatrix3x3.h b/extern/bullet/LinearMath/SimdMatrix3x3.h deleted file mode 100644 index a6f5bb43479..00000000000 --- a/extern/bullet/LinearMath/SimdMatrix3x3.h +++ /dev/null @@ -1,395 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef SimdMatrix3x3_H -#define SimdMatrix3x3_H - -#include "SimdScalar.h" - -#include "SimdVector3.h" -#include "SimdQuaternion.h" - - -class SimdMatrix3x3 { - public: - SimdMatrix3x3 () {} - -// explicit SimdMatrix3x3(const SimdScalar *m) { setFromOpenGLSubMatrix(m); } - - explicit SimdMatrix3x3(const SimdQuaternion& q) { setRotation(q); } - /* - template <typename SimdScalar> - Matrix3x3(const SimdScalar& yaw, const SimdScalar& pitch, const SimdScalar& roll) - { - setEulerYPR(yaw, pitch, roll); - } - */ - SimdMatrix3x3(const SimdScalar& xx, const SimdScalar& xy, const SimdScalar& xz, - const SimdScalar& yx, const SimdScalar& yy, const SimdScalar& yz, - const SimdScalar& zx, const SimdScalar& zy, const SimdScalar& zz) - { - setValue(xx, xy, xz, - yx, yy, yz, - zx, zy, zz); - } - - SimdVector3 getColumn(int i) const - { - return SimdVector3(m_el[0][i],m_el[1][i],m_el[2][i]); - } - - const SimdVector3& getRow(int i) const - { - return m_el[i]; - } - - - SIMD_FORCE_INLINE SimdVector3& operator[](int i) - { - assert(0 <= i && i < 3); - return m_el[i]; - } - - const SimdVector3& operator[](int i) const - { - assert(0 <= i && i < 3); - return m_el[i]; - } - - SimdMatrix3x3& operator*=(const SimdMatrix3x3& m); - - - void setFromOpenGLSubMatrix(const SimdScalar *m) - { - m_el[0][0] = (m[0]); - m_el[1][0] = (m[1]); - m_el[2][0] = (m[2]); - m_el[0][1] = (m[4]); - m_el[1][1] = (m[5]); - m_el[2][1] = (m[6]); - m_el[0][2] = (m[8]); - m_el[1][2] = (m[9]); - m_el[2][2] = (m[10]); - } - - void setValue(const SimdScalar& xx, const SimdScalar& xy, const SimdScalar& xz, - const SimdScalar& yx, const SimdScalar& yy, const SimdScalar& yz, - const SimdScalar& zx, const SimdScalar& zy, const SimdScalar& zz) - { - m_el[0][0] = SimdScalar(xx); - m_el[0][1] = SimdScalar(xy); - m_el[0][2] = SimdScalar(xz); - m_el[1][0] = SimdScalar(yx); - m_el[1][1] = SimdScalar(yy); - m_el[1][2] = SimdScalar(yz); - m_el[2][0] = SimdScalar(zx); - m_el[2][1] = SimdScalar(zy); - m_el[2][2] = SimdScalar(zz); - } - - void setRotation(const SimdQuaternion& q) - { - SimdScalar d = q.length2(); - assert(d != SimdScalar(0.0)); - SimdScalar s = SimdScalar(2.0) / d; - SimdScalar xs = q[0] * s, ys = q[1] * s, zs = q[2] * s; - SimdScalar wx = q[3] * xs, wy = q[3] * ys, wz = q[3] * zs; - SimdScalar xx = q[0] * xs, xy = q[0] * ys, xz = q[0] * zs; - SimdScalar yy = q[1] * ys, yz = q[1] * zs, zz = q[2] * zs; - setValue(SimdScalar(1.0) - (yy + zz), xy - wz, xz + wy, - xy + wz, SimdScalar(1.0) - (xx + zz), yz - wx, - xz - wy, yz + wx, SimdScalar(1.0) - (xx + yy)); - } - - - - void setEulerYPR(const SimdScalar& yaw, const SimdScalar& pitch, const SimdScalar& roll) - { - - SimdScalar cy(SimdCos(yaw)); - SimdScalar sy(SimdSin(yaw)); - SimdScalar cp(SimdCos(pitch)); - SimdScalar sp(SimdSin(pitch)); - SimdScalar cr(SimdCos(roll)); - SimdScalar sr(SimdSin(roll)); - SimdScalar cc = cy * cr; - SimdScalar cs = cy * sr; - SimdScalar sc = sy * cr; - SimdScalar ss = sy * sr; - setValue(cc - sp * ss, -cs - sp * sc, -sy * cp, - cp * sr, cp * cr, -sp, - sc + sp * cs, -ss + sp * cc, cy * cp); - - } - - /** - * setEulerZYX - * @param euler a const reference to a SimdVector3 of euler angles - * These angles are used to produce a rotation matrix. The euler - * angles are applied in ZYX order. I.e a vector is first rotated - * about X then Y and then Z - **/ - - void setEulerZYX(SimdScalar eulerX,SimdScalar eulerY,SimdScalar eulerZ) { - SimdScalar ci ( SimdCos(eulerX)); - SimdScalar cj ( SimdCos(eulerY)); - SimdScalar ch ( SimdCos(eulerZ)); - SimdScalar si ( SimdSin(eulerX)); - SimdScalar sj ( SimdSin(eulerY)); - SimdScalar sh ( SimdSin(eulerZ)); - SimdScalar cc = ci * ch; - SimdScalar cs = ci * sh; - SimdScalar sc = si * ch; - SimdScalar ss = si * sh; - - setValue(cj * ch, sj * sc - cs, sj * cc + ss, - cj * sh, sj * ss + cc, sj * cs - sc, - -sj, cj * si, cj * ci); - } - - void setIdentity() - { - setValue(SimdScalar(1.0), SimdScalar(0.0), SimdScalar(0.0), - SimdScalar(0.0), SimdScalar(1.0), SimdScalar(0.0), - SimdScalar(0.0), SimdScalar(0.0), SimdScalar(1.0)); - } - - void getOpenGLSubMatrix(SimdScalar *m) const - { - m[0] = SimdScalar(m_el[0][0]); - m[1] = SimdScalar(m_el[1][0]); - m[2] = SimdScalar(m_el[2][0]); - m[3] = SimdScalar(0.0); - m[4] = SimdScalar(m_el[0][1]); - m[5] = SimdScalar(m_el[1][1]); - m[6] = SimdScalar(m_el[2][1]); - m[7] = SimdScalar(0.0); - m[8] = SimdScalar(m_el[0][2]); - m[9] = SimdScalar(m_el[1][2]); - m[10] = SimdScalar(m_el[2][2]); - m[11] = SimdScalar(0.0); - } - - void getRotation(SimdQuaternion& q) const - { - SimdScalar trace = m_el[0][0] + m_el[1][1] + m_el[2][2]; - - if (trace > SimdScalar(0.0)) - { - SimdScalar s = SimdSqrt(trace + SimdScalar(1.0)); - q[3] = s * SimdScalar(0.5); - s = SimdScalar(0.5) / s; - - q[0] = (m_el[2][1] - m_el[1][2]) * s; - q[1] = (m_el[0][2] - m_el[2][0]) * s; - q[2] = (m_el[1][0] - m_el[0][1]) * s; - } - else - { - int i = m_el[0][0] < m_el[1][1] ? - (m_el[1][1] < m_el[2][2] ? 2 : 1) : - (m_el[0][0] < m_el[2][2] ? 2 : 0); - int j = (i + 1) % 3; - int k = (i + 2) % 3; - - SimdScalar s = SimdSqrt(m_el[i][i] - m_el[j][j] - m_el[k][k] + SimdScalar(1.0)); - q[i] = s * SimdScalar(0.5); - s = SimdScalar(0.5) / s; - - q[3] = (m_el[k][j] - m_el[j][k]) * s; - q[j] = (m_el[j][i] + m_el[i][j]) * s; - q[k] = (m_el[k][i] + m_el[i][k]) * s; - } - } - - - - void getEuler(SimdScalar& yaw, SimdScalar& pitch, SimdScalar& roll) const - { - pitch = SimdScalar(SimdAsin(-m_el[2][0])); - if (pitch < SIMD_2_PI) - { - if (pitch > SIMD_2_PI) - { - yaw = SimdScalar(SimdAtan2(m_el[1][0], m_el[0][0])); - roll = SimdScalar(SimdAtan2(m_el[2][1], m_el[2][2])); - } - else - { - yaw = SimdScalar(-SimdAtan2(-m_el[0][1], m_el[0][2])); - roll = SimdScalar(0.0); - } - } - else - { - yaw = SimdScalar(SimdAtan2(-m_el[0][1], m_el[0][2])); - roll = SimdScalar(0.0); - } - } - - SimdVector3 getScaling() const - { - return SimdVector3(m_el[0][0] * m_el[0][0] + m_el[1][0] * m_el[1][0] + m_el[2][0] * m_el[2][0], - m_el[0][1] * m_el[0][1] + m_el[1][1] * m_el[1][1] + m_el[2][1] * m_el[2][1], - m_el[0][2] * m_el[0][2] + m_el[1][2] * m_el[1][2] + m_el[2][2] * m_el[2][2]); - } - - - SimdMatrix3x3 scaled(const SimdVector3& s) const - { - return SimdMatrix3x3(m_el[0][0] * s[0], m_el[0][1] * s[1], m_el[0][2] * s[2], - m_el[1][0] * s[0], m_el[1][1] * s[1], m_el[1][2] * s[2], - m_el[2][0] * s[0], m_el[2][1] * s[1], m_el[2][2] * s[2]); - } - - SimdScalar determinant() const; - SimdMatrix3x3 adjoint() const; - SimdMatrix3x3 absolute() const; - SimdMatrix3x3 transpose() const; - SimdMatrix3x3 inverse() const; - - SimdMatrix3x3 transposeTimes(const SimdMatrix3x3& m) const; - SimdMatrix3x3 timesTranspose(const SimdMatrix3x3& m) const; - - SimdScalar tdot(int c, const SimdVector3& v) const - { - return m_el[0][c] * v[0] + m_el[1][c] * v[1] + m_el[2][c] * v[2]; - } - - protected: - SimdScalar cofac(int r1, int c1, int r2, int c2) const - { - return m_el[r1][c1] * m_el[r2][c2] - m_el[r1][c2] * m_el[r2][c1]; - } - - SimdVector3 m_el[3]; - }; - - SIMD_FORCE_INLINE SimdMatrix3x3& - SimdMatrix3x3::operator*=(const SimdMatrix3x3& m) - { - setValue(m.tdot(0, m_el[0]), m.tdot(1, m_el[0]), m.tdot(2, m_el[0]), - m.tdot(0, m_el[1]), m.tdot(1, m_el[1]), m.tdot(2, m_el[1]), - m.tdot(0, m_el[2]), m.tdot(1, m_el[2]), m.tdot(2, m_el[2])); - return *this; - } - - SIMD_FORCE_INLINE SimdScalar - SimdMatrix3x3::determinant() const - { - return triple((*this)[0], (*this)[1], (*this)[2]); - } - - - SIMD_FORCE_INLINE SimdMatrix3x3 - SimdMatrix3x3::absolute() const - { - return SimdMatrix3x3( - SimdFabs(m_el[0][0]), SimdFabs(m_el[0][1]), SimdFabs(m_el[0][2]), - SimdFabs(m_el[1][0]), SimdFabs(m_el[1][1]), SimdFabs(m_el[1][2]), - SimdFabs(m_el[2][0]), SimdFabs(m_el[2][1]), SimdFabs(m_el[2][2])); - } - - SIMD_FORCE_INLINE SimdMatrix3x3 - SimdMatrix3x3::transpose() const - { - return SimdMatrix3x3(m_el[0][0], m_el[1][0], m_el[2][0], - m_el[0][1], m_el[1][1], m_el[2][1], - m_el[0][2], m_el[1][2], m_el[2][2]); - } - - SIMD_FORCE_INLINE SimdMatrix3x3 - SimdMatrix3x3::adjoint() const - { - return SimdMatrix3x3(cofac(1, 1, 2, 2), cofac(0, 2, 2, 1), cofac(0, 1, 1, 2), - cofac(1, 2, 2, 0), cofac(0, 0, 2, 2), cofac(0, 2, 1, 0), - cofac(1, 0, 2, 1), cofac(0, 1, 2, 0), cofac(0, 0, 1, 1)); - } - - SIMD_FORCE_INLINE SimdMatrix3x3 - SimdMatrix3x3::inverse() const - { - SimdVector3 co(cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1)); - SimdScalar det = (*this)[0].dot(co); - assert(det != SimdScalar(0.0f)); - SimdScalar s = SimdScalar(1.0f) / det; - return SimdMatrix3x3(co[0] * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s, - co[1] * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s, - co[2] * s, cofac(0, 1, 2, 0) * s, cofac(0, 0, 1, 1) * s); - } - - SIMD_FORCE_INLINE SimdMatrix3x3 - SimdMatrix3x3::transposeTimes(const SimdMatrix3x3& m) const - { - return SimdMatrix3x3( - m_el[0][0] * m[0][0] + m_el[1][0] * m[1][0] + m_el[2][0] * m[2][0], - m_el[0][0] * m[0][1] + m_el[1][0] * m[1][1] + m_el[2][0] * m[2][1], - m_el[0][0] * m[0][2] + m_el[1][0] * m[1][2] + m_el[2][0] * m[2][2], - m_el[0][1] * m[0][0] + m_el[1][1] * m[1][0] + m_el[2][1] * m[2][0], - m_el[0][1] * m[0][1] + m_el[1][1] * m[1][1] + m_el[2][1] * m[2][1], - m_el[0][1] * m[0][2] + m_el[1][1] * m[1][2] + m_el[2][1] * m[2][2], - m_el[0][2] * m[0][0] + m_el[1][2] * m[1][0] + m_el[2][2] * m[2][0], - m_el[0][2] * m[0][1] + m_el[1][2] * m[1][1] + m_el[2][2] * m[2][1], - m_el[0][2] * m[0][2] + m_el[1][2] * m[1][2] + m_el[2][2] * m[2][2]); - } - - SIMD_FORCE_INLINE SimdMatrix3x3 - SimdMatrix3x3::timesTranspose(const SimdMatrix3x3& m) const - { - return SimdMatrix3x3( - m_el[0].dot(m[0]), m_el[0].dot(m[1]), m_el[0].dot(m[2]), - m_el[1].dot(m[0]), m_el[1].dot(m[1]), m_el[1].dot(m[2]), - m_el[2].dot(m[0]), m_el[2].dot(m[1]), m_el[2].dot(m[2])); - - } - - SIMD_FORCE_INLINE SimdVector3 - operator*(const SimdMatrix3x3& m, const SimdVector3& v) - { - return SimdVector3(m[0].dot(v), m[1].dot(v), m[2].dot(v)); - } - - - SIMD_FORCE_INLINE SimdVector3 - operator*(const SimdVector3& v, const SimdMatrix3x3& m) - { - return SimdVector3(m.tdot(0, v), m.tdot(1, v), m.tdot(2, v)); - } - - SIMD_FORCE_INLINE SimdMatrix3x3 - operator*(const SimdMatrix3x3& m1, const SimdMatrix3x3& m2) - { - return SimdMatrix3x3( - m2.tdot(0, m1[0]), m2.tdot(1, m1[0]), m2.tdot(2, m1[0]), - m2.tdot(0, m1[1]), m2.tdot(1, m1[1]), m2.tdot(2, m1[1]), - m2.tdot(0, m1[2]), m2.tdot(1, m1[2]), m2.tdot(2, m1[2])); - } - - - SIMD_FORCE_INLINE SimdMatrix3x3 SimdMultTransposeLeft(const SimdMatrix3x3& m1, const SimdMatrix3x3& m2) { - return SimdMatrix3x3( - m1[0][0] * m2[0][0] + m1[1][0] * m2[1][0] + m1[2][0] * m2[2][0], - m1[0][0] * m2[0][1] + m1[1][0] * m2[1][1] + m1[2][0] * m2[2][1], - m1[0][0] * m2[0][2] + m1[1][0] * m2[1][2] + m1[2][0] * m2[2][2], - m1[0][1] * m2[0][0] + m1[1][1] * m2[1][0] + m1[2][1] * m2[2][0], - m1[0][1] * m2[0][1] + m1[1][1] * m2[1][1] + m1[2][1] * m2[2][1], - m1[0][1] * m2[0][2] + m1[1][1] * m2[1][2] + m1[2][1] * m2[2][2], - m1[0][2] * m2[0][0] + m1[1][2] * m2[1][0] + m1[2][2] * m2[2][0], - m1[0][2] * m2[0][1] + m1[1][2] * m2[1][1] + m1[2][2] * m2[2][1], - m1[0][2] * m2[0][2] + m1[1][2] * m2[1][2] + m1[2][2] * m2[2][2]); -} - - -#endif diff --git a/extern/bullet/LinearMath/SimdMinMax.h b/extern/bullet/LinearMath/SimdMinMax.h deleted file mode 100644 index 693cb2b7e74..00000000000 --- a/extern/bullet/LinearMath/SimdMinMax.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef SIMD_MINMAX_H -#define SIMD_MINMAX_H - -template <class T> -SIMD_FORCE_INLINE const T& SimdMin(const T& a, const T& b) { - return b < a ? b : a; -} - -template <class T> -SIMD_FORCE_INLINE const T& SimdMax(const T& a, const T& b) { - return a < b ? b : a; -} - -template <class T> -SIMD_FORCE_INLINE void SimdSetMin(T& a, const T& b) { - if (a > b) a = b; -} - -template <class T> -SIMD_FORCE_INLINE void SimdSetMax(T& a, const T& b) { - if (a < b) a = b; -} - -#endif diff --git a/extern/bullet/LinearMath/SimdPoint3.h b/extern/bullet/LinearMath/SimdPoint3.h deleted file mode 100644 index 15fb376f286..00000000000 --- a/extern/bullet/LinearMath/SimdPoint3.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef SimdPoint3_H -#define SimdPoint3_H - -#include "SimdVector3.h" - -typedef SimdVector3 SimdPoint3; - -#endif diff --git a/extern/bullet/LinearMath/SimdQuadWord.h b/extern/bullet/LinearMath/SimdQuadWord.h deleted file mode 100644 index 99768da5891..00000000000 --- a/extern/bullet/LinearMath/SimdQuadWord.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef SIMD_QUADWORD_H -#define SIMD_QUADWORD_H - -#include "SimdScalar.h" - - - - - -class SimdQuadWord -{ - protected: - ATTRIBUTE_ALIGNED16 (SimdScalar m_x); - SimdScalar m_y; - SimdScalar m_z; - SimdScalar m_unusedW; - - public: - - SIMD_FORCE_INLINE SimdScalar& operator[](int i) { return (&m_x)[i]; } - SIMD_FORCE_INLINE const SimdScalar& operator[](int i) const { return (&m_x)[i]; } - - SIMD_FORCE_INLINE const SimdScalar& getX() const { return m_x; } - - SIMD_FORCE_INLINE const SimdScalar& getY() const { return m_y; } - - SIMD_FORCE_INLINE const SimdScalar& getZ() const { return m_z; } - - SIMD_FORCE_INLINE void setX(float x) { m_x = x;}; - - SIMD_FORCE_INLINE void setY(float y) { m_y = y;}; - - SIMD_FORCE_INLINE void setZ(float z) { m_z = z;}; - - SIMD_FORCE_INLINE const SimdScalar& x() const { return m_x; } - - SIMD_FORCE_INLINE const SimdScalar& y() const { return m_y; } - - SIMD_FORCE_INLINE const SimdScalar& z() const { return m_z; } - - - operator SimdScalar *() { return &m_x; } - operator const SimdScalar *() const { return &m_x; } - - SIMD_FORCE_INLINE void setValue(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z) - { - m_x=x; - m_y=y; - m_z=z; - } - -/* void getValue(SimdScalar *m) const - { - m[0] = m_x; - m[1] = m_y; - m[2] = m_z; - } -*/ - SIMD_FORCE_INLINE void setValue(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z,const SimdScalar& w) - { - m_x=x; - m_y=y; - m_z=z; - m_unusedW=w; - } - - SIMD_FORCE_INLINE SimdQuadWord() : - m_x(0.f),m_y(0.f),m_z(0.f),m_unusedW(0.f) - { - } - - SIMD_FORCE_INLINE SimdQuadWord(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z) - :m_x(x),m_y(y),m_z(z) - //todo, remove this in release/simd ? - ,m_unusedW(0.f) - { - } - - SIMD_FORCE_INLINE SimdQuadWord(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z,const SimdScalar& w) - :m_x(x),m_y(y),m_z(z),m_unusedW(w) - { - } - - - SIMD_FORCE_INLINE void setMax(const SimdQuadWord& other) - { - if (other.m_x > m_x) - m_x = other.m_x; - - if (other.m_y > m_y) - m_y = other.m_y; - - if (other.m_z > m_z) - m_z = other.m_z; - - if (other.m_unusedW > m_unusedW) - m_unusedW = other.m_unusedW; - } - - SIMD_FORCE_INLINE void setMin(const SimdQuadWord& other) - { - if (other.m_x < m_x) - m_x = other.m_x; - - if (other.m_y < m_y) - m_y = other.m_y; - - if (other.m_z < m_z) - m_z = other.m_z; - - if (other.m_unusedW < m_unusedW) - m_unusedW = other.m_unusedW; - } - - - -}; - -#endif //SIMD_QUADWORD_H diff --git a/extern/bullet/LinearMath/SimdQuaternion.h b/extern/bullet/LinearMath/SimdQuaternion.h deleted file mode 100644 index 2d152268ead..00000000000 --- a/extern/bullet/LinearMath/SimdQuaternion.h +++ /dev/null @@ -1,290 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef SIMD__QUATERNION_H_ -#define SIMD__QUATERNION_H_ - -#include "SimdVector3.h" - -class SimdQuaternion : public SimdQuadWord { -public: - SimdQuaternion() {} - - // template <typename SimdScalar> - // explicit Quaternion(const SimdScalar *v) : Tuple4<SimdScalar>(v) {} - - SimdQuaternion(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z, const SimdScalar& w) - : SimdQuadWord(x, y, z, w) - {} - - SimdQuaternion(const SimdVector3& axis, const SimdScalar& angle) - { - setRotation(axis, angle); - } - - SimdQuaternion(const SimdScalar& yaw, const SimdScalar& pitch, const SimdScalar& roll) - { - setEuler(yaw, pitch, roll); - } - - void setRotation(const SimdVector3& axis, const SimdScalar& angle) - { - SimdScalar d = axis.length(); - assert(d != SimdScalar(0.0)); - SimdScalar s = SimdSin(angle * SimdScalar(0.5)) / d; - setValue(axis.x() * s, axis.y() * s, axis.z() * s, - SimdCos(angle * SimdScalar(0.5))); - } - - void setEuler(const SimdScalar& yaw, const SimdScalar& pitch, const SimdScalar& roll) - { - SimdScalar halfYaw = SimdScalar(yaw) * SimdScalar(0.5); - SimdScalar halfPitch = SimdScalar(pitch) * SimdScalar(0.5); - SimdScalar halfRoll = SimdScalar(roll) * SimdScalar(0.5); - SimdScalar cosYaw = SimdCos(halfYaw); - SimdScalar sinYaw = SimdSin(halfYaw); - SimdScalar cosPitch = SimdCos(halfPitch); - SimdScalar sinPitch = SimdSin(halfPitch); - SimdScalar cosRoll = SimdCos(halfRoll); - SimdScalar sinRoll = SimdSin(halfRoll); - setValue(cosRoll * sinPitch * cosYaw + sinRoll * cosPitch * sinYaw, - cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw, - sinRoll * cosPitch * cosYaw - cosRoll * sinPitch * sinYaw, - cosRoll * cosPitch * cosYaw + sinRoll * sinPitch * sinYaw); - } - - SimdQuaternion& operator+=(const SimdQuaternion& q) - { - m_x += q.x(); m_y += q.y(); m_z += q.z(); m_unusedW += q[3]; - return *this; - } - - SimdQuaternion& operator-=(const SimdQuaternion& q) - { - m_x -= q.x(); m_y -= q.y(); m_z -= q.z(); m_unusedW -= q[3]; - return *this; - } - - SimdQuaternion& operator*=(const SimdScalar& s) - { - m_x *= s; m_y *= s; m_z *= s; m_unusedW *= s; - return *this; - } - - - SimdQuaternion& operator*=(const SimdQuaternion& q) - { - setValue(m_unusedW * q.x() + m_x * q[3] + m_y * q.z() - m_z * q.y(), - m_unusedW * q.y() + m_y * q[3] + m_z * q.x() - m_x * q.z(), - m_unusedW * q.z() + m_z * q[3] + m_x * q.y() - m_y * q.x(), - m_unusedW * q[3] - m_x * q.x() - m_y * q.y() - m_z * q.z()); - return *this; - } - - SimdScalar dot(const SimdQuaternion& q) const - { - return m_x * q.x() + m_y * q.y() + m_z * q.z() + m_unusedW * q[3]; - } - - SimdScalar length2() const - { - return dot(*this); - } - - SimdScalar length() const - { - return SimdSqrt(length2()); - } - - SimdQuaternion& normalize() - { - return *this /= length(); - } - - SIMD_FORCE_INLINE SimdQuaternion - operator*(const SimdScalar& s) const - { - return SimdQuaternion(x() * s, y() * s, z() * s, m_unusedW * s); - } - - - - SimdQuaternion operator/(const SimdScalar& s) const - { - assert(s != SimdScalar(0.0)); - return *this * (SimdScalar(1.0) / s); - } - - - SimdQuaternion& operator/=(const SimdScalar& s) - { - assert(s != SimdScalar(0.0)); - return *this *= SimdScalar(1.0) / s; - } - - - SimdQuaternion normalized() const - { - return *this / length(); - } - - SimdScalar angle(const SimdQuaternion& q) const - { - SimdScalar s = SimdSqrt(length2() * q.length2()); - assert(s != SimdScalar(0.0)); - return SimdAcos(dot(q) / s); - } - - SimdScalar getAngle() const - { - SimdScalar s = 2.f * SimdAcos(m_unusedW); - return s; - } - - - - SimdQuaternion inverse() const - { - return SimdQuaternion(m_x, m_y, m_z, -m_unusedW); - } - - SIMD_FORCE_INLINE SimdQuaternion - operator+(const SimdQuaternion& q2) const - { - const SimdQuaternion& q1 = *this; - return SimdQuaternion(q1.x() + q2.x(), q1.y() + q2.y(), q1.z() + q2.z(), q1[3] + q2[3]); - } - - SIMD_FORCE_INLINE SimdQuaternion - operator-(const SimdQuaternion& q2) const - { - const SimdQuaternion& q1 = *this; - return SimdQuaternion(q1.x() - q2.x(), q1.y() - q2.y(), q1.z() - q2.z(), q1[3] - q2[3]); - } - - SIMD_FORCE_INLINE SimdQuaternion operator-() const - { - const SimdQuaternion& q2 = *this; - return SimdQuaternion( - q2.x(), - q2.y(), - q2.z(), - q2[3]); - } - - SIMD_FORCE_INLINE SimdQuaternion farthest( const SimdQuaternion& qd) const - { - SimdQuaternion diff,sum; - diff = *this - qd; - sum = *this + qd; - if( diff.dot(diff) > sum.dot(sum) ) - return qd; - return (-qd); - } - - SimdQuaternion slerp(const SimdQuaternion& q, const SimdScalar& t) const - { - SimdScalar theta = angle(q); - if (theta != SimdScalar(0.0)) - { - SimdScalar d = SimdScalar(1.0) / SimdSin(theta); - SimdScalar s0 = SimdSin((SimdScalar(1.0) - t) * theta); - SimdScalar s1 = SimdSin(t * theta); - return SimdQuaternion((m_x * s0 + q.x() * s1) * d, - (m_y * s0 + q.y() * s1) * d, - (m_z * s0 + q.z() * s1) * d, - (m_unusedW * s0 + q[3] * s1) * d); - } - else - { - return *this; - } - } - - - -}; - - - -SIMD_FORCE_INLINE SimdQuaternion -operator-(const SimdQuaternion& q) -{ - return SimdQuaternion(-q.x(), -q.y(), -q.z(), -q[3]); -} - - - - -SIMD_FORCE_INLINE SimdQuaternion -operator*(const SimdQuaternion& q1, const SimdQuaternion& q2) { - return SimdQuaternion(q1[3] * q2.x() + q1.x() * q2[3] + q1.y() * q2.z() - q1.z() * q2.y(), - q1[3] * q2.y() + q1.y() * q2[3] + q1.z() * q2.x() - q1.x() * q2.z(), - q1[3] * q2.z() + q1.z() * q2[3] + q1.x() * q2.y() - q1.y() * q2.x(), - q1[3] * q2[3] - q1.x() * q2.x() - q1.y() * q2.y() - q1.z() * q2.z()); -} - -SIMD_FORCE_INLINE SimdQuaternion -operator*(const SimdQuaternion& q, const SimdVector3& w) -{ - return SimdQuaternion( q[3] * w.x() + q.y() * w.z() - q.z() * w.y(), - q[3] * w.y() + q.z() * w.x() - q.x() * w.z(), - q[3] * w.z() + q.x() * w.y() - q.y() * w.x(), - -q.x() * w.x() - q.y() * w.y() - q.z() * w.z()); -} - -SIMD_FORCE_INLINE SimdQuaternion -operator*(const SimdVector3& w, const SimdQuaternion& q) -{ - return SimdQuaternion( w.x() * q[3] + w.y() * q.z() - w.z() * q.y(), - w.y() * q[3] + w.z() * q.x() - w.x() * q.z(), - w.z() * q[3] + w.x() * q.y() - w.y() * q.x(), - -w.x() * q.x() - w.y() * q.y() - w.z() * q.z()); -} - -SIMD_FORCE_INLINE SimdScalar -dot(const SimdQuaternion& q1, const SimdQuaternion& q2) -{ - return q1.dot(q2); -} - - -SIMD_FORCE_INLINE SimdScalar -length(const SimdQuaternion& q) -{ - return q.length(); -} - -SIMD_FORCE_INLINE SimdScalar -angle(const SimdQuaternion& q1, const SimdQuaternion& q2) -{ - return q1.angle(q2); -} - - -SIMD_FORCE_INLINE SimdQuaternion -inverse(const SimdQuaternion& q) -{ - return q.inverse(); -} - -SIMD_FORCE_INLINE SimdQuaternion -slerp(const SimdQuaternion& q1, const SimdQuaternion& q2, const SimdScalar& t) -{ - return q1.slerp(q2, t); -} - - -#endif - - - diff --git a/extern/bullet/LinearMath/SimdScalar.h b/extern/bullet/LinearMath/SimdScalar.h deleted file mode 100644 index e866382c022..00000000000 --- a/extern/bullet/LinearMath/SimdScalar.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef SIMD___SCALAR_H -#define SIMD___SCALAR_H - -#include <math.h> -#undef max - - - -#include <cstdlib> -#include <cfloat> -#include <float.h> - -#ifdef WIN32 - - #if defined(__MINGW32__) || defined(__CYGWIN__) - #define SIMD_FORCE_INLINE inline - #else - #pragma warning(disable:4530) - #pragma warning(disable:4996) - #define SIMD_FORCE_INLINE __forceinline - #endif //__MINGW32__ - - //#define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a - #define ATTRIBUTE_ALIGNED16(a) a - #include <assert.h> - #define ASSERT assert -#else - - //non-windows systems - - #define SIMD_FORCE_INLINE inline - #define ATTRIBUTE_ALIGNED16(a) a - #ifndef assert - #include <assert.h> - #endif - #define ASSERT assert -#endif - - - -typedef float SimdScalar; - -#if defined (__sun) || defined (__sun__) || defined (__sparc) || defined (__APPLE__) -//use double float precision operation on those platforms for Blender - -SIMD_FORCE_INLINE SimdScalar SimdSqrt(SimdScalar x) { return sqrt(x); } -SIMD_FORCE_INLINE SimdScalar SimdFabs(SimdScalar x) { return fabs(x); } -SIMD_FORCE_INLINE SimdScalar SimdCos(SimdScalar x) { return cos(x); } -SIMD_FORCE_INLINE SimdScalar SimdSin(SimdScalar x) { return sin(x); } -SIMD_FORCE_INLINE SimdScalar SimdTan(SimdScalar x) { return tan(x); } -SIMD_FORCE_INLINE SimdScalar SimdAcos(SimdScalar x) { return acos(x); } -SIMD_FORCE_INLINE SimdScalar SimdAsin(SimdScalar x) { return asin(x); } -SIMD_FORCE_INLINE SimdScalar SimdAtan(SimdScalar x) { return atan(x); } -SIMD_FORCE_INLINE SimdScalar SimdAtan2(SimdScalar x, SimdScalar y) { return atan2(x, y); } -SIMD_FORCE_INLINE SimdScalar SimdExp(SimdScalar x) { return exp(x); } -SIMD_FORCE_INLINE SimdScalar SimdLog(SimdScalar x) { return log(x); } -SIMD_FORCE_INLINE SimdScalar SimdPow(SimdScalar x,SimdScalar y) { return pow(x,y); } - -#else - -SIMD_FORCE_INLINE SimdScalar SimdSqrt(SimdScalar x) { return sqrtf(x); } -SIMD_FORCE_INLINE SimdScalar SimdFabs(SimdScalar x) { return fabsf(x); } -SIMD_FORCE_INLINE SimdScalar SimdCos(SimdScalar x) { return cosf(x); } -SIMD_FORCE_INLINE SimdScalar SimdSin(SimdScalar x) { return sinf(x); } -SIMD_FORCE_INLINE SimdScalar SimdTan(SimdScalar x) { return tanf(x); } -SIMD_FORCE_INLINE SimdScalar SimdAcos(SimdScalar x) { return acosf(x); } -SIMD_FORCE_INLINE SimdScalar SimdAsin(SimdScalar x) { return asinf(x); } -SIMD_FORCE_INLINE SimdScalar SimdAtan(SimdScalar x) { return atanf(x); } -SIMD_FORCE_INLINE SimdScalar SimdAtan2(SimdScalar x, SimdScalar y) { return atan2f(x, y); } -SIMD_FORCE_INLINE SimdScalar SimdExp(SimdScalar x) { return expf(x); } -SIMD_FORCE_INLINE SimdScalar SimdLog(SimdScalar x) { return logf(x); } -SIMD_FORCE_INLINE SimdScalar SimdPow(SimdScalar x,SimdScalar y) { return powf(x,y); } - -#endif - - -const SimdScalar SIMD_2_PI = 6.283185307179586232f; -const SimdScalar SIMD_PI = SIMD_2_PI * SimdScalar(0.5f); -const SimdScalar SIMD_HALF_PI = SIMD_2_PI * SimdScalar(0.25f); -const SimdScalar SIMD_RADS_PER_DEG = SIMD_2_PI / SimdScalar(360.0f); -const SimdScalar SIMD_DEGS_PER_RAD = SimdScalar(360.0f) / SIMD_2_PI; -const SimdScalar SIMD_EPSILON = FLT_EPSILON; -const SimdScalar SIMD_INFINITY = FLT_MAX; - -SIMD_FORCE_INLINE bool SimdFuzzyZero(SimdScalar x) { return SimdFabs(x) < SIMD_EPSILON; } - -SIMD_FORCE_INLINE bool SimdEqual(SimdScalar a, SimdScalar eps) { - return (((a) <= eps) && !((a) < -eps)); -} -SIMD_FORCE_INLINE bool SimdGreaterEqual (SimdScalar a, SimdScalar eps) { - return (!((a) <= eps)); -} - -/*SIMD_FORCE_INLINE SimdScalar SimdCos(SimdScalar x) { return cosf(x); } -SIMD_FORCE_INLINE SimdScalar SimdSin(SimdScalar x) { return sinf(x); } -SIMD_FORCE_INLINE SimdScalar SimdTan(SimdScalar x) { return tanf(x); } -SIMD_FORCE_INLINE SimdScalar SimdAcos(SimdScalar x) { return acosf(x); } -SIMD_FORCE_INLINE SimdScalar SimdAsin(SimdScalar x) { return asinf(x); } -SIMD_FORCE_INLINE SimdScalar SimdAtan(SimdScalar x) { return atanf(x); } -SIMD_FORCE_INLINE SimdScalar SimdAtan2(SimdScalar x, SimdScalar y) { return atan2f(x, y); } -*/ - -SIMD_FORCE_INLINE int SimdSign(SimdScalar x) { - return x < 0.0f ? -1 : x > 0.0f ? 1 : 0; -} - -SIMD_FORCE_INLINE SimdScalar SimdRadians(SimdScalar x) { return x * SIMD_RADS_PER_DEG; } -SIMD_FORCE_INLINE SimdScalar SimdDegrees(SimdScalar x) { return x * SIMD_DEGS_PER_RAD; } - - - -#endif //SIMD___SCALAR_H diff --git a/extern/bullet/LinearMath/SimdTransform.h b/extern/bullet/LinearMath/SimdTransform.h deleted file mode 100644 index d2d9b53f94e..00000000000 --- a/extern/bullet/LinearMath/SimdTransform.h +++ /dev/null @@ -1,236 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef SimdTransform_H -#define SimdTransform_H - -#include "SimdVector3.h" -#include "SimdMatrix3x3.h" - - - -class SimdTransform { - enum { - TRANSLATION = 0x01, - ROTATION = 0x02, - RIGID = TRANSLATION | ROTATION, - SCALING = 0x04, - LINEAR = ROTATION | SCALING, - AFFINE = TRANSLATION | LINEAR - }; - -public: - SimdTransform() {} - - // template <typename Scalar2> - // explicit Transform(const Scalar2 *m) { setValue(m); } - - explicit SIMD_FORCE_INLINE SimdTransform(const SimdQuaternion& q, - const SimdVector3& c = SimdVector3(SimdScalar(0), SimdScalar(0), SimdScalar(0))) - : m_basis(q), - m_origin(c), - m_type(RIGID) - {} - - explicit SIMD_FORCE_INLINE SimdTransform(const SimdMatrix3x3& b, - const SimdVector3& c = SimdVector3(SimdScalar(0), SimdScalar(0), SimdScalar(0)), - unsigned int type = AFFINE) - : m_basis(b), - m_origin(c), - m_type(type) - {} - - - SIMD_FORCE_INLINE void mult(const SimdTransform& t1, const SimdTransform& t2) { - m_basis = t1.m_basis * t2.m_basis; - m_origin = t1(t2.m_origin); - m_type = t1.m_type | t2.m_type; - } - - void multInverseLeft(const SimdTransform& t1, const SimdTransform& t2) { - SimdVector3 v = t2.m_origin - t1.m_origin; - if (t1.m_type & SCALING) { - SimdMatrix3x3 inv = t1.m_basis.inverse(); - m_basis = inv * t2.m_basis; - m_origin = inv * v; - } - else { - m_basis = SimdMultTransposeLeft(t1.m_basis, t2.m_basis); - m_origin = v * t1.m_basis; - } - m_type = t1.m_type | t2.m_type; - } - - SIMD_FORCE_INLINE SimdVector3 operator()(const SimdVector3& x) const - { - return SimdVector3(m_basis[0].dot(x) + m_origin[0], - m_basis[1].dot(x) + m_origin[1], - m_basis[2].dot(x) + m_origin[2]); - } - - SIMD_FORCE_INLINE SimdVector3 operator*(const SimdVector3& x) const - { - return (*this)(x); - } - - SIMD_FORCE_INLINE SimdMatrix3x3& getBasis() { return m_basis; } - SIMD_FORCE_INLINE const SimdMatrix3x3& getBasis() const { return m_basis; } - - SIMD_FORCE_INLINE SimdVector3& getOrigin() { return m_origin; } - SIMD_FORCE_INLINE const SimdVector3& getOrigin() const { return m_origin; } - - SimdQuaternion getRotation() const { - SimdQuaternion q; - m_basis.getRotation(q); - return q; - } - template <typename Scalar2> - void setValue(const Scalar2 *m) - { - m_basis.setValue(m); - m_origin.setValue(&m[12]); - m_type = AFFINE; - } - - - void setFromOpenGLMatrix(const SimdScalar *m) - { - m_basis.setFromOpenGLSubMatrix(m); - m_origin[0] = m[12]; - m_origin[1] = m[13]; - m_origin[2] = m[14]; - } - - void getOpenGLMatrix(SimdScalar *m) const - { - m_basis.getOpenGLSubMatrix(m); - m[12] = m_origin[0]; - m[13] = m_origin[1]; - m[14] = m_origin[2]; - m[15] = SimdScalar(1.0f); - } - - SIMD_FORCE_INLINE void setOrigin(const SimdVector3& origin) - { - m_origin = origin; - m_type |= TRANSLATION; - } - - SIMD_FORCE_INLINE SimdVector3 invXform(const SimdVector3& inVec) const; - - - - SIMD_FORCE_INLINE void setBasis(const SimdMatrix3x3& basis) - { - m_basis = basis; - m_type |= LINEAR; - } - - SIMD_FORCE_INLINE void setRotation(const SimdQuaternion& q) - { - m_basis.setRotation(q); - m_type = (m_type & ~LINEAR) | ROTATION; - } - - SIMD_FORCE_INLINE void scale(const SimdVector3& scaling) - { - m_basis = m_basis.scaled(scaling); - m_type |= SCALING; - } - - void setIdentity() - { - m_basis.setIdentity(); - m_origin.setValue(SimdScalar(0.0), SimdScalar(0.0), SimdScalar(0.0)); - m_type = 0x0; - } - - SIMD_FORCE_INLINE bool isIdentity() const { return m_type == 0x0; } - - SimdTransform& operator*=(const SimdTransform& t) - { - m_origin += m_basis * t.m_origin; - m_basis *= t.m_basis; - m_type |= t.m_type; - return *this; - } - - SimdTransform inverse() const - { - if (m_type) - { - SimdMatrix3x3 inv = (m_type & SCALING) ? - m_basis.inverse() : - m_basis.transpose(); - - return SimdTransform(inv, inv * -m_origin, m_type); - } - - return *this; - } - - SimdTransform inverseTimes(const SimdTransform& t) const; - - SimdTransform operator*(const SimdTransform& t) const; - -private: - - SimdMatrix3x3 m_basis; - SimdVector3 m_origin; - unsigned int m_type; -}; - - -SIMD_FORCE_INLINE SimdVector3 -SimdTransform::invXform(const SimdVector3& inVec) const -{ - SimdVector3 v = inVec - m_origin; - return (m_basis.transpose() * v); -} - -SIMD_FORCE_INLINE SimdTransform -SimdTransform::inverseTimes(const SimdTransform& t) const -{ - SimdVector3 v = t.getOrigin() - m_origin; - if (m_type & SCALING) - { - SimdMatrix3x3 inv = m_basis.inverse(); - return SimdTransform(inv * t.getBasis(), inv * v, - m_type | t.m_type); - } - else - { - return SimdTransform(m_basis.transposeTimes(t.m_basis), - v * m_basis, m_type | t.m_type); - } -} - -SIMD_FORCE_INLINE SimdTransform -SimdTransform::operator*(const SimdTransform& t) const -{ - return SimdTransform(m_basis * t.m_basis, - (*this)(t.m_origin), - m_type | t.m_type); -} - - - -#endif - - - - - diff --git a/extern/bullet/LinearMath/SimdTransformUtil.h b/extern/bullet/LinearMath/SimdTransformUtil.h deleted file mode 100644 index 6bc0d297310..00000000000 --- a/extern/bullet/LinearMath/SimdTransformUtil.h +++ /dev/null @@ -1,143 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef SIMD_TRANSFORM_UTIL_H -#define SIMD_TRANSFORM_UTIL_H - -#include "SimdTransform.h" -#define ANGULAR_MOTION_TRESHOLD 0.5f*SIMD_HALF_PI - - - -#define SIMDSQRT12 SimdScalar(0.7071067811865475244008443621048490) - -#define SimdRecipSqrt(x) ((float)(1.0f/SimdSqrt(float(x)))) /* reciprocal square root */ - -inline SimdVector3 SimdAabbSupport(const SimdVector3& halfExtents,const SimdVector3& supportDir) -{ - return SimdVector3(supportDir.x() < SimdScalar(0.0f) ? -halfExtents.x() : halfExtents.x(), - supportDir.y() < SimdScalar(0.0f) ? -halfExtents.y() : halfExtents.y(), - supportDir.z() < SimdScalar(0.0f) ? -halfExtents.z() : halfExtents.z()); -} - - -inline void SimdPlaneSpace1 (const SimdVector3& n, SimdVector3& p, SimdVector3& q) -{ - if (SimdFabs(n[2]) > SIMDSQRT12) { - // choose p in y-z plane - SimdScalar a = n[1]*n[1] + n[2]*n[2]; - SimdScalar k = SimdRecipSqrt (a); - p[0] = 0; - p[1] = -n[2]*k; - p[2] = n[1]*k; - // set q = n x p - q[0] = a*k; - q[1] = -n[0]*p[2]; - q[2] = n[0]*p[1]; - } - else { - // choose p in x-y plane - SimdScalar a = n[0]*n[0] + n[1]*n[1]; - SimdScalar k = SimdRecipSqrt (a); - p[0] = -n[1]*k; - p[1] = n[0]*k; - p[2] = 0; - // set q = n x p - q[0] = -n[2]*p[1]; - q[1] = n[2]*p[0]; - q[2] = a*k; - } -} - - - -/// Utils related to temporal transforms -class SimdTransformUtil -{ - -public: - - static void IntegrateTransform(const SimdTransform& curTrans,const SimdVector3& linvel,const SimdVector3& angvel,SimdScalar timeStep,SimdTransform& predictedTransform) - { - predictedTransform.setOrigin(curTrans.getOrigin() + linvel * timeStep); -// #define QUATERNION_DERIVATIVE - #ifdef QUATERNION_DERIVATIVE - SimdQuaternion orn = curTrans.getRotation(); - orn += (angvel * orn) * (timeStep * 0.5f); - orn.normalize(); - #else - //exponential map - SimdVector3 axis; - SimdScalar fAngle = angvel.length(); - //limit the angular motion - if (fAngle*timeStep > ANGULAR_MOTION_TRESHOLD) - { - fAngle = ANGULAR_MOTION_TRESHOLD / timeStep; - } - - if ( fAngle < 0.001f ) - { - // use Taylor's expansions of sync function - axis = angvel*( 0.5f*timeStep-(timeStep*timeStep*timeStep)*(0.020833333333f)*fAngle*fAngle ); - } - else - { - // sync(fAngle) = sin(c*fAngle)/t - axis = angvel*( SimdSin(0.5f*fAngle*timeStep)/fAngle ); - } - SimdQuaternion dorn (axis.x(),axis.y(),axis.z(),SimdCos( fAngle*timeStep*0.5f )); - SimdQuaternion orn0 = curTrans.getRotation(); - - SimdQuaternion predictedOrn = dorn * orn0; - #endif - predictedTransform.setRotation(predictedOrn); - } - - static void CalculateVelocity(const SimdTransform& transform0,const SimdTransform& transform1,SimdScalar timeStep,SimdVector3& linVel,SimdVector3& angVel) - { - linVel = (transform1.getOrigin() - transform0.getOrigin()) / timeStep; -#ifdef USE_QUATERNION_DIFF - SimdQuaternion orn0 = transform0.getRotation(); - SimdQuaternion orn1a = transform1.getRotation(); - SimdQuaternion orn1 = orn0.farthest(orn1a); - SimdQuaternion dorn = orn1 * orn0.inverse(); -#else - SimdMatrix3x3 dmat = transform1.getBasis() * transform0.getBasis().inverse(); - SimdQuaternion dorn; - dmat.getRotation(dorn); -#endif//USE_QUATERNION_DIFF - - SimdVector3 axis; - SimdScalar angle; - angle = dorn.getAngle(); - axis = SimdVector3(dorn.x(),dorn.y(),dorn.z()); - axis[3] = 0.f; - //check for axis length - SimdScalar len = axis.length2(); - if (len < SIMD_EPSILON*SIMD_EPSILON) - axis = SimdVector3(1.f,0.f,0.f); - else - axis /= SimdSqrt(len); - - - angVel = axis * angle / timeStep; - - } - - -}; - -#endif //SIMD_TRANSFORM_UTIL_H - diff --git a/extern/bullet/LinearMath/SimdVector3.h b/extern/bullet/LinearMath/SimdVector3.h deleted file mode 100644 index b44ef6c099f..00000000000 --- a/extern/bullet/LinearMath/SimdVector3.h +++ /dev/null @@ -1,403 +0,0 @@ -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef SIMD__VECTOR3_H -#define SIMD__VECTOR3_H - -#include "SimdQuadWord.h" - - -///SimdVector3 is 16byte aligned, and has an extra unused component m_w -///this extra component can be used by derived classes (Quaternion?) or by user -class SimdVector3 : public SimdQuadWord { - - -public: - SIMD_FORCE_INLINE SimdVector3() {} - - - - SIMD_FORCE_INLINE SimdVector3(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z) - :SimdQuadWord(x,y,z,0.f) - { - } - -// SIMD_FORCE_INLINE SimdVector3(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z,const SimdScalar& w) -// : SimdQuadWord(x,y,z,w) -// { -// } - - - - SIMD_FORCE_INLINE SimdVector3& operator+=(const SimdVector3& v) - { - m_x += v.x(); m_y += v.y(); m_z += v.z(); - return *this; - } - - - - SIMD_FORCE_INLINE SimdVector3& operator-=(const SimdVector3& v) - { - m_x -= v.x(); m_y -= v.y(); m_z -= v.z(); - return *this; - } - - SIMD_FORCE_INLINE SimdVector3& operator*=(const SimdScalar& s) - { - m_x *= s; m_y *= s; m_z *= s; - return *this; - } - - SIMD_FORCE_INLINE SimdVector3& operator/=(const SimdScalar& s) - { - assert(s != SimdScalar(0.0)); - return *this *= SimdScalar(1.0) / s; - } - - SIMD_FORCE_INLINE SimdScalar dot(const SimdVector3& v) const - { - return m_x * v.x() + m_y * v.y() + m_z * v.z(); - } - - SIMD_FORCE_INLINE SimdScalar length2() const - { - return dot(*this); - } - - SIMD_FORCE_INLINE SimdScalar length() const - { - return SimdSqrt(length2()); - } - - SIMD_FORCE_INLINE SimdScalar distance2(const SimdVector3& v) const; - - SIMD_FORCE_INLINE SimdScalar distance(const SimdVector3& v) const; - - SIMD_FORCE_INLINE SimdVector3& normalize() - { - return *this /= length(); - } - - SIMD_FORCE_INLINE SimdVector3 normalized() const; - - SIMD_FORCE_INLINE SimdVector3 rotate( const SimdVector3& wAxis, const SimdScalar angle ); - - SIMD_FORCE_INLINE SimdScalar angle(const SimdVector3& v) const - { - SimdScalar s = SimdSqrt(length2() * v.length2()); - assert(s != SimdScalar(0.0)); - return SimdAcos(dot(v) / s); - } - - SIMD_FORCE_INLINE SimdVector3 absolute() const - { - return SimdVector3( - SimdFabs(m_x), - SimdFabs(m_y), - SimdFabs(m_z)); - } - - SIMD_FORCE_INLINE SimdVector3 cross(const SimdVector3& v) const - { - return SimdVector3( - m_y * v.z() - m_z * v.y(), - m_z * v.x() - m_x * v.z(), - m_x * v.y() - m_y * v.x()); - } - - SIMD_FORCE_INLINE SimdScalar triple(const SimdVector3& v1, const SimdVector3& v2) const - { - return m_x * (v1.y() * v2.z() - v1.z() * v2.y()) + - m_y * (v1.z() * v2.x() - v1.x() * v2.z()) + - m_z * (v1.x() * v2.y() - v1.y() * v2.x()); - } - - SIMD_FORCE_INLINE int minAxis() const - { - return m_x < m_y ? (m_x < m_z ? 0 : 2) : (m_y < m_z ? 1 : 2); - } - - SIMD_FORCE_INLINE int maxAxis() const - { - return m_x < m_y ? (m_y < m_z ? 2 : 1) : (m_x < m_z ? 2 : 0); - } - - SIMD_FORCE_INLINE int furthestAxis() const - { - return absolute().minAxis(); - } - - SIMD_FORCE_INLINE int closestAxis() const - { - return absolute().maxAxis(); - } - - SIMD_FORCE_INLINE void setInterpolate3(const SimdVector3& v0, const SimdVector3& v1, SimdScalar rt) - { - SimdScalar s = 1.0f - rt; - m_x = s * v0[0] + rt * v1.x(); - m_y = s * v0[1] + rt * v1.y(); - m_z = s * v0[2] + rt * v1.z(); - //don't do the unused w component - // m_co[3] = s * v0[3] + rt * v1[3]; - } - - SIMD_FORCE_INLINE SimdVector3 lerp(const SimdVector3& v, const SimdScalar& t) const - { - return SimdVector3(m_x + (v.x() - m_x) * t, - m_y + (v.y() - m_y) * t, - m_z + (v.z() - m_z) * t); - } - - - SIMD_FORCE_INLINE SimdVector3& operator*=(const SimdVector3& v) - { - m_x *= v.x(); m_y *= v.y(); m_z *= v.z(); - return *this; - } - - - -}; - -SIMD_FORCE_INLINE SimdVector3 -operator+(const SimdVector3& v1, const SimdVector3& v2) -{ - return SimdVector3(v1.x() + v2.x(), v1.y() + v2.y(), v1.z() + v2.z()); -} - -SIMD_FORCE_INLINE SimdVector3 -operator*(const SimdVector3& v1, const SimdVector3& v2) -{ - return SimdVector3(v1.x() * v2.x(), v1.y() * v2.y(), v1.z() * v2.z()); -} - -SIMD_FORCE_INLINE SimdVector3 -operator-(const SimdVector3& v1, const SimdVector3& v2) -{ - return SimdVector3(v1.x() - v2.x(), v1.y() - v2.y(), v1.z() - v2.z()); -} - -SIMD_FORCE_INLINE SimdVector3 -operator-(const SimdVector3& v) -{ - return SimdVector3(-v.x(), -v.y(), -v.z()); -} - -SIMD_FORCE_INLINE SimdVector3 -operator*(const SimdVector3& v, const SimdScalar& s) -{ - return SimdVector3(v.x() * s, v.y() * s, v.z() * s); -} - -SIMD_FORCE_INLINE SimdVector3 -operator*(const SimdScalar& s, const SimdVector3& v) -{ - return v * s; -} - -SIMD_FORCE_INLINE SimdVector3 -operator/(const SimdVector3& v, const SimdScalar& s) -{ - assert(s != SimdScalar(0.0)); - return v * (SimdScalar(1.0) / s); -} - -SIMD_FORCE_INLINE SimdVector3 -operator/(const SimdVector3& v1, const SimdVector3& v2) -{ - return SimdVector3(v1.x() / v2.x(),v1.y() / v2.y(),v1.z() / v2.z()); -} - -SIMD_FORCE_INLINE SimdScalar -dot(const SimdVector3& v1, const SimdVector3& v2) -{ - return v1.dot(v2); -} - - - -SIMD_FORCE_INLINE SimdScalar -distance2(const SimdVector3& v1, const SimdVector3& v2) -{ - return v1.distance2(v2); -} - - -SIMD_FORCE_INLINE SimdScalar -distance(const SimdVector3& v1, const SimdVector3& v2) -{ - return v1.distance(v2); -} - -SIMD_FORCE_INLINE SimdScalar -angle(const SimdVector3& v1, const SimdVector3& v2) -{ - return v1.angle(v2); -} - -SIMD_FORCE_INLINE SimdVector3 -cross(const SimdVector3& v1, const SimdVector3& v2) -{ - return v1.cross(v2); -} - -SIMD_FORCE_INLINE SimdScalar -triple(const SimdVector3& v1, const SimdVector3& v2, const SimdVector3& v3) -{ - return v1.triple(v2, v3); -} - -SIMD_FORCE_INLINE SimdVector3 -lerp(const SimdVector3& v1, const SimdVector3& v2, const SimdScalar& t) -{ - return v1.lerp(v2, t); -} - - -SIMD_FORCE_INLINE bool operator==(const SimdVector3& p1, const SimdVector3& p2) -{ - return p1[0] == p2[0] && p1[1] == p2[1] && p1[2] == p2[2]; -} - -SIMD_FORCE_INLINE SimdScalar SimdVector3::distance2(const SimdVector3& v) const -{ - return (v - *this).length2(); -} - -SIMD_FORCE_INLINE SimdScalar SimdVector3::distance(const SimdVector3& v) const -{ - return (v - *this).length(); -} - -SIMD_FORCE_INLINE SimdVector3 SimdVector3::normalized() const -{ - return *this / length(); -} - -SIMD_FORCE_INLINE SimdVector3 SimdVector3::rotate( const SimdVector3& wAxis, const SimdScalar angle ) -{ - // wAxis must be a unit lenght vector - - SimdVector3 o = wAxis * wAxis.dot( *this ); - SimdVector3 x = *this - o; - SimdVector3 y; - - y = wAxis.cross( *this ); - - return ( o + x * SimdCos( angle ) + y * SimdSin( angle ) ); -} - -class SimdVector4 : public SimdVector3 -{ -public: - - SIMD_FORCE_INLINE SimdVector4() {} - - - SIMD_FORCE_INLINE SimdVector4(const SimdScalar& x, const SimdScalar& y, const SimdScalar& z,const SimdScalar& w) - : SimdVector3(x,y,z) - { - m_unusedW = w; - } - - - SIMD_FORCE_INLINE SimdVector4 absolute4() const - { - return SimdVector4( - SimdFabs(m_x), - SimdFabs(m_y), - SimdFabs(m_z), - SimdFabs(m_unusedW)); - } - - - - float getW() const { return m_unusedW;} - - - SIMD_FORCE_INLINE int maxAxis4() const - { - int maxIndex = -1; - float maxVal = -1e30f; - if (m_x > maxVal) - { - maxIndex = 0; - maxVal = m_x; - } - if (m_y > maxVal) - { - maxIndex = 1; - maxVal = m_y; - } - if (m_z > maxVal) - { - maxIndex = 2; - maxVal = m_z; - } - if (m_unusedW > maxVal) - { - maxIndex = 3; - maxVal = m_unusedW; - } - - - - - return maxIndex; - - } - - - SIMD_FORCE_INLINE int minAxis4() const - { - int minIndex = -1; - float minVal = 1e30f; - if (m_x < minVal) - { - minIndex = 0; - minVal = m_x; - } - if (m_y < minVal) - { - minIndex = 1; - minVal = m_y; - } - if (m_z < minVal) - { - minIndex = 2; - minVal = m_z; - } - if (m_unusedW < minVal) - { - minIndex = 3; - minVal = m_unusedW; - } - - return minIndex; - - } - - - SIMD_FORCE_INLINE int closestAxis4() const - { - return absolute4().maxAxis4(); - } - -}; - -#endif //SIMD__VECTOR3_H diff --git a/extern/bullet/LinearMath/quickprof.h b/extern/bullet/LinearMath/quickprof.h deleted file mode 100644 index 86774d1bb01..00000000000 --- a/extern/bullet/LinearMath/quickprof.h +++ /dev/null @@ -1,678 +0,0 @@ -/************************************************************************ -* QuickProf * -* Copyright (C) 2006 * -* Tyler Streeter tylerstreeter@gmail.com * -* All rights reserved. * -* Web: http://quickprof.sourceforge.net * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of EITHER: * -* (1) The GNU Lesser General Public License as published by the Free * -* Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. The text of the GNU Lesser * -* General Public License is included with this library in the * -* file license-LGPL.txt. * -* (2) The BSD-style license that is included with this library in * -* the file license-BSD.txt. * -* * -* This library is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * -* license-LGPL.txt and license-BSD.txt for more details. * -************************************************************************/ - -// Please visit the project website (http://quickprof.sourceforge.net) -// for usage instructions. - -// Credits: The Clock class was inspired by the Timer classes in -// Ogre (www.ogre3d.org). - - -//#define USE_QUICKPROF 1 - -#ifdef USE_QUICKPROF - -#ifndef QUICK_PROF_H -#define QUICK_PROF_H - -#include <iostream> -#include <fstream> -#include <string> -#include <map> - -#ifdef __PPU__ -#include <sys/sys_time.h> -#include <stdio.h> -typedef uint64_t __int64; -#endif - -#if defined(WIN32) || defined(_WIN32) - #define USE_WINDOWS_TIMERS - #include <windows.h> - #include <time.h> -#else - #include <sys/time.h> -#endif - -#define mymin(a,b) (a > b ? a : b) -namespace hidden -{ - /// A simple data structure representing a single timed block - /// of code. - struct ProfileBlock - { - ProfileBlock() - { - currentBlockStartMicroseconds = 0; - currentCycleTotalMicroseconds = 0; - lastCycleTotalMicroseconds = 0; - totalMicroseconds = 0; - } - - /// The starting time (in us) of the current block update. - unsigned long int currentBlockStartMicroseconds; - - /// The accumulated time (in us) spent in this block during the - /// current profiling cycle. - unsigned long int currentCycleTotalMicroseconds; - - /// The accumulated time (in us) spent in this block during the - /// past profiling cycle. - unsigned long int lastCycleTotalMicroseconds; - - /// The total accumulated time (in us) spent in this block. - unsigned long int totalMicroseconds; - }; - - class Clock - { - public: - Clock() - { -#ifdef USE_WINDOWS_TIMERS - QueryPerformanceFrequency(&mClockFrequency); -#endif - reset(); - } - - ~Clock() - { - } - - /// Resets the initial reference time. - void reset() - { -#ifdef USE_WINDOWS_TIMERS - QueryPerformanceCounter(&mStartTime); - mStartTick = GetTickCount(); - mPrevElapsedTime = 0; -#else -#ifdef __PPU__ - - typedef uint64_t __int64; - typedef __int64 ClockSize; - ClockSize newTime; - __asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory"); - mStartTime = newTime; -#else - gettimeofday(&mStartTime, NULL); -#endif - -#endif - } - - /// Returns the time in ms since the last call to reset or since - /// the Clock was created. - unsigned long int getTimeMilliseconds() - { -#ifdef USE_WINDOWS_TIMERS - LARGE_INTEGER currentTime; - QueryPerformanceCounter(¤tTime); - LONGLONG elapsedTime = currentTime.QuadPart - - mStartTime.QuadPart; - - // Compute the number of millisecond ticks elapsed. - unsigned long msecTicks = (unsigned long)(1000 * elapsedTime / - mClockFrequency.QuadPart); - - // Check for unexpected leaps in the Win32 performance counter. - // (This is caused by unexpected data across the PCI to ISA - // bridge, aka south bridge. See Microsoft KB274323.) - unsigned long elapsedTicks = GetTickCount() - mStartTick; - signed long msecOff = (signed long)(msecTicks - elapsedTicks); - if (msecOff < -100 || msecOff > 100) - { - // Adjust the starting time forwards. - LONGLONG msecAdjustment = mymin(msecOff * - mClockFrequency.QuadPart / 1000, elapsedTime - - mPrevElapsedTime); - mStartTime.QuadPart += msecAdjustment; - elapsedTime -= msecAdjustment; - - // Recompute the number of millisecond ticks elapsed. - msecTicks = (unsigned long)(1000 * elapsedTime / - mClockFrequency.QuadPart); - } - - // Store the current elapsed time for adjustments next time. - mPrevElapsedTime = elapsedTime; - - return msecTicks; -#else - -#ifdef __PPU__ - __int64 freq=sys_time_get_timebase_frequency(); - double dFreq=((double) freq) / 1000.0; - typedef uint64_t __int64; - typedef __int64 ClockSize; - ClockSize newTime; - __asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory"); - - return (newTime-mStartTime) / dFreq; -#else - - struct timeval currentTime; - gettimeofday(¤tTime, NULL); - return (currentTime.tv_sec - mStartTime.tv_sec) * 1000 + - (currentTime.tv_usec - mStartTime.tv_usec) / 1000; -#endif //__PPU__ -#endif - } - - /// Returns the time in us since the last call to reset or since - /// the Clock was created. - unsigned long int getTimeMicroseconds() - { -#ifdef USE_WINDOWS_TIMERS - LARGE_INTEGER currentTime; - QueryPerformanceCounter(¤tTime); - LONGLONG elapsedTime = currentTime.QuadPart - - mStartTime.QuadPart; - - // Compute the number of millisecond ticks elapsed. - unsigned long msecTicks = (unsigned long)(1000 * elapsedTime / - mClockFrequency.QuadPart); - - // Check for unexpected leaps in the Win32 performance counter. - // (This is caused by unexpected data across the PCI to ISA - // bridge, aka south bridge. See Microsoft KB274323.) - unsigned long elapsedTicks = GetTickCount() - mStartTick; - signed long msecOff = (signed long)(msecTicks - elapsedTicks); - if (msecOff < -100 || msecOff > 100) - { - // Adjust the starting time forwards. - LONGLONG msecAdjustment = mymin(msecOff * - mClockFrequency.QuadPart / 1000, elapsedTime - - mPrevElapsedTime); - mStartTime.QuadPart += msecAdjustment; - elapsedTime -= msecAdjustment; - } - - // Store the current elapsed time for adjustments next time. - mPrevElapsedTime = elapsedTime; - - // Convert to microseconds. - unsigned long usecTicks = (unsigned long)(1000000 * elapsedTime / - mClockFrequency.QuadPart); - - return usecTicks; -#else - -#ifdef __PPU__ - __int64 freq=sys_time_get_timebase_frequency(); - double dFreq=((double) freq)/ 1000000.0; - typedef uint64_t __int64; - typedef __int64 ClockSize; - ClockSize newTime; - __asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory"); - - return (newTime-mStartTime) / dFreq; -#else - - struct timeval currentTime; - gettimeofday(¤tTime, NULL); - return (currentTime.tv_sec - mStartTime.tv_sec) * 1000000 + - (currentTime.tv_usec - mStartTime.tv_usec); -#endif//__PPU__ -#endif - } - - private: -#ifdef USE_WINDOWS_TIMERS - LARGE_INTEGER mClockFrequency; - DWORD mStartTick; - LONGLONG mPrevElapsedTime; - LARGE_INTEGER mStartTime; -#else -#ifdef __PPU__ - uint64_t mStartTime; -#else - struct timeval mStartTime; -#endif -#endif //__PPU__ - - }; -}; - -/// A static class that manages timing for a set of profiling blocks. -class Profiler -{ -public: - /// A set of ways to retrieve block timing data. - enum BlockTimingMethod - { - /// The total time spent in the block (in seconds) since the - /// profiler was initialized. - BLOCK_TOTAL_SECONDS, - - /// The total time spent in the block (in ms) since the - /// profiler was initialized. - BLOCK_TOTAL_MILLISECONDS, - - /// The total time spent in the block (in us) since the - /// profiler was initialized. - BLOCK_TOTAL_MICROSECONDS, - - /// The total time spent in the block, as a % of the total - /// elapsed time since the profiler was initialized. - BLOCK_TOTAL_PERCENT, - - /// The time spent in the block (in seconds) in the most recent - /// profiling cycle. - BLOCK_CYCLE_SECONDS, - - /// The time spent in the block (in ms) in the most recent - /// profiling cycle. - BLOCK_CYCLE_MILLISECONDS, - - /// The time spent in the block (in us) in the most recent - /// profiling cycle. - BLOCK_CYCLE_MICROSECONDS, - - /// The time spent in the block (in seconds) in the most recent - /// profiling cycle, as a % of the total cycle time. - BLOCK_CYCLE_PERCENT - }; - - /// Initializes the profiler. This must be called first. If this is - /// never called, the profiler is effectively disabled; all other - /// functions will return immediately. The first parameter - /// is the name of an output data file; if this string is not empty, - /// data will be saved on every profiling cycle; if this string is - /// empty, no data will be saved to a file. The second parameter - /// determines which timing method is used when printing data to the - /// output file. - inline static void init(const std::string outputFilename="", - BlockTimingMethod outputMethod=BLOCK_CYCLE_MILLISECONDS); - - /// Cleans up allocated memory. - inline static void destroy(); - - /// Begins timing the named block of code. - inline static void beginBlock(const std::string& name); - - /// Updates the accumulated time spent in the named block by adding - /// the elapsed time since the last call to startBlock for this block - /// name. - inline static void endBlock(const std::string& name); - - /// Returns the time spent in the named block according to the - /// given timing method. See comments on BlockTimingMethod for details. - inline static double getBlockTime(const std::string& name, - BlockTimingMethod method=BLOCK_CYCLE_MILLISECONDS); - - /// Defines the end of a profiling cycle. Use this regularly if you - /// want to generate detailed timing information. This must not be - /// called within a timing block. - inline static void endProfilingCycle(); - - /// A helper function that creates a string of statistics for - /// each timing block. This is mainly for printing an overall - /// summary to the command line. - inline static std::string createStatsString( - BlockTimingMethod method=BLOCK_TOTAL_PERCENT); - -//private: - inline Profiler(); - - inline ~Profiler(); - - /// Prints an error message to standard output. - inline static void printError(const std::string& msg) - { - std::cout << "[QuickProf error] " << msg << std::endl; - } - - /// Determines whether the profiler is enabled. - static bool mEnabled; - - /// The clock used to time profile blocks. - static hidden::Clock mClock; - - /// The starting time (in us) of the current profiling cycle. - static unsigned long int mCurrentCycleStartMicroseconds; - - /// The duration (in us) of the most recent profiling cycle. - static unsigned long int mLastCycleDurationMicroseconds; - - /// Internal map of named profile blocks. - static std::map<std::string, hidden::ProfileBlock*> mProfileBlocks; - - /// The data file used if this feature is enabled in 'init.' - static std::ofstream mOutputFile; - - /// Tracks whether we have begun print data to the output file. - static bool mFirstFileOutput; - - /// The method used when printing timing data to an output file. - static BlockTimingMethod mFileOutputMethod; - - /// The number of the current profiling cycle. - static unsigned long int mCycleNumber; -}; - - -Profiler::Profiler() -{ - // This never gets called because a Profiler instance is never - // created. -} - -Profiler::~Profiler() -{ - // This never gets called because a Profiler instance is never - // created. -} - -void Profiler::init(const std::string outputFilename, - BlockTimingMethod outputMethod) -{ - mEnabled = true; - - if (!outputFilename.empty()) - { - mOutputFile.open(outputFilename.c_str()); - } - - mFileOutputMethod = outputMethod; - - mClock.reset(); - - // Set the start time for the first cycle. - mCurrentCycleStartMicroseconds = mClock.getTimeMicroseconds(); -} - -void Profiler::destroy() -{ - if (!mEnabled) - { - return; - } - - if (mOutputFile.is_open()) - { - mOutputFile.close(); - } - - // Destroy all ProfileBlocks. - while (!mProfileBlocks.empty()) - { - delete (*mProfileBlocks.begin()).second; - mProfileBlocks.erase(mProfileBlocks.begin()); - } -} - -void Profiler::beginBlock(const std::string& name) -{ - if (!mEnabled) - { - return; - } - - if (name.empty()) - { - printError("Cannot allow unnamed profile blocks."); - return; - } - - hidden::ProfileBlock* block = mProfileBlocks[name]; - - if (!block) - { - // Create a new ProfileBlock. - mProfileBlocks[name] = new hidden::ProfileBlock(); - block = mProfileBlocks[name]; - } - - // We do this at the end to get more accurate results. - block->currentBlockStartMicroseconds = mClock.getTimeMicroseconds(); -} - -void Profiler::endBlock(const std::string& name) -{ - if (!mEnabled) - { - return; - } - - // We do this at the beginning to get more accurate results. - unsigned long int endTick = mClock.getTimeMicroseconds(); - - hidden::ProfileBlock* block = mProfileBlocks[name]; - - if (!block) - { - // The named block does not exist. Print an error. - printError("The profile block named '" + name + - "' does not exist."); - return; - } - - unsigned long int blockDuration = endTick - - block->currentBlockStartMicroseconds; - block->currentCycleTotalMicroseconds += blockDuration; - block->totalMicroseconds += blockDuration; -} - -double Profiler::getBlockTime(const std::string& name, - BlockTimingMethod method) -{ - if (!mEnabled) - { - return 0; - } - - hidden::ProfileBlock* block = mProfileBlocks[name]; - - if (!block) - { - // The named block does not exist. Print an error. - printError("The profile block named '" + name + - "' does not exist."); - return 0; - } - - double result = 0; - - switch(method) - { - case BLOCK_TOTAL_SECONDS: - result = (double)block->totalMicroseconds * (double)0.000001; - break; - case BLOCK_TOTAL_MILLISECONDS: - result = (double)block->totalMicroseconds * (double)0.001; - break; - case BLOCK_TOTAL_MICROSECONDS: - result = (double)block->totalMicroseconds; - break; - case BLOCK_TOTAL_PERCENT: - { - double timeSinceInit = (double)mClock.getTimeMicroseconds(); - if (timeSinceInit <= 0) - { - result = 0; - } - else - { - result = 100.0 * (double)block->totalMicroseconds / - timeSinceInit; - } - break; - } - case BLOCK_CYCLE_SECONDS: - result = (double)block->lastCycleTotalMicroseconds * - (double)0.000001; - break; - case BLOCK_CYCLE_MILLISECONDS: - result = (double)block->lastCycleTotalMicroseconds * - (double)0.001; - break; - case BLOCK_CYCLE_MICROSECONDS: - result = (double)block->lastCycleTotalMicroseconds; - break; - case BLOCK_CYCLE_PERCENT: - { - if (0 == mLastCycleDurationMicroseconds) - { - // We have not yet finished a cycle, so just return zero - // percent to avoid a divide by zero error. - result = 0; - } - else - { - result = 100.0 * (double)block->lastCycleTotalMicroseconds / - mLastCycleDurationMicroseconds; - } - break; - } - default: - break; - } - - return result; -} - -void Profiler::endProfilingCycle() -{ - if (!mEnabled) - { - return; - } - - // Store the duration of the cycle that just finished. - mLastCycleDurationMicroseconds = mClock.getTimeMicroseconds() - - mCurrentCycleStartMicroseconds; - - // For each block, update data for the cycle that just finished. - std::map<std::string, hidden::ProfileBlock*>::iterator iter; - for (iter = mProfileBlocks.begin(); iter != mProfileBlocks.end(); ++iter) - { - hidden::ProfileBlock* block = (*iter).second; - block->lastCycleTotalMicroseconds = - block->currentCycleTotalMicroseconds; - block->currentCycleTotalMicroseconds = 0; - } - - if (mOutputFile.is_open()) - { - // Print data to the output file. - if (mFirstFileOutput) - { - // On the first iteration, print a header line that shows the - // names of each profiling block. - mOutputFile << "#cycle; "; - - for (iter = mProfileBlocks.begin(); iter != mProfileBlocks.end(); - ++iter) - { - mOutputFile << (*iter).first << "; "; - } - - mOutputFile << std::endl; - mFirstFileOutput = false; - } - - mOutputFile << mCycleNumber << "; "; - - for (iter = mProfileBlocks.begin(); iter != mProfileBlocks.end(); - ++iter) - { - mOutputFile << getBlockTime((*iter).first, mFileOutputMethod) - << "; "; - } - - mOutputFile << std::endl; - } - - ++mCycleNumber; - mCurrentCycleStartMicroseconds = mClock.getTimeMicroseconds(); -} - -std::string Profiler::createStatsString(BlockTimingMethod method) -{ - if (!mEnabled) - { - return ""; - } - - std::string s; - std::string suffix; - - switch(method) - { - case BLOCK_TOTAL_SECONDS: - suffix = "s"; - break; - case BLOCK_TOTAL_MILLISECONDS: - suffix = "ms"; - break; - case BLOCK_TOTAL_MICROSECONDS: - suffix = "us"; - break; - case BLOCK_TOTAL_PERCENT: - { - suffix = "%"; - break; - } - case BLOCK_CYCLE_SECONDS: - suffix = "s"; - break; - case BLOCK_CYCLE_MILLISECONDS: - suffix = "ms"; - break; - case BLOCK_CYCLE_MICROSECONDS: - suffix = "us"; - break; - case BLOCK_CYCLE_PERCENT: - { - suffix = "%"; - break; - } - default: - break; - } - - std::map<std::string, hidden::ProfileBlock*>::iterator iter; - for (iter = mProfileBlocks.begin(); iter != mProfileBlocks.end(); ++iter) - { - if (iter != mProfileBlocks.begin()) - { - s += "\n"; - } - - char blockTime[64]; - sprintf(blockTime, "%lf", getBlockTime((*iter).first, method)); - - s += (*iter).first; - s += ": "; - s += blockTime; - s += " "; - s += suffix; - } - - return s; -} - -#endif - -#endif //USE_QUICKPROF diff --git a/extern/bullet/Makefile b/extern/bullet/Makefile deleted file mode 100755 index 793a9606e8c..00000000000 --- a/extern/bullet/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. The Blender -# Foundation also sells licenses for use in proprietary software under -# the Blender License. See http://www.blender.org/BL/ for information -# about this. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# 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. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL/BL DUAL LICENSE BLOCK ***** -# -# - -include nan_definitions.mk - - -SOURCEDIR = extern/bullet -LIBNAMES = bullet bulletdyn -DIR = $(OCGDIR)/$(SOURCEDIR) -DIRS = Bullet BulletDynamics - -include nan_subdirs.mk - -install: all debug - @[ -d $(NAN_BULLET) ] || mkdir $(NAN_BULLET) - @[ -d $(NAN_BULLET)/include ] || mkdir $(NAN_BULLET)/include - @[ -d $(NAN_BULLET)/include/CollisionShapes ] || mkdir $(NAN_BULLET)/include/CollisionShapes - @[ -d $(NAN_BULLET)/include/BroadphaseCollision ] || mkdir $(NAN_BULLET)/include/BroadphaseCollision - @[ -d $(NAN_BULLET)/include/NarrowPhaseCollision ] || mkdir $(NAN_BULLET)/include/NarrowPhaseCollision - @[ -d $(NAN_BULLET)/include/Dynamics ] || mkdir $(NAN_BULLET)/include/Dynamics - @[ -d $(NAN_BULLET)/include/ConstraintSolver ] || mkdir $(NAN_BULLET)/include/ConstraintSolver - @[ -d $(NAN_BULLET)/include/CollisionDispatch ] || mkdir $(NAN_BULLET)/include/CollisionDispatch - @[ -d $(NAN_BULLET)/include/Vehicle ] || mkdir $(NAN_BULLET)/include/Vehicle - @[ -d $(NAN_BULLET)/lib ] || mkdir $(NAN_BULLET)/lib - @[ -d $(NAN_BULLET)/lib/debug ] || mkdir $(NAN_BULLET)/lib/debug - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh $(DIR)/Bullet/libbullet.a $(NAN_BULLET)/lib/ - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh $(DIR)/Bullet/debug/libbullet.a $(NAN_BULLET)/lib/debug/ - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh $(DIR)/BulletDynamics/libbulletdyn.a $(NAN_BULLET)/lib/ - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh $(DIR)/BulletDynamics/debug/libbulletdyn.a $(NAN_BULLET)/lib/debug/ -ifeq ($(OS),darwin) - ranlib $(NAN_BULLET)/lib/libbullet.a - ranlib $(NAN_BULLET)/lib/debug/libbullet.a - ranlib $(NAN_BULLET)/lib/libbulletdyn.a - ranlib $(NAN_BULLET)/lib/debug/libbulletdyn.a -endif - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh Bullet/CollisionShapes/*.h $(NAN_BULLET)/include/CollisionShapes - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh Bullet/BroadphaseCollision/*.h $(NAN_BULLET)/include/BroadphaseCollision - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh Bullet/NarrowPhaseCollision/*.h $(NAN_BULLET)/include/NarrowPhaseCollision - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh Bullet/CollisionDispatch/*.h $(NAN_BULLET)/include/CollisionDispatch - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh BulletDynamics/Dynamics/*.h $(NAN_BULLET)/include/Dynamics - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh BulletDynamics/ConstraintSolver/*.h $(NAN_BULLET)/include/ConstraintSolver - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh BulletDynamics/Vehicle/*.h $(NAN_BULLET)/include/Vehicle - @$(NANBLENDERHOME)/intern/tools/cpifdiff.sh LinearMath/*.h $(NAN_BULLET)/include diff --git a/extern/bullet/SConscript b/extern/bullet/SConscript deleted file mode 100644 index 5e1d107eabc..00000000000 --- a/extern/bullet/SConscript +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/python -import sys -import os - -Import('env') - -defs = 'USE_DOUBLES QHULL _LIB' -cflags = [] - -if env['OURPLATFORM']=='win32-vc': - defs += ' WIN32 NDEBUG _WINDOWS _LIB' - #cflags += ['/MT', '/W3', '/GX', '/O2', '/Op'] - cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6'] -elif env['OURPLATFORM']=='win32-mingw': - defs += ' NDEBUG' - cflags += ['-O2'] -elif sys.platform=='linux2' or sys.platform=='linux-i386' or sys.platform=='freebsd4' or sys.platform=='freebsd5': - defs += ' NDEBUG' - cflags += ['-O2'] -elif sys.platform=='darwin': - defs += ' NDEBUG' - cflags += ['-O2','-pipe', '-fPIC', '-funsigned-char', '-ffast-math', '-mpowerpc' , '-mtune=G4'] - -sources = env.Glob("Bullet/BroadphaseCollision/*.cpp") -sources += env.Glob("Bullet/CollisionShapes/*.cpp") -sources += env.Glob("Bullet/NarrowPhaseCollision/*.cpp") -sources += env.Glob("Bullet/CollisionDispatch/*.cpp") -sources += env.Glob("BulletDynamics/ConstraintSolver/*.cpp") -sources += env.Glob("BulletDynamics/Vehicle/*.cpp") -sources += env.Glob("BulletDynamics/Dynamics/*.cpp") - -incs = '. Bullet BulletDynamics LinearMath' - -env.BlenderLib ( libname = 'extern_bullet', sources=sources, includes=Split(incs), defines=Split(defs), libtype=['game2', 'player'], priority=[20, 170], compileflags=cflags ) diff --git a/extern/bullet/continuous.dsw b/extern/bullet/continuous.dsw deleted file mode 100644 index 4d0cd2689bf..00000000000 --- a/extern/bullet/continuous.dsw +++ /dev/null @@ -1,248 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Bullet"=.\Bullet\Bullet3.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name BulletDynamics - End Project Dependency - Begin Project Dependency - Project_Dep_Name CcdPhysics - End Project Dependency - Begin Project Dependency - Project_Dep_Name PhysicsInterface - End Project Dependency -}}} - -############################################################################### - -Project: "BulletDynamics"=.\BulletDynamics\BulletDynamics.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "CcdPhysics"=.\EXTRAS\PHYSICSINTERFACE\CcdPhysics\CcdPhysics.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "CcdPhysicsDemo"=.\Demos\CcdPhysicsDemo\CcdPhysicsDemo.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Bullet - End Project Dependency - Begin Project Dependency - Project_Dep_Name BulletDynamics - End Project Dependency - Begin Project Dependency - Project_Dep_Name OpenGL - End Project Dependency - Begin Project Dependency - Project_Dep_Name CcdPhysics - End Project Dependency - Begin Project Dependency - Project_Dep_Name PhysicsInterface - End Project Dependency -}}} - -############################################################################### - -Project: "CollisionDemo"=.\Demos\CollisionDemo\CollisionDemo.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Bullet - End Project Dependency - Begin Project Dependency - Project_Dep_Name OpenGL - End Project Dependency -}}} - -############################################################################### - -Project: "ConcaveDemo"=.\DEMOS\ConcaveDemo\ConcaveDemo.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Bullet - End Project Dependency - Begin Project Dependency - Project_Dep_Name BulletDynamics - End Project Dependency - Begin Project Dependency - Project_Dep_Name CcdPhysics - End Project Dependency - Begin Project Dependency - Project_Dep_Name OpenGL - End Project Dependency - Begin Project Dependency - Project_Dep_Name PhysicsInterface - End Project Dependency -}}} - -############################################################################### - -Project: "ContinuousConvexCollision"=.\Demos\ContinuousConvexCollision\ContinuousConvexCollision.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Bullet - End Project Dependency - Begin Project Dependency - Project_Dep_Name OpenGL - End Project Dependency -}}} - -############################################################################### - -Project: "ConvexHullDistance"=.\DEMOS\ConvexHullDistance\ConvexHullDistance.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Bullet - End Project Dependency - Begin Project Dependency - Project_Dep_Name OpenGL - End Project Dependency -}}} - -############################################################################### - -Project: "GjkConvexCastDemo"=.\Demos\GjkConvexCastDemo\GjkConvexCastDemo.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Bullet - End Project Dependency - Begin Project Dependency - Project_Dep_Name OpenGL - End Project Dependency -}}} - -############################################################################### - -Project: "OpenGL"=.\Demos\OpenGL\OpenGL.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "PhysicsInterface"=.\EXTRAS\PHYSICSINTERFACE\Common\PhysicsInterface.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "Raytracer"=.\Demos\Raytracer\Raytracer.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Bullet - End Project Dependency - Begin Project Dependency - Project_Dep_Name OpenGL - End Project Dependency -}}} - -############################################################################### - -Project: "SimplexDemo"=.\Demos\SimplexDemo\SimplexDemo.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Bullet - End Project Dependency - Begin Project Dependency - Project_Dep_Name OpenGL - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/extern/bullet/continuous_vc7.sln b/extern/bullet/continuous_vc7.sln deleted file mode 100644 index 015e91e2e11..00000000000 --- a/extern/bullet/continuous_vc7.sln +++ /dev/null @@ -1,140 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGLSupport", "Demos\OpenGL\OpenGL_vc7.vcproj", "{47328C1E-54A4-4065-B3DA-F88EE281D1E5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bullet3ContinuousCollision", "Bullet\Bullet3_vc7.vcproj", "{FFD3C64A-30E2-4BC7-BC8F-51818C320400}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimplexDemo", "Demos\SimplexDemo\SimplexDemo_vc7.vcproj", "{F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}" - ProjectSection(ProjectDependencies) = postProject - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CollisionDemo", "Demos\CollisionDemo\CollisionDemo_vc7.vcproj", "{F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}" - ProjectSection(ProjectDependencies) = postProject - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LinearConvexCastDemo", "Demos\GjkConvexCastDemo\GjkConvexCastDemo_vc7.vcproj", "{B395AFF6-94FE-4A2C-9E26-58E5BE85083C}" - ProjectSection(ProjectDependencies) = postProject - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ContinuousConvexCollisionDemo", "Demos\ContinuousConvexCollision\ContinuousConvexCollision_vc7.vcproj", "{6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}" - ProjectSection(ProjectDependencies) = postProject - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Raytracer", "Demos\Raytracer\Raytracer_vc7.vcproj", "{F8B0A298-14C9-4006-8D53-51032892BEDD}" - ProjectSection(ProjectDependencies) = postProject - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bullet3Dynamics", "BulletDynamics\BulletDynamics_vc7.vcproj", "{3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CcdPhysics", "Extras\PhysicsInterface\CcdPhysics\CcdPhysics_vc7.vcproj", "{E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PhysicsInterfaceCommon", "Extras\PhysicsInterface\Common\PhysicsInterfaceCommon\PhysicsInterfaceCommon_vc7.vcproj", "{87D8C006-6DCC-4156-A03E-8CEA1B4C0580}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CcdPhysicsDemo", "Demos\CcdPhysicsDemo\CcdPhysicsDemo_vc7.vcproj", "{E9C93159-EC18-4121-9D73-1DE7053D81D7}" - ProjectSection(ProjectDependencies) = postProject - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} = {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} = {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} = {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConcaveDemo", "Demos\ConcaveDemo\ConcaveDemo.vcproj", "{F20F38CC-CFA7-40C7-81AE-945C8C09E473}" - ProjectSection(ProjectDependencies) = postProject - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} = {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} = {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} = {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConvexHullDistance", "Demos\ConvexHullDistance\ConvexHullDistance_vc7.vcproj", "{AF9E7C2B-BE49-4101-B056-4A628B276389}" - ProjectSection(ProjectDependencies) = postProject - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {47328C1E-54A4-4065-B3DA-F88EE281D1E5}.Debug.ActiveCfg = Debug|Win32 - {47328C1E-54A4-4065-B3DA-F88EE281D1E5}.Debug.Build.0 = Debug|Win32 - {47328C1E-54A4-4065-B3DA-F88EE281D1E5}.Release.ActiveCfg = Release|Win32 - {47328C1E-54A4-4065-B3DA-F88EE281D1E5}.Release.Build.0 = Release|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Debug.ActiveCfg = Debug|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Debug.Build.0 = Debug|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Release.ActiveCfg = Release|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Release.Build.0 = Release|Win32 - {F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}.Debug.ActiveCfg = Debug|Win32 - {F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}.Debug.Build.0 = Debug|Win32 - {F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}.Release.ActiveCfg = Release|Win32 - {F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}.Release.Build.0 = Release|Win32 - {F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}.Debug.ActiveCfg = Debug|Win32 - {F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}.Debug.Build.0 = Debug|Win32 - {F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}.Release.ActiveCfg = Release|Win32 - {F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}.Release.Build.0 = Release|Win32 - {B395AFF6-94FE-4A2C-9E26-58E5BE85083C}.Debug.ActiveCfg = Debug|Win32 - {B395AFF6-94FE-4A2C-9E26-58E5BE85083C}.Debug.Build.0 = Debug|Win32 - {B395AFF6-94FE-4A2C-9E26-58E5BE85083C}.Release.ActiveCfg = Release|Win32 - {B395AFF6-94FE-4A2C-9E26-58E5BE85083C}.Release.Build.0 = Release|Win32 - {6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}.Debug.ActiveCfg = Debug|Win32 - {6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}.Debug.Build.0 = Debug|Win32 - {6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}.Release.ActiveCfg = Release|Win32 - {6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}.Release.Build.0 = Release|Win32 - {F8B0A298-14C9-4006-8D53-51032892BEDD}.Debug.ActiveCfg = Debug|Win32 - {F8B0A298-14C9-4006-8D53-51032892BEDD}.Debug.Build.0 = Debug|Win32 - {F8B0A298-14C9-4006-8D53-51032892BEDD}.Release.ActiveCfg = Release|Win32 - {F8B0A298-14C9-4006-8D53-51032892BEDD}.Release.Build.0 = Release|Win32 - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}.Debug.ActiveCfg = Debug|Win32 - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}.Debug.Build.0 = Debug|Win32 - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}.Release.ActiveCfg = Release|Win32 - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}.Release.Build.0 = Release|Win32 - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}.Debug.ActiveCfg = Debug|Win32 - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}.Debug.Build.0 = Debug|Win32 - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}.Release.ActiveCfg = Release|Win32 - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}.Release.Build.0 = Release|Win32 - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580}.Debug.ActiveCfg = Debug|Win32 - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580}.Debug.Build.0 = Debug|Win32 - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580}.Release.ActiveCfg = Release|Win32 - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580}.Release.Build.0 = Release|Win32 - {E9C93159-EC18-4121-9D73-1DE7053D81D7}.Debug.ActiveCfg = Debug|Win32 - {E9C93159-EC18-4121-9D73-1DE7053D81D7}.Debug.Build.0 = Debug|Win32 - {E9C93159-EC18-4121-9D73-1DE7053D81D7}.Release.ActiveCfg = Release|Win32 - {E9C93159-EC18-4121-9D73-1DE7053D81D7}.Release.Build.0 = Release|Win32 - {F20F38CC-CFA7-40C7-81AE-945C8C09E473}.Debug.ActiveCfg = Debug|Win32 - {F20F38CC-CFA7-40C7-81AE-945C8C09E473}.Debug.Build.0 = Debug|Win32 - {F20F38CC-CFA7-40C7-81AE-945C8C09E473}.Release.ActiveCfg = Release|Win32 - {F20F38CC-CFA7-40C7-81AE-945C8C09E473}.Release.Build.0 = Release|Win32 - {AF9E7C2B-BE49-4101-B056-4A628B276389}.Debug.ActiveCfg = Debug|Win32 - {AF9E7C2B-BE49-4101-B056-4A628B276389}.Debug.Build.0 = Debug|Win32 - {AF9E7C2B-BE49-4101-B056-4A628B276389}.Release.ActiveCfg = Release|Win32 - {AF9E7C2B-BE49-4101-B056-4A628B276389}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/extern/bullet/continuous_vc8.sln b/extern/bullet/continuous_vc8.sln deleted file mode 100644 index 108d29aa1ba..00000000000 --- a/extern/bullet/continuous_vc8.sln +++ /dev/null @@ -1,155 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGLSupport", "Demos\OpenGL\OpenGL_vc8.vcproj", "{47328C1E-54A4-4065-B3DA-F88EE281D1E5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bullet3ContinuousCollision", "Bullet\Bullet3_vc8.vcproj", "{FFD3C64A-30E2-4BC7-BC8F-51818C320400}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimplexDemo", "Demos\SimplexDemo\SimplexDemo_vc8.vcproj", "{F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}" - ProjectSection(ProjectDependencies) = postProject - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CollisionDemo", "Demos\CollisionDemo\CollisionDemo_vc8.vcproj", "{F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}" - ProjectSection(ProjectDependencies) = postProject - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LinearConvexCastDemo", "Demos\GjkConvexCastDemo\GjkConvexCastDemo_vc8.vcproj", "{B395AFF6-94FE-4A2C-9E26-58E5BE85083C}" - ProjectSection(ProjectDependencies) = postProject - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ContinuousConvexCollisionDemo", "Demos\ContinuousConvexCollision\ContinuousConvexCollision_vc8.vcproj", "{6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}" - ProjectSection(ProjectDependencies) = postProject - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Raytracer", "Demos\Raytracer\Raytracer_vc8.vcproj", "{F8B0A298-14C9-4006-8D53-51032892BEDD}" - ProjectSection(ProjectDependencies) = postProject - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bullet3Dynamics", "BulletDynamics\BulletDynamics_vc8.vcproj", "{3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CcdPhysicsDemo", "Demos\CcdPhysicsDemo\CcdPhysicsDemo_vc8.vcproj", "{E9C93159-EC18-4121-9D73-1DE7053D81D7}" - ProjectSection(ProjectDependencies) = postProject - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} = {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} = {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} = {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CcdPhysics", "Extras\PhysicsInterface\CcdPhysics\CcdPhysics_vc8.vcproj", "{E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PhysicsInterfaceCommon", "Extras\PhysicsInterface\Common\PhysicsInterfaceCommon\PhysicsInterfaceCommon_vc8.vcproj", "{87D8C006-6DCC-4156-A03E-8CEA1B4C0580}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConvexHullDistance", "Demos\ConvexHullDistance\ConvexHullDistance_vc8.vcproj", "{39A0C0E0-773B-498D-B9B1-B54525FB6223}" - ProjectSection(ProjectDependencies) = postProject - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConcaveDemo", "Demos\ConcaveDemo\ConcaveDemo_vc8.vcproj", "{F20F38CC-CFA7-40C7-81AE-945C8C09E473}" - ProjectSection(ProjectDependencies) = postProject - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} = {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} = {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} = {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConstraintDemo", "Demos\ConstraintDemo\ConstraintDemo_vc8.vcproj", "{26C8AAF7-D504-4341-A882-7D082E9DED5F}" - ProjectSection(ProjectDependencies) = postProject - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} = {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} = {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} = {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EPAPenDepthDemo", "Demos\EPAPenDepthDemo\EPAPenDepthDemo_vc8.vcproj", "{965380C7-E747-41C1-91AC-E5D36ED50C09}" - ProjectSection(ProjectDependencies) = postProject - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} = {87D8C006-6DCC-4156-A03E-8CEA1B4C0580} - {47328C1E-54A4-4065-B3DA-F88EE281D1E5} = {47328C1E-54A4-4065-B3DA-F88EE281D1E5} - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} = {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE} - {FFD3C64A-30E2-4BC7-BC8F-51818C320400} = {FFD3C64A-30E2-4BC7-BC8F-51818C320400} - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} = {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {47328C1E-54A4-4065-B3DA-F88EE281D1E5}.Debug|Win32.ActiveCfg = Debug|Win32 - {47328C1E-54A4-4065-B3DA-F88EE281D1E5}.Debug|Win32.Build.0 = Debug|Win32 - {47328C1E-54A4-4065-B3DA-F88EE281D1E5}.Release|Win32.ActiveCfg = Release|Win32 - {47328C1E-54A4-4065-B3DA-F88EE281D1E5}.Release|Win32.Build.0 = Release|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Debug|Win32.ActiveCfg = Debug|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Debug|Win32.Build.0 = Debug|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Release|Win32.ActiveCfg = Release|Win32 - {FFD3C64A-30E2-4BC7-BC8F-51818C320400}.Release|Win32.Build.0 = Release|Win32 - {F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}.Debug|Win32.ActiveCfg = Debug|Win32 - {F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}.Debug|Win32.Build.0 = Debug|Win32 - {F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}.Release|Win32.ActiveCfg = Release|Win32 - {F6B9DD8D-8C40-4F2B-B492-56B167D01CC0}.Release|Win32.Build.0 = Release|Win32 - {F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}.Debug|Win32.ActiveCfg = Debug|Win32 - {F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}.Debug|Win32.Build.0 = Debug|Win32 - {F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}.Release|Win32.ActiveCfg = Release|Win32 - {F43EFC77-3CFA-4669-BAEA-1E2BC8ABA897}.Release|Win32.Build.0 = Release|Win32 - {B395AFF6-94FE-4A2C-9E26-58E5BE85083C}.Debug|Win32.ActiveCfg = Debug|Win32 - {B395AFF6-94FE-4A2C-9E26-58E5BE85083C}.Debug|Win32.Build.0 = Debug|Win32 - {B395AFF6-94FE-4A2C-9E26-58E5BE85083C}.Release|Win32.ActiveCfg = Release|Win32 - {B395AFF6-94FE-4A2C-9E26-58E5BE85083C}.Release|Win32.Build.0 = Release|Win32 - {6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}.Debug|Win32.ActiveCfg = Debug|Win32 - {6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}.Debug|Win32.Build.0 = Debug|Win32 - {6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}.Release|Win32.ActiveCfg = Release|Win32 - {6A4E3433-D0CD-4A10-BE09-78C9A5F7508B}.Release|Win32.Build.0 = Release|Win32 - {F8B0A298-14C9-4006-8D53-51032892BEDD}.Debug|Win32.ActiveCfg = Debug|Win32 - {F8B0A298-14C9-4006-8D53-51032892BEDD}.Debug|Win32.Build.0 = Debug|Win32 - {F8B0A298-14C9-4006-8D53-51032892BEDD}.Release|Win32.ActiveCfg = Release|Win32 - {F8B0A298-14C9-4006-8D53-51032892BEDD}.Release|Win32.Build.0 = Release|Win32 - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}.Debug|Win32.ActiveCfg = Debug|Win32 - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}.Debug|Win32.Build.0 = Debug|Win32 - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}.Release|Win32.ActiveCfg = Release|Win32 - {3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}.Release|Win32.Build.0 = Release|Win32 - {E9C93159-EC18-4121-9D73-1DE7053D81D7}.Debug|Win32.ActiveCfg = Debug|Win32 - {E9C93159-EC18-4121-9D73-1DE7053D81D7}.Debug|Win32.Build.0 = Debug|Win32 - {E9C93159-EC18-4121-9D73-1DE7053D81D7}.Release|Win32.ActiveCfg = Release|Win32 - {E9C93159-EC18-4121-9D73-1DE7053D81D7}.Release|Win32.Build.0 = Release|Win32 - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}.Debug|Win32.ActiveCfg = Debug|Win32 - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}.Debug|Win32.Build.0 = Debug|Win32 - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}.Release|Win32.ActiveCfg = Release|Win32 - {E3D57F36-36AC-4E9A-B0E0-2AE4510FCBFE}.Release|Win32.Build.0 = Release|Win32 - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580}.Debug|Win32.ActiveCfg = Debug|Win32 - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580}.Debug|Win32.Build.0 = Debug|Win32 - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580}.Release|Win32.ActiveCfg = Release|Win32 - {87D8C006-6DCC-4156-A03E-8CEA1B4C0580}.Release|Win32.Build.0 = Release|Win32 - {39A0C0E0-773B-498D-B9B1-B54525FB6223}.Debug|Win32.ActiveCfg = Debug|Win32 - {39A0C0E0-773B-498D-B9B1-B54525FB6223}.Debug|Win32.Build.0 = Debug|Win32 - {39A0C0E0-773B-498D-B9B1-B54525FB6223}.Release|Win32.ActiveCfg = Release|Win32 - {39A0C0E0-773B-498D-B9B1-B54525FB6223}.Release|Win32.Build.0 = Release|Win32 - {F20F38CC-CFA7-40C7-81AE-945C8C09E473}.Debug|Win32.ActiveCfg = Debug|Win32 - {F20F38CC-CFA7-40C7-81AE-945C8C09E473}.Debug|Win32.Build.0 = Debug|Win32 - {F20F38CC-CFA7-40C7-81AE-945C8C09E473}.Release|Win32.ActiveCfg = Release|Win32 - {F20F38CC-CFA7-40C7-81AE-945C8C09E473}.Release|Win32.Build.0 = Release|Win32 - {26C8AAF7-D504-4341-A882-7D082E9DED5F}.Debug|Win32.ActiveCfg = Debug|Win32 - {26C8AAF7-D504-4341-A882-7D082E9DED5F}.Debug|Win32.Build.0 = Debug|Win32 - {26C8AAF7-D504-4341-A882-7D082E9DED5F}.Release|Win32.ActiveCfg = Release|Win32 - {26C8AAF7-D504-4341-A882-7D082E9DED5F}.Release|Win32.Build.0 = Release|Win32 - {965380C7-E747-41C1-91AC-E5D36ED50C09}.Debug|Win32.ActiveCfg = Debug|Win32 - {965380C7-E747-41C1-91AC-E5D36ED50C09}.Debug|Win32.Build.0 = Debug|Win32 - {965380C7-E747-41C1-91AC-E5D36ED50C09}.Release|Win32.ActiveCfg = Release|Win32 - {965380C7-E747-41C1-91AC-E5D36ED50C09}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/extern/bullet/make/msvc_7_0/Bullet3_vc7.vcproj b/extern/bullet/make/msvc_7_0/Bullet3_vc7.vcproj deleted file mode 100644 index 67369fa4052..00000000000 --- a/extern/bullet/make/msvc_7_0/Bullet3_vc7.vcproj +++ /dev/null @@ -1,1533 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="Bullet3ContinuousCollision" - ProjectGUID="{FFD3C64A-30E2-4BC7-BC8F-51818C320400}" - SccProjectName="" - SccLocalPath=""> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Blender Debug|Win32" - OutputDirectory="..\..\..\..\..\build\msvc_7\extern\bullet\debug" - IntermediateDirectory="..\..\..\..\..\build\msvc_7\extern\bullet\debug" - ConfigurationType="4" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\LinearMath;..\..\Bullet" - PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="2" - PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\extern\bullet\debug\Bullet.pch" - AssemblerListingLocation="..\..\..\..\..\build\msvc_7\extern\bullet\debug\" - ObjectFile="..\..\..\..\..\build\msvc_7\extern\bullet\debug\" - ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\extern\bullet\debug\" - WarningLevel="3" - SuppressStartupBanner="TRUE" - DebugInformationFormat="4" - CompileAs="0"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\..\build\msvc_7\libs\extern\debug\Bullet.lib" - SuppressStartupBanner="TRUE"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="ECHO Copying header files -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch - -XCOPY /Y ..\..\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include -XCOPY /Y ..\..\Bullet\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision -XCOPY /Y ..\..\Bullet\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes -XCOPY /Y ..\..\Bullet\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision -XCOPY /Y ..\..\Bullet\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch - -ECHO Done -"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG" - Culture="1033"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Blender Release|Win32" - OutputDirectory="..\..\..\..\..\build\msvc_7\extern\bullet" - IntermediateDirectory="..\..\..\..\..\build\msvc_7\extern\bullet" - ConfigurationType="4" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - InlineFunctionExpansion="1" - AdditionalIncludeDirectories="..\..\LinearMath;..\..\Bullet" - PreprocessorDefinitions="NDEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC" - StringPooling="TRUE" - RuntimeLibrary="0" - EnableFunctionLevelLinking="TRUE" - UsePrecompiledHeader="2" - PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\extern\bullet\Bullet.pch" - AssemblerListingLocation="..\..\..\..\..\build\msvc_7\extern\bullet\" - ObjectFile="..\..\..\..\..\build\msvc_7\extern\bullet\" - ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\extern\bullet\" - WarningLevel="3" - SuppressStartupBanner="TRUE" - DebugInformationFormat="2" - CompileAs="0"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\..\build\msvc_7\libs\extern\Bullet.lib" - SuppressStartupBanner="TRUE"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="ECHO Copying header files -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch - -XCOPY /Y ..\..\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include -XCOPY /Y ..\..\Bullet\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision -XCOPY /Y ..\..\Bullet\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes -XCOPY /Y ..\..\Bullet\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision -XCOPY /Y ..\..\Bullet\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch - -ECHO Done -"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG" - Culture="1033"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="3D Plugin Debug|Win32" - OutputDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug" - IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug" - ConfigurationType="4" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\LinearMath;..\..\Bullet" - PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="2" - PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug\Bullet.pch" - AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug\" - ObjectFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug\" - ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\debug\" - WarningLevel="3" - SuppressStartupBanner="TRUE" - DebugInformationFormat="4" - CompileAs="0"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\..\..\build\msvc_7\libs\extern\mtdll\debug\Bullet.lib" - SuppressStartupBanner="TRUE"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="ECHO Copying header files -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch - -XCOPY /Y ..\..\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include -XCOPY /Y ..\..\Bullet\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision -XCOPY /Y ..\..\Bullet\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes -XCOPY /Y ..\..\Bullet\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision -XCOPY /Y ..\..\Bullet\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch - -ECHO Done -"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG" - Culture="1033"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="3D Plugin Release|Win32" - OutputDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll" - IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll" - ConfigurationType="4" - UseOfMFC="0" - ATLMinimizesCRunTimeLibraryUsage="FALSE" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - InlineFunctionExpansion="1" - AdditionalIncludeDirectories="..\..\LinearMath;..\..\Bullet" - PreprocessorDefinitions="NDEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC" - StringPooling="TRUE" - RuntimeLibrary="2" - EnableFunctionLevelLinking="TRUE" - UsePrecompiledHeader="2" - PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\Bullet.pch" - AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\" - ObjectFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\" - ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\extern\bullet\mtdll\" - WarningLevel="3" - SuppressStartupBanner="TRUE" - DebugInformationFormat="2" - CompileAs="0"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\..\..\build\msvc_7\libs\extern\mtdll\Bullet.lib" - SuppressStartupBanner="TRUE"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="ECHO Copying header files -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision -IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch - -XCOPY /Y ..\..\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include -XCOPY /Y ..\..\Bullet\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BroadphaseCollision -XCOPY /Y ..\..\Bullet\CollisionShapes\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionShapes -XCOPY /Y ..\..\Bullet\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\NarrowPhaseCollision -XCOPY /Y ..\..\Bullet\CollisionDispatch\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch - -ECHO Done -"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG" - Culture="1033"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="NarrowPhaseCollision" - Filter=""> - <Filter - Name="Source Files" - Filter=""> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_Collidable.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_CollisionPair.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_EdgeEdge.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_Screwing.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_VertexPoly.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\ContinuousConvexCollision.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\ConvexCast.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\GjkConvexCast.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\GjkPairDetector.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\PersistentManifold.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\RaycastCallback.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\SubSimplexConvexCast.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\VoronoiSimplexSolver.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - </Filter> - <Filter - Name="Header Files" - Filter=""> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_AlgebraicPolynomialSolver.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_Collidable.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_CollisionPair.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_EdgeEdge.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_MotionStateInterface.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_PolynomialSolverInterface.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_Screwing.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_StaticMotionState.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\BU_VertexPoly.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\CollisionMargin.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\ContinuousConvexCollision.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\ConvexCast.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\ConvexPenetrationDepthSolver.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\DiscreteCollisionDetectorInterface.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\GjkConvexCast.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\GjkPairDetector.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\ManifoldPoint.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\MinkowskiPenetrationDepthSolver.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\PersistentManifold.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\PointCollector.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\RaycastCallback.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\SimplexSolverInterface.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\SubSimplexConvexCast.h"> - </File> - <File - RelativePath="..\..\Bullet\NarrowPhaseCollision\VoronoiSimplexSolver.h"> - </File> - </Filter> - </Filter> - <Filter - Name="CollisionShapes" - Filter=""> - <Filter - Name="Source Files" - Filter=""> - <File - RelativePath="..\..\Bullet\CollisionShapes\BoxShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\BvhTriangleMeshShape.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\CollisionShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\CompoundShape.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConcaveShape.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConeShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConvexHullShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConvexShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConvexTriangleMeshShape.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\CylinderShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\EmptyShape.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\MinkowskiSumShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\MultiSphereShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\OptimizedBvh.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\PolyhedralConvexShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\Simplex1to4Shape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\SphereShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\StaticPlaneShape.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\StridingMeshInterface.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleCallback.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleIndexVertexArray.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleMesh.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleMeshShape.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - </Filter> - <Filter - Name="Header Files" - Filter=""> - <File - RelativePath="..\..\Bullet\CollisionShapes\BoxShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\BvhTriangleMeshShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\CollisionMargin.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\CollisionShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\CompoundShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConcaveShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConeShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConvexHullShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConvexShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\ConvexTriangleMeshShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\CylinderShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\EmptyShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\MinkowskiSumShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\MultiSphereShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\OptimizedBvh.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\PolyhedralConvexShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\Simplex1to4Shape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\SphereShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\StaticPlaneShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\StridingMeshInterface.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleCallback.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleIndexVertexArray.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleMesh.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleMeshShape.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionShapes\TriangleShape.h"> - </File> - </Filter> - </Filter> - <Filter - Name="BroadphaseCollision" - Filter=""> - <Filter - Name="Source Files" - Filter=""> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\AxisSweep3.cpp"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\BroadphaseProxy.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\CollisionAlgorithm.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\Dispatcher.cpp"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\OverlappingPairCache.cpp"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\SimpleBroadphase.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - </Filter> - <Filter - Name="Header Files" - Filter=""> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\AxisSweep3.h"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\BroadphaseInterface.h"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\BroadphaseProxy.h"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\CollisionAlgorithm.h"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\Dispatcher.h"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\OverlappingPairCache.h"> - </File> - <File - RelativePath="..\..\Bullet\BroadphaseCollision\SimpleBroadphase.h"> - </File> - </Filter> - </Filter> - <Filter - Name="LinearAlgebra" - Filter=""> - <Filter - Name="Header Files" - Filter=""> - <File - RelativePath="..\..\LinearMath\AabbUtil2.h"> - </File> - <File - RelativePath="..\..\LinearMath\GEN_List.h"> - </File> - <File - RelativePath="..\..\LinearMath\GEN_MinMax.h"> - </File> - <File - RelativePath="..\..\LinearMath\GEN_random.h"> - </File> - <File - RelativePath="..\..\LinearMath\quickprof.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdMatrix3x3.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdMinMax.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdPoint3.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdQuadWord.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdQuaternion.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdScalar.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdTransform.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdTransformUtil.h"> - </File> - <File - RelativePath="..\..\LinearMath\SimdVector3.h"> - </File> - </Filter> - </Filter> - <Filter - Name="CollisionDispatch" - Filter=""> - <Filter - Name="Source Files" - Filter=""> - <File - RelativePath="..\..\Bullet\CollisionDispatch\CollisionDispatcher.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\CollisionObject.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\CollisionWorld.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\CompoundCollisionAlgorithm.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\ConvexConcaveCollisionAlgorithm.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\ConvexConvexAlgorithm.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\EmptyCollisionAlgorithm.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\ManifoldResult.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\SimulationIslandManager.cpp"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\UnionFind.cpp"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter=""> - <File - RelativePath="..\..\Bullet\CollisionDispatch\CollisionDispatcher.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\CollisionObject.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\CollisionWorld.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\ConvexConcaveCollisionAlgorithm.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\ConvexConvexAlgorithm.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\EmptyCollisionAlgorithm.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\ManifoldResult.h"> - </File> - <File - RelativePath="..\..\Bullet\CollisionDispatch\UnionFind.h"> - </File> - </Filter> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/extern/bullet/make/msvc_7_0/Dynamics/BulletDynamics_vc7.vcproj b/extern/bullet/make/msvc_7_0/Dynamics/BulletDynamics_vc7.vcproj deleted file mode 100644 index 7f20dc3fa20..00000000000 --- a/extern/bullet/make/msvc_7_0/Dynamics/BulletDynamics_vc7.vcproj +++ /dev/null @@ -1,522 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="Bullet3Dynamics" - ProjectGUID="{3427A9EF-FF84-4B3E-9AE5-C37CF44D7DA4}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Blender Debug|Win32" - OutputDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\debug" - IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\debug" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\..\LinearMath;..\..\..\Bullet;..\..\..\BulletDynamics" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="2" - PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\debug\$(TargetName).pch" - AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\debug\" - ObjectFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\debug\" - ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\debug\" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\..\..\build\msvc_7\libs\extern\debug\BulletDynamics.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="ECHO Copying header files -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle - -XCOPY /Y ..\..\..\LinearMath\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include -XCOPY /Y ..\..\..\BulletDynamics\CollisionDispatch\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch -XCOPY /Y ..\..\..\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver -XCOPY /Y ..\..\..\BulletDynamics\Dynamics\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics -XCOPY /Y ..\..\..\BulletDynamics\Vehicle\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle - -ECHO Done -"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Blender Release|Win32" - OutputDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics" - IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\LinearMath;..\..\..\Bullet;..\..\..\BulletDynamics" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB" - RuntimeLibrary="0" - UsePrecompiledHeader="2" - PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\BulletDynamics.pch" - AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\" - ObjectFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\" - ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\..\..\build\msvc_7\libs\extern\BulletDynamics.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="ECHO Copying header files -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle - -XCOPY /Y ..\..\..\LinearMath\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include -XCOPY /Y ..\..\..\BulletDynamics\CollisionDispatch\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch -XCOPY /Y ..\..\..\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver -XCOPY /Y ..\..\..\BulletDynamics\Vehicle\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle -XCOPY /Y ..\..\..\BulletDynamics\Dynamics\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics - -ECHO Done -"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="3D Plugin Debug|Win32" - OutputDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\debug" - IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\debug" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\..\LinearMath;..\..\..\Bullet;..\..\..\BulletDynamics" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="2" - PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\debug\$(TargetName).pch" - AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\debug\" - ObjectFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\debug\" - ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\debug\" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\..\..\build\msvc_7\libs\extern\mtdll\debug\BulletDynamics.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="ECHO Copying header files -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle - -XCOPY /Y ..\..\..\LinearMath\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include -XCOPY /Y ..\..\..\BulletDynamics\CollisionDispatch\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch -XCOPY /Y ..\..\..\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver -XCOPY /Y ..\..\..\BulletDynamics\Dynamics\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics -XCOPY /Y ..\..\..\BulletDynamics\Vehicle\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle - -ECHO Done -"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="3D Plugin Release|Win32" - OutputDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll" - IntermediateDirectory="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll" - ConfigurationType="4" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\LinearMath;..\..\..\Bullet;..\..\..\BulletDynamics" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB" - RuntimeLibrary="2" - UsePrecompiledHeader="2" - PrecompiledHeaderFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\$(TargetName).pch" - AssemblerListingLocation="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\" - ObjectFile="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\" - ProgramDataBaseFileName="..\..\..\..\..\..\build\msvc_7\extern\bullet\dynamics\mtdll\" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\..\..\..\build\msvc_7\libs\extern\mtdll\BulletDynamics.lib"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="ECHO Copying header files -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics -IF NOT EXIST ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle MKDIR ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle - -XCOPY /Y ..\..\..\LinearMath\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include -XCOPY /Y ..\..\..\BulletDynamics\CollisionDispatch\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\CollisionDispatch -XCOPY /Y ..\..\..\BulletDynamics\ConstraintSolver\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\ConstraintSolver -XCOPY /Y ..\..\..\BulletDynamics\Dynamics\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Dynamics -XCOPY /Y ..\..\..\BulletDynamics\Vehicle\*.h ..\..\..\..\..\..\build\msvc_7\extern\bullet\include\Vehicle - -ECHO Done -"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="ConstraintSolver" - Filter=""> - <Filter - Name="Source Files" - Filter=""> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\ContactConstraint.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\Generic6DofConstraint.cpp"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\HingeConstraint.cpp"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\Point2PointConstraint.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\SequentialImpulseConstraintSolver.cpp"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\Solve2LinearConstraint.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\TypedConstraint.cpp"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter=""> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\ConstraintSolver.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\ContactConstraint.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\ContactSolverInfo.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\Generic6DofConstraint.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\JacobianEntry.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\Point2PointConstraint.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\SequentialImpulseConstraintSolver.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\Solve2LinearConstraint.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\ConstraintSolver\TypedConstraint.h"> - </File> - </Filter> - </Filter> - <Filter - Name="Dynamics" - Filter=""> - <Filter - Name="Source Files" - Filter=""> - <File - RelativePath="..\..\..\BulletDynamics\Dynamics\BU_Joint.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\..\BulletDynamics\Dynamics\ContactJoint.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\..\BulletDynamics\Dynamics\RigidBody.cpp"> - <FileConfiguration - Name="Blender Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="Blender Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - <FileConfiguration - Name="3D Plugin Release|Win32"> - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj"/> - </FileConfiguration> - </File> - </Filter> - <Filter - Name="Header Files" - Filter=""> - <File - RelativePath="..\..\..\BulletDynamics\Dynamics\BU_Joint.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\Dynamics\ContactJoint.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\Dynamics\MassProps.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\Dynamics\RigidBody.h"> - </File> - </Filter> - </Filter> - <Filter - Name="Vehicle" - Filter=""> - <Filter - Name="Source Files" - Filter=""> - <File - RelativePath="..\..\..\BulletDynamics\Vehicle\RaycastVehicle.cpp"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\Vehicle\WheelInfo.cpp"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter=""> - <File - RelativePath="..\..\..\BulletDynamics\Vehicle\RaycastVehicle.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\Vehicle\VehicleRaycaster.h"> - </File> - <File - RelativePath="..\..\..\BulletDynamics\Vehicle\WheelInfo.h"> - </File> - </Filter> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 20498167021..83b2a11e606 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -202,10 +202,10 @@ static struct Scene *GetSceneForName2(struct Main *maggie, const STR_String& sce #ifdef USE_BULLET -#include "IDebugDraw.h" +#include "LinearMath/btIDebugDraw.h" -struct BlenderDebugDraw : public IDebugDraw +struct BlenderDebugDraw : public btIDebugDraw { BlenderDebugDraw () : m_debugMode(0) @@ -214,7 +214,7 @@ struct BlenderDebugDraw : public IDebugDraw int m_debugMode; - virtual void DrawLine(const SimdVector3& from,const SimdVector3& to,const SimdVector3& color) + virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color) { if (m_debugMode >0) { @@ -226,16 +226,16 @@ struct BlenderDebugDraw : public IDebugDraw } } - virtual void DrawContactPoint(const SimdVector3& PointOnB,const SimdVector3& normalOnB,float distance,int lifeTime,const SimdVector3& color) + virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color) { //not yet } - virtual void SetDebugMode(int debugMode) + virtual void setDebugMode(int debugMode) { m_debugMode = debugMode; } - virtual int GetDebugMode() const + virtual int getDebugMode() const { return m_debugMode; } diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp index 54f8060c582..d28a8f40d6f 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp @@ -5,8 +5,7 @@ #include "KX_BulletPhysicsController.h" -#include "Dynamics/RigidBody.h" - +#include "btBulletDynamicsCommon.h" #include "SG_Spatial.h" #include "KX_GameObject.h" @@ -59,7 +58,7 @@ void KX_BulletPhysicsController::SetObject (SG_IObject* object) } -void KX_BulletPhysicsController::SetMargin (float collisionMargin) +void KX_BulletPhysicsController::setMargin (float collisionMargin) { CcdPhysicsController::SetMargin(collisionMargin); } @@ -144,12 +143,12 @@ void KX_BulletPhysicsController::setRigidBody(bool rigid) void KX_BulletPhysicsController::SuspendDynamics() { - GetRigidBody()->SetActivationState(DISABLE_SIMULATION); + GetRigidBody()->setActivationState(DISABLE_SIMULATION); } void KX_BulletPhysicsController::RestoreDynamics() { - GetRigidBody()->ForceActivationState(ACTIVE_TAG); + GetRigidBody()->forceActivationState(ACTIVE_TAG); } SG_Controller* KX_BulletPhysicsController::GetReplica(class SG_Node* destnode) diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h index 272868459d0..619ac42503f 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h @@ -19,7 +19,7 @@ public: virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse); virtual void SetObject (SG_IObject* object); - virtual void SetMargin (float collisionMargin); + virtual void setMargin (float collisionMargin); virtual void RelativeTranslate(const MT_Vector3& dloc,bool local); virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local); virtual void ApplyTorque(const MT_Vector3& torque,bool local); diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index e08e5e7cbf1..d637df95756 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -662,19 +662,10 @@ void KX_ConvertODEEngineObject(KX_GameObject* gameobj, #include "CcdPhysicsEnvironment.h" #include "CcdPhysicsController.h" -#include "BroadphaseCollision/BroadphaseInterface.h" +#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" #include "KX_BulletPhysicsController.h" -#include "CollisionShapes/BoxShape.h" -#include "CollisionShapes/SphereShape.h" -#include "CollisionShapes/ConeShape.h" -#include "CollisionShapes/ConvexShape.h" -#include "CollisionShapes/CylinderShape.h" -#include "CollisionShapes/MultiSphereShape.h" -#include "CollisionShapes/ConvexHullShape.h" -#include "CollisionShapes/TriangleMesh.h" -#include "CollisionShapes/TriangleMeshShape.h" -#include "CollisionShapes/BvhTriangleMeshShape.h" +#include "btBulletDynamicsCommon.h" #ifdef WIN32 #if _MSC_VER >= 1310 @@ -691,26 +682,26 @@ void KX_ConvertODEEngineObject(KX_GameObject* gameobj, #endif //WIN32 -static GEN_Map<GEN_HashedPtr,CollisionShape*> map_gamemesh_to_bulletshape; +static GEN_Map<GEN_HashedPtr,btCollisionShape*> map_gamemesh_to_bulletshape; // forward declarations -static CollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool polytope) +static btCollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool polytope) { if (!meshobj) return 0; - CollisionShape* collisionMeshShape = 0; - ConvexHullShape* convexHullShape = 0; - TriangleMeshShape* concaveShape = 0; + btCollisionShape* collisionMeshShape = 0; + btConvexHullShape* convexHullShape = 0; + btTriangleMeshShape* concaveShape = 0; - TriangleMesh* collisionMeshData = 0; + btTriangleMesh* collisionMeshData = 0; //see if there is any polygons, if not, bail out. int numPoints = 0; - SimdVector3* points = 0; + btVector3* points = 0; - CollisionShape** shapeptr = map_gamemesh_to_bulletshape[GEN_HashedPtr(meshobj)]; + btCollisionShape** shapeptr = map_gamemesh_to_bulletshape[GEN_HashedPtr(meshobj)]; // Mesh has already been converted: reuse if (shapeptr) @@ -780,12 +771,12 @@ static CollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool p if (polytope) { - convexHullShape = new ConvexHullShape(points,numPoints); + convexHullShape = new btConvexHullShape(&points[0].getX(),numPoints); collisionMeshShape = convexHullShape; } else { - collisionMeshData = new TriangleMesh(); -// concaveShape = new TriangleMeshShape(collisionMeshData); + collisionMeshData = new btTriangleMesh(); +// concaveShape = new btTriangleMeshShape(collisionMeshData); //collisionMeshShape = concaveShape; } @@ -808,8 +799,8 @@ static CollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool p const float* vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, poly->GetVertexIndexBase().m_indexarray[i], poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ(); - SimdPoint3 point(vtx[0],vtx[1],vtx[2]); - convexHullShape->AddPoint(point); + btPoint3 point(vtx[0],vtx[1],vtx[2]); + convexHullShape->addPoint(point); } if (poly->VertexCount()) numvalidpolys++; @@ -820,16 +811,16 @@ static CollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool p const float* vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, poly->GetVertexIndexBase().m_indexarray[2], poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ(); - SimdPoint3 vertex0(vtx[0],vtx[1],vtx[2]); + btPoint3 vertex0(vtx[0],vtx[1],vtx[2]); vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, poly->GetVertexIndexBase().m_indexarray[1], poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ(); - SimdPoint3 vertex1(vtx[0],vtx[1],vtx[2]); + btPoint3 vertex1(vtx[0],vtx[1],vtx[2]); vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, poly->GetVertexIndexBase().m_indexarray[0], poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ(); - SimdPoint3 vertex2(vtx[0],vtx[1],vtx[2]); - collisionMeshData->AddTriangle(vertex0,vertex1,vertex2); + btPoint3 vertex2(vtx[0],vtx[1],vtx[2]); + collisionMeshData->addTriangle(vertex0,vertex1,vertex2); numvalidpolys++; } if (poly->VertexCount() == 4) @@ -837,16 +828,16 @@ static CollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool p const float* vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, poly->GetVertexIndexBase().m_indexarray[3], poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ(); - SimdPoint3 vertex0(vtx[0],vtx[1],vtx[2]); + btPoint3 vertex0(vtx[0],vtx[1],vtx[2]); vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, poly->GetVertexIndexBase().m_indexarray[2], poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ(); - SimdPoint3 vertex1(vtx[0],vtx[1],vtx[2]); + btPoint3 vertex1(vtx[0],vtx[1],vtx[2]); vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, poly->GetVertexIndexBase().m_indexarray[0], poly->GetMaterial()->GetPolyMaterial())->getLocalXYZ(); - SimdPoint3 vertex2(vtx[0],vtx[1],vtx[2]); - collisionMeshData->AddTriangle(vertex0,vertex1,vertex2); + btPoint3 vertex2(vtx[0],vtx[1],vtx[2]); + collisionMeshData->addTriangle(vertex0,vertex1,vertex2); numvalidpolys++; } @@ -862,10 +853,10 @@ static CollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool p //map_gamemesh_to_bulletshape.insert(GEN_HashedPtr(meshobj),collisionMeshShape); if (!polytope) { - concaveShape = new BvhTriangleMeshShape( collisionMeshData ); - //concaveShape = new TriangleMeshShape( collisionMeshData ); + concaveShape = new btBvhTriangleMeshShape( collisionMeshData ); + //concaveShape = new btTriangleMeshShape( collisionMeshData ); - concaveShape->RecalcLocalAabb(); + concaveShape->recalcLocalAabb(); collisionMeshShape = concaveShape; } @@ -901,34 +892,34 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, if (objprop->m_ghost) { - ci.m_collisionFlags |= CollisionObject::noContactResponse; + ci.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE; } if (!objprop->m_dyna) { - ci.m_collisionFlags |= CollisionObject::isStatic; + ci.m_collisionFlags |= btCollisionObject::CF_STATIC_OBJECT; } ci.m_MotionState = motionstate; - ci.m_gravity = SimdVector3(0,0,0); - ci.m_localInertiaTensor =SimdVector3(0,0,0); + ci.m_gravity = btVector3(0,0,0); + ci.m_localInertiaTensor =btVector3(0,0,0); ci.m_mass = objprop->m_dyna ? shapeprops->m_mass : 0.f; isbulletdyna = objprop->m_dyna; - ci.m_localInertiaTensor = SimdVector3(ci.m_mass/3.f,ci.m_mass/3.f,ci.m_mass/3.f); + ci.m_localInertiaTensor = btVector3(ci.m_mass/3.f,ci.m_mass/3.f,ci.m_mass/3.f); - SimdTransform trans; + btTransform trans; trans.setIdentity(); - CollisionShape* bm = 0; + btCollisionShape* bm = 0; switch (objprop->m_boundclass) { case KX_BOUNDSPHERE: { float radius = objprop->m_radius; - SimdVector3 inertiaHalfExtents ( + btVector3 inertiaHalfExtents ( radius, radius, radius); @@ -936,8 +927,8 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, //blender doesn't support multisphere, but for testing: //bm = new MultiSphereShape(inertiaHalfExtents,,&trans.getOrigin(),&radius,1); - bm = new SphereShape(objprop->m_radius); - bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); + bm = new btSphereShape(objprop->m_radius); + bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); break; }; case KX_BOUNDBOX: @@ -949,41 +940,41 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, halfExtents /= 2.f; - //SimdVector3 he (halfExtents[0]-CONVEX_DISTANCE_MARGIN ,halfExtents[1]-CONVEX_DISTANCE_MARGIN ,halfExtents[2]-CONVEX_DISTANCE_MARGIN ); + //btVector3 he (halfExtents[0]-CONVEX_DISTANCE_MARGIN ,halfExtents[1]-CONVEX_DISTANCE_MARGIN ,halfExtents[2]-CONVEX_DISTANCE_MARGIN ); //he = he.absolute(); - SimdVector3 he (halfExtents[0],halfExtents[1],halfExtents[2]); + btVector3 he (halfExtents[0],halfExtents[1],halfExtents[2]); he = he.absolute(); - bm = new BoxShape(he); - bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); + bm = new btBoxShape(he); + bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); break; }; case KX_BOUNDCYLINDER: { - SimdVector3 halfExtents ( + btVector3 halfExtents ( objprop->m_boundobject.c.m_radius, objprop->m_boundobject.c.m_radius, objprop->m_boundobject.c.m_height * 0.5f ); - bm = new CylinderShapeZ(halfExtents); - bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); + bm = new btCylinderShapeZ(halfExtents); + bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); break; } case KX_BOUNDCONE: { - SimdVector3 halfExtents (objprop->m_boundobject.box.m_extends[0], + btVector3 halfExtents (objprop->m_boundobject.box.m_extends[0], objprop->m_boundobject.box.m_extends[1], objprop->m_boundobject.box.m_extends[2]); halfExtents /= 2.f; - bm = new ConeShape(objprop->m_boundobject.c.m_radius,objprop->m_boundobject.c.m_height); - bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); + bm = new btConeShape(objprop->m_boundobject.c.m_radius,objprop->m_boundobject.c.m_height); + bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); break; } @@ -992,7 +983,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, bm = CreateBulletShapeFromMesh(meshobj,true); if (bm) { - bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); + bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); } break; } @@ -1003,7 +994,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, bm = CreateBulletShapeFromMesh(meshobj,false); ci.m_localInertiaTensor.setValue(0.f,0.f,0.f); //no moving concave meshes, so don't bother calculating inertia - //bm->CalculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); + //bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); } break; @@ -1034,7 +1025,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, if (!bm) return; - bm->SetMargin(0.06); + bm->setMargin(0.06); #ifdef TEST_SIMD_HULL if (bm->IsPolyhedral()) @@ -1048,7 +1039,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, //first 4 points should not be co-planar, so add central point to satisfy MakeHull points[0] = Point3(0.f,0.f,0.f); - SimdVector3 vertex; + btVector3 vertex; for (int p=0;p<numPoints;p++) { polyhedron->GetVertex(p,vertex); @@ -1089,14 +1080,14 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, physicscontroller->setNewClientInfo(gameobj->getClientInfo()); if (objprop->m_disableSleeping) - physicscontroller->GetRigidBody()->SetActivationState(DISABLE_DEACTIVATION); + physicscontroller->GetRigidBody()->setActivationState(DISABLE_DEACTIVATION); if (objprop->m_dyna && !objprop->m_angular_rigidbody) { /* //setting the inertia could achieve similar results to constraint the up //but it is prone to instability, so use special 'Angular' constraint - SimdVector3 inertia = physicscontroller->GetRigidBody()->getInvInertiaDiagLocal(); + btVector3 inertia = physicscontroller->GetRigidBody()->getInvInertiaDiagLocal(); inertia.setX(0.f); inertia.setZ(0.f); @@ -1137,7 +1128,7 @@ void KX_ClearBulletSharedShapes() { int numshapes = map_gamemesh_to_bulletshape.size(); int i; - CollisionShape*shape=0; + btCollisionShape*shape=0; for (i=0;i<numshapes ;i++) { shape = *map_gamemesh_to_bulletshape.at(i); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 6e53cb4d25f..dfd9af1a93f 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -992,7 +992,7 @@ PyObject* KX_GameObject::PySetCollisionMargin(PyObject* self, { if (m_pPhysicsController1) { - m_pPhysicsController1->SetMargin(collisionMargin); + m_pPhysicsController1->setMargin(collisionMargin); Py_Return; } diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.h b/source/gameengine/Ketsji/KX_IPhysicsController.h index 9a64be7f99c..faf32bccbcd 100644 --- a/source/gameengine/Ketsji/KX_IPhysicsController.h +++ b/source/gameengine/Ketsji/KX_IPhysicsController.h @@ -60,7 +60,7 @@ public: virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse)=0; virtual void SetObject (SG_IObject* object)=0; - virtual void SetMargin (float collisionMargin)=0; + virtual void setMargin (float collisionMargin)=0; virtual void RelativeTranslate(const MT_Vector3& dloc,bool local)=0; virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local)=0; diff --git a/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp b/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp index d042a302eda..6ea5461dbaa 100644 --- a/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp @@ -164,7 +164,7 @@ gameobj->SetPhysicsController(this,gameobj->IsDynamic()); GetSumoObject()->setClientObject(gameobj->getClientInfo()); } -void KX_SumoPhysicsController::SetMargin(float collisionMargin) +void KX_SumoPhysicsController::setMargin(float collisionMargin) { SumoPhysicsController::SetMargin(collisionMargin); } diff --git a/source/gameengine/Ketsji/KX_SumoPhysicsController.h b/source/gameengine/Ketsji/KX_SumoPhysicsController.h index ea803d964c8..d214091a8c6 100644 --- a/source/gameengine/Ketsji/KX_SumoPhysicsController.h +++ b/source/gameengine/Ketsji/KX_SumoPhysicsController.h @@ -64,7 +64,7 @@ public: void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse); virtual void SetObject (SG_IObject* object); - virtual void SetMargin (float collisionMargin); + virtual void setMargin (float collisionMargin); void RelativeTranslate(const MT_Vector3& dloc,bool local); void RelativeRotate(const MT_Matrix3x3& drot,bool local); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 83bddc8ee1e..e542c336559 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -14,32 +14,28 @@ subject to the following restrictions: */ #include "CcdPhysicsController.h" +#include "btBulletDynamicsCommon.h" -#include "Dynamics/RigidBody.h" #include "PHY_IMotionState.h" -#include "BroadphaseCollision/BroadphaseProxy.h" -#include "BroadphaseCollision/BroadphaseInterface.h" -#include "CollisionShapes/ConvexShape.h" #include "CcdPhysicsEnvironment.h" -#include "SimdTransformUtil.h" -#include "CollisionShapes/SphereShape.h" -#include "CollisionShapes/ConeShape.h" class BP_Proxy; -///todo: fill all the empty CcdPhysicsController methods, hook them up to the RigidBody class +///todo: fill all the empty CcdPhysicsController methods, hook them up to the btRigidBody class //'temporarily' global variables -float gDeactivationTime = 2.f; -bool gDisableDeactivation = false; +//float gDeactivationTime = 2.f; +//bool gDisableDeactivation = false; +extern float gDeactivationTime; +extern bool gDisableDeactivation; + float gLinearSleepingTreshold = 0.8f; float gAngularSleepingTreshold = 1.0f; -#include "Dynamics/MassProps.h" -SimdVector3 startVel(0,0,0);//-10000); +btVector3 startVel(0,0,0);//-10000); CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci) :m_cci(ci) { @@ -47,7 +43,7 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci) m_newClientInfo = 0; m_MotionState = ci.m_MotionState; - + m_bulletMotionState = 0; CreateRigidbody(); @@ -61,51 +57,85 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci) } -SimdTransform CcdPhysicsController::GetTransformFromMotionState(PHY_IMotionState* motionState) +btTransform CcdPhysicsController::GetTransformFromMotionState(PHY_IMotionState* motionState) { - SimdTransform trans; + btTransform trans; float tmp[3]; motionState->getWorldPosition(tmp[0],tmp[1],tmp[2]); - trans.setOrigin(SimdVector3(tmp[0],tmp[1],tmp[2])); + trans.setOrigin(btVector3(tmp[0],tmp[1],tmp[2])); - SimdQuaternion orn; + btQuaternion orn; motionState->getWorldOrientation(orn[0],orn[1],orn[2],orn[3]); trans.setRotation(orn); return trans; } +class BlenderBulletMotionState : public btMotionState +{ + PHY_IMotionState* m_blenderMotionState; + +public: + + BlenderBulletMotionState(PHY_IMotionState* bms) + :m_blenderMotionState(bms) + { + + } + + virtual void getWorldTransform(btTransform& worldTrans ) const + { + float pos[3]; + float quatOrn[4]; + + m_blenderMotionState->getWorldPosition(pos[0],pos[1],pos[2]); + m_blenderMotionState->getWorldOrientation(quatOrn[0],quatOrn[1],quatOrn[2],quatOrn[3]); + worldTrans.setOrigin(btVector3(pos[0],pos[1],pos[2])); + worldTrans.setBasis(btMatrix3x3(btQuaternion(quatOrn[0],quatOrn[1],quatOrn[2],quatOrn[3]))); + } + + virtual void setWorldTransform(const btTransform& worldTrans) + { + m_blenderMotionState->setWorldPosition(worldTrans.getOrigin().getX(),worldTrans.getOrigin().getY(),worldTrans.getOrigin().getZ()); + btQuaternion rotQuat = worldTrans.getRotation(); + m_blenderMotionState->setWorldOrientation(rotQuat[0],rotQuat[1],rotQuat[2],rotQuat[3]); + + } + +}; + void CcdPhysicsController::CreateRigidbody() { - SimdTransform trans = GetTransformFromMotionState(m_cci.m_MotionState); + btTransform trans = GetTransformFromMotionState(m_cci.m_MotionState); - MassProps mp(m_cci.m_mass, m_cci.m_localInertiaTensor); + m_bulletMotionState = new BlenderBulletMotionState(m_cci.m_MotionState); - m_body = new RigidBody(mp,0,0,m_cci.m_friction,m_cci.m_restitution); - m_body->m_collisionShape = m_cci.m_collisionShape; + m_body = new btRigidBody(m_cci.m_mass,m_bulletMotionState,m_cci.m_collisionShape,m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor,m_cci.m_friction,m_cci.m_restitution); // // init the rigidbody properly // - m_body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); //setMassProps this also sets collisionFlags - m_body->m_collisionFlags = m_cci.m_collisionFlags; + //convert collision flags! +// m_body->m_collisionFlags = m_cci.m_collisionFlags; m_body->setGravity( m_cci.m_gravity); m_body->setDamping(m_cci.m_linearDamping, m_cci.m_angularDamping); - m_body->setCenterOfMassTransform( trans ); - } CcdPhysicsController::~CcdPhysicsController() { //will be reference counted, due to sharing - m_cci.m_physicsEnv->removeCcdPhysicsController(this); + if (m_cci.m_physicsEnv) + m_cci.m_physicsEnv->removeCcdPhysicsController(this); + delete m_MotionState; + if (m_bulletMotionState) + delete m_bulletMotionState; delete m_body; } @@ -116,29 +146,29 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time) { //sync non-static to motionstate, and static from motionstate (todo: add kinematic etc.) - if (!m_body->IsStatic()) + if (!m_body->isStaticObject()) { - const SimdVector3& worldPos = m_body->getCenterOfMassPosition(); + const btVector3& worldPos = m_body->getCenterOfMassPosition(); m_MotionState->setWorldPosition(worldPos[0],worldPos[1],worldPos[2]); - const SimdQuaternion& worldquat = m_body->getOrientation(); + const btQuaternion& worldquat = m_body->getOrientation(); m_MotionState->setWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]); m_MotionState->calculateWorldTransformations(); float scale[3]; m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]); - SimdVector3 scaling(scale[0],scale[1],scale[2]); + btVector3 scaling(scale[0],scale[1],scale[2]); GetCollisionShape()->setLocalScaling(scaling); } else { - SimdVector3 worldPos; - SimdQuaternion worldquat; + btVector3 worldPos; + btQuaternion worldquat; m_MotionState->getWorldPosition(worldPos[0],worldPos[1],worldPos[2]); m_MotionState->getWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]); - SimdTransform oldTrans = m_body->getCenterOfMassTransform(); - SimdTransform newTrans(worldquat,worldPos); + btTransform oldTrans = m_body->getCenterOfMassTransform(); + btTransform newTrans(worldquat,worldPos); m_body->setCenterOfMassTransform(newTrans); //need to keep track of previous position for friction effects... @@ -147,7 +177,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time) float scale[3]; m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]); - SimdVector3 scaling(scale[0],scale[1],scale[2]); + btVector3 scaling(scale[0],scale[1],scale[2]); GetCollisionShape()->setLocalScaling(scaling); } return true; @@ -217,8 +247,8 @@ void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dloc { m_body->activate(); - SimdVector3 dloc(dlocX,dlocY,dlocZ); - SimdTransform xform = m_body->getCenterOfMassTransform(); + btVector3 dloc(dlocX,dlocY,dlocZ); + btTransform xform = m_body->getCenterOfMassTransform(); if (local) { @@ -237,15 +267,15 @@ void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local) { m_body->activate(); - SimdMatrix3x3 drotmat( rotval[0],rotval[1],rotval[2], + btMatrix3x3 drotmat( rotval[0],rotval[1],rotval[2], rotval[4],rotval[5],rotval[6], rotval[8],rotval[9],rotval[10]); - SimdMatrix3x3 currentOrn; + btMatrix3x3 currentOrn; GetWorldOrientation(currentOrn); - SimdTransform xform = m_body->getCenterOfMassTransform(); + btTransform xform = m_body->getCenterOfMassTransform(); xform.setBasis(xform.getBasis()*(local ? drotmat : (currentOrn.inverse() * drotmat * currentOrn))); @@ -255,17 +285,17 @@ void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local) } -void CcdPhysicsController::GetWorldOrientation(SimdMatrix3x3& mat) +void CcdPhysicsController::GetWorldOrientation(btMatrix3x3& mat) { float orn[4]; m_MotionState->getWorldOrientation(orn[0],orn[1],orn[2],orn[3]); - SimdQuaternion quat(orn[0],orn[1],orn[2],orn[3]); + btQuaternion quat(orn[0],orn[1],orn[2],orn[3]); mat.setRotation(quat); } void CcdPhysicsController::getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal) { - SimdQuaternion q = m_body->getCenterOfMassTransform().getRotation(); + btQuaternion q = m_body->getCenterOfMassTransform().getRotation(); quatImag0 = q[0]; quatImag1 = q[1]; quatImag2 = q[2]; @@ -274,9 +304,9 @@ void CcdPhysicsController::getOrientation(float &quatImag0,float &quatImag1,flo void CcdPhysicsController::setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal) { m_body->activate(); - - SimdTransform xform = m_body->getCenterOfMassTransform(); - xform.setRotation(SimdQuaternion(quatImag0,quatImag1,quatImag2,quatReal)); + m_MotionState->setWorldOrientation(quatImag0,quatImag1,quatImag2,quatReal); + btTransform xform = m_body->getCenterOfMassTransform(); + xform.setRotation(btQuaternion(quatImag0,quatImag1,quatImag2,quatReal)); m_body->setCenterOfMassTransform(xform); } @@ -284,9 +314,9 @@ void CcdPhysicsController::setOrientation(float quatImag0,float quatImag1,float void CcdPhysicsController::setPosition(float posX,float posY,float posZ) { m_body->activate(); - - SimdTransform xform = m_body->getCenterOfMassTransform(); - xform.setOrigin(SimdVector3(posX,posY,posZ)); + m_MotionState->setWorldPosition(posX,posY,posZ); + btTransform xform = m_body->getCenterOfMassTransform(); + xform.setOrigin(btVector3(posX,posY,posZ)); m_body->setCenterOfMassTransform(xform); } @@ -296,7 +326,7 @@ void CcdPhysicsController::resolveCombinedVelocities(float linvelX,float linvel void CcdPhysicsController::getPosition(PHY__Vector3& pos) const { - const SimdTransform& xform = m_body->getCenterOfMassTransform(); + const btTransform& xform = m_body->getCenterOfMassTransform(); pos[0] = xform.getOrigin().x(); pos[1] = xform.getOrigin().y(); pos[2] = xform.getOrigin().z(); @@ -304,16 +334,16 @@ void CcdPhysicsController::getPosition(PHY__Vector3& pos) const void CcdPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ) { - if (!SimdFuzzyZero(m_cci.m_scaling.x()-scaleX) || - !SimdFuzzyZero(m_cci.m_scaling.y()-scaleY) || - !SimdFuzzyZero(m_cci.m_scaling.z()-scaleZ)) + if (!btFuzzyZero(m_cci.m_scaling.x()-scaleX) || + !btFuzzyZero(m_cci.m_scaling.y()-scaleY) || + !btFuzzyZero(m_cci.m_scaling.z()-scaleZ)) { - m_cci.m_scaling = SimdVector3(scaleX,scaleY,scaleZ); + m_cci.m_scaling = btVector3(scaleX,scaleY,scaleZ); - if (m_body && m_body->GetCollisionShape()) + if (m_body && m_body->getCollisionShape()) { - m_body->GetCollisionShape()->setLocalScaling(m_cci.m_scaling); - m_body->GetCollisionShape()->CalculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); + m_body->getCollisionShape()->setLocalScaling(m_cci.m_scaling); + m_body->getCollisionShape()->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); m_body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); } } @@ -322,8 +352,8 @@ void CcdPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ) // physics methods void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local) { - SimdVector3 torque(torqueX,torqueY,torqueZ); - SimdTransform xform = m_body->getCenterOfMassTransform(); + btVector3 torque(torqueX,torqueY,torqueZ); + btTransform xform = m_body->getCenterOfMassTransform(); if (local) { torque = xform.getBasis()*torque; @@ -333,8 +363,8 @@ void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torque void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bool local) { - SimdVector3 force(forceX,forceY,forceZ); - SimdTransform xform = m_body->getCenterOfMassTransform(); + btVector3 force(forceX,forceY,forceZ); + btTransform xform = m_body->getCenterOfMassTransform(); if (local) { force = xform.getBasis()*force; @@ -343,14 +373,14 @@ void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bo } void CcdPhysicsController::SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local) { - SimdVector3 angvel(ang_velX,ang_velY,ang_velZ); + btVector3 angvel(ang_velX,ang_velY,ang_velZ); if (angvel.length2() > (SIMD_EPSILON*SIMD_EPSILON)) { m_body->activate(); } { - SimdTransform xform = m_body->getCenterOfMassTransform(); + btTransform xform = m_body->getCenterOfMassTransform(); if (local) { angvel = xform.getBasis()*angvel; @@ -363,14 +393,14 @@ void CcdPhysicsController::SetAngularVelocity(float ang_velX,float ang_velY,flo void CcdPhysicsController::SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local) { - SimdVector3 linVel(lin_velX,lin_velY,lin_velZ); + btVector3 linVel(lin_velX,lin_velY,lin_velZ); if (linVel.length2() > (SIMD_EPSILON*SIMD_EPSILON)) { m_body->activate(); } { - SimdTransform xform = m_body->getCenterOfMassTransform(); + btTransform xform = m_body->getCenterOfMassTransform(); if (local) { linVel = xform.getBasis()*linVel; @@ -380,13 +410,13 @@ void CcdPhysicsController::SetLinearVelocity(float lin_velX,float lin_velY,floa } void CcdPhysicsController::applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ) { - SimdVector3 impulse(impulseX,impulseY,impulseZ); + btVector3 impulse(impulseX,impulseY,impulseZ); if (impulse.length2() > (SIMD_EPSILON*SIMD_EPSILON)) { m_body->activate(); - SimdVector3 pos(attachX,attachY,attachZ); + btVector3 pos(attachX,attachY,attachZ); m_body->activate(); @@ -400,7 +430,7 @@ void CcdPhysicsController::SetActive(bool active) // reading out information from physics void CcdPhysicsController::GetLinearVelocity(float& linvX,float& linvY,float& linvZ) { - const SimdVector3& linvel = this->m_body->getLinearVelocity(); + const btVector3& linvel = this->m_body->getLinearVelocity(); linvX = linvel.x(); linvY = linvel.y(); linvZ = linvel.z(); @@ -409,7 +439,7 @@ void CcdPhysicsController::GetLinearVelocity(float& linvX,float& linvY,float& l void CcdPhysicsController::GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ) { - const SimdVector3& angvel= m_body->getAngularVelocity(); + const btVector3& angvel= m_body->getAngularVelocity(); angVelX = angvel.x(); angVelY = angvel.y(); angVelZ = angvel.z(); @@ -417,9 +447,9 @@ void CcdPhysicsController::GetAngularVelocity(float& angVelX,float& angVelY,flo void CcdPhysicsController::GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ) { - SimdVector3 pos(posX,posY,posZ); - SimdVector3 rel_pos = pos-m_body->getCenterOfMassPosition(); - SimdVector3 linvel = m_body->getVelocityInLocalPoint(rel_pos); + btVector3 pos(posX,posY,posZ); + btVector3 rel_pos = pos-m_body->getCenterOfMassPosition(); + btVector3 linvel = m_body->getVelocityInLocalPoint(rel_pos); linvX = linvel.x(); linvY = linvel.y(); linvZ = linvel.z(); @@ -434,7 +464,7 @@ void CcdPhysicsController::setRigidBody(bool rigid) if (!rigid) { //fake it for now - SimdVector3 inertia = m_body->getInvInertiaDiagLocal(); + btVector3 inertia = m_body->getInvInertiaDiagLocal(); inertia[1] = 0.f; m_body->setInvInertiaDiagLocal(inertia); m_body->updateInertiaTensor(); @@ -454,62 +484,36 @@ void CcdPhysicsController::setNewClientInfo(void* clientinfo) void CcdPhysicsController::UpdateDeactivation(float timeStep) { - if ( (m_body->GetActivationState() == ISLAND_SLEEPING) || (m_body->GetActivationState() == DISABLE_DEACTIVATION)) - return; - - if ((m_body->getLinearVelocity().length2() < gLinearSleepingTreshold*gLinearSleepingTreshold) && - (m_body->getAngularVelocity().length2() < gAngularSleepingTreshold*gAngularSleepingTreshold)) - { - m_body->m_deactivationTime += timeStep; - } else - { - m_body->m_deactivationTime=0.f; - m_body->SetActivationState(0); - } - + m_body->updateDeactivation( timeStep); } bool CcdPhysicsController::wantsSleeping() { - if (m_body->GetActivationState() == DISABLE_DEACTIVATION) - return false; - - //disable deactivation - if (gDisableDeactivation || (gDeactivationTime == 0.f)) - return false; - - if ( (m_body->GetActivationState() == ISLAND_SLEEPING) || (m_body->GetActivationState() == WANTS_DEACTIVATION)) - return true; - - if (m_body->m_deactivationTime> gDeactivationTime) - { - return true; - } - return false; + return m_body->wantsSleeping(); } PHY_IPhysicsController* CcdPhysicsController::GetReplica() { //very experimental, shape sharing is not implemented yet. - //just support SphereShape/ConeShape for now + //just support btSphereShape/ConeShape for now CcdConstructionInfo cinfo = m_cci; if (cinfo.m_collisionShape) { - switch (cinfo.m_collisionShape->GetShapeType()) + switch (cinfo.m_collisionShape->getShapeType()) { case SPHERE_SHAPE_PROXYTYPE: { - SphereShape* orgShape = (SphereShape*)cinfo.m_collisionShape; - cinfo.m_collisionShape = new SphereShape(*orgShape); + btSphereShape* orgShape = (btSphereShape*)cinfo.m_collisionShape; + cinfo.m_collisionShape = new btSphereShape(*orgShape); break; } case CONE_SHAPE_PROXYTYPE: { - ConeShape* orgShape = (ConeShape*)cinfo.m_collisionShape; - cinfo.m_collisionShape = new ConeShape(*orgShape); + btConeShape* orgShape = (btConeShape*)cinfo.m_collisionShape; + cinfo.m_collisionShape = new btConeShape(*orgShape); break; } @@ -568,13 +572,13 @@ void DefaultMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,flo void DefaultMotionState::setWorldPosition(float posX,float posY,float posZ) { - SimdPoint3 pos(posX,posY,posZ); + btPoint3 pos(posX,posY,posZ); m_worldTransform.setOrigin( pos ); } void DefaultMotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal) { - SimdQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal); + btQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal); m_worldTransform.setRotation( orn ); } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 632d5d776d2..11fef56401f 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -21,23 +21,16 @@ subject to the following restrictions: /// PHY_IPhysicsController is the abstract simplified Interface to a physical object. /// It contains the IMotionState and IDeformableMesh Interfaces. -#include "SimdVector3.h" -#include "SimdScalar.h" -#include "SimdMatrix3x3.h" -#include "SimdTransform.h" -#include "Dynamics/RigidBody.h" +#include "btBulletDynamicsCommon.h" #include "PHY_IMotionState.h" -#include "BroadphaseCollision/BroadphaseProxy.h" //for CollisionShape access -class CollisionShape; - extern float gDeactivationTime; extern float gLinearSleepingTreshold; extern float gAngularSleepingTreshold; extern bool gDisableDeactivation; class CcdPhysicsEnvironment; - +class btMotionState; @@ -46,7 +39,7 @@ struct CcdConstructionInfo ///CollisionFilterGroups provides some optional usage of basic collision filtering ///this is done during broadphase, so very early in the pipeline - ///more advanced collision filtering should be done in CollisionDispatcher::NeedsCollision + ///more advanced collision filtering should be done in btCollisionDispatcher::NeedsCollision enum CollisionFilterGroups { DefaultFilter = 1, @@ -74,46 +67,47 @@ struct CcdConstructionInfo { } - SimdVector3 m_localInertiaTensor; - SimdVector3 m_gravity; - SimdVector3 m_scaling; - SimdScalar m_mass; - SimdScalar m_restitution; - SimdScalar m_friction; - SimdScalar m_linearDamping; - SimdScalar m_angularDamping; + btVector3 m_localInertiaTensor; + btVector3 m_gravity; + btVector3 m_scaling; + btScalar m_mass; + btScalar m_restitution; + btScalar m_friction; + btScalar m_linearDamping; + btScalar m_angularDamping; int m_collisionFlags; ///optional use of collision group/mask: ///only collision with object goups that match the collision mask. ///this is very basic early out. advanced collision filtering should be - ///done in the CollisionDispatcher::NeedsCollision and NeedsResponse + ///done in the btCollisionDispatcher::NeedsCollision and NeedsResponse ///both values default to 1 short int m_collisionFilterGroup; short int m_collisionFilterMask; - CollisionShape* m_collisionShape; + btCollisionShape* m_collisionShape; class PHY_IMotionState* m_MotionState; - + CcdPhysicsEnvironment* m_physicsEnv; //needed for self-replication float m_inertiaFactor;//tweak the inertia (hooked up to Blender 'formfactor' }; -class RigidBody; +class btRigidBody; ///CcdPhysicsController is a physics object that supports continuous collision detection and time of impact based physics resolution. class CcdPhysicsController : public PHY_IPhysicsController { - RigidBody* m_body; + btRigidBody* m_body; class PHY_IMotionState* m_MotionState; - + btMotionState* m_bulletMotionState; + void* m_newClientInfo; CcdConstructionInfo m_cci;//needed for replication - void GetWorldOrientation(SimdMatrix3x3& mat); + void GetWorldOrientation(btMatrix3x3& mat); void CreateRigidbody(); @@ -127,10 +121,10 @@ class CcdPhysicsController : public PHY_IPhysicsController virtual ~CcdPhysicsController(); - RigidBody* GetRigidBody() { return m_body;} + btRigidBody* GetRigidBody() { return m_body;} - CollisionShape* GetCollisionShape() { - return m_body->GetCollisionShape(); + btCollisionShape* GetCollisionShape() { + return m_body->getCollisionShape(); } //////////////////////////////////// // PHY_IPhysicsController interface @@ -206,9 +200,9 @@ class CcdPhysicsController : public PHY_IPhysicsController void UpdateDeactivation(float timeStep); - static SimdTransform GetTransformFromMotionState(PHY_IMotionState* motionState); + static btTransform GetTransformFromMotionState(PHY_IMotionState* motionState); - void SetAabb(const SimdVector3& aabbMin,const SimdVector3& aabbMax); + void setAabb(const btVector3& aabbMin,const btVector3& aabbMax); class PHY_IMotionState* GetMotionState() @@ -227,7 +221,7 @@ class CcdPhysicsController : public PHY_IPhysicsController -///DefaultMotionState implements standard motionstate, using SimdTransform +///DefaultMotionState implements standard motionstate, using btTransform class DefaultMotionState : public PHY_IMotionState { @@ -245,8 +239,8 @@ class DefaultMotionState : public PHY_IMotionState virtual void calculateWorldTransformations(); - SimdTransform m_worldTransform; - SimdVector3 m_localScaling; + btTransform m_worldTransform; + btVector3 m_localScaling; }; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 813462fdf5e..9533adfa3d5 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -20,74 +20,36 @@ subject to the following restrictions: #include "CcdPhysicsController.h" #include <algorithm> -#include "SimdTransform.h" -#include "Dynamics/RigidBody.h" -#include "BroadphaseCollision/BroadphaseInterface.h" -#include "BroadphaseCollision/SimpleBroadphase.h" -#include "BroadphaseCollision/AxisSweep3.h" - -#include "CollisionDispatch/CollisionWorld.h" - -#include "CollisionShapes/ConvexShape.h" -#include "CollisionShapes/ConeShape.h" -#include "CollisionDispatch/SimulationIslandManager.h" - -#include "BroadphaseCollision/Dispatcher.h" -#include "NarrowPhaseCollision/PersistentManifold.h" -#include "CollisionShapes/TriangleMeshShape.h" -#include "ConstraintSolver/SequentialImpulseConstraintSolver.h" - +#include "btBulletDynamicsCommon.h" +#include "LinearMath/btIDebugDraw.h" +#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h" //profiling/timings -#include "quickprof.h" - +#include "LinearMath/btQuickprof.h" -#include "IDebugDraw.h" -#include "NarrowPhaseCollision/VoronoiSimplexSolver.h" -#include "NarrowPhaseCollision/SubSimplexConvexCast.h" -#include "NarrowPhaseCollision/GjkConvexCast.h" -#include "NarrowPhaseCollision/ContinuousConvexCollision.h" - - -#include "CollisionDispatch/CollisionDispatcher.h" #include "PHY_IMotionState.h" -#include "CollisionDispatch/EmptyCollisionAlgorithm.h" - - - -#include "CollisionShapes/SphereShape.h" bool useIslands = true; #ifdef NEW_BULLET_VEHICLE_SUPPORT -#include "Vehicle/RaycastVehicle.h" -#include "Vehicle/VehicleRaycaster.h" - -#include "Vehicle/WheelInfo.h" +#include "BulletDynamics/Vehicle/btRaycastVehicle.h" +#include "BulletDynamics/Vehicle/btVehicleRaycaster.h" +#include "BulletDynamics/Vehicle/btWheelInfo.h" #include "PHY_IVehicle.h" -RaycastVehicle::VehicleTuning gTuning; +btRaycastVehicle::btVehicleTuning gTuning; #endif //NEW_BULLET_VEHICLE_SUPPORT -#include "AabbUtil2.h" - -#include "ConstraintSolver/ConstraintSolver.h" -#include "ConstraintSolver/Point2PointConstraint.h" -#include "ConstraintSolver/HingeConstraint.h" -#include "ConstraintSolver/Generic6DofConstraint.h" - +#include "LinearMath/btAabbUtil2.h" -//#include "BroadphaseCollision/QueryDispatcher.h" -//#include "BroadphaseCollision/QueryBox.h" -//todo: change this to allow dynamic registration of types! #ifdef WIN32 void DrawRasterizerLine(const float* from,const float* to,int color); #endif -#include "ConstraintSolver/ContactConstraint.h" +#include "BulletDynamics/ConstraintSolver/btContactConstraint.h" #include <stdio.h> @@ -96,18 +58,18 @@ void DrawRasterizerLine(const float* from,const float* to,int color); class WrapperVehicle : public PHY_IVehicle { - RaycastVehicle* m_vehicle; + btRaycastVehicle* m_vehicle; PHY_IPhysicsController* m_chassis; public: - WrapperVehicle(RaycastVehicle* vehicle,PHY_IPhysicsController* chassis) + WrapperVehicle(btRaycastVehicle* vehicle,PHY_IPhysicsController* chassis) :m_vehicle(vehicle), m_chassis(chassis) { } - RaycastVehicle* GetVehicle() + btRaycastVehicle* GetVehicle() { return m_vehicle; } @@ -127,12 +89,12 @@ public: bool hasSteering ) { - SimdVector3 connectionPointCS0(connectionPoint[0],connectionPoint[1],connectionPoint[2]); - SimdVector3 wheelDirectionCS0(downDirection[0],downDirection[1],downDirection[2]); - SimdVector3 wheelAxle(axleDirection[0],axleDirection[1],axleDirection[2]); + btVector3 connectionPointCS0(connectionPoint[0],connectionPoint[1],connectionPoint[2]); + btVector3 wheelDirectionCS0(downDirection[0],downDirection[1],downDirection[2]); + btVector3 wheelAxle(axleDirection[0],axleDirection[1],axleDirection[2]); - WheelInfo& info = m_vehicle->AddWheel(connectionPointCS0,wheelDirectionCS0,wheelAxle, + btWheelInfo& info = m_vehicle->addWheel(connectionPointCS0,wheelDirectionCS0,wheelAxle, suspensionRestLength,wheelRadius,gTuning,hasSteering); info.m_clientInfo = motionState; @@ -144,12 +106,12 @@ public: int i; for (i=0;i<numWheels;i++) { - WheelInfo& info = m_vehicle->GetWheelInfo(i); + btWheelInfo& info = m_vehicle->getWheelInfo(i); PHY_IMotionState* motionState = (PHY_IMotionState*)info.m_clientInfo ; - m_vehicle->UpdateWheelTransform(i); - SimdTransform trans = m_vehicle->GetWheelTransformWS(i); - SimdQuaternion orn = trans.getRotation(); - const SimdVector3& pos = trans.getOrigin(); + m_vehicle->updateWheelTransform(i); + btTransform trans = m_vehicle->getWheelTransformWS(i); + btQuaternion orn = trans.getRotation(); + const btVector3& pos = trans.getOrigin(); motionState->setWorldOrientation(orn.x(),orn.y(),orn.z(),orn[3]); motionState->setWorldPosition(pos.x(),pos.y(),pos.z()); @@ -158,21 +120,21 @@ public: virtual int GetNumWheels() const { - return m_vehicle->GetNumWheels(); + return m_vehicle->getNumWheels(); } virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const { - SimdTransform trans = m_vehicle->GetWheelTransformWS(wheelIndex); + btTransform trans = m_vehicle->getWheelTransformWS(wheelIndex); posX = trans.getOrigin().x(); posY = trans.getOrigin().y(); posZ = trans.getOrigin().z(); } virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const { - SimdTransform trans = m_vehicle->GetWheelTransformWS(wheelIndex); - SimdQuaternion quat = trans.getRotation(); - SimdMatrix3x3 orn2(quat); + btTransform trans = m_vehicle->getWheelTransformWS(wheelIndex); + btQuaternion quat = trans.getRotation(); + btMatrix3x3 orn2(quat); quatX = trans.getRotation().x(); quatY = trans.getRotation().y(); @@ -189,9 +151,9 @@ public: { float rotation = 0.f; - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) + if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); + btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); rotation = info.m_rotation; } return rotation; @@ -202,38 +164,38 @@ public: virtual int GetUserConstraintId() const { - return m_vehicle->GetUserConstraintId(); + return m_vehicle->getUserConstraintId(); } virtual int GetUserConstraintType() const { - return m_vehicle->GetUserConstraintType(); + return m_vehicle->getUserConstraintType(); } virtual void SetSteeringValue(float steering,int wheelIndex) { - m_vehicle->SetSteeringValue(steering,wheelIndex); + m_vehicle->setSteeringValue(steering,wheelIndex); } virtual void ApplyEngineForce(float force,int wheelIndex) { - m_vehicle->ApplyEngineForce(force,wheelIndex); + m_vehicle->applyEngineForce(force,wheelIndex); } virtual void ApplyBraking(float braking,int wheelIndex) { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) + if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); + btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); info.m_brake = braking; } } virtual void SetWheelFriction(float friction,int wheelIndex) { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) + if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); + btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); info.m_frictionSlip = friction; } @@ -241,9 +203,9 @@ public: virtual void SetSuspensionStiffness(float suspensionStiffness,int wheelIndex) { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) + if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); + btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); info.m_suspensionStiffness = suspensionStiffness; } @@ -251,18 +213,18 @@ public: virtual void SetSuspensionDamping(float suspensionDamping,int wheelIndex) { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) + if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); + btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); info.m_wheelsDampingRelaxation = suspensionDamping; } } virtual void SetSuspensionCompression(float suspensionCompression,int wheelIndex) { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) + if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); + btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); info.m_wheelsDampingCompression = suspensionCompression; } } @@ -271,13 +233,18 @@ public: virtual void SetRollInfluence(float rollInfluence,int wheelIndex) { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->GetNumWheels())) + if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) { - WheelInfo& info = m_vehicle->GetWheelInfo(wheelIndex); + btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); info.m_rollInfluence = rollInfluence; } } + virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) + { + m_vehicle->setCoordinateSystem(rightIndex,upIndex,forwardIndex); + } + }; @@ -285,30 +252,30 @@ public: -static void DrawAabb(IDebugDraw* debugDrawer,const SimdVector3& from,const SimdVector3& to,const SimdVector3& color) +static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVector3& to,const btVector3& color) { - SimdVector3 halfExtents = (to-from)* 0.5f; - SimdVector3 center = (to+from) *0.5f; + btVector3 halfExtents = (to-from)* 0.5f; + btVector3 center = (to+from) *0.5f; int i,j; - SimdVector3 edgecoord(1.f,1.f,1.f),pa,pb; + btVector3 edgecoord(1.f,1.f,1.f),pa,pb; for (i=0;i<4;i++) { for (j=0;j<3;j++) { - pa = SimdVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], + pa = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], edgecoord[2]*halfExtents[2]); pa+=center; int othercoord = j%3; edgecoord[othercoord]*=-1.f; - pb = SimdVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], + pb = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], edgecoord[2]*halfExtents[2]); pb+=center; - debugDrawer->DrawLine(pa,pb,color); + debugDrawer->drawLine(pa,pb,color); } - edgecoord = SimdVector3(-1.f,-1.f,-1.f); + edgecoord = btVector3(-1.f,-1.f,-1.f); if (i<3) edgecoord[i]*=-1.f; } @@ -321,7 +288,7 @@ static void DrawAabb(IDebugDraw* debugDrawer,const SimdVector3& from,const SimdV -CcdPhysicsEnvironment::CcdPhysicsEnvironment(Dispatcher* dispatcher,OverlappingPairCache* pairCache) +CcdPhysicsEnvironment::CcdPhysicsEnvironment(btDispatcher* dispatcher,btOverlappingPairCache* pairCache) :m_scalingPropagated(false), m_numIterations(10), m_numTimeSubSteps(1), @@ -335,71 +302,68 @@ m_enableSatCollisionDetection(false) { m_triggerCallbacks[i] = 0; } - if (!dispatcher) - dispatcher = new CollisionDispatcher(); + dispatcher = new btCollisionDispatcher(); if(!pairCache) { //todo: calculate/let user specify this world sizes - SimdVector3 worldMin(-10000,-10000,-10000); - SimdVector3 worldMax(10000,10000,10000); + btVector3 worldMin(-10000,-10000,-10000); + btVector3 worldMax(10000,10000,10000); - pairCache = new AxisSweep3(worldMin,worldMax); + pairCache = new btAxisSweep3(worldMin,worldMax); - //broadphase = new SimpleBroadphase(); + //broadphase = new btSimpleBroadphase(); } setSolverType(1);//issues with quickstep and memory allocations - m_collisionWorld = new CollisionWorld(dispatcher,pairCache); - + m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,pairCache); m_debugDrawer = 0; - m_gravity = SimdVector3(0.f,-10.f,0.f); - - m_islandManager = new SimulationIslandManager(); + m_gravity = btVector3(0.f,-10.f,0.f); + m_dynamicsWorld->setGravity(m_gravity); } void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl) { - RigidBody* body = ctrl->GetRigidBody(); + btRigidBody* body = ctrl->GetRigidBody(); //this m_userPointer is just used for triggers, see CallbackTriggers - body->m_userPointer = ctrl; + body->setUserPointer(ctrl); body->setGravity( m_gravity ); m_controllers.push_back(ctrl); - m_collisionWorld->AddCollisionObject(body,ctrl->GetCollisionFilterGroup(),ctrl->GetCollisionFilterMask()); + m_dynamicsWorld->addRigidBody(body); + //CollisionObject(body,ctrl->GetCollisionFilterGroup(),ctrl->GetCollisionFilterMask()); - assert(body->m_broadphaseHandle); + assert(body->getBroadphaseHandle()); - BroadphaseInterface* scene = GetBroadphase(); + btBroadphaseInterface* scene = getBroadphase(); - CollisionShape* shapeinterface = ctrl->GetCollisionShape(); + btCollisionShape* shapeinterface = ctrl->GetCollisionShape(); assert(shapeinterface); - const SimdTransform& t = ctrl->GetRigidBody()->getCenterOfMassTransform(); + const btTransform& t = ctrl->GetRigidBody()->getCenterOfMassTransform(); - body->m_cachedInvertedWorldTransform = body->m_worldTransform.inverse(); - SimdPoint3 minAabb,maxAabb; + btPoint3 minAabb,maxAabb; - shapeinterface->GetAabb(t,minAabb,maxAabb); + shapeinterface->getAabb(t,minAabb,maxAabb); float timeStep = 0.02f; //extent it with the motion - SimdVector3 linMotion = body->getLinearVelocity()*timeStep; + btVector3 linMotion = body->getLinearVelocity()*timeStep; float maxAabbx = maxAabb.getX(); float maxAabby = maxAabb.getY(); @@ -422,8 +386,8 @@ void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl) minAabbz += linMotion.z(); - minAabb = SimdVector3(minAabbx,minAabby,minAabbz); - maxAabb = SimdVector3(maxAabbx,maxAabby,maxAabbz); + minAabb = btVector3(minAabbx,minAabby,minAabbz); + maxAabb = btVector3(maxAabbx,maxAabby,maxAabbz); @@ -435,42 +399,9 @@ void CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr //also remove constraint - { - std::vector<TypedConstraint*>::iterator i; - - for (i=m_constraints.begin(); - !(i==m_constraints.end()); i++) - { - TypedConstraint* constraint = (*i); - if ((&constraint->GetRigidBodyA() == ctrl->GetRigidBody() || - (&constraint->GetRigidBodyB() == ctrl->GetRigidBody()))) - { - removeConstraint(constraint->GetUserConstraintId()); - //only 1 constraint per constroller - break; - } - } - } - - { - std::vector<TypedConstraint*>::iterator i; - - for (i=m_constraints.begin(); - !(i==m_constraints.end()); i++) - { - TypedConstraint* constraint = (*i); - if ((&constraint->GetRigidBodyA() == ctrl->GetRigidBody() || - (&constraint->GetRigidBodyB() == ctrl->GetRigidBody()))) - { - removeConstraint(constraint->GetUserConstraintId()); - //only 1 constraint per constroller - break; - } - } - } - + - m_collisionWorld->RemoveCollisionObject(ctrl->GetRigidBody()); + m_dynamicsWorld->removeRigidBody(ctrl->GetRigidBody()); { @@ -506,482 +437,24 @@ void CcdPhysicsEnvironment::beginFrame() bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep) { - //don't simulate without timesubsteps - if (m_numTimeSubSteps<1) - return true; - - //printf("proceedDeltaTime\n"); - - -#ifdef USE_QUICKPROF - //toggle Profiler - if ( m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_ProfileTimings) - { - if (!m_profileTimings) - { - m_profileTimings = 1; - // To disable profiling, simply comment out the following line. - static int counter = 0; - - char filename[128]; - sprintf(filename,"quickprof_bullet_timings%i.csv",counter++); - Profiler::init(filename, Profiler::BLOCK_CYCLE_SECONDS);//BLOCK_TOTAL_MICROSECONDS - - } - } else - { - if (m_profileTimings) - { - m_profileTimings = 0; - Profiler::destroy(); - } - } -#endif //USE_QUICKPROF - - - - if (!SimdFuzzyZero(timeStep)) - { - - { - //do the kinematic calculation here, over the full timestep - std::vector<CcdPhysicsController*>::iterator i; - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - - CcdPhysicsController* ctrl = *i; - - SimdTransform predictedTrans; - RigidBody* body = ctrl->GetRigidBody(); - if (body->GetActivationState() != ISLAND_SLEEPING) - { - - if (body->IsStatic()) - { - //to calculate velocities next frame - body->saveKinematicState(timeStep); - } - } - } - } - - int i; - float subTimeStep = timeStep / float(m_numTimeSubSteps); - - for (i=0;i<this->m_numTimeSubSteps;i++) - { - proceedDeltaTimeOneStep(subTimeStep); - } - } else + int numCtrl = GetNumControllers(); + for (int i=0;i<numCtrl;i++) { - //todo: interpolate - } - - return true; -} - - - - - - - - - - - - - -/// Perform an integration step of duration 'timeStep'. -bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep) -{ - - - //printf("CcdPhysicsEnvironment::proceedDeltaTime\n"); - - if (SimdFuzzyZero(timeStep)) - return true; - - if (m_debugDrawer) - { - gDisableDeactivation = (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_NoDeactivation); - } - - -#ifdef USE_QUICKPROF - Profiler::beginBlock("SyncMotionStates"); -#endif //USE_QUICKPROF - - - //this is needed because scaling is not known in advance, and scaling has to propagate to the shape - if (!m_scalingPropagated) - { - SyncMotionStates(timeStep); - m_scalingPropagated = true; - } - - -#ifdef USE_QUICKPROF - Profiler::endBlock("SyncMotionStates"); - - Profiler::beginBlock("predictIntegratedTransform"); -#endif //USE_QUICKPROF - - { - // std::vector<CcdPhysicsController*>::iterator i; - - - - int k; - for (k=0;k<GetNumControllers();k++) - { - CcdPhysicsController* ctrl = m_controllers[k]; - // SimdTransform predictedTrans; - RigidBody* body = ctrl->GetRigidBody(); - - body->m_cachedInvertedWorldTransform = body->m_worldTransform.inverse(); - - if (body->IsActive()) - { - if (!body->IsStatic()) - { - body->applyForces( timeStep); - body->integrateVelocities( timeStep); - body->predictIntegratedTransform(timeStep,body->m_interpolationWorldTransform); - } - } - - } + CcdPhysicsController* ctrl = GetPhysicsController(i); + ctrl->SynchronizeMotionStates(timeStep); } -#ifdef USE_QUICKPROF - Profiler::endBlock("predictIntegratedTransform"); -#endif //USE_QUICKPROF - - OverlappingPairCache* scene = m_collisionWorld->GetPairCache(); - - - // - // collision detection (?) - // - - -#ifdef USE_QUICKPROF - Profiler::beginBlock("DispatchAllCollisionPairs"); -#endif //USE_QUICKPROF - - - int numsubstep = m_numIterations; - - - DispatcherInfo dispatchInfo; - dispatchInfo.m_timeStep = timeStep; - dispatchInfo.m_stepCount = 0; - dispatchInfo.m_enableSatConvex = m_enableSatCollisionDetection; - dispatchInfo.m_debugDraw = this->m_debugDrawer; - - scene->RefreshOverlappingPairs(); - GetCollisionWorld()->GetDispatcher()->DispatchAllCollisionPairs(&scene->GetOverlappingPair(0),scene->GetNumOverlappingPairs(),dispatchInfo); - - -#ifdef USE_QUICKPROF - Profiler::endBlock("DispatchAllCollisionPairs"); -#endif //USE_QUICKPROF - - - int numRigidBodies = m_controllers.size(); - + m_dynamicsWorld->stepSimulation(timeStep); - m_islandManager->UpdateActivationState(GetCollisionWorld(),GetCollisionWorld()->GetDispatcher()); - - { - int i; - int numConstraints = m_constraints.size(); - for (i=0;i< numConstraints ; i++ ) - { - TypedConstraint* constraint = m_constraints[i]; - - const RigidBody* colObj0 = &constraint->GetRigidBodyA(); - const RigidBody* colObj1 = &constraint->GetRigidBodyB(); - - if (((colObj0) && ((colObj0)->mergesSimulationIslands())) && - ((colObj1) && ((colObj1)->mergesSimulationIslands()))) - { - if (colObj0->IsActive() || colObj1->IsActive()) - { - - m_islandManager->GetUnionFind().unite((colObj0)->m_islandTag1, - (colObj1)->m_islandTag1); - } - } - } - } - - m_islandManager->StoreIslandActivationState(GetCollisionWorld()); - - - //contacts -#ifdef USE_QUICKPROF - Profiler::beginBlock("SolveConstraint"); -#endif //USE_QUICKPROF - - - //solve the regular constraints (point 2 point, hinge, etc) - - for (int g=0;g<numsubstep;g++) - { - // - // constraint solving - // - - - int i; - int numConstraints = m_constraints.size(); - - //point to point constraints - for (i=0;i< numConstraints ; i++ ) - { - TypedConstraint* constraint = m_constraints[i]; - - constraint->BuildJacobian(); - constraint->SolveConstraint( timeStep ); - - } - - - } - -#ifdef USE_QUICKPROF - Profiler::endBlock("SolveConstraint"); -#endif //USE_QUICKPROF - - //solve the vehicles - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - //vehicles - int numVehicles = m_wrapperVehicles.size(); - for (int i=0;i<numVehicles;i++) - { - WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - RaycastVehicle* vehicle = wrapperVehicle->GetVehicle(); - vehicle->UpdateVehicle( timeStep); - } -#endif //NEW_BULLET_VEHICLE_SUPPORT - - - struct InplaceSolverIslandCallback : public SimulationIslandManager::IslandCallback - { - - ContactSolverInfo& m_solverInfo; - ConstraintSolver* m_solver; - IDebugDraw* m_debugDrawer; - - InplaceSolverIslandCallback( - ContactSolverInfo& solverInfo, - ConstraintSolver* solver, - IDebugDraw* debugDrawer) - :m_solverInfo(solverInfo), - m_solver(solver), - m_debugDrawer(debugDrawer) - { - - } - - virtual void ProcessIsland(PersistentManifold** manifolds,int numManifolds) - { - m_solver->SolveGroup( manifolds, numManifolds,m_solverInfo,m_debugDrawer); - } - - }; - - - m_solverInfo.m_friction = 0.9f; - m_solverInfo.m_numIterations = m_numIterations; - m_solverInfo.m_timeStep = timeStep; - m_solverInfo.m_restitution = 0.f;//m_restitution; - - InplaceSolverIslandCallback solverCallback( - m_solverInfo, - m_solver, - m_debugDrawer); - -#ifdef USE_QUICKPROF - Profiler::beginBlock("BuildAndProcessIslands"); -#endif //USE_QUICKPROF - - /// solve all the contact points and contact friction - m_islandManager->BuildAndProcessIslands(GetCollisionWorld()->GetDispatcher(),m_collisionWorld->GetCollisionObjectArray(),&solverCallback); - -#ifdef USE_QUICKPROF - Profiler::endBlock("BuildAndProcessIslands"); - - Profiler::beginBlock("CallbackTriggers"); -#endif //USE_QUICKPROF - - CallbackTriggers(); - -#ifdef USE_QUICKPROF - Profiler::endBlock("CallbackTriggers"); - - - Profiler::beginBlock("proceedToTransform"); - -#endif //USE_QUICKPROF - { - - - - { - - - - UpdateAabbs(timeStep); - - - float toi = 1.f; - - - - if (m_ccdMode == 3) - { - DispatcherInfo dispatchInfo; - dispatchInfo.m_timeStep = timeStep; - dispatchInfo.m_stepCount = 0; - dispatchInfo.m_dispatchFunc = DispatcherInfo::DISPATCH_CONTINUOUS; - - //pairCache->RefreshOverlappingPairs();//?? - GetCollisionWorld()->GetDispatcher()->DispatchAllCollisionPairs(&scene->GetOverlappingPair(0),scene->GetNumOverlappingPairs(),dispatchInfo); - - toi = dispatchInfo.m_timeOfImpact; - - } - - - - // - // integrating solution - // - - { - - std::vector<CcdPhysicsController*>::iterator i; - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - - CcdPhysicsController* ctrl = *i; - - SimdTransform predictedTrans; - RigidBody* body = ctrl->GetRigidBody(); - - if (body->IsActive()) - { - - if (!body->IsStatic()) - { - if (body->m_hitFraction < 1.f) - { - //set velocity to zero... until we have proper CCD integrated - body->setLinearVelocity(body->getLinearVelocity()*0.5f); - } - body->predictIntegratedTransform(timeStep* toi, predictedTrans); - body->proceedToTransform( predictedTrans); - } - - } - } - - } - - - - - - // - // disable sleeping physics objects - // - - std::vector<CcdPhysicsController*> m_sleepingControllers; - - std::vector<CcdPhysicsController*>::iterator i; - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - CcdPhysicsController* ctrl = (*i); - RigidBody* body = ctrl->GetRigidBody(); - - ctrl->UpdateDeactivation(timeStep); - - - if (ctrl->wantsSleeping()) - { - if (body->GetActivationState() == ACTIVE_TAG) - body->SetActivationState( WANTS_DEACTIVATION ); - } else - { - if (body->GetActivationState() != DISABLE_DEACTIVATION) - body->SetActivationState( ACTIVE_TAG ); - } - - if (useIslands) - { - if (body->GetActivationState() == ISLAND_SLEEPING) - { - m_sleepingControllers.push_back(ctrl); - } - } else - { - if (ctrl->wantsSleeping()) - { - m_sleepingControllers.push_back(ctrl); - } - } - } - - - - - } - - -#ifdef USE_QUICKPROF - Profiler::endBlock("proceedToTransform"); - - Profiler::beginBlock("SyncMotionStates"); -#endif //USE_QUICKPROF - - SyncMotionStates(timeStep); - -#ifdef USE_QUICKPROF - Profiler::endBlock("SyncMotionStates"); - - Profiler::endProfilingCycle(); -#endif //USE_QUICKPROF - - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - //sync wheels for vehicles - int numVehicles = m_wrapperVehicles.size(); - for (int i=0;i<numVehicles;i++) - { - WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - - wrapperVehicle->SyncWheels(); - } -#endif //NEW_BULLET_VEHICLE_SUPPORT - } - return true; } + void CcdPhysicsEnvironment::setDebugMode(int debugMode) { if (m_debugDrawer){ - m_debugDrawer->SetDebugMode(debugMode); + m_debugDrawer->setDebugMode(debugMode); } } @@ -1001,9 +474,10 @@ void CcdPhysicsEnvironment::setDeactivationAngularTreshold(float angTresh) { gAngularSleepingTreshold = angTresh; } + void CcdPhysicsEnvironment::setContactBreakingTreshold(float contactBreakingTreshold) { - gContactBreakingTreshold = contactBreakingTreshold; + gContactBreakingThreshold = contactBreakingTreshold; } @@ -1049,7 +523,7 @@ void CcdPhysicsEnvironment::setSolverType(int solverType) if (m_solverType != solverType) { - m_solver = new SequentialImpulseConstraintSolver(); + m_solver = new btSequentialImpulseConstraintSolver(); break; } @@ -1073,296 +547,46 @@ void CcdPhysicsEnvironment::setSolverType(int solverType) -void CcdPhysicsEnvironment::SyncMotionStates(float timeStep) -{ - std::vector<CcdPhysicsController*>::iterator i; - - // - // synchronize the physics and graphics transformations - // - - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - CcdPhysicsController* ctrl = (*i); - ctrl->SynchronizeMotionStates(timeStep); - - } -} void CcdPhysicsEnvironment::setGravity(float x,float y,float z) { - m_gravity = SimdVector3(x,y,z); - - std::vector<CcdPhysicsController*>::iterator i; + m_gravity = btVector3(x,y,z); + m_dynamicsWorld->setGravity(m_gravity); - //todo: review this gravity stuff - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) - { - - CcdPhysicsController* ctrl = (*i); - ctrl->GetRigidBody()->setGravity(m_gravity); - - } } -#ifdef NEW_BULLET_VEHICLE_SUPPORT -class DefaultVehicleRaycaster : public VehicleRaycaster -{ - CcdPhysicsEnvironment* m_physEnv; - PHY_IPhysicsController* m_chassis; - -public: - DefaultVehicleRaycaster(CcdPhysicsEnvironment* physEnv,PHY_IPhysicsController* chassis): - m_physEnv(physEnv), - m_chassis(chassis) - { - } - - /* struct VehicleRaycasterResult - { - VehicleRaycasterResult() :m_distFraction(-1.f){}; - SimdVector3 m_hitPointInWorld; - SimdVector3 m_hitNormalInWorld; - SimdScalar m_distFraction; - }; - */ - virtual void* CastRay(const SimdVector3& from,const SimdVector3& to, VehicleRaycasterResult& result) - { - - - float hit[3]; - float normal[3]; - - PHY_IPhysicsController* ignore = m_chassis; - void* hitObject = m_physEnv->rayTest(ignore,from.x(),from.y(),from.z(),to.x(),to.y(),to.z(),hit[0],hit[1],hit[2],normal[0],normal[1],normal[2]); - if (hitObject) - { - result.m_hitPointInWorld[0] = hit[0]; - result.m_hitPointInWorld[1] = hit[1]; - result.m_hitPointInWorld[2] = hit[2]; - result.m_hitNormalInWorld[0] = normal[0]; - result.m_hitNormalInWorld[1] = normal[1]; - result.m_hitNormalInWorld[2] = normal[2]; - result.m_hitNormalInWorld.normalize(); - //calc fraction? or put it in the interface? - //calc for now - - result.m_distFraction = (result.m_hitPointInWorld-from).length() / (to-from).length(); - //some safety for 'explosion' due to sudden penetration of the full 'ray' - /* if (result.m_distFraction<0.1) - { - printf("Vehicle Raycast: avoided instability due to penetration. Consider moving the connection points deeper inside vehicle chassis"); - result.m_distFraction = 1.f; - hitObject = 0; - } - */ - - /* if (result.m_distFraction>1.) - { - printf("Vehicle Raycast: avoided instability 1Consider moving the connection points deeper inside vehicle chassis"); - result.m_distFraction = 1.f; - hitObject = 0; - } - */ - - - - } - //? - return hitObject; - } -}; -#endif //NEW_BULLET_VEHICLE_SUPPORT static int gConstraintUid = 1; -int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl0,class PHY_IPhysicsController* ctrl1,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ, - float axisX,float axisY,float axisZ) -{ - - - CcdPhysicsController* c0 = (CcdPhysicsController*)ctrl0; - CcdPhysicsController* c1 = (CcdPhysicsController*)ctrl1; - - RigidBody* rb0 = c0 ? c0->GetRigidBody() : 0; - RigidBody* rb1 = c1 ? c1->GetRigidBody() : 0; - - ASSERT(rb0); - - SimdVector3 pivotInA(pivotX,pivotY,pivotZ); - SimdVector3 pivotInB = rb1 ? rb1->getCenterOfMassTransform().inverse()(rb0->getCenterOfMassTransform()(pivotInA)) : pivotInA; - SimdVector3 axisInA(axisX,axisY,axisZ); - SimdVector3 axisInB = rb1 ? - (rb1->getCenterOfMassTransform().getBasis().inverse()*(rb0->getCenterOfMassTransform().getBasis() * axisInA)) : - rb0->getCenterOfMassTransform().getBasis() * axisInA; - - bool angularOnly = false; - - switch (type) - { - case PHY_POINT2POINT_CONSTRAINT: - { - - Point2PointConstraint* p2p = 0; - - if (rb1) - { - p2p = new Point2PointConstraint(*rb0, - *rb1,pivotInA,pivotInB); - } else - { - p2p = new Point2PointConstraint(*rb0, - pivotInA); - } - - m_constraints.push_back(p2p); - p2p->SetUserConstraintId(gConstraintUid++); - p2p->SetUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return p2p->GetUserConstraintId(); - - break; - } - - case PHY_GENERIC_6DOF_CONSTRAINT: - { - Generic6DofConstraint* genericConstraint = 0; - - if (rb1) - { - SimdTransform frameInA; - SimdTransform frameInB; - - SimdVector3 axis1, axis2; - SimdPlaneSpace1( axisInA, axis1, axis2 ); - - frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), - axisInA.y(), axis1.y(), axis2.y(), - axisInA.z(), axis1.z(), axis2.z() ); - - - SimdPlaneSpace1( axisInB, axis1, axis2 ); - frameInB.getBasis().setValue( axisInB.x(), axis1.x(), axis2.x(), - axisInB.y(), axis1.y(), axis2.y(), - axisInB.z(), axis1.z(), axis2.z() ); - - frameInA.setOrigin( pivotInA ); - frameInB.setOrigin( pivotInB ); - - genericConstraint = new Generic6DofConstraint( - *rb0,*rb1, - frameInA,frameInB); - - - } else - { - // TODO: Implement single body case... - - } - - - m_constraints.push_back(genericConstraint); - genericConstraint->SetUserConstraintId(gConstraintUid++); - genericConstraint->SetUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return genericConstraint->GetUserConstraintId(); - - break; - } - case PHY_ANGULAR_CONSTRAINT: - angularOnly = true; - - - case PHY_LINEHINGE_CONSTRAINT: - { - HingeConstraint* hinge = 0; - - if (rb1) - { - hinge = new HingeConstraint( - *rb0, - *rb1,pivotInA,pivotInB,axisInA,axisInB); - - - } else - { - hinge = new HingeConstraint(*rb0, - pivotInA,axisInA); - - } - hinge->setAngularOnly(angularOnly); - - m_constraints.push_back(hinge); - hinge->SetUserConstraintId(gConstraintUid++); - hinge->SetUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return hinge->GetUserConstraintId(); - break; - } -#ifdef NEW_BULLET_VEHICLE_SUPPORT - - case PHY_VEHICLE_CONSTRAINT: - { - RaycastVehicle::VehicleTuning* tuning = new RaycastVehicle::VehicleTuning(); - RigidBody* chassis = rb0; - DefaultVehicleRaycaster* raycaster = new DefaultVehicleRaycaster(this,ctrl0); - RaycastVehicle* vehicle = new RaycastVehicle(*tuning,chassis,raycaster); - WrapperVehicle* wrapperVehicle = new WrapperVehicle(vehicle,ctrl0); - m_wrapperVehicles.push_back(wrapperVehicle); - vehicle->SetUserConstraintId(gConstraintUid++); - vehicle->SetUserConstraintType(type); - return vehicle->GetUserConstraintId(); - - break; - }; -#endif //NEW_BULLET_VEHICLE_SUPPORT - - default: - { - } - }; - - //RigidBody& rbA,RigidBody& rbB, const SimdVector3& pivotInA,const SimdVector3& pivotInB - - return 0; - -} - - - - //Following the COLLADA physics specification for constraints int CcdPhysicsEnvironment::createUniversalD6Constraint( class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther, - SimdTransform& frameInA, - SimdTransform& frameInB, - const SimdVector3& linearMinLimits, - const SimdVector3& linearMaxLimits, - const SimdVector3& angularMinLimits, - const SimdVector3& angularMaxLimits + btTransform& frameInA, + btTransform& frameInB, + const btVector3& linearMinLimits, + const btVector3& linearMaxLimits, + const btVector3& angularMinLimits, + const btVector3& angularMaxLimits ) { //we could either add some logic to recognize ball-socket and hinge, or let that up to the user //perhaps some warning or hint that hinge/ball-socket is more efficient? - Generic6DofConstraint* genericConstraint = 0; + btGeneric6DofConstraint* genericConstraint = 0; CcdPhysicsController* ctrl0 = (CcdPhysicsController*) ctrlRef; CcdPhysicsController* ctrl1 = (CcdPhysicsController*) ctrlOther; - RigidBody* rb0 = ctrl0->GetRigidBody(); - RigidBody* rb1 = ctrl1->GetRigidBody(); + btRigidBody* rb0 = ctrl0->GetRigidBody(); + btRigidBody* rb1 = ctrl1->GetRigidBody(); if (rb1) { - genericConstraint = new Generic6DofConstraint( + genericConstraint = new btGeneric6DofConstraint( *rb0,*rb1, frameInA,frameInB); genericConstraint->setLinearLowerLimit(linearMinLimits); @@ -1378,11 +602,13 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint( if (genericConstraint) { - m_constraints.push_back(genericConstraint); - genericConstraint->SetUserConstraintId(gConstraintUid++); - genericConstraint->SetUserConstraintType(PHY_GENERIC_6DOF_CONSTRAINT); + // m_constraints.push_back(genericConstraint); + m_dynamicsWorld->addConstraint(genericConstraint); + + genericConstraint->setUserConstraintId(gConstraintUid++); + genericConstraint->setUserConstraintType(PHY_GENERIC_6DOF_CONSTRAINT); //64 bit systems can't cast pointer to int. could use size_t instead. - return genericConstraint->GetUserConstraintId(); + return genericConstraint->getUserConstraintId(); } return 0; } @@ -1391,51 +617,49 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint( void CcdPhysicsEnvironment::removeConstraint(int constraintId) { - std::vector<TypedConstraint*>::iterator i; - - for (i=m_constraints.begin(); - !(i==m_constraints.end()); i++) + + int i; + int numConstraints = m_dynamicsWorld->getNumConstraints(); + for (i=0;i<numConstraints;i++) { - TypedConstraint* constraint = (*i); - if (constraint->GetUserConstraintId() == constraintId) + btTypedConstraint* constraint = m_dynamicsWorld->getConstraint(i); + if (constraint->getUserConstraintId() == constraintId) { - std::swap(*i, m_constraints.back()); - m_constraints.pop_back(); + m_dynamicsWorld->removeConstraint(constraint); break; } } - } - struct FilterClosestRayResultCallback : public CollisionWorld::ClosestRayResultCallback - { - PHY_IPhysicsController* m_ignoreClient; +struct FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResultCallback +{ + PHY_IPhysicsController* m_ignoreClient; - FilterClosestRayResultCallback (PHY_IPhysicsController* ignoreClient,const SimdVector3& rayFrom,const SimdVector3& rayTo) - : CollisionWorld::ClosestRayResultCallback(rayFrom,rayTo), - m_ignoreClient(ignoreClient) - { + FilterClosestRayResultCallback (PHY_IPhysicsController* ignoreClient,const btVector3& rayFrom,const btVector3& rayTo) + : btCollisionWorld::ClosestRayResultCallback(rayFrom,rayTo), + m_ignoreClient(ignoreClient) + { - } + } - virtual ~FilterClosestRayResultCallback() - { - } + virtual ~FilterClosestRayResultCallback() + { + } - virtual float AddSingleResult(const CollisionWorld::LocalRayResult& rayResult) - { - CcdPhysicsController* curHit = static_cast<CcdPhysicsController*>(rayResult.m_collisionObject->m_userPointer); - //ignore client... - if (curHit != m_ignoreClient) - { - //if valid - return ClosestRayResultCallback::AddSingleResult(rayResult); - } - return m_closestHitFraction; + virtual float AddSingleResult( btCollisionWorld::LocalRayResult& rayResult) + { + CcdPhysicsController* curHit = static_cast<CcdPhysicsController*>(rayResult.m_collisionObject->getUserPointer()); + //ignore client... + if (curHit != m_ignoreClient) + { + //if valid + return ClosestRayResultCallback::AddSingleResult(rayResult); } + return m_closestHitFraction; + } - }; +}; PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ) @@ -1444,23 +668,23 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController* i float minFraction = 1.f; - SimdVector3 rayFrom(fromX,fromY,fromZ); - SimdVector3 rayTo(toX,toY,toZ); + btVector3 rayFrom(fromX,fromY,fromZ); + btVector3 rayTo(toX,toY,toZ); - SimdVector3 hitPointWorld,normalWorld; + btVector3 hitPointWorld,normalWorld; //Either Ray Cast with or without filtering - //CollisionWorld::ClosestRayResultCallback rayCallback(rayFrom,rayTo); + //btCollisionWorld::ClosestRayResultCallback rayCallback(rayFrom,rayTo); FilterClosestRayResultCallback rayCallback(ignoreClient,rayFrom,rayTo); PHY_IPhysicsController* nearestHit = 0; - m_collisionWorld->RayTest(rayFrom,rayTo,rayCallback); + m_dynamicsWorld->rayTest(rayFrom,rayTo,rayCallback); if (rayCallback.HasHit()) { - nearestHit = static_cast<CcdPhysicsController*>(rayCallback.m_collisionObject->m_userPointer); + nearestHit = static_cast<CcdPhysicsController*>(rayCallback.m_collisionObject->getUserPointer()); hitX = rayCallback.m_hitPointWorld.getX(); hitY = rayCallback.m_hitPointWorld.getY(); hitZ = rayCallback.m_hitPointWorld.getZ(); @@ -1490,9 +714,9 @@ void CcdPhysicsEnvironment::getContactPoint(int i,float& hitX,float& hitY,float& -BroadphaseInterface* CcdPhysicsEnvironment::GetBroadphase() +btBroadphaseInterface* CcdPhysicsEnvironment::getBroadphase() { - return m_collisionWorld->GetBroadphase(); + return m_dynamicsWorld->getBroadphase(); } @@ -1510,9 +734,9 @@ CcdPhysicsEnvironment::~CcdPhysicsEnvironment() //first delete scene, then dispatcher, because pairs have to release manifolds on the dispatcher //delete m_dispatcher; - delete m_collisionWorld; + delete m_dynamicsWorld; - delete m_islandManager; + } @@ -1533,18 +757,22 @@ CcdPhysicsController* CcdPhysicsEnvironment::GetPhysicsController( int index) -TypedConstraint* CcdPhysicsEnvironment::getConstraintById(int constraintId) +btTypedConstraint* CcdPhysicsEnvironment::getConstraintById(int constraintId) { + return 0; + /* int numConstraint = m_constraints.size(); int i; for (i=0;i<numConstraint;i++) { - TypedConstraint* constraint = m_constraints[i]; - if (constraint->GetUserConstraintId()==constraintId) + btTypedConstraint* constraint = m_constraints[i]; + if (constraint->getUserConstraintId()==constraintId) { return constraint; } } + */ + return 0; } @@ -1627,32 +855,32 @@ void CcdPhysicsEnvironment::CallbackTriggers() CcdPhysicsController* ctrl0=0,*ctrl1=0; - if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawContactPoints))) + if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints))) { //walk over all overlapping pairs, and if one of the involved bodies is registered for trigger callback, perform callback - int numManifolds = m_collisionWorld->GetDispatcher()->GetNumManifolds(); + int numManifolds = m_dynamicsWorld->getDispatcher()->getNumManifolds(); for (int i=0;i<numManifolds;i++) { - PersistentManifold* manifold = m_collisionWorld->GetDispatcher()->GetManifoldByIndexInternal(i); - int numContacts = manifold->GetNumContacts(); + btPersistentManifold* manifold = m_dynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i); + int numContacts = manifold->getNumContacts(); if (numContacts) { - if (m_debugDrawer && (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawContactPoints)) + if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints)) { for (int j=0;j<numContacts;j++) { - SimdVector3 color(1,0,0); - const ManifoldPoint& cp = manifold->GetContactPoint(j); + btVector3 color(1,0,0); + const btManifoldPoint& cp = manifold->getContactPoint(j); if (m_debugDrawer) - m_debugDrawer->DrawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.GetDistance(),cp.GetLifeTime(),color); + m_debugDrawer->drawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.getDistance(),cp.getLifeTime(),color); } } - RigidBody* obj0 = static_cast<RigidBody* >(manifold->GetBody0()); - RigidBody* obj1 = static_cast<RigidBody* >(manifold->GetBody1()); + btRigidBody* obj0 = static_cast<btRigidBody* >(manifold->getBody0()); + btRigidBody* obj1 = static_cast<btRigidBody* >(manifold->getBody1()); - //m_userPointer is set in 'addPhysicsController - CcdPhysicsController* ctrl0 = static_cast<CcdPhysicsController*>(obj0->m_userPointer); - CcdPhysicsController* ctrl1 = static_cast<CcdPhysicsController*>(obj1->m_userPointer); + //m_internalOwner is set in 'addPhysicsController' + CcdPhysicsController* ctrl0 = static_cast<CcdPhysicsController*>(obj0->getUserPointer()); + CcdPhysicsController* ctrl1 = static_cast<CcdPhysicsController*>(obj1->getUserPointer()); std::vector<CcdPhysicsController*>::iterator i = std::find(m_triggerControllers.begin(), m_triggerControllers.end(), ctrl0); @@ -1692,7 +920,7 @@ PHY_IVehicle* CcdPhysicsEnvironment::getVehicleConstraint(int constraintId) for (i=0;i<numVehicles;i++) { WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i]; - if (wrapperVehicle->GetVehicle()->GetUserConstraintId() == constraintId) + if (wrapperVehicle->GetVehicle()->getUserConstraintId() == constraintId) return wrapperVehicle; } @@ -1702,132 +930,209 @@ PHY_IVehicle* CcdPhysicsEnvironment::getVehicleConstraint(int constraintId) #endif //NEW_BULLET_VEHICLE_SUPPORT +int currentController = 0; +int numController = 0; + -void CcdPhysicsEnvironment::UpdateAabbs(float timeStep) + + +PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const PHY__Vector3& position) { - std::vector<CcdPhysicsController*>::iterator i; - BroadphaseInterface* scene = GetBroadphase(); - - // - // update aabbs, only for moving objects (!) - // - for (i=m_controllers.begin(); - !(i==m_controllers.end()); i++) + + CcdConstructionInfo cinfo; + cinfo.m_collisionShape = new btSphereShape(radius); + cinfo.m_MotionState = 0; + cinfo.m_physicsEnv = this; + cinfo.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE; + DefaultMotionState* motionState = new DefaultMotionState(); + cinfo.m_MotionState = motionState; + motionState->m_worldTransform.setIdentity(); + motionState->m_worldTransform.setOrigin(btVector3(position[0],position[1],position[2])); + + CcdPhysicsController* sphereController = new CcdPhysicsController(cinfo); + + + return sphereController; +} + +int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl0,class PHY_IPhysicsController* ctrl1,PHY_ConstraintType type, + float pivotX,float pivotY,float pivotZ, + float axisX,float axisY,float axisZ) +{ + + + CcdPhysicsController* c0 = (CcdPhysicsController*)ctrl0; + CcdPhysicsController* c1 = (CcdPhysicsController*)ctrl1; + + btRigidBody* rb0 = c0 ? c0->GetRigidBody() : 0; + btRigidBody* rb1 = c1 ? c1->GetRigidBody() : 0; + + bool rb0static = rb0 ? rb0->isStaticOrKinematicObject() : true; + bool rb1static = rb1 ? rb1->isStaticOrKinematicObject() : true; + + + if (rb0static && rb1static) + return 0; + + + ASSERT(rb0); + + btVector3 pivotInA(pivotX,pivotY,pivotZ); + btVector3 pivotInB = rb1 ? rb1->getCenterOfMassTransform().inverse()(rb0->getCenterOfMassTransform()(pivotInA)) : pivotInA; + btVector3 axisInA(axisX,axisY,axisZ); + btVector3 axisInB = rb1 ? + (rb1->getCenterOfMassTransform().getBasis().inverse()*(rb0->getCenterOfMassTransform().getBasis() * axisInA)) : + rb0->getCenterOfMassTransform().getBasis() * axisInA; + + bool angularOnly = false; + + switch (type) + { + case PHY_POINT2POINT_CONSTRAINT: + { + + btPoint2PointConstraint* p2p = 0; + + if (rb1) { - CcdPhysicsController* ctrl = (*i); - RigidBody* body = ctrl->GetRigidBody(); + p2p = new btPoint2PointConstraint(*rb0, + *rb1,pivotInA,pivotInB); + } else + { + p2p = new btPoint2PointConstraint(*rb0, + pivotInA); + } + m_dynamicsWorld->addConstraint(p2p); +// m_constraints.push_back(p2p); - SimdPoint3 minAabb,maxAabb; - CollisionShape* shapeinterface = ctrl->GetCollisionShape(); + p2p->setUserConstraintId(gConstraintUid++); + p2p->setUserConstraintType(type); + //64 bit systems can't cast pointer to int. could use size_t instead. + return p2p->getUserConstraintId(); + break; + } + case PHY_GENERIC_6DOF_CONSTRAINT: + { + btGeneric6DofConstraint* genericConstraint = 0; - shapeinterface->CalculateTemporalAabb(body->getCenterOfMassTransform(), - body->getLinearVelocity(), - //body->getAngularVelocity(), - SimdVector3(0.f,0.f,0.f),//no angular effect for now //body->getAngularVelocity(), - timeStep,minAabb,maxAabb); + if (rb1) + { + btTransform frameInA; + btTransform frameInB; + + btVector3 axis1, axis2; + btPlaneSpace1( axisInA, axis1, axis2 ); + frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), + axisInA.y(), axis1.y(), axis2.y(), + axisInA.z(), axis1.z(), axis2.z() ); - SimdVector3 manifoldExtraExtents(gContactBreakingTreshold,gContactBreakingTreshold,gContactBreakingTreshold); - minAabb -= manifoldExtraExtents; - maxAabb += manifoldExtraExtents; + + btPlaneSpace1( axisInB, axis1, axis2 ); + frameInB.getBasis().setValue( axisInB.x(), axis1.x(), axis2.x(), + axisInB.y(), axis1.y(), axis2.y(), + axisInB.z(), axis1.z(), axis2.z() ); - BroadphaseProxy* bp = body->m_broadphaseHandle; - if (bp) - { + frameInA.setOrigin( pivotInA ); + frameInB.setOrigin( pivotInB ); - SimdVector3 color (1,1,0); - - if (m_debugDrawer) - { - //draw aabb - switch (body->GetActivationState()) - { - case ISLAND_SLEEPING: - { - color.setValue(1,1,1); - break; - } - case WANTS_DEACTIVATION: - { - color.setValue(0,0,1); - break; - } - case ACTIVE_TAG: - { - break; - } - case DISABLE_DEACTIVATION: - { - color.setValue(1,0,1); - }; - - }; - - if (m_debugDrawer->GetDebugMode() & IDebugDraw::DBG_DrawAabb) - { - DrawAabb(m_debugDrawer,minAabb,maxAabb,color); - } - } + genericConstraint = new btGeneric6DofConstraint( + *rb0,*rb1, + frameInA,frameInB); + + } else + { + // TODO: Implement single body case... + + } - if ( (maxAabb-minAabb).length2() < 1e12f) - { - scene->SetAabb(bp,minAabb,maxAabb); - } else - { - //something went wrong, investigate - //removeCcdPhysicsController(ctrl); - body->SetActivationState(DISABLE_SIMULATION); - - static bool reportMe = true; - if (reportMe) - { - reportMe = false; - printf("Overflow in AABB, object removed from simulation \n"); - printf("If you can reproduce this, please email bugs@continuousphysics.com\n"); - printf("Please include above information, your Platform, version of OS.\n"); - printf("Thanks.\n"); - } - - } - } + //m_constraints.push_back(genericConstraint); + m_dynamicsWorld->addConstraint(genericConstraint); + genericConstraint->setUserConstraintId(gConstraintUid++); + genericConstraint->setUserConstraintType(type); + //64 bit systems can't cast pointer to int. could use size_t instead. + return genericConstraint->getUserConstraintId(); + + break; + } + case PHY_ANGULAR_CONSTRAINT: + angularOnly = true; + + + case PHY_LINEHINGE_CONSTRAINT: + { + btHingeConstraint* hinge = 0; + + if (rb1) + { + hinge = new btHingeConstraint( + *rb0, + *rb1,pivotInA,pivotInB,axisInA,axisInB); + + + } else + { + hinge = new btHingeConstraint(*rb0, + pivotInA,axisInA); + } -} + hinge->setAngularOnly(angularOnly); -PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const PHY__Vector3& position) -{ - - CcdConstructionInfo cinfo; - cinfo.m_collisionShape = new SphereShape(radius); - cinfo.m_MotionState = 0; - cinfo.m_physicsEnv = this; - cinfo.m_collisionFlags |= CollisionObject::noContactResponse; - DefaultMotionState* motionState = new DefaultMotionState(); - cinfo.m_MotionState = motionState; - motionState->m_worldTransform.setIdentity(); - motionState->m_worldTransform.setOrigin(SimdVector3(position[0],position[1],position[2])); + //m_constraints.push_back(hinge); + m_dynamicsWorld->addConstraint(hinge); + hinge->setUserConstraintId(gConstraintUid++); + hinge->setUserConstraintType(type); + //64 bit systems can't cast pointer to int. could use size_t instead. + return hinge->getUserConstraintId(); + break; + } +#ifdef NEW_BULLET_VEHICLE_SUPPORT - CcdPhysicsController* sphereController = new CcdPhysicsController(cinfo); - + case PHY_VEHICLE_CONSTRAINT: + { + btRaycastVehicle::btVehicleTuning* tuning = new btRaycastVehicle::btVehicleTuning(); + btRigidBody* chassis = rb0; + btDefaultVehicleRaycaster* raycaster = new btDefaultVehicleRaycaster(m_dynamicsWorld); + btRaycastVehicle* vehicle = new btRaycastVehicle(*tuning,chassis,raycaster); + WrapperVehicle* wrapperVehicle = new WrapperVehicle(vehicle,ctrl0); + m_wrapperVehicles.push_back(wrapperVehicle); + m_dynamicsWorld->addVehicle(vehicle); + vehicle->setUserConstraintId(gConstraintUid++); + vehicle->setUserConstraintType(type); + return vehicle->getUserConstraintId(); + + break; + }; +#endif //NEW_BULLET_VEHICLE_SUPPORT + + default: + { + } + }; + + //btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB + + return 0; - return sphereController; } + PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float coneradius,float coneheight) { CcdConstructionInfo cinfo; - cinfo.m_collisionShape = new ConeShape(coneradius,coneheight); + cinfo.m_collisionShape = new btConeShape(coneradius,coneheight); cinfo.m_MotionState = 0; cinfo.m_physicsEnv = this; DefaultMotionState* motionState = new DefaultMotionState(); cinfo.m_MotionState = motionState; motionState->m_worldTransform.setIdentity(); -// motionState->m_worldTransform.setOrigin(SimdVector3(position[0],position[1],position[2])); +// motionState->m_worldTransform.setOrigin(btVector3(position[0],position[1],position[2])); CcdPhysicsController* sphereController = new CcdPhysicsController(cinfo); @@ -1837,16 +1142,16 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float conera float CcdPhysicsEnvironment::getAppliedImpulse(int constraintid) { - std::vector<TypedConstraint*>::iterator i; - - for (i=m_constraints.begin(); - !(i==m_constraints.end()); i++) + int i; + int numConstraints = m_dynamicsWorld->getNumConstraints(); + for (i=0;i<numConstraints;i++) { - TypedConstraint* constraint = (*i); - if (constraint->GetUserConstraintId() == constraintid) + btTypedConstraint* constraint = m_dynamicsWorld->getConstraint(i); + if (constraint->getUserConstraintId() == constraintid) { - return constraint->GetAppliedImpulse(); + return constraint->getAppliedImpulse(); } } + return 0.f; } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index a1f075e3882..7911c3d1ed9 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -19,41 +19,42 @@ subject to the following restrictions: #include "PHY_IPhysicsEnvironment.h" #include <vector> class CcdPhysicsController; -#include "SimdVector3.h" -#include "SimdTransform.h" +#include "LinearMath/btVector3.h" +#include "LinearMath/btTransform.h" -class TypedConstraint; -class SimulationIslandManager; -class CollisionDispatcher; -class Dispatcher; -//#include "BroadphaseInterface.h" +class btTypedConstraint; +class btSimulationIslandManager; +class btCollisionDispatcher; +class btDispatcher; +//#include "btBroadphaseInterface.h" //switch on/off new vehicle support #define NEW_BULLET_VEHICLE_SUPPORT 1 -#include "ConstraintSolver/ContactSolverInfo.h" +#include "BulletDynamics/ConstraintSolver/btContactSolverInfo.h" class WrapperVehicle; -class PersistentManifold; -class BroadphaseInterface; -class OverlappingPairCache; -class IDebugDraw; +class btPersistentManifold; +class btBroadphaseInterface; +class btOverlappingPairCache; +class btIDebugDraw; +class PHY_IVehicle; -/// CcdPhysicsEnvironment is experimental mainloop for physics simulation using optional continuous collision detection. +/// CcdPhysicsEnvironment is an experimental mainloop for physics simulation using optional continuous collision detection. /// Physics Environment takes care of stepping the simulation and is a container for physics entities. /// It stores rigidbodies,constraints, materials etc. /// A derived class may be able to 'construct' entities by loading and/or converting class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment { - SimdVector3 m_gravity; + btVector3 m_gravity; protected: - IDebugDraw* m_debugDrawer; + btIDebugDraw* m_debugDrawer; //solver iterations int m_numIterations; @@ -66,12 +67,11 @@ protected: int m_profileTimings; bool m_enableSatCollisionDetection; - ContactSolverInfo m_solverInfo; + btContactSolverInfo m_solverInfo; - SimulationIslandManager* m_islandManager; public: - CcdPhysicsEnvironment(Dispatcher* dispatcher=0, OverlappingPairCache* pairCache=0); + CcdPhysicsEnvironment(btDispatcher* dispatcher=0, btOverlappingPairCache* pairCache=0); virtual ~CcdPhysicsEnvironment(); @@ -81,7 +81,7 @@ protected: /// Perform an integration step of duration 'timeStep'. - virtual void setDebugDrawer(IDebugDraw* debugDrawer) + virtual void setDebugDrawer(btIDebugDraw* debugDrawer) { m_debugDrawer = debugDrawer; } @@ -107,7 +107,7 @@ protected: virtual void endFrame() {}; /// Perform an integration step of duration 'timeStep'. virtual bool proceedDeltaTime(double curTime,float timeStep); - virtual bool proceedDeltaTimeOneStep(float timeStep); +// virtual bool proceedDeltaTimeOneStep(float timeStep); virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep){}; //returns 0.f if no fixed timestep is used @@ -126,20 +126,20 @@ protected: //Following the COLLADA physics specification for constraints virtual int createUniversalD6Constraint( class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther, - SimdTransform& localAttachmentFrameRef, - SimdTransform& localAttachmentOther, - const SimdVector3& linearMinLimits, - const SimdVector3& linearMaxLimits, - const SimdVector3& angularMinLimits, - const SimdVector3& angularMaxLimits + btTransform& localAttachmentFrameRef, + btTransform& localAttachmentOther, + const btVector3& linearMinLimits, + const btVector3& linearMaxLimits, + const btVector3& angularMinLimits, + const btVector3& angularMaxLimits ); virtual void removeConstraint(int constraintid); - virtual float getAppliedImpulse(int constraintid); + virtual void CallbackTriggers(); @@ -153,7 +153,7 @@ protected: } #endif //NEW_BULLET_VEHICLE_SUPPORT - TypedConstraint* getConstraintById(int constraintId); + btTypedConstraint* getConstraintById(int constraintId); virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ, float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ); @@ -182,7 +182,7 @@ protected: void removeCcdPhysicsController(CcdPhysicsController* ctrl); - BroadphaseInterface* GetBroadphase(); + btBroadphaseInterface* getBroadphase(); @@ -198,40 +198,21 @@ protected: m_enableSatCollisionDetection = enableSat; } - void UpdateAabbs(float timeStep); - + int GetNumControllers(); CcdPhysicsController* GetPhysicsController( int index); - const PersistentManifold* GetManifold(int index) const; - - std::vector<TypedConstraint*> m_constraints; + const btPersistentManifold* GetManifold(int index) const; + void SyncMotionStates(float timeStep); - class CollisionWorld* GetCollisionWorld() - { - return m_collisionWorld; - } - - const class CollisionWorld* GetCollisionWorld() const - { - return m_collisionWorld; - } - - SimulationIslandManager* GetSimulationIslandManager() - { - return m_islandManager; - } - - const SimulationIslandManager* GetSimulationIslandManager() const - { - return m_islandManager; - } + + class btConstraintSolver* GetConstraintSolver(); protected: @@ -247,9 +228,9 @@ protected: std::vector<WrapperVehicle*> m_wrapperVehicles; - class CollisionWorld* m_collisionWorld; + class btDynamicsWorld* m_dynamicsWorld; - class ConstraintSolver* m_solver; + class btConstraintSolver* m_solver; bool m_scalingPropagated; diff --git a/source/gameengine/Physics/common/PHY_IVehicle.h b/source/gameengine/Physics/common/PHY_IVehicle.h index d5566ff5bb3..498df0dd840 100644 --- a/source/gameengine/Physics/common/PHY_IVehicle.h +++ b/source/gameengine/Physics/common/PHY_IVehicle.h @@ -50,6 +50,7 @@ public: virtual void SetRollInfluence(float rollInfluence,int wheelIndex) = 0; + virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0; }; |