| Bullet-C-Api.h | | Bullet-C-Api.h | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 68 | |
| | | | |
| /** Broadphase Scene/Proxy Handles (C-API)*/ | | /** Broadphase Scene/Proxy Handles (C-API)*/ | |
| PL_DECLARE_HANDLE(plCollisionBroadphaseHandle); | | PL_DECLARE_HANDLE(plCollisionBroadphaseHandle); | |
| PL_DECLARE_HANDLE(plBroadphaseProxyHandle); | | PL_DECLARE_HANDLE(plBroadphaseProxyHandle); | |
| PL_DECLARE_HANDLE(plCollisionWorldHandle); | | PL_DECLARE_HANDLE(plCollisionWorldHandle); | |
| | | | |
| /** | | /** | |
| Create and Delete a Physics SDK | | Create and Delete a Physics SDK | |
| */ | | */ | |
| | | | |
|
| extern plPhysicsSdkHandle plNewBulletSdk(); //this could be al
so another sdk, like ODE, PhysX etc. | | extern plPhysicsSdkHandle plNewBulletSdk(void); //this could b
e also another sdk, like ODE, PhysX etc. | |
| extern void plDeletePhysicsSdk(plPhysicsSdkHandle phys
icsSdk); | | extern void plDeletePhysicsSdk(plPhysicsSdkHandle phys
icsSdk); | |
| | | | |
| /** Collision World, not strictly necessary, you can also just create a Dyn
amics World with Rigid Bodies which internally manages the Collision World
with Collision Objects */ | | /** Collision World, not strictly necessary, you can also just create a Dyn
amics World with Rigid Bodies which internally manages the Collision World
with Collision Objects */ | |
| | | | |
| typedef void(*btBroadphaseCallback)(void* clientData, void* object1,
void* object2); | | typedef void(*btBroadphaseCallback)(void* clientData, void* object1,
void* object2); | |
| | | | |
| extern plCollisionBroadphaseHandle plCreateSapBroadphase(btBroa
dphaseCallback beginCallback,btBroadphaseCallback endCallback); | | extern plCollisionBroadphaseHandle plCreateSapBroadphase(btBroa
dphaseCallback beginCallback,btBroadphaseCallback endCallback); | |
| | | | |
| extern void plDestroyBroadphase(plCollisionBroadphaseHandle bp); | | extern void plDestroyBroadphase(plCollisionBroadphaseHandle bp); | |
| | | | |
| | | | |
| skipping to change at line 116 | | skipping to change at line 116 | |
| | | | |
| extern void plDeleteRigidBody(plRigidBodyHandle body); | | extern void plDeleteRigidBody(plRigidBodyHandle body); | |
| | | | |
| /* Collision Shape definition */ | | /* Collision Shape definition */ | |
| | | | |
| extern plCollisionShapeHandle plNewSphereShape(plReal radius); | | extern plCollisionShapeHandle plNewSphereShape(plReal radius); | |
| extern plCollisionShapeHandle plNewBoxShape(plReal x, plReal y, plR
eal z); | | extern plCollisionShapeHandle plNewBoxShape(plReal x, plReal y, plR
eal z); | |
| extern plCollisionShapeHandle plNewCapsuleShape(plReal radius, plRe
al height); | | extern plCollisionShapeHandle plNewCapsuleShape(plReal radius, plRe
al height); | |
| extern plCollisionShapeHandle plNewConeShape(plReal radius, plReal
height); | | extern plCollisionShapeHandle plNewConeShape(plReal radius, plReal
height); | |
| extern plCollisionShapeHandle plNewCylinderShape(plReal radius, plR
eal height); | | extern plCollisionShapeHandle plNewCylinderShape(plReal radius, plR
eal height); | |
|
| extern plCollisionShapeHandle plNewCompoundShape(); | | extern plCollisionShapeHandle plNewCompoundShape(void); | |
| extern void plAddChildShape(plCollisionShapeHandle compoundShape
,plCollisionShapeHandle childShape, plVector3 childPos,plQuaternion childOr
n); | | extern void plAddChildShape(plCollisionShapeHandle compoundShape
,plCollisionShapeHandle childShape, plVector3 childPos,plQuaternion childOr
n); | |
| | | | |
| extern void plDeleteShape(plCollisionShapeHandle shape); | | extern void plDeleteShape(plCollisionShapeHandle shape); | |
| | | | |
| /* Convex Meshes */ | | /* Convex Meshes */ | |
|
| extern plCollisionShapeHandle plNewConvexHullShape(); | | extern plCollisionShapeHandle plNewConvexHullShape(void); | |
| extern void plAddVertex(plCollisionShapeHandle convexHul
l, plReal x,plReal y,plReal z); | | extern void plAddVertex(plCollisionShapeHandle convexHul
l, plReal x,plReal y,plReal z); | |
| /* Concave static triangle meshes */ | | /* Concave static triangle meshes */ | |
|
| extern plMeshInterfaceHandle plNewMeshInterface(); | | extern plMeshInterfaceHandle plNewMeshInterface(void); | |
| extern void plAddTriangle(plMeshInterfaceHandle meshHand
le, plVector3 v0,plVector3 v1,plVector3 v2); | | extern void plAddTriangle(plMeshInterfaceHandle meshHand
le, plVector3 v0,plVector3 v1,plVector3 v2); | |
| extern plCollisionShapeHandle plNewStaticTriangleMeshShape(plMeshIn
terfaceHandle); | | extern plCollisionShapeHandle plNewStaticTriangleMeshShape(plMeshIn
terfaceHandle); | |
| | | | |
| extern void plSetScaling(plCollisionShapeHandle shape, plVector3 sc
aling); | | extern void plSetScaling(plCollisionShapeHandle shape, plVector3 sc
aling); | |
| | | | |
| /* SOLID has Response Callback/Table/Management */ | | /* SOLID has Response Callback/Table/Management */ | |
| /* PhysX has Triggers, User Callbacks and filtering */ | | /* PhysX has Triggers, User Callbacks and filtering */ | |
| /* ODE has the typedef void dNearCallback (void *data, dGeomID o1, dGeomID
o2); */ | | /* ODE has the typedef void dNearCallback (void *data, dGeomID o1, dGeomID
o2); */ | |
| | | | |
| /* typedef void plUpdatedPositionCallback(void* userData, plRigidBodyHa
ndle rbHandle, plVector3 pos); */ | | /* typedef void plUpdatedPositionCallback(void* userData, plRigidBodyHa
ndle rbHandle, plVector3 pos); */ | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| btBox2dBox2dCollisionAlgorithm.h | | btBox2dBox2dCollisionAlgorithm.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef BOX_2D_BOX_2D__COLLISION_ALGORITHM_H | | #ifndef BT_BOX_2D_BOX_2D__COLLISION_ALGORITHM_H | |
| #define BOX_2D_BOX_2D__COLLISION_ALGORITHM_H | | #define BT_BOX_2D_BOX_2D__COLLISION_ALGORITHM_H | |
| | | | |
| #include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.
h" | | #include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.
h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | |
| #include "BulletCollision/BroadphaseCollision/btDispatcher.h" | | #include "BulletCollision/BroadphaseCollision/btDispatcher.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | | #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | |
| | | | |
| class btPersistentManifold; | | class btPersistentManifold; | |
| | | | |
| ///box-box collision detection | | ///box-box collision detection | |
| class btBox2dBox2dCollisionAlgorithm : public btActivatingCollisionAlgorith
m | | class btBox2dBox2dCollisionAlgorithm : public btActivatingCollisionAlgorith
m | |
| | | | |
| skipping to change at line 64 | | skipping to change at line 64 | |
| virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol
lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb
ject* body1) | | virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol
lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb
ject* body1) | |
| { | | { | |
| int bbsize = sizeof(btBox2dBox2dCollisionAlgorithm); | | int bbsize = sizeof(btBox2dBox2dCollisionAlgorithm); | |
| void* ptr = ci.m_dispatcher1->allocateCollisionAlgor
ithm(bbsize); | | void* ptr = ci.m_dispatcher1->allocateCollisionAlgor
ithm(bbsize); | |
| return new(ptr) btBox2dBox2dCollisionAlgorithm(0,ci,
body0,body1); | | return new(ptr) btBox2dBox2dCollisionAlgorithm(0,ci,
body0,body1); | |
| } | | } | |
| }; | | }; | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //BOX_2D_BOX_2D__COLLISION_ALGORITHM_H | | #endif //BT_BOX_2D_BOX_2D__COLLISION_ALGORITHM_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btBoxShape.h | | btBoxShape.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef OBB_BOX_MINKOWSKI_H | | #ifndef BT_OBB_BOX_MINKOWSKI_H | |
| #define OBB_BOX_MINKOWSKI_H | | #define BT_OBB_BOX_MINKOWSKI_H | |
| | | | |
| #include "btPolyhedralConvexShape.h" | | #include "btPolyhedralConvexShape.h" | |
| #include "btCollisionMargin.h" | | #include "btCollisionMargin.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "LinearMath/btMinMax.h" | | #include "LinearMath/btMinMax.h" | |
| | | | |
| ///The btBoxShape is a box primitive around the origin, its sides axis alig
ned with length specified by half extents, in local shape coordinates. When
used as part of a btCollisionObject or btRigidBody it will be an oriented
box in world space. | | ///The btBoxShape is a box primitive around the origin, its sides axis alig
ned with length specified by half extents, in local shape coordinates. When
used as part of a btCollisionObject or btRigidBody it will be an oriented
box in world space. | |
| class btBoxShape: public btPolyhedralConvexShape | | class btBoxShape: public btPolyhedralConvexShape | |
| { | | { | |
| | | | |
| skipping to change at line 141 | | skipping to change at line 141 | |
| return 8; | | return 8; | |
| } | | } | |
| | | | |
| virtual int getNumEdges() const | | virtual int getNumEdges() const | |
| { | | { | |
| return 12; | | return 12; | |
| } | | } | |
| | | | |
| virtual void getVertex(int i,btVector3& vtx) const | | virtual void getVertex(int i,btVector3& vtx) const | |
| { | | { | |
|
| btVector3 halfExtents = getHalfExtentsWithoutMargin(); | | btVector3 halfExtents = getHalfExtentsWithMargin(); | |
| | | | |
| vtx = btVector3( | | vtx = btVector3( | |
| halfExtents.x() * (1-(i&1)) - halfExtents.x(
) * (i&1), | | halfExtents.x() * (1-(i&1)) - halfExtents.x(
) * (i&1), | |
| halfExtents.y() * (1-((i&2)>>1)) - halfExten
ts.y() * ((i&2)>>1), | | halfExtents.y() * (1-((i&2)>>1)) - halfExten
ts.y() * ((i&2)>>1), | |
| halfExtents.z() * (1-((i&4)>>2)) - halfExten
ts.z() * ((i&4)>>2)); | | halfExtents.z() * (1-((i&4)>>2)) - halfExten
ts.z() * ((i&4)>>2)); | |
| } | | } | |
| | | | |
| virtual void getPlaneEquation(btVector4& plane,int i) const | | virtual void getPlaneEquation(btVector4& plane,int i) const | |
| { | | { | |
| btVector3 halfExtents = getHalfExtentsWithoutMargin(); | | btVector3 halfExtents = getHalfExtentsWithoutMargin(); | |
| | | | |
| skipping to change at line 301 | | skipping to change at line 301 | |
| case 5: | | case 5: | |
| penetrationVector.setValue(btScalar(0.),btScalar(0.)
,btScalar(-1.)); | | penetrationVector.setValue(btScalar(0.),btScalar(0.)
,btScalar(-1.)); | |
| break; | | break; | |
| default: | | default: | |
| btAssert(0); | | btAssert(0); | |
| } | | } | |
| } | | } | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //OBB_BOX_MINKOWSKI_H | | #endif //BT_OBB_BOX_MINKOWSKI_H | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| btBvhTriangleMeshShape.h | | btBvhTriangleMeshShape.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef BVH_TRIANGLE_MESH_SHAPE_H | | #ifndef BT_BVH_TRIANGLE_MESH_SHAPE_H | |
| #define BVH_TRIANGLE_MESH_SHAPE_H | | #define BT_BVH_TRIANGLE_MESH_SHAPE_H | |
| | | | |
| #include "btTriangleMeshShape.h" | | #include "btTriangleMeshShape.h" | |
| #include "btOptimizedBvh.h" | | #include "btOptimizedBvh.h" | |
| #include "LinearMath/btAlignedAllocator.h" | | #include "LinearMath/btAlignedAllocator.h" | |
| #include "btTriangleInfoMap.h" | | #include "btTriangleInfoMap.h" | |
| | | | |
| ///The btBvhTriangleMeshShape is a static-triangle mesh shape with several
optimizations, such as bounding volume hierarchy and cache friendly travers
al for PlayStation 3 Cell SPU. It is recommended to enable useQuantizedAabb
Compression for better memory usage. | | ///The btBvhTriangleMeshShape is a static-triangle mesh shape with several
optimizations, such as bounding volume hierarchy and cache friendly travers
al for PlayStation 3 Cell SPU. It is recommended to enable useQuantizedAabb
Compression for better memory usage. | |
| ///It takes a triangle mesh as input, for example a btTriangleMesh or btTri
angleIndexVertexArray. The btBvhTriangleMeshShape class allows for triangle
mesh deformations by a refit or partialRefit method. | | ///It takes a triangle mesh as input, for example a btTriangleMesh or btTri
angleIndexVertexArray. The btBvhTriangleMeshShape class allows for triangle
mesh deformations by a refit or partialRefit method. | |
| ///Instead of building the bounding volume hierarchy acceleration structure
, it is also possible to serialize (save) and deserialize (load) the struct
ure from disk. | | ///Instead of building the bounding volume hierarchy acceleration structure
, it is also possible to serialize (save) and deserialize (load) the struct
ure from disk. | |
| ///See Demos\ConcaveDemo\ConcavePhysicsDemo.cpp for an example. | | ///See Demos\ConcaveDemo\ConcavePhysicsDemo.cpp for an example. | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| btTriangleInfoMap* m_triangleInfoMap; | | btTriangleInfoMap* m_triangleInfoMap; | |
| | | | |
| bool m_useQuantizedAabbCompression; | | bool m_useQuantizedAabbCompression; | |
| bool m_ownsBvh; | | bool m_ownsBvh; | |
| bool m_pad[11];////need padding due to alignment | | bool m_pad[11];////need padding due to alignment | |
| | | | |
| public: | | public: | |
| | | | |
| BT_DECLARE_ALIGNED_ALLOCATOR(); | | BT_DECLARE_ALIGNED_ALLOCATOR(); | |
| | | | |
|
| btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_triangl
eInfoMap(0),m_ownsBvh(false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;}
; | | | |
| btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool
useQuantizedAabbCompression, bool buildBvh = true); | | btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool
useQuantizedAabbCompression, bool buildBvh = true); | |
| | | | |
| ///optionally pass in a larger bvh aabb, used for quantization. This
allows for deformations within this aabb | | ///optionally pass in a larger bvh aabb, used for quantization. This
allows for deformations within this aabb | |
| btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool
useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bv
hAabbMax, bool buildBvh = true); | | btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool
useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bv
hAabbMax, bool buildBvh = true); | |
| | | | |
| virtual ~btBvhTriangleMeshShape(); | | virtual ~btBvhTriangleMeshShape(); | |
| | | | |
| bool getOwnsBvh () const | | bool getOwnsBvh () const | |
| { | | { | |
| return m_ownsBvh; | | return m_ownsBvh; | |
| | | | |
| skipping to change at line 133 | | skipping to change at line 132 | |
| | | | |
| char m_pad3[4]; | | char m_pad3[4]; | |
| | | | |
| }; | | }; | |
| | | | |
| SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBu
fferSize() const | | SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBu
fferSize() const | |
| { | | { | |
| return sizeof(btTriangleMeshShapeData); | | return sizeof(btTriangleMeshShapeData); | |
| } | | } | |
| | | | |
|
| #endif //BVH_TRIANGLE_MESH_SHAPE_H | | #endif //BT_BVH_TRIANGLE_MESH_SHAPE_H | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 2 lines changed or added | |
|
| btCollisionAlgorithm.h | | btCollisionAlgorithm.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef COLLISION_ALGORITHM_H | | #ifndef BT_COLLISION_ALGORITHM_H | |
| #define COLLISION_ALGORITHM_H | | #define BT_COLLISION_ALGORITHM_H | |
| | | | |
| #include "LinearMath/btScalar.h" | | #include "LinearMath/btScalar.h" | |
| #include "LinearMath/btAlignedObjectArray.h" | | #include "LinearMath/btAlignedObjectArray.h" | |
| | | | |
| struct btBroadphaseProxy; | | struct btBroadphaseProxy; | |
| class btDispatcher; | | class btDispatcher; | |
| class btManifoldResult; | | class btManifoldResult; | |
| class btCollisionObject; | | class btCollisionObject; | |
| struct btDispatcherInfo; | | struct btDispatcherInfo; | |
| class btPersistentManifold; | | class btPersistentManifold; | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| } | | } | |
| btCollisionAlgorithmConstructionInfo(btDispatcher* dispatcher,int te
mp) | | btCollisionAlgorithmConstructionInfo(btDispatcher* dispatcher,int te
mp) | |
| :m_dispatcher1(dispatcher) | | :m_dispatcher1(dispatcher) | |
| { | | { | |
| (void)temp; | | (void)temp; | |
| } | | } | |
| | | | |
| btDispatcher* m_dispatcher1; | | btDispatcher* m_dispatcher1; | |
| btPersistentManifold* m_manifold; | | btPersistentManifold* m_manifold; | |
| | | | |
|
| int getDispatcherId(); | | // int getDispatcherId(); | |
| | | | |
| }; | | }; | |
| | | | |
| ///btCollisionAlgorithm is an collision interface that is compatible with t
he Broadphase and btDispatcher. | | ///btCollisionAlgorithm is an collision interface that is compatible with t
he Broadphase and btDispatcher. | |
| ///It is persistent over frames | | ///It is persistent over frames | |
| class btCollisionAlgorithm | | class btCollisionAlgorithm | |
| { | | { | |
| | | | |
| protected: | | protected: | |
| | | | |
| btDispatcher* m_dispatcher; | | btDispatcher* m_dispatcher; | |
| | | | |
| protected: | | protected: | |
|
| int getDispatcherId(); | | // int getDispatcherId(); | |
| | | | |
| public: | | public: | |
| | | | |
| btCollisionAlgorithm() {}; | | btCollisionAlgorithm() {}; | |
| | | | |
| btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
; | | btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci)
; | |
| | | | |
| virtual ~btCollisionAlgorithm() {}; | | virtual ~btCollisionAlgorithm() {}; | |
| | | | |
| virtual void processCollision (btCollisionObject* body0,btCollisionO
bject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultO
ut) = 0; | | virtual void processCollision (btCollisionObject* body0,btCollisionO
bject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultO
ut) = 0; | |
| | | | |
| virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCo
llisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult*
resultOut) = 0; | | virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCo
llisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult*
resultOut) = 0; | |
| | | | |
| virtual void getAllContactManifolds(btManifoldArray& manifoldArra
y) = 0; | | virtual void getAllContactManifolds(btManifoldArray& manifoldArra
y) = 0; | |
| }; | | }; | |
| | | | |
|
| #endif //COLLISION_ALGORITHM_H | | #endif //BT_COLLISION_ALGORITHM_H | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| btCollisionDispatcher.h | | btCollisionDispatcher.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef COLLISION__DISPATCHER_H | | #ifndef BT_COLLISION__DISPATCHER_H | |
| #define COLLISION__DISPATCHER_H | | #define BT_COLLISION__DISPATCHER_H | |
| | | | |
| #include "BulletCollision/BroadphaseCollision/btDispatcher.h" | | #include "BulletCollision/BroadphaseCollision/btDispatcher.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | | #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | |
| | | | |
| #include "BulletCollision/CollisionDispatch/btManifoldResult.h" | | #include "BulletCollision/CollisionDispatch/btManifoldResult.h" | |
| | | | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | |
| #include "LinearMath/btAlignedObjectArray.h" | | #include "LinearMath/btAlignedObjectArray.h" | |
| | | | |
| class btIDebugDraw; | | class btIDebugDraw; | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| #define USE_DISPATCH_REGISTRY_ARRAY 1 | | #define USE_DISPATCH_REGISTRY_ARRAY 1 | |
| | | | |
| class btCollisionDispatcher; | | class btCollisionDispatcher; | |
| ///user can override this nearcallback for collision filtering and more fin
egrained control over collision detection | | ///user can override this nearcallback for collision filtering and more fin
egrained control over collision detection | |
| typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollision
Dispatcher& dispatcher, const btDispatcherInfo& dispatchInfo); | | typedef void (*btNearCallback)(btBroadphasePair& collisionPair, btCollision
Dispatcher& dispatcher, const btDispatcherInfo& dispatchInfo); | |
| | | | |
| ///btCollisionDispatcher supports algorithms that handle ConvexConvex and C
onvexConcave collision pairs. | | ///btCollisionDispatcher supports algorithms that handle ConvexConvex and C
onvexConcave collision pairs. | |
| ///Time of Impact, Closest Points and Penetration Depth. | | ///Time of Impact, Closest Points and Penetration Depth. | |
| class btCollisionDispatcher : public btDispatcher | | class btCollisionDispatcher : public btDispatcher | |
| { | | { | |
|
| | | | |
| | | protected: | |
| | | | |
| int m_dispatcherFlags; | | int m_dispatcherFlags; | |
| | | | |
| btAlignedObjectArray<btPersistentManifold*> m_manifoldsPtr; | | btAlignedObjectArray<btPersistentManifold*> m_manifoldsPtr; | |
| | | | |
| btManifoldResult m_defaultManifoldResult; | | btManifoldResult m_defaultManifoldResult; | |
| | | | |
| btNearCallback m_nearCallback; | | btNearCallback m_nearCallback; | |
| | | | |
| btPoolAllocator* m_collisionAlgorithmPoolAllocator; | | btPoolAllocator* m_collisionAlgorithmPoolAllocator; | |
| | | | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 68 | |
| | | | |
| btCollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLL
ISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES]; | | btCollisionAlgorithmCreateFunc* m_doubleDispatch[MAX_BROADPHASE_COLL
ISION_TYPES][MAX_BROADPHASE_COLLISION_TYPES]; | |
| | | | |
| btCollisionConfiguration* m_collisionConfiguration; | | btCollisionConfiguration* m_collisionConfiguration; | |
| | | | |
| public: | | public: | |
| | | | |
| enum DispatcherFlags | | enum DispatcherFlags | |
| { | | { | |
| CD_STATIC_STATIC_REPORTED = 1, | | CD_STATIC_STATIC_REPORTED = 1, | |
|
| CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD = 2 | | CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD = 2, | |
| | | CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION = 4 | |
| }; | | }; | |
| | | | |
| int getDispatcherFlags() const | | int getDispatcherFlags() const | |
| { | | { | |
| return m_dispatcherFlags; | | return m_dispatcherFlags; | |
| } | | } | |
| | | | |
| void setDispatcherFlags(int flags) | | void setDispatcherFlags(int flags) | |
| { | | { | |
|
| (void) flags; | | m_dispatcherFlags = flags; | |
| m_dispatcherFlags = 0; | | | |
| } | | } | |
| | | | |
| ///registerCollisionCreateFunc allows registration of custom/alterna
tive collision create functions | | ///registerCollisionCreateFunc allows registration of custom/alterna
tive collision create functions | |
| void registerCollisionCreateFunc(int proxyType0,int proxyType1, b
tCollisionAlgorithmCreateFunc* createFunc); | | void registerCollisionCreateFunc(int proxyType0,int proxyType1, b
tCollisionAlgorithmCreateFunc* createFunc); | |
| | | | |
| int getNumManifolds() const | | int getNumManifolds() const | |
| { | | { | |
| return int( m_manifoldsPtr.size()); | | return int( m_manifoldsPtr.size()); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 152 | | skipping to change at line 155 | |
| const btCollisionConfiguration* getCollisionConfiguration() const | | const btCollisionConfiguration* getCollisionConfiguration() const | |
| { | | { | |
| return m_collisionConfiguration; | | return m_collisionConfiguration; | |
| } | | } | |
| | | | |
| void setCollisionConfiguration(btCollisionConfiguration* config) | | void setCollisionConfiguration(btCollisionConfiguration* config) | |
| { | | { | |
| m_collisionConfiguration = config; | | m_collisionConfiguration = config; | |
| } | | } | |
| | | | |
|
| | | virtual btPoolAllocator* getInternalManifoldPool() | |
| | | { | |
| | | return m_persistentManifoldPoolAllocator; | |
| | | } | |
| | | | |
| | | virtual const btPoolAllocator* getInternalManifoldPool() const | |
| | | { | |
| | | return m_persistentManifoldPoolAllocator; | |
| | | } | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //COLLISION__DISPATCHER_H | | #endif //BT_COLLISION__DISPATCHER_H | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 18 lines changed or added | |
|
| btCompoundShape.h | | btCompoundShape.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef COMPOUND_SHAPE_H | | #ifndef BT_COMPOUND_SHAPE_H | |
| #define COMPOUND_SHAPE_H | | #define BT_COMPOUND_SHAPE_H | |
| | | | |
| #include "btCollisionShape.h" | | #include "btCollisionShape.h" | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "LinearMath/btTransform.h" | | #include "LinearMath/btTransform.h" | |
| #include "LinearMath/btMatrix3x3.h" | | #include "LinearMath/btMatrix3x3.h" | |
| #include "btCollisionMargin.h" | | #include "btCollisionMargin.h" | |
| #include "LinearMath/btAlignedObjectArray.h" | | #include "LinearMath/btAlignedObjectArray.h" | |
| | | | |
| //class btOptimizedBvh; | | //class btOptimizedBvh; | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 108 | |
| btTransform& getChildTransform(int index) | | btTransform& getChildTransform(int index) | |
| { | | { | |
| return m_children[index].m_transform; | | return m_children[index].m_transform; | |
| } | | } | |
| const btTransform& getChildTransform(int index) const | | const btTransform& getChildTransform(int index) const | |
| { | | { | |
| return m_children[index].m_transform; | | return m_children[index].m_transform; | |
| } | | } | |
| | | | |
| ///set a new transform for a child, and update internal data structu
res (local aabb and dynamic tree) | | ///set a new transform for a child, and update internal data structu
res (local aabb and dynamic tree) | |
|
| void updateChildTransform(int childIndex, const btTransform& newC
hildTransform); | | void updateChildTransform(int childIndex, const btTransform& newC
hildTransform, bool shouldRecalculateLocalAabb = true); | |
| | | | |
| btCompoundShapeChild* getChildList() | | btCompoundShapeChild* getChildList() | |
| { | | { | |
| return &m_children[0]; | | return &m_children[0]; | |
| } | | } | |
| | | | |
| ///getAabb's default implementation is brute force, expected derived
classes to implement a fast dedicated version | | ///getAabb's default implementation is brute force, expected derived
classes to implement a fast dedicated version | |
| virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto
r3& aabbMax) const; | | virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto
r3& aabbMax) const; | |
| | | | |
| /** Re-calculate the local Aabb. Is called at the end of removeChild
Shapes. | | /** Re-calculate the local Aabb. Is called at the end of removeChild
Shapes. | |
| | | | |
| skipping to change at line 144 | | skipping to change at line 144 | |
| } | | } | |
| virtual btScalar getMargin() const | | virtual btScalar getMargin() const | |
| { | | { | |
| return m_collisionMargin; | | return m_collisionMargin; | |
| } | | } | |
| virtual const char* getName()const | | virtual const char* getName()const | |
| { | | { | |
| return "Compound"; | | return "Compound"; | |
| } | | } | |
| | | | |
|
| btDbvt* getDynamicAa | | const btDbvt* getDynamicAabbTree() const | |
| bbTree() | | { | |
| | | return m_dynamicAabbTree; | |
| | | } | |
| | | | |
| | | btDbvt* getDynamicAabbTree() | |
| { | | { | |
| return m_dynamicAabbTree; | | return m_dynamicAabbTree; | |
| } | | } | |
| | | | |
| void createAabbTreeFromChildren(); | | void createAabbTreeFromChildren(); | |
| | | | |
| ///computes the exact moment of inertia and the transform from the c
oordinate system defined by the principal axes of the moment of inertia | | ///computes the exact moment of inertia and the transform from the c
oordinate system defined by the principal axes of the moment of inertia | |
| ///and the center of mass to the current coordinate system. "masses"
points to an array of masses of the children. The resulting transform | | ///and the center of mass to the current coordinate system. "masses"
points to an array of masses of the children. The resulting transform | |
| ///"principal" has to be applied inversely to all children transform
s in order for the local coordinate system of the compound | | ///"principal" has to be applied inversely to all children transform
s in order for the local coordinate system of the compound | |
| ///shape to be centered at the center of mass and to coincide with t
he principal axes. This also necessitates a correction of the world transfo
rm | | ///shape to be centered at the center of mass and to coincide with t
he principal axes. This also necessitates a correction of the world transfo
rm | |
| | | | |
| skipping to change at line 197 | | skipping to change at line 202 | |
| | | | |
| float m_collisionMargin; | | float m_collisionMargin; | |
| | | | |
| }; | | }; | |
| | | | |
| SIMD_FORCE_INLINE int btCompoundShape::calculateSerializeBufferSiz
e() const | | SIMD_FORCE_INLINE int btCompoundShape::calculateSerializeBufferSiz
e() const | |
| { | | { | |
| return sizeof(btCompoundShapeData); | | return sizeof(btCompoundShapeData); | |
| } | | } | |
| | | | |
|
| #endif //COMPOUND_SHAPE_H | | #endif //BT_COMPOUND_SHAPE_H | |
| | | | |
End of changes. 4 change blocks. |
| 5 lines changed or deleted | | 9 lines changed or added | |
|
| btConeShape.h | | btConeShape.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONE_MINKOWSKI_H | | #ifndef BT_CONE_MINKOWSKI_H | |
| #define CONE_MINKOWSKI_H | | #define BT_CONE_MINKOWSKI_H | |
| | | | |
| #include "btConvexInternalShape.h" | | #include "btConvexInternalShape.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for t
he types | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for t
he types | |
| | | | |
| ///The btConeShape implements a cone shape primitive, centered around the o
rigin and aligned with the Y axis. The btConeShapeX is aligned around the X
axis and btConeShapeZ around the Z axis. | | ///The btConeShape implements a cone shape primitive, centered around the o
rigin and aligned with the Y axis. The btConeShapeX is aligned around the X
axis and btConeShapeZ around the Z axis. | |
| class btConeShape : public btConvexInternalShape | | class btConeShape : public btConvexInternalShape | |
| | | | |
| { | | { | |
| | | | |
| btScalar m_sinAngle; | | btScalar m_sinAngle; | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| return "Cone"; | | return "Cone"; | |
| } | | } | |
| | | | |
| ///choose upAxis index | | ///choose upAxis index | |
| void setConeUpIndex(int upIndex); | | void setConeUpIndex(int upIndex); | |
| | | | |
| int getConeUpIndex() const | | int getConeUpIndex() const | |
| { | | { | |
| return m_coneIndices[1]; | | return m_coneIndices[1]; | |
| } | | } | |
|
| | | | |
| | | virtual void setLocalScaling(const btVector3& scaling); | |
| | | | |
| }; | | }; | |
| | | | |
| ///btConeShape implements a Cone shape, around the X axis | | ///btConeShape implements a Cone shape, around the X axis | |
| class btConeShapeX : public btConeShape | | class btConeShapeX : public btConeShape | |
| { | | { | |
| public: | | public: | |
| btConeShapeX(btScalar radius,btScalar height); | | btConeShapeX(btScalar radius,btScalar height); | |
| }; | | }; | |
| | | | |
| ///btConeShapeZ implements a Cone shape, around the Z axis | | ///btConeShapeZ implements a Cone shape, around the Z axis | |
| class btConeShapeZ : public btConeShape | | class btConeShapeZ : public btConeShape | |
| { | | { | |
| public: | | public: | |
| btConeShapeZ(btScalar radius,btScalar height); | | btConeShapeZ(btScalar radius,btScalar height); | |
| }; | | }; | |
|
| #endif //CONE_MINKOWSKI_H | | #endif //BT_CONE_MINKOWSKI_H | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 5 lines changed or added | |
|
| btConeTwistConstraint.h | | btConeTwistConstraint.h | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| It is a fixed translation, 3 degree-of-freedom (DOF) rotational "joint". | | It is a fixed translation, 3 degree-of-freedom (DOF) rotational "joint". | |
| It divides the 3 rotational DOFs into swing (movement within a cone) and tw
ist. | | It divides the 3 rotational DOFs into swing (movement within a cone) and tw
ist. | |
| Swing is divided into swing1 and swing2 which can have different limits, gi
ving an elliptical shape. | | Swing is divided into swing1 and swing2 which can have different limits, gi
ving an elliptical shape. | |
| (Note: the cone's base isn't flat, so this ellipse is "embedded" on the sur
face of a sphere.) | | (Note: the cone's base isn't flat, so this ellipse is "embedded" on the sur
face of a sphere.) | |
| | | | |
| In the contraint's frame of reference: | | In the contraint's frame of reference: | |
| twist is along the x-axis, | | twist is along the x-axis, | |
| and swing 1 and 2 are along the z and y axes respectively. | | and swing 1 and 2 are along the z and y axes respectively. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONETWISTCONSTRAINT_H | | #ifndef BT_CONETWISTCONSTRAINT_H | |
| #define CONETWISTCONSTRAINT_H | | #define BT_CONETWISTCONSTRAINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btJacobianEntry.h" | | #include "btJacobianEntry.h" | |
| #include "btTypedConstraint.h" | | #include "btTypedConstraint.h" | |
| | | | |
| class btRigidBody; | | class btRigidBody; | |
| | | | |
| enum btConeTwistFlags | | enum btConeTwistFlags | |
| { | | { | |
| BT_CONETWIST_FLAGS_LIN_CFM = 1, | | BT_CONETWIST_FLAGS_LIN_CFM = 1, | |
| | | | |
| skipping to change at line 265 | | skipping to change at line 265 | |
| void setMotorTarget(const btQuaternion &q); | | void setMotorTarget(const btQuaternion &q); | |
| | | | |
| // same as above, but q is the desired rotation of frameA wrt frameB
in constraint space | | // same as above, but q is the desired rotation of frameA wrt frameB
in constraint space | |
| void setMotorTargetInConstraintSpace(const btQuaternion &q); | | void setMotorTargetInConstraintSpace(const btQuaternion &q); | |
| | | | |
| btVector3 GetPointForAngle(btScalar fAngleInRadians, btScalar fLengt
h) const; | | btVector3 GetPointForAngle(btScalar fAngleInRadians, btScalar fLengt
h) const; | |
| | | | |
| ///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5). | | ///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5). | |
| ///If no axis is provided, it uses the default axis for this constra
int. | | ///If no axis is provided, it uses the default axis for this constra
int. | |
| virtual void setParam(int num, btScalar value, int axis = -1); | | virtual void setParam(int num, btScalar value, int axis = -1); | |
|
| | | | |
| | | virtual void setFrames(const btTransform& frameA, const btTransform& | |
| | | frameB); | |
| | | | |
| | | const btTransform& getFrameOffsetA() const | |
| | | { | |
| | | return m_rbAFrame; | |
| | | } | |
| | | | |
| | | const btTransform& getFrameOffsetB() const | |
| | | { | |
| | | return m_rbBFrame; | |
| | | } | |
| | | | |
| ///return the local value of parameter | | ///return the local value of parameter | |
| virtual btScalar getParam(int num, int axis = -1) const; | | virtual btScalar getParam(int num, int axis = -1) const; | |
| | | | |
| virtual int calculateSerializeBufferSize() const; | | virtual int calculateSerializeBufferSize() const; | |
| | | | |
| ///fills the dataBuffer and returns the struct name (and 0 on failur
e) | | ///fills the dataBuffer and returns the struct name (and 0 on failur
e) | |
| virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const; | | virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const; | |
| | | | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 322 | | skipping to change at line 335 | |
| cone->m_swingSpan2 = float(m_swingSpan2); | | cone->m_swingSpan2 = float(m_swingSpan2); | |
| cone->m_twistSpan = float(m_twistSpan); | | cone->m_twistSpan = float(m_twistSpan); | |
| cone->m_limitSoftness = float(m_limitSoftness); | | cone->m_limitSoftness = float(m_limitSoftness); | |
| cone->m_biasFactor = float(m_biasFactor); | | cone->m_biasFactor = float(m_biasFactor); | |
| cone->m_relaxationFactor = float(m_relaxationFactor); | | cone->m_relaxationFactor = float(m_relaxationFactor); | |
| cone->m_damping = float(m_damping); | | cone->m_damping = float(m_damping); | |
| | | | |
| return "btConeTwistConstraintData"; | | return "btConeTwistConstraintData"; | |
| } | | } | |
| | | | |
|
| #endif //CONETWISTCONSTRAINT_H | | #endif //BT_CONETWISTCONSTRAINT_H | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 16 lines changed or added | |
|
| btConstraintSolver.h | | btConstraintSolver.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONSTRAINT_SOLVER_H | | #ifndef BT_CONSTRAINT_SOLVER_H | |
| #define CONSTRAINT_SOLVER_H | | #define BT_CONSTRAINT_SOLVER_H | |
| | | | |
| #include "LinearMath/btScalar.h" | | #include "LinearMath/btScalar.h" | |
| | | | |
| class btPersistentManifold; | | class btPersistentManifold; | |
| class btRigidBody; | | class btRigidBody; | |
| class btCollisionObject; | | class btCollisionObject; | |
| class btTypedConstraint; | | class btTypedConstraint; | |
| struct btContactSolverInfo; | | struct btContactSolverInfo; | |
| struct btBroadphaseProxy; | | struct btBroadphaseProxy; | |
| class btIDebugDraw; | | class btIDebugDraw; | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| | | | |
| ///solve a group of constraints | | ///solve a group of constraints | |
| virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies
,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** const
raints,int numConstraints, const btContactSolverInfo& info,class btIDebugDr
aw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher) = 0; | | virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies
,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** const
raints,int numConstraints, const btContactSolverInfo& info,class btIDebugDr
aw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher) = 0; | |
| | | | |
| virtual void allSolved (const btContactSolverInfo& /* info */,class
btIDebugDraw* /* debugDrawer */, btStackAlloc* /* stackAlloc */) {;} | | virtual void allSolved (const btContactSolverInfo& /* info */,class
btIDebugDraw* /* debugDrawer */, btStackAlloc* /* stackAlloc */) {;} | |
| | | | |
| ///clear internal cached data and reset random seed | | ///clear internal cached data and reset random seed | |
| virtual void reset() = 0; | | virtual void reset() = 0; | |
| }; | | }; | |
| | | | |
|
| #endif //CONSTRAINT_SOLVER_H | | #endif //BT_CONSTRAINT_SOLVER_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btContactConstraint.h | | btContactConstraint.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONTACT_CONSTRAINT_H | | #ifndef BT_CONTACT_CONSTRAINT_H | |
| #define CONTACT_CONSTRAINT_H | | #define BT_CONTACT_CONSTRAINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btJacobianEntry.h" | | #include "btJacobianEntry.h" | |
| #include "btTypedConstraint.h" | | #include "btTypedConstraint.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | | #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | |
| | | | |
| ///btContactConstraint can be automatically created to solve contact constr
aints using the unified btTypedConstraint interface | | ///btContactConstraint can be automatically created to solve contact constr
aints using the unified btTypedConstraint interface | |
| ATTRIBUTE_ALIGNED16(class) btContactConstraint : public btTypedConstraint | | ATTRIBUTE_ALIGNED16(class) btContactConstraint : public btTypedConstraint | |
| { | | { | |
| protected: | | protected: | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| | | | |
| virtual void getInfo1 (btConstraintInfo1* info); | | virtual void getInfo1 (btConstraintInfo1* info); | |
| | | | |
| virtual void getInfo2 (btConstraintInfo2* info); | | virtual void getInfo2 (btConstraintInfo2* info); | |
| | | | |
| ///obsolete methods | | ///obsolete methods | |
| virtual void buildJacobian(); | | virtual void buildJacobian(); | |
| | | | |
| }; | | }; | |
| | | | |
|
| | | ///very basic collision resolution without friction | |
| | | btScalar resolveSingleCollision(btRigidBody* body1, class btCollisionObject | |
| | | * colObj2, const btVector3& contactPositionWorld,const btVector3& contactNo | |
| | | rmalOnB, const struct btContactSolverInfo& solverInfo,btScalar distance); | |
| | | | |
| ///resolveSingleBilateral is an obsolete methods used for vehicle friction
between two dynamic objects | | ///resolveSingleBilateral is an obsolete methods used for vehicle friction
between two dynamic objects | |
| void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1, | | void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1, | |
| btRigidBody& body2, const btVector3& pos2, | | btRigidBody& body2, const btVector3& pos2, | |
| btScalar distance, const btVector3& normal,btScalar&
impulse ,btScalar timeStep); | | btScalar distance, const btVector3& normal,btScalar&
impulse ,btScalar timeStep); | |
| | | | |
|
| #endif //CONTACT_CONSTRAINT_H | | #endif //BT_CONTACT_CONSTRAINT_H | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 7 lines changed or added | |
|
| btContactSolverInfo.h | | btContactSolverInfo.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONTACT_SOLVER_INFO | | #ifndef BT_CONTACT_SOLVER_INFO | |
| #define CONTACT_SOLVER_INFO | | #define BT_CONTACT_SOLVER_INFO | |
| | | | |
| enum btSolverMode | | enum btSolverMode | |
| { | | { | |
| SOLVER_RANDMIZE_ORDER = 1, | | SOLVER_RANDMIZE_ORDER = 1, | |
| SOLVER_FRICTION_SEPARATE = 2, | | SOLVER_FRICTION_SEPARATE = 2, | |
| SOLVER_USE_WARMSTARTING = 4, | | SOLVER_USE_WARMSTARTING = 4, | |
| SOLVER_USE_FRICTION_WARMSTARTING = 8, | | SOLVER_USE_FRICTION_WARMSTARTING = 8, | |
| SOLVER_USE_2_FRICTION_DIRECTIONS = 16, | | SOLVER_USE_2_FRICTION_DIRECTIONS = 16, | |
| SOLVER_ENABLE_FRICTION_DIRECTION_CACHING = 32, | | SOLVER_ENABLE_FRICTION_DIRECTION_CACHING = 32, | |
| SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION = 64, | | SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION = 64, | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 83 | |
| m_splitImpulse = false; | | m_splitImpulse = false; | |
| m_splitImpulsePenetrationThreshold = -0.02f; | | m_splitImpulsePenetrationThreshold = -0.02f; | |
| m_linearSlop = btScalar(0.0); | | m_linearSlop = btScalar(0.0); | |
| m_warmstartingFactor=btScalar(0.85); | | m_warmstartingFactor=btScalar(0.85); | |
| m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD;// | SO
LVER_RANDMIZE_ORDER; | | m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD;// | SO
LVER_RANDMIZE_ORDER; | |
| m_restingContactRestitutionThreshold = 2;//resting contact l
ifetime threshold to disable restitution | | m_restingContactRestitutionThreshold = 2;//resting contact l
ifetime threshold to disable restitution | |
| m_minimumSolverBatchSize = 128; //try to combine islands unt
il the amount of constraints reaches this limit | | m_minimumSolverBatchSize = 128; //try to combine islands unt
il the amount of constraints reaches this limit | |
| } | | } | |
| }; | | }; | |
| | | | |
|
| #endif //CONTACT_SOLVER_INFO | | #endif //BT_CONTACT_SOLVER_INFO | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btContinuousConvexCollision.h | | btContinuousConvexCollision.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONTINUOUS_COLLISION_CONVEX_CAST_H | | #ifndef BT_CONTINUOUS_COLLISION_CONVEX_CAST_H | |
| #define CONTINUOUS_COLLISION_CONVEX_CAST_H | | #define BT_CONTINUOUS_COLLISION_CONVEX_CAST_H | |
| | | | |
| #include "btConvexCast.h" | | #include "btConvexCast.h" | |
| #include "btSimplexSolverInterface.h" | | #include "btSimplexSolverInterface.h" | |
| class btConvexPenetrationDepthSolver; | | class btConvexPenetrationDepthSolver; | |
| class btConvexShape; | | class btConvexShape; | |
|
| | | class btStaticPlaneShape; | |
| | | | |
| /// btContinuousConvexCollision implements angular and linear time of impac
t for convex objects. | | /// btContinuousConvexCollision implements angular and linear time of impac
t for convex objects. | |
| /// Based on Brian Mirtich's Conservative Advancement idea (PhD thesis). | | /// Based on Brian Mirtich's Conservative Advancement idea (PhD thesis). | |
| /// Algorithm operates in worldspace, in order to keep inbetween motion glo
bally consistent. | | /// Algorithm operates in worldspace, in order to keep inbetween motion glo
bally consistent. | |
| /// It uses GJK at the moment. Future improvement would use minkowski sum /
supporting vertex, merging innerloops | | /// It uses GJK at the moment. Future improvement would use minkowski sum /
supporting vertex, merging innerloops | |
| class btContinuousConvexCollision : public btConvexCast | | class btContinuousConvexCollision : public btConvexCast | |
| { | | { | |
| btSimplexSolverInterface* m_simplexSolver; | | btSimplexSolverInterface* m_simplexSolver; | |
| btConvexPenetrationDepthSolver* m_penetrationDepthSolver; | | btConvexPenetrationDepthSolver* m_penetrationDepthSolver; | |
| const btConvexShape* m_convexA; | | const btConvexShape* m_convexA; | |
|
| const btConvexShape* m_convexB; | | //second object is either a convex or a plane (code sharing) | |
| | | const btConvexShape* m_convexB1; | |
| | | const btStaticPlaneShape* m_planeShape; | |
| | | | |
| | | void computeClosestPoints( const btTransform& transA, const btTransf | |
| | | orm& transB,struct btPointCollector& pointCollector); | |
| | | | |
| public: | | public: | |
| | | | |
| btContinuousConvexCollision (const btConvexShape* shapeA,const
btConvexShape* shapeB ,btSimplexSolverInterface* simplexSolver,btConve
xPenetrationDepthSolver* penetrationDepthSolver); | | btContinuousConvexCollision (const btConvexShape* shapeA,const
btConvexShape* shapeB ,btSimplexSolverInterface* simplexSolver,btConve
xPenetrationDepthSolver* penetrationDepthSolver); | |
| | | | |
|
| | | btContinuousConvexCollision(const btConvexShape* shapeA,const | |
| | | btStaticPlaneShape* plane ); | |
| | | | |
| virtual bool calcTimeOfImpact( | | virtual bool calcTimeOfImpact( | |
| const btTransform& fromA, | | const btTransform& fromA, | |
| const btTransform& toA, | | const btTransform& toA, | |
| const btTransform& fromB, | | const btTransform& fromB, | |
| const btTransform& toB, | | const btTransform& toB, | |
| CastResult& result); | | CastResult& result); | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //CONTINUOUS_COLLISION_CONVEX_CAST_H | | #endif //BT_CONTINUOUS_COLLISION_CONVEX_CAST_H | |
| | | | |
End of changes. 5 change blocks. |
| 3 lines changed or deleted | | 12 lines changed or added | |
|
| btConvex2dConvex2dAlgorithm.h | | btConvex2dConvex2dAlgorithm.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONVEX_2D_CONVEX_2D_ALGORITHM_H | | #ifndef BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H | |
| #define CONVEX_2D_CONVEX_2D_ALGORITHM_H | | #define BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H | |
| | | | |
| #include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.
h" | | #include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.
h" | |
| #include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h" | | #include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | | #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h" | | #include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | | #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" | | #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" | |
| #include "LinearMath/btTransformUtil.h" //for btConvexSeparatingDistanceUti
l | | #include "LinearMath/btTransformUtil.h" //for btConvexSeparatingDistanceUti
l | |
| | | | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 89 | |
| | | | |
| virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol
lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb
ject* body1) | | virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol
lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb
ject* body1) | |
| { | | { | |
| void* mem = ci.m_dispatcher1->allocateCollisionAlgor
ithm(sizeof(btConvex2dConvex2dAlgorithm)); | | void* mem = ci.m_dispatcher1->allocateCollisionAlgor
ithm(sizeof(btConvex2dConvex2dAlgorithm)); | |
| return new(mem) btConvex2dConvex2dAlgorithm(ci.m_man
ifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations
,m_minimumPointsPerturbationThreshold); | | return new(mem) btConvex2dConvex2dAlgorithm(ci.m_man
ifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations
,m_minimumPointsPerturbationThreshold); | |
| } | | } | |
| }; | | }; | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //CONVEX_2D_CONVEX_2D_ALGORITHM_H | | #endif //BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btConvexCast.h | | btConvexCast.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONVEX_CAST_H | | #ifndef BT_CONVEX_CAST_H | |
| #define CONVEX_CAST_H | | #define BT_CONVEX_CAST_H | |
| | | | |
| #include "LinearMath/btTransform.h" | | #include "LinearMath/btTransform.h" | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "LinearMath/btScalar.h" | | #include "LinearMath/btScalar.h" | |
| class btMinkowskiSumShape; | | class btMinkowskiSumShape; | |
| #include "LinearMath/btIDebugDraw.h" | | #include "LinearMath/btIDebugDraw.h" | |
| | | | |
| /// btConvexCast is an interface for Casting | | /// btConvexCast is an interface for Casting | |
| class btConvexCast | | class btConvexCast | |
| { | | { | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| virtual ~btConvexCast(); | | virtual ~btConvexCast(); | |
| | | | |
| ///RayResult stores the closest result | | ///RayResult stores the closest result | |
| /// alternatively, add a callback method to decide about closest/all
results | | /// alternatively, add a callback method to decide about closest/all
results | |
| struct CastResult | | struct CastResult | |
| { | | { | |
| //virtual bool addRayResult(const btVector3& normal,btScala
r fraction) = 0; | | //virtual bool addRayResult(const btVector3& normal,btScala
r fraction) = 0; | |
| | | | |
| virtual void DebugDraw(btScalar fraction) {(void)fra
ction;} | | virtual void DebugDraw(btScalar fraction) {(void)fra
ction;} | |
| virtual void drawCoordSystem(const btTransform& trans) {(
void)trans;} | | virtual void drawCoordSystem(const btTransform& trans) {(
void)trans;} | |
|
| | | virtual void reportFailure(int errNo, int numIterations)
{(void)errNo;(void)numIterations;} | |
| CastResult() | | CastResult() | |
| :m_fraction(btScalar(BT_LARGE_FLOAT)), | | :m_fraction(btScalar(BT_LARGE_FLOAT)), | |
| m_debugDrawer(0), | | m_debugDrawer(0), | |
| m_allowedPenetration(btScalar(0)) | | m_allowedPenetration(btScalar(0)) | |
| { | | { | |
| } | | } | |
| | | | |
| virtual ~CastResult() {}; | | virtual ~CastResult() {}; | |
| | | | |
| btTransform m_hitTransformA; | | btTransform m_hitTransformA; | |
| | | | |
| skipping to change at line 69 | | skipping to change at line 69 | |
| | | | |
| /// cast a convex against another convex object | | /// cast a convex against another convex object | |
| virtual bool calcTimeOfImpact( | | virtual bool calcTimeOfImpact( | |
| const btTransform& fromA, | | const btTransform& fromA, | |
| const btTransform& toA, | | const btTransform& toA, | |
| const btTransform& fromB, | | const btTransform& fromB, | |
| const btTransform& toB, | | const btTransform& toB, | |
| CastResult& result) = 0; | | CastResult& result) = 0; | |
| }; | | }; | |
| | | | |
|
| #endif //CONVEX_CAST_H | | #endif //BT_CONVEX_CAST_H | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| btConvexConvexAlgorithm.h | | btConvexConvexAlgorithm.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONVEX_CONVEX_ALGORITHM_H | | #ifndef BT_CONVEX_CONVEX_ALGORITHM_H | |
| #define CONVEX_CONVEX_ALGORITHM_H | | #define BT_CONVEX_CONVEX_ALGORITHM_H | |
| | | | |
| #include "btActivatingCollisionAlgorithm.h" | | #include "btActivatingCollisionAlgorithm.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h" | | #include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | | #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h" | | #include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h" | |
| #include "btCollisionCreateFunc.h" | | #include "btCollisionCreateFunc.h" | |
| #include "btCollisionDispatcher.h" | | #include "btCollisionDispatcher.h" | |
| #include "LinearMath/btTransformUtil.h" //for btConvexSeparatingDistanceUti
l | | #include "LinearMath/btTransformUtil.h" //for btConvexSeparatingDistanceUti
l | |
| | | | |
| | | | |
| skipping to change at line 102 | | skipping to change at line 102 | |
| | | | |
| virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol
lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb
ject* body1) | | virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol
lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb
ject* body1) | |
| { | | { | |
| void* mem = ci.m_dispatcher1->allocateCollisionAlgor
ithm(sizeof(btConvexConvexAlgorithm)); | | void* mem = ci.m_dispatcher1->allocateCollisionAlgor
ithm(sizeof(btConvexConvexAlgorithm)); | |
| return new(mem) btConvexConvexAlgorithm(ci.m_manifol
d,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_m
inimumPointsPerturbationThreshold); | | return new(mem) btConvexConvexAlgorithm(ci.m_manifol
d,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_m
inimumPointsPerturbationThreshold); | |
| } | | } | |
| }; | | }; | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //CONVEX_CONVEX_ALGORITHM_H | | #endif //BT_CONVEX_CONVEX_ALGORITHM_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btConvexPlaneCollisionAlgorithm.h | | btConvexPlaneCollisionAlgorithm.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef CONVEX_PLANE_COLLISION_ALGORITHM_H | | #ifndef BT_CONVEX_PLANE_COLLISION_ALGORITHM_H | |
| #define CONVEX_PLANE_COLLISION_ALGORITHM_H | | #define BT_CONVEX_PLANE_COLLISION_ALGORITHM_H | |
| | | | |
| #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" | | #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | | #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | |
| class btPersistentManifold; | | class btPersistentManifold; | |
| #include "btCollisionDispatcher.h" | | #include "btCollisionDispatcher.h" | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| | | | |
| /// btSphereBoxCollisionAlgorithm provides sphere-box collision detection. | | /// btSphereBoxCollisionAlgorithm provides sphere-box collision detection. | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 83 | |
| return new(mem) btConvexPlaneCollisionAlgori
thm(0,ci,body0,body1,false,m_numPerturbationIterations,m_minimumPointsPertu
rbationThreshold); | | return new(mem) btConvexPlaneCollisionAlgori
thm(0,ci,body0,body1,false,m_numPerturbationIterations,m_minimumPointsPertu
rbationThreshold); | |
| } else | | } else | |
| { | | { | |
| return new(mem) btConvexPlaneCollisionAlgori
thm(0,ci,body0,body1,true,m_numPerturbationIterations,m_minimumPointsPertur
bationThreshold); | | return new(mem) btConvexPlaneCollisionAlgori
thm(0,ci,body0,body1,true,m_numPerturbationIterations,m_minimumPointsPertur
bationThreshold); | |
| } | | } | |
| } | | } | |
| }; | | }; | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //CONVEX_PLANE_COLLISION_ALGORITHM_H | | #endif //BT_CONVEX_PLANE_COLLISION_ALGORITHM_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btConvexTriangleMeshShape.h | | btConvexTriangleMeshShape.h | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| This software is provided 'as-is', without any express or implied warranty. | | 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 th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
|
| #ifndef CONVEX_TRIANGLEMESH_SHAPE_H | | #ifndef BT_CONVEX_TRIANGLEMESH_SHAPE_H | |
| #define CONVEX_TRIANGLEMESH_SHAPE_H | | #define BT_CONVEX_TRIANGLEMESH_SHAPE_H | |
| | | | |
| #include "btPolyhedralConvexShape.h" | | #include "btPolyhedralConvexShape.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for t
he types | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for t
he types | |
| | | | |
| /// The btConvexTriangleMeshShape is a convex hull of a triangle mesh, but
the performance is not as good as btConvexHullShape. | | /// The btConvexTriangleMeshShape is a convex hull of a triangle mesh, but
the performance is not as good as btConvexHullShape. | |
| /// A small benefit of this class is that it uses the btStridingMeshInterfa
ce, so you can avoid the duplication of the triangle mesh data. Nevertheles
s, most users should use the much better performing btConvexHullShape inste
ad. | | /// A small benefit of this class is that it uses the btStridingMeshInterfa
ce, so you can avoid the duplication of the triangle mesh data. Nevertheles
s, most users should use the much better performing btConvexHullShape inste
ad. | |
| class btConvexTriangleMeshShape : public btPolyhedralConvexAabbCachingShape | | class btConvexTriangleMeshShape : public btPolyhedralConvexAabbCachingShape | |
| { | | { | |
| | | | |
| class btStridingMeshInterface* m_stridingMesh; | | class btStridingMeshInterface* m_stridingMesh; | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 67 | |
| | | | |
| ///computes the exact moment of inertia and the transform from the c
oordinate system defined by the principal axes of the moment of inertia | | ///computes the exact moment of inertia and the transform from the c
oordinate system defined by the principal axes of the moment of inertia | |
| ///and the center of mass to the current coordinate system. A mass o
f 1 is assumed, for other masses just multiply the computed "inertia" | | ///and the center of mass to the current coordinate system. A mass o
f 1 is assumed, for other masses just multiply the computed "inertia" | |
| ///by the mass. The resulting transform "principal" has to be applie
d inversely to the mesh in order for the local coordinate system of the | | ///by the mass. The resulting transform "principal" has to be applie
d inversely to the mesh in order for the local coordinate system of the | |
| ///shape to be centered at the center of mass and to coincide with t
he principal axes. This also necessitates a correction of the world transfo
rm | | ///shape to be centered at the center of mass and to coincide with t
he principal axes. This also necessitates a correction of the world transfo
rm | |
| ///of the collision object by the principal transform. This method a
lso computes the volume of the convex mesh. | | ///of the collision object by the principal transform. This method a
lso computes the volume of the convex mesh. | |
| void calculatePrincipalAxisTransform(btTransform& principal, btVecto
r3& inertia, btScalar& volume) const; | | void calculatePrincipalAxisTransform(btTransform& principal, btVecto
r3& inertia, btScalar& volume) const; | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //CONVEX_TRIANGLEMESH_SHAPE_H | | #endif //BT_CONVEX_TRIANGLEMESH_SHAPE_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btDispatcher.h | | btDispatcher.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef _DISPATCHER_H | | #ifndef BT_DISPATCHER_H | |
| #define _DISPATCHER_H | | #define BT_DISPATCHER_H | |
| | | | |
| #include "LinearMath/btScalar.h" | | #include "LinearMath/btScalar.h" | |
| | | | |
| class btCollisionAlgorithm; | | class btCollisionAlgorithm; | |
| struct btBroadphaseProxy; | | struct btBroadphaseProxy; | |
| class btRigidBody; | | class btRigidBody; | |
| class btCollisionObject; | | class btCollisionObject; | |
| class btOverlappingPairCache; | | class btOverlappingPairCache; | |
| | | | |
| class btPersistentManifold; | | class btPersistentManifold; | |
| class btStackAlloc; | | class btStackAlloc; | |
|
| | | class btPoolAllocator; | |
| | | | |
| struct btDispatcherInfo | | struct btDispatcherInfo | |
| { | | { | |
| enum DispatchFunc | | enum DispatchFunc | |
| { | | { | |
| DISPATCH_DISCRETE = 1, | | DISPATCH_DISCRETE = 1, | |
| DISPATCH_CONTINUOUS | | DISPATCH_CONTINUOUS | |
| }; | | }; | |
| btDispatcherInfo() | | btDispatcherInfo() | |
| :m_timeStep(btScalar(0.)), | | :m_timeStep(btScalar(0.)), | |
| m_stepCount(0), | | m_stepCount(0), | |
| m_dispatchFunc(DISPATCH_DISCRETE), | | m_dispatchFunc(DISPATCH_DISCRETE), | |
| m_timeOfImpact(btScalar(1.)), | | m_timeOfImpact(btScalar(1.)), | |
|
| m_useContinuous(false), | | m_useContinuous(true), | |
| m_debugDraw(0), | | m_debugDraw(0), | |
| m_enableSatConvex(false), | | m_enableSatConvex(false), | |
| m_enableSPU(true), | | m_enableSPU(true), | |
| m_useEpa(true), | | m_useEpa(true), | |
| m_allowedCcdPenetration(btScalar(0.04)), | | m_allowedCcdPenetration(btScalar(0.04)), | |
| m_useConvexConservativeDistanceUtil(false), | | m_useConvexConservativeDistanceUtil(false), | |
| m_convexConservativeDistanceThreshold(0.0f), | | m_convexConservativeDistanceThreshold(0.0f), | |
|
| m_convexMaxDistanceUseCPT(false), | | | |
| m_stackAllocator(0) | | m_stackAllocator(0) | |
| { | | { | |
| | | | |
| } | | } | |
| btScalar m_timeStep; | | btScalar m_timeStep; | |
| int m_stepCount; | | int m_stepCount; | |
| int m_dispatchFunc; | | int m_dispatchFunc; | |
| mutable btScalar m_timeOfImpact; | | mutable btScalar m_timeOfImpact; | |
| bool m_useContinuous; | | bool m_useContinuous; | |
| class btIDebugDraw* m_debugDraw; | | class btIDebugDraw* m_debugDraw; | |
| bool m_enableSatConvex; | | bool m_enableSatConvex; | |
| bool m_enableSPU; | | bool m_enableSPU; | |
| bool m_useEpa; | | bool m_useEpa; | |
| btScalar m_allowedCcdPenetration; | | btScalar m_allowedCcdPenetration; | |
| bool m_useConvexConservativeDistanceUtil; | | bool m_useConvexConservativeDistanceUtil; | |
| btScalar m_convexConservativeDistanceThreshold; | | btScalar m_convexConservativeDistanceThreshold; | |
|
| bool m_convexMaxDistanceUseCPT; | | | |
| btStackAlloc* m_stackAllocator; | | btStackAlloc* m_stackAllocator; | |
| }; | | }; | |
| | | | |
| ///The btDispatcher interface class can be used in combination with broadph
ase to dispatch calculations for overlapping pairs. | | ///The btDispatcher interface class can be used in combination with broadph
ase to dispatch calculations for overlapping pairs. | |
| ///For example for pairwise collision detection, calculating contact points
stored in btPersistentManifold or user callbacks (game logic). | | ///For example for pairwise collision detection, calculating contact points
stored in btPersistentManifold or user callbacks (game logic). | |
| class btDispatcher | | class btDispatcher | |
| { | | { | |
| | | | |
| public: | | public: | |
| virtual ~btDispatcher() ; | | virtual ~btDispatcher() ; | |
| | | | |
| skipping to change at line 99 | | skipping to change at line 97 | |
| virtual bool needsResponse(btCollisionObject* body0,btCollisionOb
ject* body1)=0; | | virtual bool needsResponse(btCollisionObject* body0,btCollisionOb
ject* body1)=0; | |
| | | | |
| virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pa
irCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) =0; | | virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pa
irCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) =0; | |
| | | | |
| virtual int getNumManifolds() const = 0; | | virtual int getNumManifolds() const = 0; | |
| | | | |
| virtual btPersistentManifold* getManifoldByIndexInternal(int index)
= 0; | | virtual btPersistentManifold* getManifoldByIndexInternal(int index)
= 0; | |
| | | | |
| virtual btPersistentManifold** getInternalManifoldPointer() = 0; | | virtual btPersistentManifold** getInternalManifoldPointer() = 0; | |
| | | | |
|
| | | virtual btPoolAllocator* getInternalManifoldPool() = 0; | |
| | | | |
| | | virtual const btPoolAllocator* getInternalManifoldPool() const = 0; | |
| | | | |
| virtual void* allocateCollisionAlgorithm(int size) = 0; | | virtual void* allocateCollisionAlgorithm(int size) = 0; | |
| | | | |
| virtual void freeCollisionAlgorithm(void* ptr) = 0; | | virtual void freeCollisionAlgorithm(void* ptr) = 0; | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //_DISPATCHER_H | | #endif //BT_DISPATCHER_H | |
| | | | |
End of changes. 7 change blocks. |
| 6 lines changed or deleted | | 8 lines changed or added | |
|
| btGImpactCollisionAlgorithm.h | | btGImpactCollisionAlgorithm.h | |
| | | | |
| skipping to change at line 23 | | skipping to change at line 23 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef BVH_CONCAVE_COLLISION_ALGORITHM_H | | #ifndef BT_GIMPACT_BVH_CONCAVE_COLLISION_ALGORITHM_H | |
| #define BVH_CONCAVE_COLLISION_ALGORITHM_H | | #define BT_GIMPACT_BVH_CONCAVE_COLLISION_ALGORITHM_H | |
| | | | |
| #include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.
h" | | #include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.
h" | |
| #include "BulletCollision/BroadphaseCollision/btDispatcher.h" | | #include "BulletCollision/BroadphaseCollision/btDispatcher.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | | #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | |
| class btDispatcher; | | class btDispatcher; | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | | #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" | | #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" | |
| | | | |
| | | | |
| skipping to change at line 209 | | skipping to change at line 209 | |
| { | | { | |
| virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol
lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb
ject* body1) | | virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCol
lisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionOb
ject* body1) | |
| { | | { | |
| void* mem = ci.m_dispatcher1->allocateCollisionAlgor
ithm(sizeof(btGImpactCollisionAlgorithm)); | | void* mem = ci.m_dispatcher1->allocateCollisionAlgor
ithm(sizeof(btGImpactCollisionAlgorithm)); | |
| return new(mem) btGImpactCollisionAlgorithm(ci,body0
,body1); | | return new(mem) btGImpactCollisionAlgorithm(ci,body0
,body1); | |
| } | | } | |
| }; | | }; | |
| | | | |
| //! Use this function for register the algorithm externally | | //! Use this function for register the algorithm externally | |
| static void registerAlgorithm(btCollisionDispatcher * dispatcher); | | static void registerAlgorithm(btCollisionDispatcher * dispatcher); | |
|
| | | #ifdef TRI_COLLISION_PROFILING | |
| //! Gets the average time in miliseconds of tree collisions | | //! Gets the average time in miliseconds of tree collisions | |
| static float getAverageTreeCollisionTime(); | | static float getAverageTreeCollisionTime(); | |
| | | | |
| //! Gets the average time in miliseconds of triangle collisions | | //! Gets the average time in miliseconds of triangle collisions | |
| static float getAverageTriangleCollisionTime(); | | static float getAverageTriangleCollisionTime(); | |
|
| | | #endif //TRI_COLLISION_PROFILING | |
| | | | |
| //! Collides two gimpact shapes | | //! Collides two gimpact shapes | |
| /*! | | /*! | |
| \pre shape0 and shape1 couldn't be btGImpactMeshShape objects | | \pre shape0 and shape1 couldn't be btGImpactMeshShape objects | |
| */ | | */ | |
| | | | |
| void gimpact_vs_gimpact(btCollisionObject * body0, | | void gimpact_vs_gimpact(btCollisionObject * body0, | |
| btCollisionObject * body1, | | btCollisionObject * body1, | |
| btGImpactShapeInterface * shape0, | | btGImpactShapeInterface * shape0, | |
| btGImpactShapeInterface * shape1); | | btGImpactShapeInterface * shape1); | |
| | | | |
| skipping to change at line 282 | | skipping to change at line 283 | |
| { | | { | |
| return m_part1; | | return m_part1; | |
| } | | } | |
| | | | |
| }; | | }; | |
| | | | |
| //algorithm details | | //algorithm details | |
| //#define BULLET_TRIANGLE_COLLISION 1 | | //#define BULLET_TRIANGLE_COLLISION 1 | |
| #define GIMPACT_VS_PLANE_COLLISION 1 | | #define GIMPACT_VS_PLANE_COLLISION 1 | |
| | | | |
|
| #endif //BVH_CONCAVE_COLLISION_ALGORITHM_H | | #endif //BT_GIMPACT_BVH_CONCAVE_COLLISION_ALGORITHM_H | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 4 lines changed or added | |
|
| btGeneric6DofConstraint.h | | btGeneric6DofConstraint.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| /// 2009 March: btGeneric6DofConstraint refactored by Roman Ponomarev | | /// 2009 March: btGeneric6DofConstraint refactored by Roman Ponomarev | |
| /// Added support for generic constraint solver through getInfo1/getInfo2 m
ethods | | /// Added support for generic constraint solver through getInfo1/getInfo2 m
ethods | |
| | | | |
| /* | | /* | |
| 2007-09-09 | | 2007-09-09 | |
| btGeneric6DofConstraint Refactored by Francisco Le?n | | btGeneric6DofConstraint Refactored by Francisco Le?n | |
| email: projectileman@yahoo.com | | email: projectileman@yahoo.com | |
| http://gimpact.sf.net | | http://gimpact.sf.net | |
| */ | | */ | |
| | | | |
|
| #ifndef GENERIC_6DOF_CONSTRAINT_H | | #ifndef BT_GENERIC_6DOF_CONSTRAINT_H | |
| #define GENERIC_6DOF_CONSTRAINT_H | | #define BT_GENERIC_6DOF_CONSTRAINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btJacobianEntry.h" | | #include "btJacobianEntry.h" | |
| #include "btTypedConstraint.h" | | #include "btTypedConstraint.h" | |
| | | | |
| class btRigidBody; | | class btRigidBody; | |
| | | | |
| //! Rotation Limit structure for generic joints | | //! Rotation Limit structure for generic joints | |
| class btRotationalLimitMotor | | class btRotationalLimitMotor | |
| { | | { | |
| | | | |
| skipping to change at line 417 | | skipping to change at line 417 | |
| \pre btGeneric6DofConstraint::calculateTransforms() must be called p
reviously. | | \pre btGeneric6DofConstraint::calculateTransforms() must be called p
reviously. | |
| */ | | */ | |
| btScalar getAngle(int axis_index) const; | | btScalar getAngle(int axis_index) const; | |
| | | | |
| //! Get the relative position of the constraint pivot | | //! Get the relative position of the constraint pivot | |
| /*! | | /*! | |
| \pre btGeneric6DofConstraint::calculateTransforms() must be called p
reviously. | | \pre btGeneric6DofConstraint::calculateTransforms() must be called p
reviously. | |
| */ | | */ | |
| btScalar getRelativePivotPosition(int axis_index) const; | | btScalar getRelativePivotPosition(int axis_index) const; | |
| | | | |
|
| | | void setFrames(const btTransform & frameA, const btTransform & frame | |
| | | B); | |
| | | | |
| //! Test angular limit. | | //! Test angular limit. | |
| /*! | | /*! | |
| Calculates angular correction and returns true if limit needs to be
corrected. | | Calculates angular correction and returns true if limit needs to be
corrected. | |
| \pre btGeneric6DofConstraint::calculateTransforms() must be called p
reviously. | | \pre btGeneric6DofConstraint::calculateTransforms() must be called p
reviously. | |
| */ | | */ | |
| bool testAngularLimitMotor(int axis_index); | | bool testAngularLimitMotor(int axis_index); | |
| | | | |
| void setLinearLowerLimit(const btVector3& linearLower) | | void setLinearLowerLimit(const btVector3& linearLower) | |
| { | | { | |
| m_linearLimits.m_lowerLimit = linearLower; | | m_linearLimits.m_lowerLimit = linearLower; | |
| } | | } | |
| | | | |
|
| void setLinearUpperLimit(const btVector3& linearUpper) | | void getLinearLowerLimit(btVector3& linearLower) | |
| { | | { | |
| m_linearLimits.m_upperLimit = linearUpper; | | linearLower = m_linearLimits.m_lowerLimit; | |
| } | | } | |
| | | | |
| | | void setLinearUpperLimit(const btVector3& linearUpper) | |
| | | { | |
| | | m_linearLimits.m_upperLimit = linearUpper; | |
| | | } | |
| | | | |
| | | void getLinearUpperLimit(btVector3& linearUpper) | |
| | | { | |
| | | linearUpper = m_linearLimits.m_upperLimit; | |
| | | } | |
| | | | |
| void setAngularLowerLimit(const btVector3& angularLower) | | void setAngularLowerLimit(const btVector3& angularLower) | |
| { | | { | |
| for(int i = 0; i < 3; i++) | | for(int i = 0; i < 3; i++) | |
| m_angularLimits[i].m_loLimit = btNormalizeAngle(angu
larLower[i]); | | m_angularLimits[i].m_loLimit = btNormalizeAngle(angu
larLower[i]); | |
| } | | } | |
| | | | |
|
| | | void getAngularLowerLimit(btVector3& angularLower) | |
| | | { | |
| | | for(int i = 0; i < 3; i++) | |
| | | angularLower[i] = m_angularLimits[i].m_loLimit; | |
| | | } | |
| | | | |
| void setAngularUpperLimit(const btVector3& angularUpper) | | void setAngularUpperLimit(const btVector3& angularUpper) | |
| { | | { | |
| for(int i = 0; i < 3; i++) | | for(int i = 0; i < 3; i++) | |
| m_angularLimits[i].m_hiLimit = btNormalizeAngle(angu
larUpper[i]); | | m_angularLimits[i].m_hiLimit = btNormalizeAngle(angu
larUpper[i]); | |
| } | | } | |
| | | | |
|
| | | void getAngularUpperLimit(btVector3& angularUpper) | |
| | | { | |
| | | for(int i = 0; i < 3; i++) | |
| | | angularUpper[i] = m_angularLimits[i].m_hiLimit; | |
| | | } | |
| | | | |
| //! Retrieves the angular limit informacion | | //! Retrieves the angular limit informacion | |
| btRotationalLimitMotor * getRotationalLimitMotor(int index) | | btRotationalLimitMotor * getRotationalLimitMotor(int index) | |
| { | | { | |
| return &m_angularLimits[index]; | | return &m_angularLimits[index]; | |
| } | | } | |
| | | | |
| //! Retrieves the limit informacion | | //! Retrieves the limit informacion | |
| btTranslationalLimitMotor * getTranslationalLimitMotor() | | btTranslationalLimitMotor * getTranslationalLimitMotor() | |
| { | | { | |
| return &m_linearLimits; | | return &m_linearLimits; | |
| | | | |
| skipping to change at line 508 | | skipping to change at line 532 | |
| // access for UseFrameOffset | | // access for UseFrameOffset | |
| bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; } | | bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; } | |
| void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstr
aintFrame = frameOffsetOnOff; } | | void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstr
aintFrame = frameOffsetOnOff; } | |
| | | | |
| ///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5). | | ///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5). | |
| ///If no axis is provided, it uses the default axis for this constra
int. | | ///If no axis is provided, it uses the default axis for this constra
int. | |
| virtual void setParam(int num, btScalar value, int axis = -1); | | virtual void setParam(int num, btScalar value, int axis = -1); | |
| ///return the local value of parameter | | ///return the local value of parameter | |
| virtual btScalar getParam(int num, int axis = -1) const; | | virtual btScalar getParam(int num, int axis = -1) const; | |
| | | | |
|
| | | void setAxis( const btVector3& axis1, const btVector3& axis2); | |
| | | | |
| virtual int calculateSerializeBufferSize() const; | | virtual int calculateSerializeBufferSize() const; | |
| | | | |
| ///fills the dataBuffer and returns the struct name (and 0 on failur
e) | | ///fills the dataBuffer and returns the struct name (and 0 on failur
e) | |
| virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const; | | virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const; | |
| | | | |
| }; | | }; | |
| | | | |
| ///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64 | | ///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64 | |
| struct btGeneric6DofConstraintData | | struct btGeneric6DofConstraintData | |
| { | | { | |
| | | | |
| skipping to change at line 562 | | skipping to change at line 588 | |
| dof->m_linearLowerLimit.m_floats[i] = float(m_linearLimits.m
_lowerLimit[i]); | | dof->m_linearLowerLimit.m_floats[i] = float(m_linearLimits.m
_lowerLimit[i]); | |
| dof->m_linearUpperLimit.m_floats[i] = float(m_linearLimits.m
_upperLimit[i]); | | dof->m_linearUpperLimit.m_floats[i] = float(m_linearLimits.m
_upperLimit[i]); | |
| } | | } | |
| | | | |
| dof->m_useLinearReferenceFrameA = m_useLinearReferenceFrameA? 1 : 0; | | dof->m_useLinearReferenceFrameA = m_useLinearReferenceFrameA? 1 : 0; | |
| dof->m_useOffsetForConstraintFrame = m_useOffsetForConstraintFrame ?
1 : 0; | | dof->m_useOffsetForConstraintFrame = m_useOffsetForConstraintFrame ?
1 : 0; | |
| | | | |
| return "btGeneric6DofConstraintData"; | | return "btGeneric6DofConstraintData"; | |
| } | | } | |
| | | | |
|
| #endif //GENERIC_6DOF_CONSTRAINT_H | | #endif //BT_GENERIC_6DOF_CONSTRAINT_H | |
| | | | |
End of changes. 7 change blocks. |
| 6 lines changed or deleted | | 33 lines changed or added | |
|
| btGeneric6DofSpringConstraint.h | | btGeneric6DofSpringConstraint.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef GENERIC_6DOF_SPRING_CONSTRAINT_H | | #ifndef BT_GENERIC_6DOF_SPRING_CONSTRAINT_H | |
| #define GENERIC_6DOF_SPRING_CONSTRAINT_H | | #define BT_GENERIC_6DOF_SPRING_CONSTRAINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btTypedConstraint.h" | | #include "btTypedConstraint.h" | |
| #include "btGeneric6DofConstraint.h" | | #include "btGeneric6DofConstraint.h" | |
| | | | |
| /// Generic 6 DOF constraint that allows to set spring motors to any transl
ational and rotational DOF | | /// Generic 6 DOF constraint that allows to set spring motors to any transl
ational and rotational DOF | |
| | | | |
| /// DOF index used in enableSpring() and setStiffness() means: | | /// DOF index used in enableSpring() and setStiffness() means: | |
| /// 0 : translation X | | /// 0 : translation X | |
| /// 1 : translation Y | | /// 1 : translation Y | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| btScalar m_springDamping[6]; // between 0 and 1 (1 == no damp
ing) | | btScalar m_springDamping[6]; // between 0 and 1 (1 == no damp
ing) | |
| void internalUpdateSprings(btConstraintInfo2* info); | | void internalUpdateSprings(btConstraintInfo2* info); | |
| public: | | public: | |
| btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const
btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenc
eFrameA); | | btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const
btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenc
eFrameA); | |
| void enableSpring(int index, bool onOff); | | void enableSpring(int index, bool onOff); | |
| void setStiffness(int index, btScalar stiffness); | | void setStiffness(int index, btScalar stiffness); | |
| void setDamping(int index, btScalar damping); | | void setDamping(int index, btScalar damping); | |
| void setEquilibriumPoint(); // set the current constraint position/o
rientation as an equilibrium point for all DOF | | void setEquilibriumPoint(); // set the current constraint position/o
rientation as an equilibrium point for all DOF | |
| void setEquilibriumPoint(int index); // set the current constraint
position/orientation as an equilibrium point for given DOF | | void setEquilibriumPoint(int index); // set the current constraint
position/orientation as an equilibrium point for given DOF | |
| void setEquilibriumPoint(int index, btScalar val); | | void setEquilibriumPoint(int index, btScalar val); | |
|
| | | | |
| | | virtual void setAxis( const btVector3& axis1, const btVector3& axis2 | |
| | | ); | |
| | | | |
| virtual void getInfo2 (btConstraintInfo2* info); | | virtual void getInfo2 (btConstraintInfo2* info); | |
|
| | | | |
| | | virtual int calculateSerializeBufferSize() const; | |
| | | ///fills the dataBuffer and returns the struct name (and 0 on failur | |
| | | e) | |
| | | virtual const char* serialize(void* dataBuffer, btSerializer* se | |
| | | rializer) const; | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif // GENERIC_6DOF_SPRING_CONSTRAINT_H | | ///do not change those serialization structures, it requires an updated sBu | |
| | | lletDNAstr/sBulletDNAstr64 | |
| | | struct btGeneric6DofSpringConstraintData | |
| | | { | |
| | | btGeneric6DofConstraintData m_6dofData; | |
| | | | |
| | | int m_springEnabled[6]; | |
| | | float m_equilibriumPoint[6]; | |
| | | float m_springStiffness[6]; | |
| | | float m_springDamping[6]; | |
| | | }; | |
| | | | |
| | | SIMD_FORCE_INLINE int btGeneric6DofSpringConstraint::calculateSeri | |
| | | alizeBufferSize() const | |
| | | { | |
| | | return sizeof(btGeneric6DofSpringConstraintData); | |
| | | } | |
| | | | |
| | | ///fills the dataBuffer and returns the struct name (and 0 on failur | |
| | | e) | |
| | | SIMD_FORCE_INLINE const char* btGeneric6DofSpringConstraint::seria | |
| | | lize(void* dataBuffer, btSerializer* serializer) const | |
| | | { | |
| | | btGeneric6DofSpringConstraintData* dof = (btGeneric6DofSpringConstra | |
| | | intData*)dataBuffer; | |
| | | btGeneric6DofConstraint::serialize(&dof->m_6dofData,serializer); | |
| | | | |
| | | int i; | |
| | | for (i=0;i<6;i++) | |
| | | { | |
| | | dof->m_equilibriumPoint[i] = m_equilibriumPoint[i]; | |
| | | dof->m_springDamping[i] = m_springDamping[i]; | |
| | | dof->m_springEnabled[i] = m_springEnabled[i]? 1 : 0; | |
| | | dof->m_springStiffness[i] = m_springStiffness[i]; | |
| | | } | |
| | | return "btGeneric6DofConstraintData"; | |
| | | } | |
| | | | |
| | | #endif // BT_GENERIC_6DOF_SPRING_CONSTRAINT_H | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 13 lines changed or added | |
|
| btHinge2Constraint.h | | btHinge2Constraint.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef HINGE2_CONSTRAINT_H | | #ifndef BT_HINGE2_CONSTRAINT_H | |
| #define HINGE2_CONSTRAINT_H | | #define BT_HINGE2_CONSTRAINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btTypedConstraint.h" | | #include "btTypedConstraint.h" | |
| #include "btGeneric6DofSpringConstraint.h" | | #include "btGeneric6DofSpringConstraint.h" | |
| | | | |
| // Constraint similar to ODE Hinge2 Joint | | // Constraint similar to ODE Hinge2 Joint | |
| // has 3 degrees of frredom: | | // has 3 degrees of frredom: | |
| // 2 rotational degrees of freedom, similar to Euler rotations around Z (ax
is 1) and X (axis 2) | | // 2 rotational degrees of freedom, similar to Euler rotations around Z (ax
is 1) and X (axis 2) | |
| // 1 translational (along axis Z) with suspension spring | | // 1 translational (along axis Z) with suspension spring | |
| | | | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| const btVector3& getAnchor2() { return m_calculatedTransformB.getOri
gin(); } | | const btVector3& getAnchor2() { return m_calculatedTransformB.getOri
gin(); } | |
| const btVector3& getAxis1() { return m_axis1; } | | const btVector3& getAxis1() { return m_axis1; } | |
| const btVector3& getAxis2() { return m_axis2; } | | const btVector3& getAxis2() { return m_axis2; } | |
| btScalar getAngle1() { return getAngle(2); } | | btScalar getAngle1() { return getAngle(2); } | |
| btScalar getAngle2() { return getAngle(0); } | | btScalar getAngle2() { return getAngle(0); } | |
| // limits | | // limits | |
| void setUpperLimit(btScalar ang1max) { setAngularUpperLimit(btVector
3(-1.f, 0.f, ang1max)); } | | void setUpperLimit(btScalar ang1max) { setAngularUpperLimit(btVector
3(-1.f, 0.f, ang1max)); } | |
| void setLowerLimit(btScalar ang1min) { setAngularLowerLimit(btVector
3( 1.f, 0.f, ang1min)); } | | void setLowerLimit(btScalar ang1min) { setAngularLowerLimit(btVector
3( 1.f, 0.f, ang1min)); } | |
| }; | | }; | |
| | | | |
|
| #endif // HINGE2_CONSTRAINT_H | | #endif // BT_HINGE2_CONSTRAINT_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btHingeConstraint.h | | btHingeConstraint.h | |
| | | | |
| skipping to change at line 18 | | skipping to change at line 18 | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
| /* Hinge Constraint by Dirk Gregorius. Limits added by Marcus Hennix at Sta
rbreeze Studios */ | | /* Hinge Constraint by Dirk Gregorius. Limits added by Marcus Hennix at Sta
rbreeze Studios */ | |
| | | | |
|
| #ifndef HINGECONSTRAINT_H | | #ifndef BT_HINGECONSTRAINT_H | |
| #define HINGECONSTRAINT_H | | #define BT_HINGECONSTRAINT_H | |
| | | | |
| | | #define _BT_USE_CENTER_LIMIT_ 1 | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btJacobianEntry.h" | | #include "btJacobianEntry.h" | |
| #include "btTypedConstraint.h" | | #include "btTypedConstraint.h" | |
| | | | |
| class btRigidBody; | | class btRigidBody; | |
| | | | |
| #ifdef BT_USE_DOUBLE_PRECISION | | #ifdef BT_USE_DOUBLE_PRECISION | |
| #define btHingeConstraintData btHingeConstraintDoubleData | | #define btHingeConstraintData btHingeConstraintDoubleData | |
| #define btHingeConstraintDataName "btHingeConstraintDoubleData" | | #define btHingeConstraintDataName "btHingeConstraintDoubleData" | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 60 | |
| #endif | | #endif | |
| btJacobianEntry m_jac[3]; //3 orthogonal linear constraints | | btJacobianEntry m_jac[3]; //3 orthogonal linear constraints | |
| btJacobianEntry m_jacAng[3]; //2 orthogonal angular constraints+ 1 f
or limit/motor | | btJacobianEntry m_jacAng[3]; //2 orthogonal angular constraints+ 1 f
or limit/motor | |
| | | | |
| btTransform m_rbAFrame; // constraint axii. Assumes z is hinge axis. | | btTransform m_rbAFrame; // constraint axii. Assumes z is hinge axis. | |
| btTransform m_rbBFrame; | | btTransform m_rbBFrame; | |
| | | | |
| btScalar m_motorTargetVelocity; | | btScalar m_motorTargetVelocity; | |
| btScalar m_maxMotorImpulse; | | btScalar m_maxMotorImpulse; | |
| | | | |
|
| | | #ifdef _BT_USE_CENTER_LIMIT_ | |
| | | btAngularLimit m_limit; | |
| | | #else | |
| | | btScalar m_lowerLimit; | |
| | | btScalar m_upperLimit; | |
| | | btScalar m_limitSign; | |
| | | btScalar m_correction; | |
| | | | |
| btScalar m_limitSoftness; | | btScalar m_limitSoftness; | |
| btScalar m_biasFactor; | | btScalar m_biasFactor; | |
|
| btScalar m_relaxationFactor; | | btScalar m_relaxationFactor; | |
| | | | |
|
| btScalar m_lowerLimit; | | bool m_solveLimit; | |
| btScalar m_upperLimit; | | #endif | |
| | | | |
| btScalar m_kHinge; | | btScalar m_kHinge; | |
| | | | |
|
| btScalar m_limitSign; | | | |
| btScalar m_correction; | | | |
| | | | |
| btScalar m_accLimitImpulse; | | btScalar m_accLimitImpulse; | |
| btScalar m_hingeAngle; | | btScalar m_hingeAngle; | |
|
| btScalar m_referenceSign; | | btScalar m_referenceSign; | |
| | | | |
| bool m_angularOnly; | | bool m_angularOnly; | |
| bool m_enableAngularMotor; | | bool m_enableAngularMotor; | |
|
| bool m_solveLimit; | | | |
| bool m_useSolveConstraintObsolete; | | bool m_useSolveConstraintObsolete; | |
| bool m_useOffsetForConstraintFrame; | | bool m_useOffsetForConstraintFrame; | |
| bool m_useReferenceFrameA; | | bool m_useReferenceFrameA; | |
| | | | |
| btScalar m_accMotorImpulse; | | btScalar m_accMotorImpulse; | |
| | | | |
| int m_flags; | | int m_flags; | |
| btScalar m_normalCFM; | | btScalar m_normalCFM; | |
| btScalar m_stopCFM; | | btScalar m_stopCFM; | |
| btScalar m_stopERP; | | btScalar m_stopERP; | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 138 | |
| btRigidBody& getRigidBodyA() | | btRigidBody& getRigidBodyA() | |
| { | | { | |
| return m_rbA; | | return m_rbA; | |
| } | | } | |
| | | | |
| btRigidBody& getRigidBodyB() | | btRigidBody& getRigidBodyB() | |
| { | | { | |
| return m_rbB; | | return m_rbB; | |
| } | | } | |
| | | | |
|
| | | btTransform& getFrameOffsetA() | |
| | | { | |
| | | return m_rbAFrame; | |
| | | } | |
| | | | |
| | | btTransform& getFrameOffsetB() | |
| | | { | |
| | | return m_rbBFrame; | |
| | | } | |
| | | | |
| | | void setFrames(const btTransform& frameA, const btTransform& frameB) | |
| | | ; | |
| | | | |
| void setAngularOnly(bool angularOnly) | | void setAngularOnly(bool angularOnly) | |
| { | | { | |
| m_angularOnly = angularOnly; | | m_angularOnly = angularOnly; | |
| } | | } | |
| | | | |
| void enableAngularMotor(bool enableMotor,btScalar targetVelocity,
btScalar maxMotorImpulse) | | void enableAngularMotor(bool enableMotor,btScalar targetVelocity,
btScalar maxMotorImpulse) | |
| { | | { | |
| m_enableAngularMotor = enableMotor; | | m_enableAngularMotor = enableMotor; | |
| m_motorTargetVelocity = targetVelocity; | | m_motorTargetVelocity = targetVelocity; | |
| m_maxMotorImpulse = maxMotorImpulse; | | m_maxMotorImpulse = maxMotorImpulse; | |
| | | | |
| skipping to change at line 154 | | skipping to change at line 172 | |
| // extra motor API, including ability to set a target rotation (as o
pposed to angular velocity) | | // extra motor API, including ability to set a target rotation (as o
pposed to angular velocity) | |
| // note: setMotorTarget sets angular velocity under the hood, so you
must call it every tick to | | // note: setMotorTarget sets angular velocity under the hood, so you
must call it every tick to | |
| // maintain a given angular target. | | // maintain a given angular target. | |
| void enableMotor(bool enableMotor) { m_enableAngularMotor = ena
bleMotor; } | | void enableMotor(bool enableMotor) { m_enableAngularMotor = ena
bleMotor; } | |
| void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpuls
e = maxMotorImpulse; } | | void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpuls
e = maxMotorImpulse; } | |
| void setMotorTarget(const btQuaternion& qAinB, btScalar dt); // qAin
B is rotation of body A wrt body B. | | void setMotorTarget(const btQuaternion& qAinB, btScalar dt); // qAin
B is rotation of body A wrt body B. | |
| void setMotorTarget(btScalar targetAngle, btScalar dt); | | void setMotorTarget(btScalar targetAngle, btScalar dt); | |
| | | | |
| void setLimit(btScalar low,btScalar high,btScalar _softness = 0.9
f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) | | void setLimit(btScalar low,btScalar high,btScalar _softness = 0.9
f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) | |
| { | | { | |
|
| | | #ifdef _BT_USE_CENTER_LIMIT_ | |
| | | m_limit.set(low, high, _softness, _biasFactor, _relaxationFa | |
| | | ctor); | |
| | | #else | |
| m_lowerLimit = btNormalizeAngle(low); | | m_lowerLimit = btNormalizeAngle(low); | |
| m_upperLimit = btNormalizeAngle(high); | | m_upperLimit = btNormalizeAngle(high); | |
|
| | | | |
| m_limitSoftness = _softness; | | m_limitSoftness = _softness; | |
| m_biasFactor = _biasFactor; | | m_biasFactor = _biasFactor; | |
| m_relaxationFactor = _relaxationFactor; | | m_relaxationFactor = _relaxationFactor; | |
|
| | | #endif | |
| } | | } | |
| | | | |
| void setAxis(btVector3& axisInA) | | void setAxis(btVector3& axisInA) | |
| { | | { | |
| btVector3 rbAxisA1, rbAxisA2; | | btVector3 rbAxisA1, rbAxisA2; | |
| btPlaneSpace1(axisInA, rbAxisA1, rbAxisA2); | | btPlaneSpace1(axisInA, rbAxisA1, rbAxisA2); | |
| btVector3 pivotInA = m_rbAFrame.getOrigin(); | | btVector3 pivotInA = m_rbAFrame.getOrigin(); | |
| // m_rbAFrame.getOrigin() = pivotInA; | | // m_rbAFrame.getOrigin() = pivotInA; | |
| m_rbAFrame.getBasis().setValue( rbAxisA1.getX(),rbAxisA2.get
X(),axisInA.getX(), | | m_rbAFrame.getBasis().setValue( rbAxisA1.getX(),rbAxisA2.get
X(),axisInA.getX(), | |
|
rbAxisA1.getY(),rbAxisA2.getY(),axisInA.getY(), | |
rbAxisA1.getY(),rbAxisA2.getY(),axisInA.getY(), | |
|
rbAxisA1.getZ(),rbAxisA2.getZ(),axisInA.getZ() ); | |
rbAxisA1.getZ(),rbAxisA2.getZ(),axisInA.getZ() ); | |
| | | | |
| btVector3 axisInB = m_rbA.getCenterOfMassTransform().getBasi
s() * axisInA; | | btVector3 axisInB = m_rbA.getCenterOfMassTransform().getBasi
s() * axisInA; | |
| | | | |
| btQuaternion rotationArc = shortestArcQuat(axisInA,axisInB); | | btQuaternion rotationArc = shortestArcQuat(axisInA,axisInB); | |
| btVector3 rbAxisB1 = quatRotate(rotationArc,rbAxisA1); | | btVector3 rbAxisB1 = quatRotate(rotationArc,rbAxisA1); | |
| btVector3 rbAxisB2 = axisInB.cross(rbAxisB1); | | btVector3 rbAxisB2 = axisInB.cross(rbAxisB1); | |
| | | | |
|
| m_rbBFrame.getOrigin() = m_rbA.getCenterOfMassTransform()(pi | | m_rbBFrame.getOrigin() = m_rbB.getCenterOfMassTransform().in | |
| votInA); | | verse()(m_rbA.getCenterOfMassTransform()(pivotInA)); | |
| | | | |
| m_rbBFrame.getBasis().setValue( rbAxisB1.getX(),rbAxisB2.get
X(),axisInB.getX(), | | m_rbBFrame.getBasis().setValue( rbAxisB1.getX(),rbAxisB2.get
X(),axisInB.getX(), | |
|
rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(), | |
rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(), | |
|
rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() ); | |
rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() ); | |
|
| | | m_rbBFrame.getBasis() = m_rbB.getCenterOfMassTransform().get | |
| | | Basis().inverse() * m_rbBFrame.getBasis(); | |
| | | | |
| } | | } | |
| | | | |
| btScalar getLowerLimit() const | | btScalar getLowerLimit() const | |
| { | | { | |
|
| return m_lowerLimit; | | #ifdef _BT_USE_CENTER_LIMIT_ | |
| | | return m_limit.getLow(); | |
| | | #else | |
| | | return m_lowerLimit; | |
| | | #endif | |
| } | | } | |
| | | | |
| btScalar getUpperLimit() const | | btScalar getUpperLimit() const | |
| { | | { | |
|
| return m_upperLimit; | | #ifdef _BT_USE_CENTER_LIMIT_ | |
| | | return m_limit.getHigh(); | |
| | | #else | |
| | | return m_upperLimit; | |
| | | #endif | |
| } | | } | |
| | | | |
| btScalar getHingeAngle(); | | btScalar getHingeAngle(); | |
| | | | |
| btScalar getHingeAngle(const btTransform& transA,const btTransform&
transB); | | btScalar getHingeAngle(const btTransform& transA,const btTransform&
transB); | |
| | | | |
| void testLimit(const btTransform& transA,const btTransform& transB); | | void testLimit(const btTransform& transA,const btTransform& transB); | |
| | | | |
| const btTransform& getAFrame() const { return m_rbAFrame; }; | | const btTransform& getAFrame() const { return m_rbAFrame; }; | |
| const btTransform& getBFrame() const { return m_rbBFrame; }; | | const btTransform& getBFrame() const { return m_rbBFrame; }; | |
| | | | |
| btTransform& getAFrame() { return m_rbAFrame; }; | | btTransform& getAFrame() { return m_rbAFrame; }; | |
| btTransform& getBFrame() { return m_rbBFrame; }; | | btTransform& getBFrame() { return m_rbBFrame; }; | |
| | | | |
| inline int getSolveLimit() | | inline int getSolveLimit() | |
| { | | { | |
|
| return m_solveLimit; | | #ifdef _BT_USE_CENTER_LIMIT_ | |
| | | return m_limit.isLimit(); | |
| | | #else | |
| | | return m_solveLimit; | |
| | | #endif | |
| } | | } | |
| | | | |
| inline btScalar getLimitSign() | | inline btScalar getLimitSign() | |
| { | | { | |
|
| | | #ifdef _BT_USE_CENTER_LIMIT_ | |
| | | return m_limit.getSign(); | |
| | | #else | |
| return m_limitSign; | | return m_limitSign; | |
|
| | | #endif | |
| } | | } | |
| | | | |
| inline bool getAngularOnly() | | inline bool getAngularOnly() | |
| { | | { | |
| return m_angularOnly; | | return m_angularOnly; | |
| } | | } | |
| inline bool getEnableAngularMotor() | | inline bool getEnableAngularMotor() | |
| { | | { | |
| return m_enableAngularMotor; | | return m_enableAngularMotor; | |
| } | | } | |
| | | | |
| skipping to change at line 309 | | skipping to change at line 348 | |
| btTypedConstraint::serialize(&hingeData->m_typeConstraintData,serial
izer); | | btTypedConstraint::serialize(&hingeData->m_typeConstraintData,serial
izer); | |
| | | | |
| m_rbAFrame.serialize(hingeData->m_rbAFrame); | | m_rbAFrame.serialize(hingeData->m_rbAFrame); | |
| m_rbBFrame.serialize(hingeData->m_rbBFrame); | | m_rbBFrame.serialize(hingeData->m_rbBFrame); | |
| | | | |
| hingeData->m_angularOnly = m_angularOnly; | | hingeData->m_angularOnly = m_angularOnly; | |
| hingeData->m_enableAngularMotor = m_enableAngularMotor; | | hingeData->m_enableAngularMotor = m_enableAngularMotor; | |
| hingeData->m_maxMotorImpulse = float(m_maxMotorImpulse); | | hingeData->m_maxMotorImpulse = float(m_maxMotorImpulse); | |
| hingeData->m_motorTargetVelocity = float(m_motorTargetVelocity); | | hingeData->m_motorTargetVelocity = float(m_motorTargetVelocity); | |
| hingeData->m_useReferenceFrameA = m_useReferenceFrameA; | | hingeData->m_useReferenceFrameA = m_useReferenceFrameA; | |
|
| | | #ifdef _BT_USE_CENTER_LIMIT_ | |
| | | hingeData->m_lowerLimit = float(m_limit.getLow()); | |
| | | hingeData->m_upperLimit = float(m_limit.getHigh()); | |
| | | hingeData->m_limitSoftness = float(m_limit.getSoftness()); | |
| | | hingeData->m_biasFactor = float(m_limit.getBiasFactor()); | |
| | | hingeData->m_relaxationFactor = float(m_limit.getRelaxationFactor()) | |
| | | ; | |
| | | #else | |
| hingeData->m_lowerLimit = float(m_lowerLimit); | | hingeData->m_lowerLimit = float(m_lowerLimit); | |
| hingeData->m_upperLimit = float(m_upperLimit); | | hingeData->m_upperLimit = float(m_upperLimit); | |
| hingeData->m_limitSoftness = float(m_limitSoftness); | | hingeData->m_limitSoftness = float(m_limitSoftness); | |
| hingeData->m_biasFactor = float(m_biasFactor); | | hingeData->m_biasFactor = float(m_biasFactor); | |
| hingeData->m_relaxationFactor = float(m_relaxationFactor); | | hingeData->m_relaxationFactor = float(m_relaxationFactor); | |
|
| | | #endif | |
| | | | |
| return btHingeConstraintDataName; | | return btHingeConstraintDataName; | |
| } | | } | |
| | | | |
|
| #endif //HINGECONSTRAINT_H | | #endif //BT_HINGECONSTRAINT_H | |
| | | | |
End of changes. 21 change blocks. |
| 18 lines changed or deleted | | 68 lines changed or added | |
|
| btIDebugDraw.h | | btIDebugDraw.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef IDEBUG_DRAW__H | | #ifndef BT_IDEBUG_DRAW__H | |
| #define IDEBUG_DRAW__H | | #define BT_IDEBUG_DRAW__H | |
| | | | |
| #include "btVector3.h" | | #include "btVector3.h" | |
| #include "btTransform.h" | | #include "btTransform.h" | |
| | | | |
| ///The btIDebugDraw interface class allows hooking up a debug renderer to v
isually debug simulations. | | ///The btIDebugDraw interface class allows hooking up a debug renderer to v
isually debug simulations. | |
| ///Typical use case: create a debug drawer object, and assign it to a btCol
lisionWorld or btDynamicsWorld using setDebugDrawer and call debugDrawWorld
. | | ///Typical use case: create a debug drawer object, and assign it to a btCol
lisionWorld or btDynamicsWorld using setDebugDrawer and call debugDrawWorld
. | |
| ///A class that implements the btIDebugDraw interface has to implement the
drawLine method at a minimum. | | ///A class that implements the btIDebugDraw interface has to implement the
drawLine method at a minimum. | |
| ///For color arguments the X,Y,Z components refer to Red, Green and Blue ea
ch in the range [0..1] | | ///For color arguments the X,Y,Z components refer to Red, Green and Blue ea
ch in the range [0..1] | |
| class btIDebugDraw | | class btIDebugDraw | |
| { | | { | |
| | | | |
| skipping to change at line 310 | | skipping to change at line 310 | |
| drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMin[2]), color); | | drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMin[2]), color); | |
| drawLine(trans * btVector3(bbMin[0], bbMin[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMax[2]), color); | | drawLine(trans * btVector3(bbMin[0], bbMin[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMax[2]), color); | |
| drawLine(trans * btVector3(bbMax[0], bbMin[1], bbMin[2]), tr
ans * btVector3(bbMax[0], bbMin[1], bbMax[2]), color); | | drawLine(trans * btVector3(bbMax[0], bbMin[1], bbMin[2]), tr
ans * btVector3(bbMax[0], bbMin[1], bbMax[2]), color); | |
| drawLine(trans * btVector3(bbMax[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMax[0], bbMax[1], bbMax[2]), color); | | drawLine(trans * btVector3(bbMax[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMax[0], bbMax[1], bbMax[2]), color); | |
| drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMax[1], bbMax[2]), color); | | drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMin[2]), tr
ans * btVector3(bbMin[0], bbMax[1], bbMax[2]), color); | |
| drawLine(trans * btVector3(bbMin[0], bbMin[1], bbMax[2]), tr
ans * btVector3(bbMax[0], bbMin[1], bbMax[2]), color); | | drawLine(trans * btVector3(bbMin[0], bbMin[1], bbMax[2]), tr
ans * btVector3(bbMax[0], bbMin[1], bbMax[2]), color); | |
| drawLine(trans * btVector3(bbMax[0], bbMin[1], bbMax[2]), tr
ans * btVector3(bbMax[0], bbMax[1], bbMax[2]), color); | | drawLine(trans * btVector3(bbMax[0], bbMin[1], bbMax[2]), tr
ans * btVector3(bbMax[0], bbMax[1], bbMax[2]), color); | |
| drawLine(trans * btVector3(bbMax[0], bbMax[1], bbMax[2]), tr
ans * btVector3(bbMin[0], bbMax[1], bbMax[2]), color); | | drawLine(trans * btVector3(bbMax[0], bbMax[1], bbMax[2]), tr
ans * btVector3(bbMin[0], bbMax[1], bbMax[2]), color); | |
| drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMax[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMax[2]), color); | | drawLine(trans * btVector3(bbMin[0], bbMax[1], bbMax[2]), tr
ans * btVector3(bbMin[0], bbMin[1], bbMax[2]), color); | |
| } | | } | |
|
| | | | |
| | | virtual void drawCapsule(btScalar radius, btScalar halfHeight, int u | |
| | | pAxis, const btTransform& transform, const btVector3& color) | |
| | | { | |
| | | btVector3 capStart(0.f,0.f,0.f); | |
| | | capStart[upAxis] = -halfHeight; | |
| | | | |
| | | btVector3 capEnd(0.f,0.f,0.f); | |
| | | capEnd[upAxis] = halfHeight; | |
| | | | |
| | | // Draw the ends | |
| | | { | |
| | | | |
| | | btTransform childTransform = transform; | |
| | | childTransform.getOrigin() = transform * capStart; | |
| | | drawSphere(radius, childTransform, color); | |
| | | } | |
| | | | |
| | | { | |
| | | btTransform childTransform = transform; | |
| | | childTransform.getOrigin() = transform * capEnd; | |
| | | drawSphere(radius, childTransform, color); | |
| | | } | |
| | | | |
| | | // Draw some additional lines | |
| | | btVector3 start = transform.getOrigin(); | |
| | | | |
| | | capStart[(upAxis+1)%3] = radius; | |
| | | capEnd[(upAxis+1)%3] = radius; | |
| | | drawLine(start+transform.getBasis() * capStart,start+transfo | |
| | | rm.getBasis() * capEnd, color); | |
| | | capStart[(upAxis+1)%3] = -radius; | |
| | | capEnd[(upAxis+1)%3] = -radius; | |
| | | drawLine(start+transform.getBasis() * capStart,start+transfo | |
| | | rm.getBasis() * capEnd, color); | |
| | | | |
| | | capStart[(upAxis+1)%3] = 0.f; | |
| | | capEnd[(upAxis+1)%3] = 0.f; | |
| | | | |
| | | capStart[(upAxis+2)%3] = radius; | |
| | | capEnd[(upAxis+2)%3] = radius; | |
| | | drawLine(start+transform.getBasis() * capStart,start+transfo | |
| | | rm.getBasis() * capEnd, color); | |
| | | capStart[(upAxis+2)%3] = -radius; | |
| | | capEnd[(upAxis+2)%3] = -radius; | |
| | | drawLine(start+transform.getBasis() * capStart,start+transfo | |
| | | rm.getBasis() * capEnd, color); | |
| | | } | |
| | | | |
| | | virtual void drawCylinder(btScalar radius, btScalar halfHeight, int | |
| | | upAxis, const btTransform& transform, const btVector3& color) | |
| | | { | |
| | | btVector3 start = transform.getOrigin(); | |
| | | btVector3 offsetHeight(0,0,0); | |
| | | offsetHeight[upAxis] = halfHeight; | |
| | | btVector3 offsetRadius(0,0,0); | |
| | | offsetRadius[(upAxis+1)%3] = radius; | |
| | | drawLine(start+transform.getBasis() * (offsetHeight+offsetRa | |
| | | dius),start+transform.getBasis() * (-offsetHeight+offsetRadius),color); | |
| | | drawLine(start+transform.getBasis() * (offsetHeight-offsetRa | |
| | | dius),start+transform.getBasis() * (-offsetHeight-offsetRadius),color); | |
| | | | |
| | | // Drawing top and bottom caps of the cylinder | |
| | | btVector3 yaxis(0,0,0); | |
| | | yaxis[upAxis] = btScalar(1.0); | |
| | | btVector3 xaxis(0,0,0); | |
| | | xaxis[(upAxis+1)%3] = btScalar(1.0); | |
| | | drawArc(start-transform.getBasis()*(offsetHeight),transform. | |
| | | getBasis()*yaxis,transform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color | |
| | | ,false,btScalar(10.0)); | |
| | | drawArc(start+transform.getBasis()*(offsetHeight),transform. | |
| | | getBasis()*yaxis,transform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color | |
| | | ,false,btScalar(10.0)); | |
| | | } | |
| | | | |
| | | virtual void drawCone(btScalar radius, btScalar height, int upAxis, | |
| | | const btTransform& transform, const btVector3& color) | |
| | | { | |
| | | | |
| | | btVector3 start = transform.getOrigin(); | |
| | | | |
| | | btVector3 offsetHeight(0,0,0); | |
| | | offsetHeight[upAxis] = height * btScalar(0.5); | |
| | | btVector3 offsetRadius(0,0,0); | |
| | | offsetRadius[(upAxis+1)%3] = radius; | |
| | | btVector3 offset2Radius(0,0,0); | |
| | | offset2Radius[(upAxis+2)%3] = radius; | |
| | | | |
| | | drawLine(start+transform.getBasis() * (offsetHeight),start+t | |
| | | ransform.getBasis() * (-offsetHeight+offsetRadius),color); | |
| | | drawLine(start+transform.getBasis() * (offsetHeight),start+t | |
| | | ransform.getBasis() * (-offsetHeight-offsetRadius),color); | |
| | | drawLine(start+transform.getBasis() * (offsetHeight),start+t | |
| | | ransform.getBasis() * (-offsetHeight+offset2Radius),color); | |
| | | drawLine(start+transform.getBasis() * (offsetHeight),start+t | |
| | | ransform.getBasis() * (-offsetHeight-offset2Radius),color); | |
| | | | |
| | | // Drawing the base of the cone | |
| | | btVector3 yaxis(0,0,0); | |
| | | yaxis[upAxis] = btScalar(1.0); | |
| | | btVector3 xaxis(0,0,0); | |
| | | xaxis[(upAxis+1)%3] = btScalar(1.0); | |
| | | drawArc(start-transform.getBasis()*(offsetHeight),transform. | |
| | | getBasis()*yaxis,transform.getBasis()*xaxis,radius,radius,0,SIMD_2_PI,color | |
| | | ,false,10.0); | |
| | | } | |
| | | | |
| | | virtual void drawPlane(const btVector3& planeNormal, btScalar planeC | |
| | | onst, const btTransform& transform, const btVector3& color) | |
| | | { | |
| | | btVector3 planeOrigin = planeNormal * planeConst; | |
| | | btVector3 vec0,vec1; | |
| | | btPlaneSpace1(planeNormal,vec0,vec1); | |
| | | btScalar vecLen = 100.f; | |
| | | btVector3 pt0 = planeOrigin + vec0*vecLen; | |
| | | btVector3 pt1 = planeOrigin - vec0*vecLen; | |
| | | btVector3 pt2 = planeOrigin + vec1*vecLen; | |
| | | btVector3 pt3 = planeOrigin - vec1*vecLen; | |
| | | drawLine(transform*pt0,transform*pt1,color); | |
| | | drawLine(transform*pt2,transform*pt3,color); | |
| | | } | |
| }; | | }; | |
| | | | |
|
| #endif //IDEBUG_DRAW__H | | #endif //BT_IDEBUG_DRAW__H | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 123 lines changed or added | |
|
| btManifoldPoint.h | | btManifoldPoint.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef MANIFOLD_CONTACT_POINT_H | | #ifndef BT_MANIFOLD_CONTACT_POINT_H | |
| #define MANIFOLD_CONTACT_POINT_H | | #define BT_MANIFOLD_CONTACT_POINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "LinearMath/btTransformUtil.h" | | #include "LinearMath/btTransformUtil.h" | |
| | | | |
|
| // Don't change following order of parameters | | #ifdef PFX_USE_FREE_VECTORMATH | |
| ATTRIBUTE_ALIGNED16(struct) PfxConstraintRow { | | #include "physics_effects/base_level/solver/pfx_constraint_row.h" | |
| btScalar mNormal[3]; | | typedef sce::PhysicsEffects::PfxConstraintRow btConstraintRow; | |
| btScalar mRhs; | | #else | |
| btScalar mJacDiagInv; | | // Don't change following order of parameters | |
| btScalar mLowerLimit; | | ATTRIBUTE_ALIGNED16(struct) btConstraintRow { | |
| btScalar mUpperLimit; | | btScalar m_normal[3]; | |
| btScalar mAccumImpulse; | | btScalar m_rhs; | |
| }; | | btScalar m_jacDiagInv; | |
| | | btScalar m_lowerLimit; | |
| | | btScalar m_upperLimit; | |
| | | btScalar m_accumImpulse; | |
| | | }; | |
| | | typedef btConstraintRow PfxConstraintRow; | |
| | | #endif //PFX_USE_FREE_VECTORMATH | |
| | | | |
| /// ManifoldContactPoint collects and maintains persistent contactpoints. | | /// ManifoldContactPoint collects and maintains persistent contactpoints. | |
| /// used to improve stability and performance of rigidbody dynamics respons
e. | | /// used to improve stability and performance of rigidbody dynamics respons
e. | |
| class btManifoldPoint | | class btManifoldPoint | |
| { | | { | |
| public: | | public: | |
| btManifoldPoint() | | btManifoldPoint() | |
| :m_userPersistentData(0), | | :m_userPersistentData(0), | |
| m_appliedImpulse(0.f), | | m_appliedImpulse(0.f), | |
| m_lateralFrictionInitialized(false), | | m_lateralFrictionInitialized(false), | |
| | | | |
| skipping to change at line 71 | | skipping to change at line 77 | |
| m_appliedImpulse(0.f), | | m_appliedImpulse(0.f), | |
| m_lateralFrictionInitialized(false), | | m_lateralFrictionInitialized(false), | |
| m_appliedImpulseLateral1(0.f), | | m_appliedImpulseLateral1(0.f), | |
| m_appliedImpulseLateral2(0.f), | | m_appliedImpulseLateral2(0.f), | |
| m_contactMotion1(0.f), | | m_contactMotion1(0.f), | |
| m_contactMotion2(0.f), | | m_contactMotion2(0.f), | |
| m_contactCFM1(0.f), | | m_contactCFM1(0.f), | |
| m_contactCFM2(0.f), | | m_contactCFM2(0.f), | |
| m_lifeTime(0) | | m_lifeTime(0) | |
| { | | { | |
|
| mConstraintRow[0].mAccumImpulse = 0.f; | | mConstraintRow[0].m_accumImpulse = 0.f; | |
| mConstraintRow[1].mAccumImpulse = 0.f; | | mConstraintRow[1].m_accumImpulse = 0.f; | |
| mConstraintRow[2].mAccumImpulse = 0.f; | | mConstraintRow[2].m_accumImpulse = 0.f; | |
| } | | } | |
| | | | |
| btVector3 m_localPointA; | | btVector3 m_localPointA; | |
| btVector3 m_localPointB; | | btVector3 m_localPointB; | |
| btVector3 m_positionWorldOnB; | | btVector3 m_positionWorldOnB; | |
| ///m_positionWorldOnA is redundant information, see
getPositionWorldOnA(), but for clarity | | ///m_positionWorldOnA is redundant information, see
getPositionWorldOnA(), but for clarity | |
| btVector3 m_positionWorldOnA; | | btVector3 m_positionWorldOnA; | |
| btVector3 m_normalWorldOnB; | | btVector3 m_normalWorldOnB; | |
| | | | |
| btScalar m_distance1; | | btScalar m_distance1; | |
| | | | |
| skipping to change at line 109 | | skipping to change at line 115 | |
| btScalar m_contactMotion1; | | btScalar m_contactMotion1; | |
| btScalar m_contactMotion2; | | btScalar m_contactMotion2; | |
| btScalar m_contactCFM1; | | btScalar m_contactCFM1; | |
| btScalar m_contactCFM2; | | btScalar m_contactCFM2; | |
| | | | |
| int m_lifeTime;//lifetim
e of the contactpoint in frames | | int m_lifeTime;//lifetim
e of the contactpoint in frames | |
| | | | |
| btVector3 m_lateralFrictionDir1; | | btVector3 m_lateralFrictionDir1; | |
| btVector3 m_lateralFrictionDir2; | | btVector3 m_lateralFrictionDir2; | |
| | | | |
|
| PfxConstraintRow mConstraintRow[3]; | | btConstraintRow mConstraintRow[3]; | |
| | | | |
| btScalar getDistance() const | | btScalar getDistance() const | |
| { | | { | |
| return m_distance1; | | return m_distance1; | |
| } | | } | |
| int getLifeTime() const | | int getLifeTime() const | |
| { | | { | |
| return m_lifeTime; | | return m_lifeTime; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 149 | |
| } | | } | |
| | | | |
| ///this returns the most recent applied impulse, to
satisfy contact constraints by the constraint solver | | ///this returns the most recent applied impulse, to
satisfy contact constraints by the constraint solver | |
| btScalar getAppliedImpulse() const | | btScalar getAppliedImpulse() const | |
| { | | { | |
| return m_appliedImpulse; | | return m_appliedImpulse; | |
| } | | } | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //MANIFOLD_CONTACT_POINT_H | | #endif //BT_MANIFOLD_CONTACT_POINT_H | |
| | | | |
End of changes. 5 change blocks. |
| 15 lines changed or deleted | | 21 lines changed or added | |
|
| btMatrix3x3.h | | btMatrix3x3.h | |
| | | | |
| skipping to change at line 110 | | skipping to change at line 110 | |
| { | | { | |
| btFullAssert(0 <= i && i < 3); | | btFullAssert(0 <= i && i < 3); | |
| return m_el[i]; | | return m_el[i]; | |
| } | | } | |
| | | | |
| /** @brief Multiply by the target matrix on the right | | /** @brief Multiply by the target matrix on the right | |
| * @param m Rotation matrix to be applied | | * @param m Rotation matrix to be applied | |
| * Equivilant to this = this * m */ | | * Equivilant to this = this * m */ | |
| btMatrix3x3& operator*=(const btMatrix3x3& m); | | btMatrix3x3& operator*=(const btMatrix3x3& m); | |
| | | | |
|
| /** @brief Set from a carray of btScalars | | /** @brief Adds by the target matrix on the right | |
| * @param m A pointer to the beginning of an array of 9 btScalars */ | | * @param m matrix to be applied | |
| | | * Equivilant to this = this + m */ | |
| | | btMatrix3x3& operator+=(const btMatrix3x3& m); | |
| | | | |
| | | /** @brief Substractss by the target matrix on the right | |
| | | * @param m matrix to be applied | |
| | | * Equivilant to this = this - m */ | |
| | | btMatrix3x3& operator-=(const btMatrix3x3& m); | |
| | | | |
| | | /** @brief Set from the rotational part of a 4x4 OpenGL matrix | |
| | | * @param m A pointer to the beginning of the array of scalars*/ | |
| void setFromOpenGLSubMatrix(const btScalar *m) | | void setFromOpenGLSubMatrix(const btScalar *m) | |
| { | | { | |
| m_el[0].setValue(m[0],m[4],m[8]); | | m_el[0].setValue(m[0],m[4],m[8]); | |
| m_el[1].setValue(m[1],m[5],m[9]); | | m_el[1].setValue(m[1],m[5],m[9]); | |
| m_el[2].setValue(m[2],m[6],m[10]); | | m_el[2].setValue(m[2],m[6],m[10]); | |
| | | | |
| } | | } | |
| /** @brief Set the values of the matrix explicitly (row major) | | /** @brief Set the values of the matrix explicitly (row major) | |
| * @param xx Top left | | * @param xx Top left | |
| * @param xy Top Middle | | * @param xy Top Middle | |
| | | | |
| skipping to change at line 207 | | skipping to change at line 217 | |
| } | | } | |
| | | | |
| static const btMatrix3x3& getIdentity() | | static const btMatrix3x3& getIdentity() | |
| { | | { | |
| static const btMatrix3x3 identityMatrix(btScalar(1.0), btSca
lar(0.0), btScalar(0.0), | | static const btMatrix3x3 identityMatrix(btScalar(1.0), btSca
lar(0.0), btScalar(0.0), | |
| btScalar(0.0), btScalar(1.0), btScalar(0.0), | | btScalar(0.0), btScalar(1.0), btScalar(0.0), | |
| btScalar(0.0), btScalar(0.0), btScalar(1.0)); | | btScalar(0.0), btScalar(0.0), btScalar(1.0)); | |
| return identityMatrix; | | return identityMatrix; | |
| } | | } | |
| | | | |
|
| /**@brief Fill the values of the matrix into a 9 element array | | /**@brief Fill the rotational part of an OpenGL matrix and clear the
shear/perspective | |
| * @param m The array to be filled */ | | * @param m The array to be filled */ | |
| void getOpenGLSubMatrix(btScalar *m) const | | void getOpenGLSubMatrix(btScalar *m) const | |
| { | | { | |
| m[0] = btScalar(m_el[0].x()); | | m[0] = btScalar(m_el[0].x()); | |
| m[1] = btScalar(m_el[1].x()); | | m[1] = btScalar(m_el[1].x()); | |
| m[2] = btScalar(m_el[2].x()); | | m[2] = btScalar(m_el[2].x()); | |
| m[3] = btScalar(0.0); | | m[3] = btScalar(0.0); | |
| m[4] = btScalar(m_el[0].y()); | | m[4] = btScalar(m_el[0].y()); | |
| m[5] = btScalar(m_el[1].y()); | | m[5] = btScalar(m_el[1].y()); | |
| m[6] = btScalar(m_el[2].y()); | | m[6] = btScalar(m_el[2].y()); | |
| | | | |
| skipping to change at line 516 | | skipping to change at line 526 | |
| | | | |
| SIMD_FORCE_INLINE btMatrix3x3& | | SIMD_FORCE_INLINE btMatrix3x3& | |
| btMatrix3x3::operator*=(const btMatrix3x3& m) | | btMatrix3x3::operator*=(const btMatrix3x3& m) | |
| { | | { | |
| setValue(m.tdotx(m_el[0]), m.tdoty(m_el[0]), m.tdotz(m_el[0]), | | setValue(m.tdotx(m_el[0]), m.tdoty(m_el[0]), m.tdotz(m_el[0]), | |
| m.tdotx(m_el[1]), m.tdoty(m_el[1]), m.tdotz(m_el[1]), | | m.tdotx(m_el[1]), m.tdoty(m_el[1]), m.tdotz(m_el[1]), | |
| m.tdotx(m_el[2]), m.tdoty(m_el[2]), m.tdotz(m_el[2])); | | m.tdotx(m_el[2]), m.tdoty(m_el[2]), m.tdotz(m_el[2])); | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
|
| | | SIMD_FORCE_INLINE btMatrix3x3& | |
| | | btMatrix3x3::operator+=(const btMatrix3x3& m) | |
| | | { | |
| | | setValue( | |
| | | m_el[0][0]+m.m_el[0][0], | |
| | | m_el[0][1]+m.m_el[0][1], | |
| | | m_el[0][2]+m.m_el[0][2], | |
| | | m_el[1][0]+m.m_el[1][0], | |
| | | m_el[1][1]+m.m_el[1][1], | |
| | | m_el[1][2]+m.m_el[1][2], | |
| | | m_el[2][0]+m.m_el[2][0], | |
| | | m_el[2][1]+m.m_el[2][1], | |
| | | m_el[2][2]+m.m_el[2][2]); | |
| | | return *this; | |
| | | } | |
| | | | |
| | | SIMD_FORCE_INLINE btMatrix3x3 | |
| | | operator*(const btMatrix3x3& m, const btScalar & k) | |
| | | { | |
| | | return btMatrix3x3( | |
| | | m[0].x()*k,m[0].y()*k,m[0].z()*k, | |
| | | m[1].x()*k,m[1].y()*k,m[1].z()*k, | |
| | | m[2].x()*k,m[2].y()*k,m[2].z()*k); | |
| | | } | |
| | | | |
| | | SIMD_FORCE_INLINE btMatrix3x3 | |
| | | operator+(const btMatrix3x3& m1, const btMatrix3x3& m2) | |
| | | { | |
| | | return btMatrix3x3( | |
| | | m1[0][0]+m2[0][0], | |
| | | m1[0][1]+m2[0][1], | |
| | | m1[0][2]+m2[0][2], | |
| | | m1[1][0]+m2[1][0], | |
| | | m1[1][1]+m2[1][1], | |
| | | m1[1][2]+m2[1][2], | |
| | | m1[2][0]+m2[2][0], | |
| | | m1[2][1]+m2[2][1], | |
| | | m1[2][2]+m2[2][2]); | |
| | | } | |
| | | | |
| | | SIMD_FORCE_INLINE btMatrix3x3 | |
| | | operator-(const btMatrix3x3& m1, const btMatrix3x3& m2) | |
| | | { | |
| | | return btMatrix3x3( | |
| | | m1[0][0]-m2[0][0], | |
| | | m1[0][1]-m2[0][1], | |
| | | m1[0][2]-m2[0][2], | |
| | | m1[1][0]-m2[1][0], | |
| | | m1[1][1]-m2[1][1], | |
| | | m1[1][2]-m2[1][2], | |
| | | m1[2][0]-m2[2][0], | |
| | | m1[2][1]-m2[2][1], | |
| | | m1[2][2]-m2[2][2]); | |
| | | } | |
| | | | |
| | | SIMD_FORCE_INLINE btMatrix3x3& | |
| | | btMatrix3x3::operator-=(const btMatrix3x3& m) | |
| | | { | |
| | | setValue( | |
| | | m_el[0][0]-m.m_el[0][0], | |
| | | m_el[0][1]-m.m_el[0][1], | |
| | | m_el[0][2]-m.m_el[0][2], | |
| | | m_el[1][0]-m.m_el[1][0], | |
| | | m_el[1][1]-m.m_el[1][1], | |
| | | m_el[1][2]-m.m_el[1][2], | |
| | | m_el[2][0]-m.m_el[2][0], | |
| | | m_el[2][1]-m.m_el[2][1], | |
| | | m_el[2][2]-m.m_el[2][2]); | |
| | | return *this; | |
| | | } | |
| | | | |
| SIMD_FORCE_INLINE btScalar | | SIMD_FORCE_INLINE btScalar | |
| btMatrix3x3::determinant() const | | btMatrix3x3::determinant() const | |
| { | | { | |
| return btTriple((*this)[0], (*this)[1], (*this)[2]); | | return btTriple((*this)[0], (*this)[1], (*this)[2]); | |
| } | | } | |
| | | | |
| SIMD_FORCE_INLINE btMatrix3x3 | | SIMD_FORCE_INLINE btMatrix3x3 | |
| btMatrix3x3::absolute() const | | btMatrix3x3::absolute() const | |
| { | | { | |
| return btMatrix3x3( | | return btMatrix3x3( | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 84 lines changed or added | |
|
| btMinkowskiPenetrationDepthSolver.h | | btMinkowskiPenetrationDepthSolver.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef MINKOWSKI_PENETRATION_DEPTH_SOLVER_H | | #ifndef BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H | |
| #define MINKOWSKI_PENETRATION_DEPTH_SOLVER_H | | #define BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H | |
| | | | |
| #include "btConvexPenetrationDepthSolver.h" | | #include "btConvexPenetrationDepthSolver.h" | |
| | | | |
| ///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth
estimation. | | ///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. | | ///Implementation is based on sampling the depth using support mapping, and
using GJK step to get the witness points. | |
| class btMinkowskiPenetrationDepthSolver : public btConvexPenetrationDepthSo
lver | | class btMinkowskiPenetrationDepthSolver : public btConvexPenetrationDepthSo
lver | |
| { | | { | |
| protected: | | protected: | |
| | | | |
| static btVector3* getPenetrationDirections(); | | static btVector3* getPenetrationDirections(); | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 39 | |
| public: | | public: | |
| | | | |
| virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver, | | virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver, | |
| const btConvexShape* convexA,const btConvexShape* convexB, | | const btConvexShape* convexA,const btConvexShape* convexB, | |
| const btTransform& transA,const btTransform&
transB, | | const btTransform& transA,const btTransform&
transB, | |
| btVector3& v, btVector3& pa, btVector3& pb, | | btVector3& v, btVector3& pa, btVector3& pb, | |
| class btIDebugDraw* debugDraw,btStackAlloc* stackAll
oc | | class btIDebugDraw* debugDraw,btStackAlloc* stackAll
oc | |
| ); | | ); | |
| }; | | }; | |
| | | | |
|
| #endif //MINKOWSKI_PENETRATION_DEPTH_SOLVER_H | | #endif //BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btMultimaterialTriangleMeshShape.h | | btMultimaterialTriangleMeshShape.h | |
| | | | |
| skipping to change at line 18 | | skipping to change at line 18 | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
| /// This file was created by Alex Silverman | | /// This file was created by Alex Silverman | |
| | | | |
|
| #ifndef BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H | | #ifndef BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H | |
| #define BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H | | #define BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H | |
| | | | |
| #include "btBvhTriangleMeshShape.h" | | #include "btBvhTriangleMeshShape.h" | |
| #include "btMaterial.h" | | #include "btMaterial.h" | |
| | | | |
| ///The BvhTriangleMaterialMeshShape extends the btBvhTriangleMeshShape. Its
main contribution is the interface into a material array, which allows per
-triangle friction and restitution. | | ///The BvhTriangleMaterialMeshShape extends the btBvhTriangleMeshShape. Its
main contribution is the interface into a material array, which allows per
-triangle friction and restitution. | |
| ATTRIBUTE_ALIGNED16(class) btMultimaterialTriangleMeshShape : public btBvhT
riangleMeshShape | | ATTRIBUTE_ALIGNED16(class) btMultimaterialTriangleMeshShape : public btBvhT
riangleMeshShape | |
| { | | { | |
| btAlignedObjectArray <btMaterial*> m_materialList; | | btAlignedObjectArray <btMaterial*> m_materialList; | |
| int ** m_triangleMaterials; | | int ** m_triangleMaterials; | |
| | | | |
| public: | | public: | |
| | | | |
| BT_DECLARE_ALIGNED_ALLOCATOR(); | | BT_DECLARE_ALIGNED_ALLOCATOR(); | |
| | | | |
|
| btMultimaterialTriangleMeshShape(): btBvhTriangleMeshShape() {m_shapeTy
pe = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE;} | | | |
| btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface
, bool useQuantizedAabbCompression, bool buildBvh = true): | | btMultimaterialTriangleMeshShape(btStridingMeshInterface* meshInterface
, bool useQuantizedAabbCompression, bool buildBvh = true): | |
| btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression,
buildBvh) | | btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression,
buildBvh) | |
| { | | { | |
| m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE; | | m_shapeType = MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE; | |
| | | | |
| const unsigned char *vertexbase; | | const unsigned char *vertexbase; | |
| int numverts; | | int numverts; | |
| PHY_ScalarType type; | | PHY_ScalarType type; | |
| int stride; | | int stride; | |
| const unsigned char *indexbase; | | const unsigned char *indexbase; | |
| | | | |
| skipping to change at line 121 | | skipping to change at line 120 | |
| } | | } | |
| //debugging | | //debugging | |
| virtual const char* getName()const {return "MULTIMATERIALTRIANGL
EMESH";} | | virtual const char* getName()const {return "MULTIMATERIALTRIANGL
EMESH";} | |
| | | | |
| ///Obtains the material for a specific triangle | | ///Obtains the material for a specific triangle | |
| const btMaterial * getMaterialProperties(int partID, int triIndex); | | const btMaterial * getMaterialProperties(int partID, int triIndex); | |
| | | | |
| } | | } | |
| ; | | ; | |
| | | | |
|
| #endif //BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H | | #endif //BT_BVH_TRIANGLE_MATERIAL_MESH_SHAPE_H | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 2 lines changed or added | |
|
| btPersistentManifold.h | | btPersistentManifold.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef PERSISTENT_MANIFOLD_H | | #ifndef BT_PERSISTENT_MANIFOLD_H | |
| #define PERSISTENT_MANIFOLD_H | | #define BT_PERSISTENT_MANIFOLD_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "LinearMath/btTransform.h" | | #include "LinearMath/btTransform.h" | |
| #include "btManifoldPoint.h" | | #include "btManifoldPoint.h" | |
| #include "LinearMath/btAlignedAllocator.h" | | #include "LinearMath/btAlignedAllocator.h" | |
| | | | |
| struct btCollisionResult; | | struct btCollisionResult; | |
| | | | |
| ///maximum contact breaking and merging threshold | | ///maximum contact breaking and merging threshold | |
| extern btScalar gContactBreakingThreshold; | | extern btScalar gContactBreakingThreshold; | |
| | | | |
| typedef bool (*ContactDestroyedCallback)(void* userPersistentData); | | typedef bool (*ContactDestroyedCallback)(void* userPersistentData); | |
| typedef bool (*ContactProcessedCallback)(btManifoldPoint& cp,void* body0,vo
id* body1); | | typedef bool (*ContactProcessedCallback)(btManifoldPoint& cp,void* body0,vo
id* body1); | |
| extern ContactDestroyedCallback gContactDestroyedCallback; | | extern ContactDestroyedCallback gContactDestroyedCallback; | |
| extern ContactProcessedCallback gContactProcessedCallback; | | extern ContactProcessedCallback gContactProcessedCallback; | |
| | | | |
|
| | | //the enum starts at 1024 to avoid type conflicts with btTypedConstraint | |
| enum btContactManifoldTypes | | enum btContactManifoldTypes | |
| { | | { | |
|
| BT_PERSISTENT_MANIFOLD_TYPE = 1, | | MIN_CONTACT_MANIFOLD_TYPE = 1024, | |
| MAX_CONTACT_MANIFOLD_TYPE | | BT_PERSISTENT_MANIFOLD_TYPE | |
| }; | | }; | |
| | | | |
| #define MANIFOLD_CACHE_SIZE 4 | | #define MANIFOLD_CACHE_SIZE 4 | |
| | | | |
| ///btPersistentManifold is a contact point cache, it stays persistent as lo
ng as objects are overlapping in the broadphase. | | ///btPersistentManifold is a contact point cache, it stays persistent as lo
ng as objects are overlapping in the broadphase. | |
| ///Those contact points are created by the collision narrow phase. | | ///Those contact points are created by the collision narrow phase. | |
| ///The cache can be empty, or hold 1,2,3 or 4 points. Some collision algori
thms (GJK) might only add one point at a time. | | ///The cache can be empty, or hold 1,2,3 or 4 points. Some collision algori
thms (GJK) might only add one point at a time. | |
| ///updates/refreshes old contact points, and throw them away if necessary (
distance becomes too large) | | ///updates/refreshes old contact points, and throw them away if necessary (
distance becomes too large) | |
| ///reduces the cache to 4 points, when more then 4 points are added, using
following rules: | | ///reduces the cache to 4 points, when more then 4 points are added, using
following rules: | |
| ///the contact point with deepest penetration is always kept, and it tries
to maximuze the area covered by the points | | ///the contact point with deepest penetration is always kept, and it tries
to maximuze the area covered by the points | |
| | | | |
| skipping to change at line 145 | | skipping to change at line 146 | |
| { | | { | |
| clearUserCache(m_pointCache[index]); | | clearUserCache(m_pointCache[index]); | |
| | | | |
| int lastUsedIndex = getNumContacts() - 1; | | int lastUsedIndex = getNumContacts() - 1; | |
| // m_pointCache[index] = m_pointCache[lastUsedIndex]; | | // m_pointCache[index] = m_pointCache[lastUsedIndex]; | |
| if(index != lastUsedIndex) | | if(index != lastUsedIndex) | |
| { | | { | |
| m_pointCache[index] = m_pointCache[lastUsedIndex]; | | m_pointCache[index] = m_pointCache[lastUsedIndex]; | |
| //get rid of duplicated userPersistentData pointer | | //get rid of duplicated userPersistentData pointer | |
| m_pointCache[lastUsedIndex].m_userPersistentData = 0
; | | m_pointCache[lastUsedIndex].m_userPersistentData = 0
; | |
|
| m_pointCache[lastUsedIndex].mConstraintRow[0].mAccum | | m_pointCache[lastUsedIndex].mConstraintRow[0].m_accu | |
| Impulse = 0.f; | | mImpulse = 0.f; | |
| m_pointCache[lastUsedIndex].mConstraintRow[1].mAccum | | m_pointCache[lastUsedIndex].mConstraintRow[1].m_accu | |
| Impulse = 0.f; | | mImpulse = 0.f; | |
| m_pointCache[lastUsedIndex].mConstraintRow[2].mAccum | | m_pointCache[lastUsedIndex].mConstraintRow[2].m_accu | |
| Impulse = 0.f; | | mImpulse = 0.f; | |
| | | | |
| m_pointCache[lastUsedIndex].m_appliedImpulse = 0.f; | | m_pointCache[lastUsedIndex].m_appliedImpulse = 0.f; | |
| m_pointCache[lastUsedIndex].m_lateralFrictionInitial
ized = false; | | m_pointCache[lastUsedIndex].m_lateralFrictionInitial
ized = false; | |
| m_pointCache[lastUsedIndex].m_appliedImpulseLateral1
= 0.f; | | m_pointCache[lastUsedIndex].m_appliedImpulseLateral1
= 0.f; | |
| m_pointCache[lastUsedIndex].m_appliedImpulseLateral2
= 0.f; | | m_pointCache[lastUsedIndex].m_appliedImpulseLateral2
= 0.f; | |
| m_pointCache[lastUsedIndex].m_lifeTime = 0; | | m_pointCache[lastUsedIndex].m_lifeTime = 0; | |
| } | | } | |
| | | | |
| btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0
); | | btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0
); | |
| m_cachedPoints--; | | m_cachedPoints--; | |
| } | | } | |
| void replaceContactPoint(const btManifoldPoint& newPoint,int insertI
ndex) | | void replaceContactPoint(const btManifoldPoint& newPoint,int insertI
ndex) | |
| { | | { | |
| btAssert(validContactDistance(newPoint)); | | btAssert(validContactDistance(newPoint)); | |
| | | | |
| #define MAINTAIN_PERSISTENCY 1 | | #define MAINTAIN_PERSISTENCY 1 | |
| #ifdef MAINTAIN_PERSISTENCY | | #ifdef MAINTAIN_PERSISTENCY | |
| int lifeTime = m_pointCache[insertIndex].getLifeTime(); | | int lifeTime = m_pointCache[insertIndex].getLifeTime(); | |
|
| btScalar appliedImpulse = m_pointCache[insertIndex].m | | btScalar appliedImpulse = m_pointCache[insertIndex].m | |
| ConstraintRow[0].mAccumImpulse; | | ConstraintRow[0].m_accumImpulse; | |
| btScalar appliedLateralImpulse1 = m_pointCache[insert | | btScalar appliedLateralImpulse1 = m_pointCache[insert | |
| Index].mConstraintRow[1].mAccumImpulse; | | Index].mConstraintRow[1].m_accumImpulse; | |
| btScalar appliedLateralImpulse2 = m_pointCache[insert | | btScalar appliedLateralImpulse2 = m_pointCache[insert | |
| Index].mConstraintRow[2].mAccumImpulse; | | Index].mConstraintRow[2].m_accumImpulse; | |
| // bool isLateralFrictionInitialized = m_pointCache[insertIndex
].m_lateralFrictionInitialized; | | // bool isLateralFrictionInitialized = m_pointCache[insertIndex
].m_lateralFrictionInitialized; | |
| | | | |
| btAssert(lifeTime>=0); | | btAssert(lifeTime>=0); | |
| void* cache = m_pointCache[insertIndex].m_userPersistentData
; | | void* cache = m_pointCache[insertIndex].m_userPersistentData
; | |
| | | | |
| m_pointCache[insertIndex] = newPoint; | | m_pointCache[insertIndex] = newPoint; | |
| | | | |
| m_pointCache[insertIndex].m_userPersistentData = cache; | | m_pointCache[insertIndex].m_userPersistentData = cache; | |
| m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse; | | m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse; | |
| m_pointCache[insertIndex].m_appliedImpulseLateral1 = applied
LateralImpulse1; | | m_pointCache[insertIndex].m_appliedImpulseLateral1 = applied
LateralImpulse1; | |
| m_pointCache[insertIndex].m_appliedImpulseLateral2 = applied
LateralImpulse2; | | m_pointCache[insertIndex].m_appliedImpulseLateral2 = applied
LateralImpulse2; | |
| | | | |
|
| m_pointCache[insertIndex].mConstraintRow[0].mAccumImpulse = | | m_pointCache[insertIndex].mConstraintRow[0].m_accumImpulse = | |
| appliedImpulse; | | appliedImpulse; | |
| m_pointCache[insertIndex].mConstraintRow[1].mAccumImpulse = | | m_pointCache[insertIndex].mConstraintRow[1].m_accumImpulse = | |
| appliedLateralImpulse1; | | appliedLateralImpulse1; | |
| m_pointCache[insertIndex].mConstraintRow[2].mAccumImpulse = | | m_pointCache[insertIndex].mConstraintRow[2].m_accumImpulse = | |
| appliedLateralImpulse2; | | appliedLateralImpulse2; | |
| | | | |
| m_pointCache[insertIndex].m_lifeTime = lifeTime; | | m_pointCache[insertIndex].m_lifeTime = lifeTime; | |
| #else | | #else | |
| clearUserCache(m_pointCache[insertIndex]); | | clearUserCache(m_pointCache[insertIndex]); | |
| m_pointCache[insertIndex] = newPoint; | | m_pointCache[insertIndex] = newPoint; | |
| | | | |
| #endif | | #endif | |
| } | | } | |
| | | | |
| bool validContactDistance(const btManifoldPoint& pt) const | | bool validContactDistance(const btManifoldPoint& pt) const | |
| { | | { | |
|
| return pt.m_distance1 <= getContactBreakingThreshold(); | | if (pt.m_lifeTime >1) | |
| | | { | |
| | | return pt.m_distance1 <= getContactBreakingThreshold | |
| | | (); | |
| | | } | |
| | | return pt.m_distance1 <= getContactProcessingThreshold(); | |
| | | | |
| } | | } | |
| /// calculated new worldspace coordinates and depth, and reject poin
ts that exceed the collision margin | | /// calculated new worldspace coordinates and depth, and reject poin
ts that exceed the collision margin | |
| void refreshContactPoints( const btTransform& trA,const btTransf
orm& trB); | | void refreshContactPoints( const btTransform& trA,const btTransf
orm& trB); | |
| | | | |
| SIMD_FORCE_INLINE void clearManifold() | | SIMD_FORCE_INLINE void clearManifold() | |
| { | | { | |
| int i; | | int i; | |
| for (i=0;i<m_cachedPoints;i++) | | for (i=0;i<m_cachedPoints;i++) | |
| { | | { | |
| clearUserCache(m_pointCache[i]); | | clearUserCache(m_pointCache[i]); | |
| } | | } | |
| m_cachedPoints = 0; | | m_cachedPoints = 0; | |
| } | | } | |
| | | | |
| } | | } | |
| ; | | ; | |
| | | | |
|
| #endif //PERSISTENT_MANIFOLD_H | | #endif //BT_PERSISTENT_MANIFOLD_H | |
| | | | |
End of changes. 8 change blocks. |
| 23 lines changed or deleted | | 30 lines changed or added | |
|
| btPolyhedralConvexShape.h | | btPolyhedralConvexShape.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef BU_SHAPE | | #ifndef BT_POLYHEDRAL_CONVEX_SHAPE_H | |
| #define BU_SHAPE | | #define BT_POLYHEDRAL_CONVEX_SHAPE_H | |
| | | | |
| #include "LinearMath/btMatrix3x3.h" | | #include "LinearMath/btMatrix3x3.h" | |
| #include "btConvexInternalShape.h" | | #include "btConvexInternalShape.h" | |
|
| | | class btConvexPolyhedron; | |
| | | | |
| ///The btPolyhedralConvexShape is an internal interface class for polyhedra
l convex shapes. | | ///The btPolyhedralConvexShape is an internal interface class for polyhedra
l convex shapes. | |
| class btPolyhedralConvexShape : public btConvexInternalShape | | class btPolyhedralConvexShape : public btConvexInternalShape | |
| { | | { | |
| | | | |
| protected: | | protected: | |
| | | | |
|
| | | btConvexPolyhedron* m_polyhedron; | |
| | | | |
| public: | | public: | |
| | | | |
| btPolyhedralConvexShape(); | | btPolyhedralConvexShape(); | |
| | | | |
|
| | | virtual ~btPolyhedralConvexShape(); | |
| | | | |
| | | ///optional method mainly used to generate multiple contact points b | |
| | | y clipping polyhedral features (faces/edges) | |
| | | virtual bool initializePolyhedralFeatures(); | |
| | | | |
| | | const btConvexPolyhedron* getConvexPolyhedron() const | |
| | | { | |
| | | return m_polyhedron; | |
| | | } | |
| | | | |
| //brute force implementations | | //brute force implementations | |
| | | | |
| virtual btVector3 localGetSupportingVertexWithoutMargin(const
btVector3& vec)const; | | virtual btVector3 localGetSupportingVertexWithoutMargin(const
btVector3& vec)const; | |
| virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(co
nst btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; | | virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(co
nst btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; | |
| | | | |
| virtual void calculateLocalInertia(btScalar mass,btVector3& inert
ia) const; | | virtual void calculateLocalInertia(btScalar mass,btVector3& inert
ia) const; | |
| | | | |
| virtual int getNumVertices() const = 0 ; | | virtual int getNumVertices() const = 0 ; | |
| virtual int getNumEdges() const = 0; | | virtual int getNumEdges() const = 0; | |
| virtual void getEdge(int i,btVector3& pa,btVector3& pb) const = 0; | | virtual void getEdge(int i,btVector3& pa,btVector3& pb) const = 0; | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 108 | |
| } | | } | |
| | | | |
| virtual void setLocalScaling(const btVector3& scaling); | | virtual void setLocalScaling(const btVector3& scaling); | |
| | | | |
| virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto
r3& aabbMax) const; | | virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto
r3& aabbMax) const; | |
| | | | |
| void recalcLocalAabb(); | | void recalcLocalAabb(); | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //BU_SHAPE | | #endif //BT_POLYHEDRAL_CONVEX_SHAPE_H | |
| | | | |
End of changes. 5 change blocks. |
| 2 lines changed or deleted | | 16 lines changed or added | |
|
| btRaycastCallback.h | | btRaycastCallback.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef RAYCAST_TRI_CALLBACK_H | | #ifndef BT_RAYCAST_TRI_CALLBACK_H | |
| #define RAYCAST_TRI_CALLBACK_H | | #define BT_RAYCAST_TRI_CALLBACK_H | |
| | | | |
| #include "BulletCollision/CollisionShapes/btTriangleCallback.h" | | #include "BulletCollision/CollisionShapes/btTriangleCallback.h" | |
| #include "LinearMath/btTransform.h" | | #include "LinearMath/btTransform.h" | |
| struct btBroadphaseProxy; | | struct btBroadphaseProxy; | |
| class btConvexShape; | | class btConvexShape; | |
| | | | |
| class btTriangleRaycastCallback: public btTriangleCallback | | class btTriangleRaycastCallback: public btTriangleCallback | |
| { | | { | |
| public: | | public: | |
| | | | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 61 | |
| }; | | }; | |
| | | | |
| class btTriangleConvexcastCallback : public btTriangleCallback | | class btTriangleConvexcastCallback : public btTriangleCallback | |
| { | | { | |
| public: | | public: | |
| const btConvexShape* m_convexShape; | | const btConvexShape* m_convexShape; | |
| btTransform m_convexShapeFrom; | | btTransform m_convexShapeFrom; | |
| btTransform m_convexShapeTo; | | btTransform m_convexShapeTo; | |
| btTransform m_triangleToWorld; | | btTransform m_triangleToWorld; | |
| btScalar m_hitFraction; | | btScalar m_hitFraction; | |
|
| btScalar m_triangleCollisionMargin; | | btScalar m_triangleCollisionMargin; | |
| | | btScalar m_allowedPenetration; | |
| | | | |
| btTriangleConvexcastCallback (const btConvexShape* convexShape, cons
t btTransform& convexShapeFrom, const btTransform& convexShapeTo, const btT
ransform& triangleToWorld, const btScalar triangleCollisionMargin); | | btTriangleConvexcastCallback (const btConvexShape* convexShape, cons
t btTransform& convexShapeFrom, const btTransform& convexShapeTo, const btT
ransform& triangleToWorld, const btScalar triangleCollisionMargin); | |
| | | | |
| virtual void processTriangle (btVector3* triangle, int partId, int t
riangleIndex); | | virtual void processTriangle (btVector3* triangle, int partId, int t
riangleIndex); | |
| | | | |
| virtual btScalar reportHit (const btVector3& hitNormalLocal, const b
tVector3& hitPointLocal, btScalar hitFraction, int partId, int triangleInde
x) = 0; | | virtual btScalar reportHit (const btVector3& hitNormalLocal, const b
tVector3& hitPointLocal, btScalar hitFraction, int partId, int triangleInde
x) = 0; | |
| }; | | }; | |
| | | | |
|
| #endif //RAYCAST_TRI_CALLBACK_H | | #endif //BT_RAYCAST_TRI_CALLBACK_H | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 4 lines changed or added | |
|
| btRaycastVehicle.h | | btRaycastVehicle.h | |
| /* | | /* | |
| * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ | | * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ | |
| * | | * | |
| * Permission to use, copy, modify, distribute and sell this software | | * Permission to use, copy, modify, distribute and sell this software | |
| * and its documentation for any purpose is hereby granted without fee, | | * and its documentation for any purpose is hereby granted without fee, | |
| * provided that the above copyright notice appear in all copies. | | * provided that the above copyright notice appear in all copies. | |
| * Erwin Coumans makes no representations about the suitability | | * Erwin Coumans makes no representations about the suitability | |
| * of this software for any purpose. | | * of this software for any purpose. | |
| * It is provided "as is" without express or implied warranty. | | * It is provided "as is" without express or implied warranty. | |
| */ | | */ | |
|
| #ifndef RAYCASTVEHICLE_H | | #ifndef BT_RAYCASTVEHICLE_H | |
| #define RAYCASTVEHICLE_H | | #define BT_RAYCASTVEHICLE_H | |
| | | | |
| #include "BulletDynamics/Dynamics/btRigidBody.h" | | #include "BulletDynamics/Dynamics/btRigidBody.h" | |
| #include "BulletDynamics/ConstraintSolver/btTypedConstraint.h" | | #include "BulletDynamics/ConstraintSolver/btTypedConstraint.h" | |
| #include "btVehicleRaycaster.h" | | #include "btVehicleRaycaster.h" | |
| class btDynamicsWorld; | | class btDynamicsWorld; | |
| #include "LinearMath/btAlignedObjectArray.h" | | #include "LinearMath/btAlignedObjectArray.h" | |
| #include "btWheelInfo.h" | | #include "btWheelInfo.h" | |
| #include "BulletDynamics/Dynamics/btActionInterface.h" | | #include "BulletDynamics/Dynamics/btActionInterface.h" | |
| | | | |
| class btVehicleTuning; | | class btVehicleTuning; | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 111 | |
| btScalar getSteeringValue(int wheel) const; | | btScalar getSteeringValue(int wheel) const; | |
| | | | |
| void setSteeringValue(btScalar steering,int wheel); | | void setSteeringValue(btScalar steering,int wheel); | |
| | | | |
| void applyEngineForce(btScalar force, int wheel); | | void applyEngineForce(btScalar force, int wheel); | |
| | | | |
| const btTransform& getWheelTransformWS( int wheelIndex ) const; | | const btTransform& getWheelTransformWS( int wheelIndex ) const; | |
| | | | |
| void updateWheelTransform( int wheelIndex, bool interpolatedTrans
form = true ); | | void updateWheelTransform( int wheelIndex, bool interpolatedTrans
form = true ); | |
| | | | |
|
| void setRaycastWheelInfo( int wheelIndex , bool isInContact, cons
t btVector3& hitPoint, const btVector3& hitNormal,btScalar depth); | | // void setRaycastWheelInfo( int wheelIndex , bool isInContact, cons
t btVector3& hitPoint, const btVector3& hitNormal,btScalar depth); | |
| | | | |
| btWheelInfo& addWheel( const btVector3& connectionPointCS0, const
btVector3& wheelDirectionCS0,const btVector3& wheelAxleCS,btScalar suspens
ionRestLength,btScalar wheelRadius,const btVehicleTuning& tuning, bool isFr
ontWheel); | | btWheelInfo& addWheel( const btVector3& connectionPointCS0, const
btVector3& wheelDirectionCS0,const btVector3& wheelAxleCS,btScalar suspens
ionRestLength,btScalar wheelRadius,const btVehicleTuning& tuning, bool isFr
ontWheel); | |
| | | | |
| inline int getNumWheels() const { | | inline int getNumWheels() const { | |
| return int (m_wheelInfo.size()); | | return int (m_wheelInfo.size()); | |
| } | | } | |
| | | | |
| btAlignedObjectArray<btWheelInfo> m_wheelInfo; | | btAlignedObjectArray<btWheelInfo> m_wheelInfo; | |
| | | | |
| const btWheelInfo& getWheelInfo(int index) const; | | const btWheelInfo& getWheelInfo(int index) const; | |
| | | | |
| skipping to change at line 224 | | skipping to change at line 224 | |
| public: | | public: | |
| btDefaultVehicleRaycaster(btDynamicsWorld* world) | | btDefaultVehicleRaycaster(btDynamicsWorld* world) | |
| :m_dynamicsWorld(world) | | :m_dynamicsWorld(world) | |
| { | | { | |
| } | | } | |
| | | | |
| virtual void* castRay(const btVector3& from,const btVector3& to, btV
ehicleRaycasterResult& result); | | virtual void* castRay(const btVector3& from,const btVector3& to, btV
ehicleRaycasterResult& result); | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //RAYCASTVEHICLE_H | | #endif //BT_RAYCASTVEHICLE_H | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| btRigidBody.h | | btRigidBody.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef RIGIDBODY_H | | #ifndef BT_RIGIDBODY_H | |
| #define RIGIDBODY_H | | #define BT_RIGIDBODY_H | |
| | | | |
| #include "LinearMath/btAlignedObjectArray.h" | | #include "LinearMath/btAlignedObjectArray.h" | |
| #include "LinearMath/btTransform.h" | | #include "LinearMath/btTransform.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionObject.h" | | #include "BulletCollision/CollisionDispatch/btCollisionObject.h" | |
| | | | |
| class btCollisionShape; | | class btCollisionShape; | |
| class btMotionState; | | class btMotionState; | |
| class btTypedConstraint; | | class btTypedConstraint; | |
| | | | |
| | | | |
| skipping to change at line 265 | | skipping to change at line 265 | |
| | | | |
| void integrateVelocities(btScalar step); | | void integrateVelocities(btScalar step); | |
| | | | |
| void setCenterOfMassTransform(const btTransform&
xform); | | void setCenterOfMassTransform(const btTransform&
xform); | |
| | | | |
| void applyCentralForce(const btVector3& force) | | void applyCentralForce(const btVector3& force) | |
| { | | { | |
| m_totalForce += force*m_linearFactor; | | m_totalForce += force*m_linearFactor; | |
| } | | } | |
| | | | |
|
| const btVector3& getTotalForce() | | const btVector3& getTotalForce() const | |
| { | | { | |
| return m_totalForce; | | return m_totalForce; | |
| }; | | }; | |
| | | | |
|
| const btVector3& getTotalTorque() | | const btVector3& getTotalTorque() const | |
| { | | { | |
| return m_totalTorque; | | return m_totalTorque; | |
| }; | | }; | |
| | | | |
| const btVector3& getInvInertiaDiagLocal() const | | const btVector3& getInvInertiaDiagLocal() const | |
| { | | { | |
| return m_invInertiaLocal; | | return m_invInertiaLocal; | |
| }; | | }; | |
| | | | |
| void setInvInertiaDiagLocal(const btVector3& diagInvInertia) | | void setInvInertiaDiagLocal(const btVector3& diagInvInertia) | |
| | | | |
| skipping to change at line 491 | | skipping to change at line 491 | |
| virtual bool checkCollideWithOverride(btCollisionObject* co); | | virtual bool checkCollideWithOverride(btCollisionObject* co); | |
| | | | |
| void addConstraintRef(btTypedConstraint* c); | | void addConstraintRef(btTypedConstraint* c); | |
| void removeConstraintRef(btTypedConstraint* c); | | void removeConstraintRef(btTypedConstraint* c); | |
| | | | |
| btTypedConstraint* getConstraintRef(int index) | | btTypedConstraint* getConstraintRef(int index) | |
| { | | { | |
| return m_constraintRefs[index]; | | return m_constraintRefs[index]; | |
| } | | } | |
| | | | |
|
| int getNumConstraintRefs() | | int getNumConstraintRefs() const | |
| { | | { | |
| return m_constraintRefs.size(); | | return m_constraintRefs.size(); | |
| } | | } | |
| | | | |
| void setFlags(int flags) | | void setFlags(int flags) | |
| { | | { | |
| m_rigidbodyFlags = flags; | | m_rigidbodyFlags = flags; | |
| } | | } | |
| | | | |
| int getFlags() const | | int getFlags() const | |
| | | | |
| skipping to change at line 667 | | skipping to change at line 667 | |
| double m_additionalDampingFactor; | | double m_additionalDampingFactor; | |
| double m_additionalLinearDampingThr
esholdSqr; | | double m_additionalLinearDampingThr
esholdSqr; | |
| double m_additionalAngularDampingTh
resholdSqr; | | double m_additionalAngularDampingTh
resholdSqr; | |
| double m_additionalAngularDampingFa
ctor; | | double m_additionalAngularDampingFa
ctor; | |
| double m_linearSleepingThreshold; | | double m_linearSleepingThreshold; | |
| double m_angularSleepingThreshold; | | double m_angularSleepingThreshold; | |
| int m_additionalDamping; | | int m_additionalDamping; | |
| char m_padding[4]; | | char m_padding[4]; | |
| }; | | }; | |
| | | | |
|
| #endif | | #endif //BT_RIGIDBODY_H | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 5 lines changed or added | |
|
| btScaledBvhTriangleMeshShape.h | | btScaledBvhTriangleMeshShape.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef SCALED_BVH_TRIANGLE_MESH_SHAPE_H | | #ifndef BT_SCALED_BVH_TRIANGLE_MESH_SHAPE_H | |
| #define SCALED_BVH_TRIANGLE_MESH_SHAPE_H | | #define BT_SCALED_BVH_TRIANGLE_MESH_SHAPE_H | |
| | | | |
| #include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h" | | #include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h" | |
| | | | |
| ///The btScaledBvhTriangleMeshShape allows to instance a scaled version of
an existing btBvhTriangleMeshShape. | | ///The btScaledBvhTriangleMeshShape allows to instance a scaled version of
an existing btBvhTriangleMeshShape. | |
| ///Note that each btBvhTriangleMeshShape still can have its own local scali
ng, independent from this btScaledBvhTriangleMeshShape 'localScaling' | | ///Note that each btBvhTriangleMeshShape still can have its own local scali
ng, independent from this btScaledBvhTriangleMeshShape 'localScaling' | |
| ATTRIBUTE_ALIGNED16(class) btScaledBvhTriangleMeshShape : public btConcaveS
hape | | ATTRIBUTE_ALIGNED16(class) btScaledBvhTriangleMeshShape : public btConcaveS
hape | |
| { | | { | |
| | | | |
| btVector3 m_localScaling; | | btVector3 m_localScaling; | |
| | | | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| } | | } | |
| | | | |
| const btBvhTriangleMeshShape* getChildShape() const | | const btBvhTriangleMeshShape* getChildShape() const | |
| { | | { | |
| return m_bvhTriMeshShape; | | return m_bvhTriMeshShape; | |
| } | | } | |
| | | | |
| //debugging | | //debugging | |
| virtual const char* getName()const {return "SCALEDBVHTRIANGLEMES
H";} | | virtual const char* getName()const {return "SCALEDBVHTRIANGLEMES
H";} | |
| | | | |
|
| | | virtual int calculateSerializeBufferSize() const; | |
| | | | |
| | | ///fills the dataBuffer and returns the struct name (and 0 on failur | |
| | | e) | |
| | | virtual const char* serialize(void* dataBuffer, btSerializer* se | |
| | | rializer) const; | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //BVH_TRIANGLE_MESH_SHAPE_H | | ///do not change those serialization structures, it requires an updated sBu | |
| | | lletDNAstr/sBulletDNAstr64 | |
| | | struct btScaledTriangleMeshShapeData | |
| | | { | |
| | | btTriangleMeshShapeData m_trimeshShapeData; | |
| | | | |
| | | btVector3FloatData m_localScaling; | |
| | | }; | |
| | | | |
| | | SIMD_FORCE_INLINE int btScaledBvhTriangleMeshShape::calculateSeria | |
| | | lizeBufferSize() const | |
| | | { | |
| | | return sizeof(btScaledTriangleMeshShapeData); | |
| | | } | |
| | | | |
| | | ///fills the dataBuffer and returns the struct name (and 0 on failure) | |
| | | SIMD_FORCE_INLINE const char* btScaledBvhTriangleMeshShape::serial | |
| | | ize(void* dataBuffer, btSerializer* serializer) const | |
| | | { | |
| | | btScaledTriangleMeshShapeData* scaledMeshData = (btScaledTriangleMes | |
| | | hShapeData*) dataBuffer; | |
| | | m_bvhTriMeshShape->serialize(&scaledMeshData->m_trimeshShapeData,ser | |
| | | ializer); | |
| | | scaledMeshData->m_trimeshShapeData.m_collisionShapeData.m_shapeType | |
| | | = SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE; | |
| | | m_localScaling.serializeFloat(scaledMeshData->m_localScaling); | |
| | | return "btScaledTriangleMeshShapeData"; | |
| | | } | |
| | | | |
| | | #endif //BT_SCALED_BVH_TRIANGLE_MESH_SHAPE_H | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 9 lines changed or added | |
|
| btSerializer.h | | btSerializer.h | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 108 | |
| | | | |
| }; | | }; | |
| | | | |
| #define BT_HEADER_LENGTH 12 | | #define BT_HEADER_LENGTH 12 | |
| #if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (
__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__) | | #if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (
__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__) | |
| # define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d)
) | | # define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d)
) | |
| #else | | #else | |
| # define MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a)
) | | # define MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a)
) | |
| #endif | | #endif | |
| | | | |
|
| | | #define BT_SOFTBODY_CODE MAKE_ID('S','B','D','Y') | |
| #define BT_COLLISIONOBJECT_CODE MAKE_ID('C','O','B','J') | | #define BT_COLLISIONOBJECT_CODE MAKE_ID('C','O','B','J') | |
| #define BT_RIGIDBODY_CODE MAKE_ID('R','B','D','Y') | | #define BT_RIGIDBODY_CODE MAKE_ID('R','B','D','Y') | |
| #define BT_CONSTRAINT_CODE MAKE_ID('C','O','N','S') | | #define BT_CONSTRAINT_CODE MAKE_ID('C','O','N','S') | |
| #define BT_BOXSHAPE_CODE MAKE_ID('B','O','X','S') | | #define BT_BOXSHAPE_CODE MAKE_ID('B','O','X','S') | |
| #define BT_QUANTIZED_BVH_CODE MAKE_ID('Q','B','V','H') | | #define BT_QUANTIZED_BVH_CODE MAKE_ID('Q','B','V','H') | |
| #define BT_TRIANLGE_INFO_MAP MAKE_ID('T','M','A','P') | | #define BT_TRIANLGE_INFO_MAP MAKE_ID('T','M','A','P') | |
| #define BT_SHAPE_CODE MAKE_ID('S','H','A','P') | | #define BT_SHAPE_CODE MAKE_ID('S','H','A','P') | |
| #define BT_ARRAY_CODE MAKE_ID('A','R','A','Y') | | #define BT_ARRAY_CODE MAKE_ID('A','R','A','Y') | |
|
| | | #define BT_SBMATERIAL_CODE MAKE_ID('S','B','M','T') | |
| | | #define BT_SBNODE_CODE MAKE_ID('S','B','N','D') | |
| #define BT_DNA_CODE MAKE_ID('D','N','A','1') | | #define BT_DNA_CODE MAKE_ID('D','N','A','1') | |
| | | | |
| struct btPointerUid | | struct btPointerUid | |
| { | | { | |
| union | | union | |
| { | | { | |
| void* m_ptr; | | void* m_ptr; | |
| int m_uniqueIds[2]; | | int m_uniqueIds[2]; | |
| }; | | }; | |
| }; | | }; | |
| | | | |
|
| | | ///The btDefaultSerializer is the main Bullet serialization class. | |
| | | ///The constructor takes an optional argument for backwards compatibility, | |
| | | it is recommended to leave this empty/zero. | |
| class btDefaultSerializer : public btSerializer | | class btDefaultSerializer : public btSerializer | |
| { | | { | |
| | | | |
| btAlignedObjectArray<char*> mTypes; | | btAlignedObjectArray<char*> mTypes; | |
| btAlignedObjectArray<short*> mStructs; | | btAlignedObjectArray<short*> mStructs; | |
| btAlignedObjectArray<short> mTlens; | | btAlignedObjectArray<short> mTlens; | |
| btHashMap<btHashInt, int> mStructReverse; | | btHashMap<btHashInt, int> mStructReverse; | |
| btHashMap<btHashString,int> mTypeLookup; | | btHashMap<btHashString,int> mTypeLookup; | |
| | | | |
| btHashMap<btHashPtr,void*> m_chunkP; | | btHashMap<btHashPtr,void*> m_chunkP; | |
| | | | |
| skipping to change at line 351 | | skipping to change at line 356 | |
| for (i=0; i<(int)mStructs.size(); i++) | | for (i=0; i<(int)mStructs.size(); i++) | |
| { | | { | |
| short *strc = mStructs.at(i); | | short *strc = mStructs.at(i); | |
| mStructReverse.insert(strc[0], i); | | mStructReverse.insert(strc[0], i); | |
| mTypeLookup.insert(btHashString(mTypes[strc[
0]]),i); | | mTypeLookup.insert(btHashString(mTypes[strc[
0]]),i); | |
| } | | } | |
| } | | } | |
| | | | |
| public: | | public: | |
| | | | |
|
| btDefaultSerializer(int totalSize) | | btDefaultSerializer(int totalSize=0) | |
| :m_totalSize(totalSize), | | :m_totalSize(totalSize), | |
| m_currentSize(0), | | m_currentSize(0), | |
| m_dna(0), | | m_dna(0), | |
| m_dnaLength(0), | | m_dnaLength(0), | |
| m_serializationFlags(0) | | m_serializationFlags(0) | |
| { | | { | |
|
| m_buffer = (unsigned char*)btAlignedAlloc(totalSize,
16); | | m_buffer = m_totalSize?(unsigned char*)btAlignedAllo
c(totalSize,16):0; | |
| | | | |
| const bool VOID_IS_8 = ((sizeof(void*)==8)); | | const bool VOID_IS_8 = ((sizeof(void*)==8)); | |
| | | | |
| #ifdef BT_INTERNAL_UPDATE_SERIALIZATION_STRUCTURES | | #ifdef BT_INTERNAL_UPDATE_SERIALIZATION_STRUCTURES | |
| if (VOID_IS_8) | | if (VOID_IS_8) | |
| { | | { | |
| #if _WIN64 | | #if _WIN64 | |
| initDNA((const char*)sBulletDNAstr64,sBullet
DNAlen64); | | initDNA((const char*)sBulletDNAstr64,sBullet
DNAlen64); | |
| #else | | #else | |
| btAssert(0); | | btAssert(0); | |
| | | | |
| skipping to change at line 399 | | skipping to change at line 404 | |
| } | | } | |
| | | | |
| virtual ~btDefaultSerializer() | | virtual ~btDefaultSerializer() | |
| { | | { | |
| if (m_buffer) | | if (m_buffer) | |
| btAlignedFree(m_buffer); | | btAlignedFree(m_buffer); | |
| if (m_dna) | | if (m_dna) | |
| btAlignedFree(m_dna); | | btAlignedFree(m_dna); | |
| } | | } | |
| | | | |
|
| virtual void startSerialization() | | void writeHeader(unsigned char* buffer) const | |
| { | | { | |
|
| m_uniqueIdGenerator= 1; | | | |
| | | | |
| m_currentSize = BT_HEADER_LENGTH; | | | |
| | | | |
| #ifdef BT_USE_DOUBLE_PRECISION | | #ifdef BT_USE_DOUBLE_PRECISION | |
|
| memcpy(m_buffer, "BULLETd", 7); | | memcpy(buffer, "BULLETd", 7); | |
| #else | | #else | |
|
| memcpy(m_buffer, "BULLETf", 7); | | memcpy(buffer, "BULLETf", 7); | |
| #endif //BT_USE_DOUBLE_PRECISION | | #endif //BT_USE_DOUBLE_PRECISION | |
| | | | |
| int littleEndian= 1; | | int littleEndian= 1; | |
| littleEndian= ((char*)&littleEndian)[0]; | | littleEndian= ((char*)&littleEndian)[0]; | |
| | | | |
| if (sizeof(void*)==8) | | if (sizeof(void*)==8) | |
| { | | { | |
|
| m_buffer[7] = '-'; | | buffer[7] = '-'; | |
| } else | | } else | |
| { | | { | |
|
| m_buffer[7] = '_'; | | buffer[7] = '_'; | |
| } | | } | |
| | | | |
| if (littleEndian) | | if (littleEndian) | |
| { | | { | |
|
| m_buffer[8]='v'; | | buffer[8]='v'; | |
| } else | | } else | |
| { | | { | |
|
| m_buffer[8]='V'; | | buffer[8]='V'; | |
| } | | } | |
| | | | |
|
| m_buffer[9] = '2'; | | buffer[9] = '2'; | |
| m_buffer[10] = '7'; | | buffer[10] = '7'; | |
| m_buffer[11] = '7'; | | buffer[11] = '8'; | |
| | | | |
| | | } | |
| | | | |
| | | virtual void startSerialization() | |
| | | { | |
| | | m_uniqueIdGenerator= 1; | |
| | | if (m_totalSize) | |
| | | { | |
| | | unsigned char* buffer = internalAlloc(BT_HEA | |
| | | DER_LENGTH); | |
| | | writeHeader(buffer); | |
| | | } | |
| | | | |
| } | | } | |
| | | | |
| virtual void finishSerialization() | | virtual void finishSerialization() | |
| { | | { | |
| writeDNA(); | | writeDNA(); | |
| | | | |
|
| | | //if we didn't pre-allocate a buffer, we need to cre | |
| | | ate a contiguous buffer now | |
| | | int mysize = 0; | |
| | | if (!m_totalSize) | |
| | | { | |
| | | if (m_buffer) | |
| | | btAlignedFree(m_buffer); | |
| | | | |
| | | m_currentSize += BT_HEADER_LENGTH; | |
| | | m_buffer = (unsigned char*)btAlignedAlloc(m_ | |
| | | currentSize,16); | |
| | | | |
| | | unsigned char* currentPtr = m_buffer; | |
| | | writeHeader(m_buffer); | |
| | | currentPtr += BT_HEADER_LENGTH; | |
| | | mysize+=BT_HEADER_LENGTH; | |
| | | for (int i=0;i< m_chunkPtrs.size();i++) | |
| | | { | |
| | | int curLength = sizeof(btChunk)+m_ch | |
| | | unkPtrs[i]->m_length; | |
| | | memcpy(currentPtr,m_chunkPtrs[i], cu | |
| | | rLength); | |
| | | btAlignedFree(m_chunkPtrs[i]); | |
| | | currentPtr+=curLength; | |
| | | mysize+=curLength; | |
| | | } | |
| | | } | |
| | | | |
| mTypes.clear(); | | mTypes.clear(); | |
| mStructs.clear(); | | mStructs.clear(); | |
| mTlens.clear(); | | mTlens.clear(); | |
| mStructReverse.clear(); | | mStructReverse.clear(); | |
| mTypeLookup.clear(); | | mTypeLookup.clear(); | |
| m_chunkP.clear(); | | m_chunkP.clear(); | |
| m_nameMap.clear(); | | m_nameMap.clear(); | |
| m_uniquePointers.clear(); | | m_uniquePointers.clear(); | |
|
| | | m_chunkPtrs.clear(); | |
| } | | } | |
| | | | |
| virtual void* getUniquePointer(void*oldPtr) | | virtual void* getUniquePointer(void*oldPtr) | |
| { | | { | |
| if (!oldPtr) | | if (!oldPtr) | |
| return 0; | | return 0; | |
| | | | |
| btPointerUid* uptr = (btPointerUid*)m_uniquePointers
.find(oldPtr); | | btPointerUid* uptr = (btPointerUid*)m_uniquePointers
.find(oldPtr); | |
| if (uptr) | | if (uptr) | |
| { | | { | |
| | | | |
| skipping to change at line 498 | | skipping to change at line 536 | |
| | | | |
| chunk->m_chunkCode = chunkCode; | | chunk->m_chunkCode = chunkCode; | |
| | | | |
| void* uniquePtr = getUniquePointer(oldPtr); | | void* uniquePtr = getUniquePointer(oldPtr); | |
| | | | |
| m_chunkP.insert(oldPtr,uniquePtr);//chunk->m_oldPtr)
; | | m_chunkP.insert(oldPtr,uniquePtr);//chunk->m_oldPtr)
; | |
| chunk->m_oldPtr = uniquePtr;//oldPtr; | | chunk->m_oldPtr = uniquePtr;//oldPtr; | |
| | | | |
| } | | } | |
| | | | |
|
| | | virtual unsigned char* internalAlloc(size_t size) | |
| | | { | |
| | | unsigned char* ptr = 0; | |
| | | | |
| | | if (m_totalSize) | |
| | | { | |
| | | ptr = m_buffer+m_currentSize; | |
| | | m_currentSize += int(size); | |
| | | btAssert(m_currentSize<m_totalSize); | |
| | | } else | |
| | | { | |
| | | ptr = (unsigned char*)btAlignedAlloc(size,16 | |
| | | ); | |
| | | m_currentSize += int(size); | |
| | | } | |
| | | return ptr; | |
| | | } | |
| | | | |
| virtual btChunk* allocate(size_t size, int numElement
s) | | virtual btChunk* allocate(size_t size, int numElement
s) | |
| { | | { | |
| | | | |
|
| unsigned char* ptr = m_buffer+m_currentSize; | | unsigned char* ptr = internalAlloc(int(size)*numElem | |
| m_currentSize += int(size)*numElements+sizeof(btChun | | ents+sizeof(btChunk)); | |
| k); | | | |
| btAssert(m_currentSize<m_totalSize); | | | |
| | | | |
| unsigned char* data = ptr + sizeof(btChunk); | | unsigned char* data = ptr + sizeof(btChunk); | |
| | | | |
| btChunk* chunk = (btChunk*)ptr; | | btChunk* chunk = (btChunk*)ptr; | |
| chunk->m_chunkCode = 0; | | chunk->m_chunkCode = 0; | |
| chunk->m_oldPtr = data; | | chunk->m_oldPtr = data; | |
| chunk->m_length = int(size)*numElements; | | chunk->m_length = int(size)*numElements; | |
| chunk->m_number = numElements; | | chunk->m_number = numElements; | |
| | | | |
| m_chunkPtrs.push_back(chunk); | | m_chunkPtrs.push_back(chunk); | |
| | | | |
End of changes. 18 change blocks. |
| 19 lines changed or deleted | | 79 lines changed or added | |
|
| btSliderConstraint.h | | btSliderConstraint.h | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| | | | |
| /* | | /* | |
| Added by Roman Ponomarev (rponom@gmail.com) | | Added by Roman Ponomarev (rponom@gmail.com) | |
| April 04, 2008 | | April 04, 2008 | |
| | | | |
| TODO: | | TODO: | |
| - add clamping od accumulated impulse to improve stability | | - add clamping od accumulated impulse to improve stability | |
| - add conversion for ODE constraint solver | | - add conversion for ODE constraint solver | |
| */ | | */ | |
| | | | |
|
| #ifndef SLIDER_CONSTRAINT_H | | #ifndef BT_SLIDER_CONSTRAINT_H | |
| #define SLIDER_CONSTRAINT_H | | #define BT_SLIDER_CONSTRAINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btJacobianEntry.h" | | #include "btJacobianEntry.h" | |
| #include "btTypedConstraint.h" | | #include "btTypedConstraint.h" | |
| | | | |
| class btRigidBody; | | class btRigidBody; | |
| | | | |
| #define SLIDER_CONSTRAINT_DEF_SOFTNESS (btScalar(1.0)) | | #define SLIDER_CONSTRAINT_DEF_SOFTNESS (btScalar(1.0)) | |
| #define SLIDER_CONSTRAINT_DEF_DAMPING (btScalar(1.0)) | | #define SLIDER_CONSTRAINT_DEF_DAMPING (btScalar(1.0)) | |
| #define SLIDER_CONSTRAINT_DEF_RESTITUTION (btScalar(0.7)) | | #define SLIDER_CONSTRAINT_DEF_RESTITUTION (btScalar(0.7)) | |
| | | | |
| skipping to change at line 230 | | skipping to change at line 230 | |
| void setTargetLinMotorVelocity(btScalar targetLinMotorVelocity) { m_
targetLinMotorVelocity = targetLinMotorVelocity; } | | void setTargetLinMotorVelocity(btScalar targetLinMotorVelocity) { m_
targetLinMotorVelocity = targetLinMotorVelocity; } | |
| btScalar getTargetLinMotorVelocity() { return m_targetLinMotorVeloci
ty; } | | btScalar getTargetLinMotorVelocity() { return m_targetLinMotorVeloci
ty; } | |
| void setMaxLinMotorForce(btScalar maxLinMotorForce) { m_maxLinMotorF
orce = maxLinMotorForce; } | | void setMaxLinMotorForce(btScalar maxLinMotorForce) { m_maxLinMotorF
orce = maxLinMotorForce; } | |
| btScalar getMaxLinMotorForce() { return m_maxLinMotorForce; } | | btScalar getMaxLinMotorForce() { return m_maxLinMotorForce; } | |
| void setPoweredAngMotor(bool onOff) { m_poweredAngMotor = onOff; } | | void setPoweredAngMotor(bool onOff) { m_poweredAngMotor = onOff; } | |
| bool getPoweredAngMotor() { return m_poweredAngMotor; } | | bool getPoweredAngMotor() { return m_poweredAngMotor; } | |
| void setTargetAngMotorVelocity(btScalar targetAngMotorVelocity) { m_
targetAngMotorVelocity = targetAngMotorVelocity; } | | void setTargetAngMotorVelocity(btScalar targetAngMotorVelocity) { m_
targetAngMotorVelocity = targetAngMotorVelocity; } | |
| btScalar getTargetAngMotorVelocity() { return m_targetAngMotorVeloci
ty; } | | btScalar getTargetAngMotorVelocity() { return m_targetAngMotorVeloci
ty; } | |
| void setMaxAngMotorForce(btScalar maxAngMotorForce) { m_maxAngMotorF
orce = maxAngMotorForce; } | | void setMaxAngMotorForce(btScalar maxAngMotorForce) { m_maxAngMotorF
orce = maxAngMotorForce; } | |
| btScalar getMaxAngMotorForce() { return m_maxAngMotorForce; } | | btScalar getMaxAngMotorForce() { return m_maxAngMotorForce; } | |
|
| btScalar getLinearPos() { return m_linPos; } | | | |
| | | btScalar getLinearPos() const { return m_linPos; } | |
| | | btScalar getAngularPos() const { return m_angPos; } | |
| | | | |
| // access for ODE solver | | // access for ODE solver | |
| bool getSolveLinLimit() { return m_solveLinLim; } | | bool getSolveLinLimit() { return m_solveLinLim; } | |
| btScalar getLinDepth() { return m_depth[0]; } | | btScalar getLinDepth() { return m_depth[0]; } | |
| bool getSolveAngLimit() { return m_solveAngLim; } | | bool getSolveAngLimit() { return m_solveAngLim; } | |
| btScalar getAngDepth() { return m_angDepth; } | | btScalar getAngDepth() { return m_angDepth; } | |
| // shared code used by ODE solver | | // shared code used by ODE solver | |
| void calculateTransforms(const btTransform& transA,const btTransf
orm& transB); | | void calculateTransforms(const btTransform& transA,const btTransf
orm& transB); | |
| void testLinLimits(); | | void testLinLimits(); | |
| void testAngLimits(); | | void testAngLimits(); | |
| // access for PE Solver | | // access for PE Solver | |
| btVector3 getAncorInA(); | | btVector3 getAncorInA(); | |
| btVector3 getAncorInB(); | | btVector3 getAncorInB(); | |
| // access for UseFrameOffset | | // access for UseFrameOffset | |
| bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; } | | bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; } | |
| void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstr
aintFrame = frameOffsetOnOff; } | | void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstr
aintFrame = frameOffsetOnOff; } | |
| | | | |
|
| | | void setFrames(const btTransform& frameA, const btTransform& frameB) | |
| | | { | |
| | | m_frameInA=frameA; | |
| | | m_frameInB=frameB; | |
| | | calculateTransforms(m_rbA.getCenterOfMassTransform(),m_rbB.g | |
| | | etCenterOfMassTransform()); | |
| | | buildJacobian(); | |
| | | } | |
| | | | |
| ///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5). | | ///override the default global value of a parameter (such as ERP or
CFM), optionally provide the axis (0..5). | |
| ///If no axis is provided, it uses the default axis for this constra
int. | | ///If no axis is provided, it uses the default axis for this constra
int. | |
| virtual void setParam(int num, btScalar value, int axis = -1); | | virtual void setParam(int num, btScalar value, int axis = -1); | |
| ///return the local value of parameter | | ///return the local value of parameter | |
| virtual btScalar getParam(int num, int axis = -1) const; | | virtual btScalar getParam(int num, int axis = -1) const; | |
| | | | |
| virtual int calculateSerializeBufferSize() const; | | virtual int calculateSerializeBufferSize() const; | |
| | | | |
| ///fills the dataBuffer and returns the struct name (and 0 on failur
e) | | ///fills the dataBuffer and returns the struct name (and 0 on failur
e) | |
| virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const; | | virtual const char* serialize(void* dataBuffer, btSerializer* se
rializer) const; | |
| | | | |
| skipping to change at line 306 | | skipping to change at line 316 | |
| | | | |
| sliderData->m_angularUpperLimit = float(m_upperAngLimit); | | sliderData->m_angularUpperLimit = float(m_upperAngLimit); | |
| sliderData->m_angularLowerLimit = float(m_lowerAngLimit); | | sliderData->m_angularLowerLimit = float(m_lowerAngLimit); | |
| | | | |
| sliderData->m_useLinearReferenceFrameA = m_useLinearReferenceFrameA; | | sliderData->m_useLinearReferenceFrameA = m_useLinearReferenceFrameA; | |
| sliderData->m_useOffsetForConstraintFrame = m_useOffsetForConstraint
Frame; | | sliderData->m_useOffsetForConstraintFrame = m_useOffsetForConstraint
Frame; | |
| | | | |
| return "btSliderConstraintData"; | | return "btSliderConstraintData"; | |
| } | | } | |
| | | | |
|
| #endif //SLIDER_CONSTRAINT_H | | #endif //BT_SLIDER_CONSTRAINT_H | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 14 lines changed or added | |
|
| btSoftBody.h | | btSoftBody.h | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| #include "LinearMath/btAlignedObjectArray.h" | | #include "LinearMath/btAlignedObjectArray.h" | |
| #include "LinearMath/btTransform.h" | | #include "LinearMath/btTransform.h" | |
| #include "LinearMath/btIDebugDraw.h" | | #include "LinearMath/btIDebugDraw.h" | |
| #include "BulletDynamics/Dynamics/btRigidBody.h" | | #include "BulletDynamics/Dynamics/btRigidBody.h" | |
| | | | |
| #include "BulletCollision/CollisionShapes/btConcaveShape.h" | | #include "BulletCollision/CollisionShapes/btConcaveShape.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | | #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" | |
| #include "btSparseSDF.h" | | #include "btSparseSDF.h" | |
| #include "BulletCollision/BroadphaseCollision/btDbvt.h" | | #include "BulletCollision/BroadphaseCollision/btDbvt.h" | |
| | | | |
|
| | | //#ifdef BT_USE_DOUBLE_PRECISION | |
| | | //#define btRigidBodyData btRigidBodyDoubleData | |
| | | //#define btRigidBodyDataName "btRigidBodyDoubleData" | |
| | | //#else | |
| | | #define btSoftBodyData btSoftBodyFloatData | |
| | | #define btSoftBodyDataName "btSoftBodyFloatData" | |
| | | //#endif //BT_USE_DOUBLE_PRECISION | |
| | | | |
| class btBroadphaseInterface; | | class btBroadphaseInterface; | |
| class btDispatcher; | | class btDispatcher; | |
|
| | | class btSoftBodySolver; | |
| | | | |
| /* btSoftBodyWorldInfo */ | | /* btSoftBodyWorldInfo */ | |
| struct btSoftBodyWorldInfo | | struct btSoftBodyWorldInfo | |
| { | | { | |
| btScalar air_density; | | btScalar air_density; | |
| btScalar water_density; | | btScalar water_density; | |
| btScalar water_offset; | | btScalar water_offset; | |
| btVector3 water_normal; | | btVector3 water_normal; | |
| btBroadphaseInterface* m_broadphase; | | btBroadphaseInterface* m_broadphase; | |
| btDispatcher* m_dispatcher; | | btDispatcher* m_dispatcher; | |
| btVector3 m_gravity; | | btVector3 m_gravity; | |
| btSparseSdf<3> m_sparsesdf; | | btSparseSdf<3> m_sparsesdf; | |
|
| | | | |
| | | btSoftBodyWorldInfo() | |
| | | :air_density((btScalar)1.2), | |
| | | water_density(0), | |
| | | water_offset(0), | |
| | | water_normal(0,0,0), | |
| | | m_broadphase(0), | |
| | | m_dispatcher(0), | |
| | | m_gravity(0,-10,0) | |
| | | { | |
| | | } | |
| }; | | }; | |
| | | | |
| ///The btSoftBody is an class to simulate cloth and volumetric soft bodies. | | ///The btSoftBody is an class to simulate cloth and volumetric soft bodies. | |
| ///There is two-way interaction between btSoftBody and btRigidBody/btCollis
ionObject. | | ///There is two-way interaction between btSoftBody and btRigidBody/btCollis
ionObject. | |
| class btSoftBody : public btCollisionObject | | class btSoftBody : public btCollisionObject | |
| { | | { | |
| public: | | public: | |
| btAlignedObjectArray<class btCollisionObject*> m_collisionDisabledOb
jects; | | btAlignedObjectArray<class btCollisionObject*> m_collisionDisabledOb
jects; | |
| | | | |
|
| | | // The solver object that handles this soft body | |
| | | btSoftBodySolver *m_softBodySolver; | |
| | | | |
| // | | // | |
| // Enumerations | | // Enumerations | |
| // | | // | |
| | | | |
| ///eAeroModel | | ///eAeroModel | |
| struct eAeroModel { enum _ { | | struct eAeroModel { enum _ { | |
| V_Point, ///Vertex normals are oriented toward veloci
ty | | V_Point, ///Vertex normals are oriented toward veloci
ty | |
| V_TwoSided, ///Vertex normals are fliped to match veloci
ty | | V_TwoSided, ///Vertex normals are fliped to match veloci
ty | |
| V_OneSided, ///Vertex normals are taken as it is | | V_OneSided, ///Vertex normals are taken as it is | |
| F_TwoSided, ///Face normals are fliped to match velocity | | F_TwoSided, ///Face normals are fliped to match velocity | |
| | | | |
| skipping to change at line 261 | | skipping to change at line 284 | |
| btScalar m_margin;
// Margin | | btScalar m_margin;
// Margin | |
| btScalar m_friction;
// Friction | | btScalar m_friction;
// Friction | |
| btScalar m_cfm[2];
// Constraint force mixing | | btScalar m_cfm[2];
// Constraint force mixing | |
| }; | | }; | |
| /* Anchor */ | | /* Anchor */ | |
| struct Anchor | | struct Anchor | |
| { | | { | |
| Node* m_node;
// Node pointer | | Node* m_node;
// Node pointer | |
| btVector3 m_local;
// Anchor position in body space | | btVector3 m_local;
// Anchor position in body space | |
| btRigidBody* m_body; // B
ody | | btRigidBody* m_body; // B
ody | |
|
| | | btScalar m_influence; | |
| btMatrix3x3 m_c0;
// Impulse matrix | | btMatrix3x3 m_c0;
// Impulse matrix | |
| btVector3 m_c1;
// Relative anchor | | btVector3 m_c1;
// Relative anchor | |
| btScalar m_c2;
// ima*dt | | btScalar m_c2;
// ima*dt | |
| }; | | }; | |
| /* Note */ | | /* Note */ | |
| struct Note : Element | | struct Note : Element | |
| { | | { | |
| const char* m_text;
// Text | | const char* m_text;
// Text | |
| btVector3 m_offset;
// Offset | | btVector3 m_offset;
// Offset | |
| int m_rank;
// Rank | | int m_rank;
// Rank | |
| | | | |
| skipping to change at line 290 | | skipping to change at line 314 | |
| tVector3Array m_pos; // R
eference positions | | tVector3Array m_pos; // R
eference positions | |
| tScalarArray m_wgh; // W
eights | | tScalarArray m_wgh; // W
eights | |
| btVector3 m_com;
// COM | | btVector3 m_com;
// COM | |
| btMatrix3x3 m_rot;
// Rotation | | btMatrix3x3 m_rot;
// Rotation | |
| btMatrix3x3 m_scl;
// Scale | | btMatrix3x3 m_scl;
// Scale | |
| btMatrix3x3 m_aqq;
// Base scaling | | btMatrix3x3 m_aqq;
// Base scaling | |
| }; | | }; | |
| /* Cluster */ | | /* Cluster */ | |
| struct Cluster | | struct Cluster | |
| { | | { | |
|
| btAlignedObjectArray<Node*> m_nodes; | | | |
| tScalarArray m_masses; | | tScalarArray m_masses; | |
|
| | | btAlignedObjectArray<Node*> m_nodes; | |
| tVector3Array m_framerefs; | | tVector3Array m_framerefs; | |
| btTransform m_framexform
; | | btTransform m_framexform
; | |
| btScalar m_idmass; | | btScalar m_idmass; | |
| btScalar m_imass; | | btScalar m_imass; | |
| btMatrix3x3 m_locii; | | btMatrix3x3 m_locii; | |
| btMatrix3x3 m_invwi; | | btMatrix3x3 m_invwi; | |
| btVector3 m_com; | | btVector3 m_com; | |
| btVector3 m_vimpulses[
2]; | | btVector3 m_vimpulses[
2]; | |
| btVector3 m_dimpulses[
2]; | | btVector3 m_dimpulses[
2]; | |
| int m_nv
impulses; | | int m_nv
impulses; | |
| | | | |
| skipping to change at line 360 | | skipping to change at line 384 | |
| | | | |
| Body() : m_soft(0),m_rigid(0),m_collisionObject(0)
{} | | Body() : m_soft(0),m_rigid(0),m_collisionObject(0)
{} | |
| Body(Cluster* p) : m_soft(p),m_rigid(0),m_collisionObject(0)
{} | | Body(Cluster* p) : m_soft(p),m_rigid(0),m_collisionObject(0)
{} | |
| Body(btCollisionObject* colObj) : m_soft(0),m_collisionObjec
t(colObj) | | Body(btCollisionObject* colObj) : m_soft(0),m_collisionObjec
t(colObj) | |
| { | | { | |
| m_rigid = btRigidBody::upcast(m_collisionObject); | | m_rigid = btRigidBody::upcast(m_collisionObject); | |
| } | | } | |
| | | | |
| void activate() c
onst | | void activate() c
onst | |
| { | | { | |
|
| if(m_rigid) m_rigid->activate(); | | if(m_rigid) | |
| | | m_rigid->activate(); | |
| | | if (m_collisionObject) | |
| | | m_collisionObject->activate(); | |
| | | | |
| } | | } | |
| const btMatrix3x3& invWorldInertia() co
nst | | const btMatrix3x3& invWorldInertia() co
nst | |
| { | | { | |
| static const btMatrix3x3 iwi(0,0,0,0,0,0,0,0,
0); | | static const btMatrix3x3 iwi(0,0,0,0,0,0,0,0,
0); | |
| if(m_rigid) return(m_rigid->getInvInertiaTensorWorld
()); | | if(m_rigid) return(m_rigid->getInvInertiaTensorWorld
()); | |
| if(m_soft) return(m_soft->m_invwi); | | if(m_soft) return(m_soft->m_invwi); | |
| return(iwi); | | return(iwi); | |
| } | | } | |
| btScalar invMass() co
nst | | btScalar invMass() co
nst | |
| { | | { | |
| if(m_rigid) return(m_rigid->getInvMass()); | | if(m_rigid) return(m_rigid->getInvMass()); | |
| if(m_soft) return(m_soft->m_imass); | | if(m_soft) return(m_soft->m_imass); | |
| return(0); | | return(0); | |
| } | | } | |
| const btTransform& xform() const | | const btTransform& xform() const | |
| { | | { | |
| static const btTransform identity=btTransform
::getIdentity(); | | static const btTransform identity=btTransform
::getIdentity(); | |
|
| if(m_collisionObject) return(m_collisionObject->getI
nterpolationWorldTransform()); | | if(m_collisionObject) return(m_collisionObject->getW
orldTransform()); | |
| if(m_soft) return(m_soft->m_framexform); | | if(m_soft) return(m_soft->m_framexform); | |
| return(identity); | | return(identity); | |
| } | | } | |
| btVector3 linearVeloci
ty() const | | btVector3 linearVeloci
ty() const | |
| { | | { | |
| if(m_rigid) return(m_rigid->getLinearVelocity()); | | if(m_rigid) return(m_rigid->getLinearVelocity()); | |
| if(m_soft) return(m_soft->m_lv); | | if(m_soft) return(m_soft->m_lv); | |
| return(btVector3(0,0,0)); | | return(btVector3(0,0,0)); | |
| } | | } | |
| btVector3 angularVeloc
ity(const btVector3& rpos) const | | btVector3 angularVeloc
ity(const btVector3& rpos) const | |
| | | | |
| skipping to change at line 452 | | skipping to change at line 480 | |
| void applyDCImpul
se(const btVector3& impulse) const | | void applyDCImpul
se(const btVector3& impulse) const | |
| { | | { | |
| if(m_rigid) m_rigid->applyCentralImpulse(impulse
); | | if(m_rigid) m_rigid->applyCentralImpulse(impulse
); | |
| if(m_soft) btSoftBody::clusterDCImpulse(m_soft,
impulse); | | if(m_soft) btSoftBody::clusterDCImpulse(m_soft,
impulse); | |
| } | | } | |
| }; | | }; | |
| /* Joint */ | | /* Joint */ | |
| struct Joint | | struct Joint | |
| { | | { | |
| struct eType { enum _ { | | struct eType { enum _ { | |
|
| Linear, | | Linear=0, | |
| Angular, | | Angular, | |
| Contact | | Contact | |
| };}; | | };}; | |
| struct Specs | | struct Specs | |
| { | | { | |
| Specs() : erp(1),cfm(1),split(1) {} | | Specs() : erp(1),cfm(1),split(1) {} | |
| btScalar erp; | | btScalar erp; | |
| btScalar cfm; | | btScalar cfm; | |
| btScalar split; | | btScalar split; | |
| }; | | }; | |
| | | | |
| skipping to change at line 647 | | skipping to change at line 675 | |
| btAlignedObjectArray<bool>m_clusterConnectivity;//cluster connectivi
ty, for self-collision | | btAlignedObjectArray<bool>m_clusterConnectivity;//cluster connectivi
ty, for self-collision | |
| | | | |
| btTransform m_initialWorldTransform; | | btTransform m_initialWorldTransform; | |
| | | | |
| btVector3 m_windVelocity; | | btVector3 m_windVelocity; | |
| // | | // | |
| // Api | | // Api | |
| // | | // | |
| | | | |
| /* ctor
*/ | | /* ctor
*/ | |
|
| btSoftBody( btSoftBodyWorldInfo* worldInfo,int node_count, | | btSoftBody( btSoftBodyWorldInfo* worldInfo,int node_count, | |
| const btVector3* x, | | const btVector3* x, const btScalar* m); | |
| const btScalar* m); | | | |
| | | /* ctor | |
| | | */ | |
| | | btSoftBody( btSoftBodyWorldInfo* worldInfo); | |
| | | | |
| | | void initDefaults(); | |
| | | | |
| /* dtor
*/ | | /* dtor
*/ | |
| virtual ~btSoftBody(); | | virtual ~btSoftBody(); | |
| /* Check for existing link
*/ | | /* Check for existing link
*/ | |
| | | | |
| btAlignedObjectArray<int> m_userIndexMapping; | | btAlignedObjectArray<int> m_userIndexMapping; | |
| | | | |
| btSoftBodyWorldInfo* getWorldInfo() | | btSoftBodyWorldInfo* getWorldInfo() | |
| { | | { | |
| return m_worldInfo; | | return m_worldInfo; | |
| } | | } | |
| | | | |
| skipping to change at line 722 | | skipping to change at line 754 | |
| void appendTetra(int model,Material* mat); | | void appendTetra(int model,Material* mat); | |
| // | | // | |
| void appendTetra(int node0, | | void appendTetra(int node0, | |
|
int node1, | |
int node1, | |
|
int node2, | |
int node2, | |
|
int node3, | |
int node3, | |
|
Material* mat=0); | |
Material* mat=0); | |
| | | | |
| /* Append anchor
*/ | | /* Append anchor
*/ | |
| void appendAnchor( int node, | | void appendAnchor( int node, | |
|
| btRigidBody* body, bool disableCollisionBetweenLinkedBodies= | | btRigidBody* body, bool disableCollisionBetweenLinkedBodies= | |
| false); | | false,btScalar influence = 1); | |
| | | void appendAnchor(int node,btRigidBody* body, con | |
| | | st btVector3& localPivot,bool disableCollisionBetweenLinkedBodies=false,btS | |
| | | calar influence = 1); | |
| /* Append linear joint
*/ | | /* Append linear joint
*/ | |
| void appendLinearJoint(const LJoint::Spec
s& specs,Cluster* body0,Body body1); | | void appendLinearJoint(const LJoint::Spec
s& specs,Cluster* body0,Body body1); | |
| void appendLinearJoint(const LJoint::Spec
s& specs,Body body=Body()); | | void appendLinearJoint(const LJoint::Spec
s& specs,Body body=Body()); | |
| void appendLinearJoint(const LJoint::Spec
s& specs,btSoftBody* body); | | void appendLinearJoint(const LJoint::Spec
s& specs,btSoftBody* body); | |
| /* Append linear joint
*/ | | /* Append linear joint
*/ | |
| void appendAngularJoint(const AJoint::Spe
cs& specs,Cluster* body0,Body body1); | | void appendAngularJoint(const AJoint::Spe
cs& specs,Cluster* body0,Body body1); | |
| void appendAngularJoint(const AJoint::Spe
cs& specs,Body body=Body()); | | void appendAngularJoint(const AJoint::Spe
cs& specs,Body body=Body()); | |
| void appendAngularJoint(const AJoint::Spe
cs& specs,btSoftBody* body); | | void appendAngularJoint(const AJoint::Spe
cs& specs,btSoftBody* body); | |
| /* Add force (or gravity) to the entire body
*/ | | /* Add force (or gravity) to the entire body
*/ | |
| void addForce( const btVect
or3& force); | | void addForce( const btVect
or3& force); | |
| | | | |
| skipping to change at line 844 | | skipping to change at line 877 | |
| * Set a wind velocity for interaction with the air. | | * Set a wind velocity for interaction with the air. | |
| */ | | */ | |
| void setWindVelocity( const btVector3 &velocity ); | | void setWindVelocity( const btVector3 &velocity ); | |
| | | | |
| /** | | /** | |
| * Return the wind velocity for interaction with the air. | | * Return the wind velocity for interaction with the air. | |
| */ | | */ | |
| const btVector3& getWindVelocity(); | | const btVector3& getWindVelocity(); | |
| | | | |
| // | | // | |
|
| | | // Set the solver that handles this soft body | |
| | | // Should not be allowed to get out of sync with reality | |
| | | // Currently called internally on addition to the world | |
| | | void setSoftBodySolver( btSoftBodySolver *softBodySolver ) | |
| | | { | |
| | | m_softBodySolver = softBodySolver; | |
| | | } | |
| | | | |
| | | // | |
| | | // Return the solver that handles this soft body | |
| | | // | |
| | | btSoftBodySolver *getSoftBodySolver() | |
| | | { | |
| | | return m_softBodySolver; | |
| | | } | |
| | | | |
| | | // | |
| | | // Return the solver that handles this soft body | |
| | | // | |
| | | btSoftBodySolver *getSoftBodySolver() const | |
| | | { | |
| | | return m_softBodySolver; | |
| | | } | |
| | | | |
| | | // | |
| // Cast | | // Cast | |
| // | | // | |
| | | | |
| static const btSoftBody* upcast(const btCollisionObject* colO
bj) | | static const btSoftBody* upcast(const btCollisionObject* colO
bj) | |
| { | | { | |
| if (colObj->getInternalType()==CO_SOFT_BODY) | | if (colObj->getInternalType()==CO_SOFT_BODY) | |
| return (const btSoftBody*)colObj; | | return (const btSoftBody*)colObj; | |
| return 0; | | return 0; | |
| } | | } | |
| static btSoftBody* upcast(btCollisionObject* co
lObj) | | static btSoftBody* upcast(btCollisionObject* co
lObj) | |
| | | | |
| skipping to change at line 900 | | skipping to change at line 958 | |
| void dampClusters(); | | void dampClusters(); | |
| void applyForces(); | | void applyForces(); | |
| static void PSolve_Anchors(btSoftBody* psb,btSca
lar kst,btScalar ti); | | static void PSolve_Anchors(btSoftBody* psb,btSca
lar kst,btScalar ti); | |
| static void PSolve_RContacts(btSoftBody* psb,btS
calar kst,btScalar ti); | | static void PSolve_RContacts(btSoftBody* psb,btS
calar kst,btScalar ti); | |
| static void PSolve_SContacts(btSoftBody* psb,btS
calar,btScalar ti); | | static void PSolve_SContacts(btSoftBody* psb,btS
calar,btScalar ti); | |
| static void PSolve_Links(btSoftBody* psb,btScala
r kst,btScalar ti); | | static void PSolve_Links(btSoftBody* psb,btScala
r kst,btScalar ti); | |
| static void VSolve_Links(btSoftBody* psb,btScala
r kst); | | static void VSolve_Links(btSoftBody* psb,btScala
r kst); | |
| static psolver_t getSolver(ePSolver::_ solver); | | static psolver_t getSolver(ePSolver::_ solver); | |
| static vsolver_t getSolver(eVSolver::_ solver); | | static vsolver_t getSolver(eVSolver::_ solver); | |
| | | | |
|
| | | virtual int calculateSerializeBufferSize() const; | |
| | | | |
| | | ///fills the dataBuffer and returns the struct name (and 0 on failur | |
| | | e) | |
| | | virtual const char* serialize(void* dataBuffer, class btSeriali | |
| | | zer* serializer) const; | |
| | | | |
| | | //virtual void serializeSingleObject(class btSerializer* serializer) | |
| | | const; | |
| | | | |
| }; | | }; | |
| | | | |
| #endif //_BT_SOFT_BODY_H | | #endif //_BT_SOFT_BODY_H | |
| | | | |
End of changes. 14 change blocks. |
| 9 lines changed or deleted | | 81 lines changed or added | |
|
| btSoftBodyHelpers.h | | btSoftBodyHelpers.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef SOFT_BODY_HELPERS_H | | #ifndef BT_SOFT_BODY_HELPERS_H | |
| #define SOFT_BODY_HELPERS_H | | #define BT_SOFT_BODY_HELPERS_H | |
| | | | |
| #include "btSoftBody.h" | | #include "btSoftBody.h" | |
| | | | |
| // | | // | |
| // Helpers | | // Helpers | |
| // | | // | |
| | | | |
| /* fDrawFlags
*/ | | /* fDrawFlags
*/ | |
| struct fDrawFlags { enum _ { | | struct fDrawFlags { enum _ { | |
| Nodes = 0x0001, | | Nodes = 0x0001, | |
| | | | |
| skipping to change at line 121 | | skipping to change at line 121 | |
| const int* triangles, | | const int* triangles, | |
| int ntriangles, | | int ntriangles, | |
| bool randomizeConstraints = true); | | bool randomizeConstraints = true); | |
| /* Create from convex-hull
*/ | | /* Create from convex-hull
*/ | |
| static btSoftBody* CreateFromConvexHull( btSoftBodyWo
rldInfo& worldInfo, | | static btSoftBody* CreateFromConvexHull( btSoftBodyWo
rldInfo& worldInfo, | |
| const btVector3* vertices, | | const btVector3* vertices, | |
| int nvertices, | | int nvertices, | |
| bool randomizeConstraints = true); | | bool randomizeConstraints = true); | |
| | | | |
| /* Export TetGen compatible .smesh file
*/ | | /* Export TetGen compatible .smesh file
*/ | |
|
| static void ExportAsSMeshFile( btSo | | // static void ExportAsSMeshFile( btSo | |
| ftBody* psb, | | ftBody* psb, | |
| | | // | |
| const char* filename); | | const char* filename); | |
| /* Create from TetGen .ele, .face, .node files
*/ | | /* Create from TetGen .ele, .face, .node files
*/ | |
|
| static btSoftBody* CreateFromTetGenFile( btSoftBodyWo | | // static btSoftBody* CreateFromTetGenFile( btSoftBodyWo | |
| rldInfo& worldInfo, | | rldInfo& worldInfo, | |
| | | // | |
| const char* ele, | | const char* ele, | |
| | | // | |
| const char* face, | | const char* face, | |
| | | // | |
| const char* node, | | const char* node, | |
| | | // | |
| bool bfacelinks, | | bool bfacelinks, | |
| | | // | |
| bool btetralinks, | | bool btetralinks, | |
| | | // | |
| bool bfacesfromtetras); | | bool bfacesfromtetras); | |
| /* Create from TetGen .ele, .face, .node data
*/ | | /* Create from TetGen .ele, .face, .node data
*/ | |
| static btSoftBody* CreateFromTetGenData( btSoftBodyWo
rldInfo& worldInfo, | | static btSoftBody* CreateFromTetGenData( btSoftBodyWo
rldInfo& worldInfo, | |
|
const char* ele, | |
const char* ele, | |
|
const char* face, | |
const char* face, | |
|
const char* node, | |
const char* node, | |
|
bool bfacelinks, | |
bool bfacelinks, | |
|
bool btetralinks, | |
bool btetralinks, | |
|
bool bfacesfromtetras); | |
bool bfacesfromtetras); | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //SOFT_BODY_HELPERS_H | | #endif //BT_SOFT_BODY_HELPERS_H | |
| | | | |
End of changes. 4 change blocks. |
| 20 lines changed or deleted | | 20 lines changed or added | |
|
| btSoftBodyInternals.h | | btSoftBodyInternals.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| #ifndef _BT_SOFT_BODY_INTERNALS_H | | #ifndef _BT_SOFT_BODY_INTERNALS_H | |
| #define _BT_SOFT_BODY_INTERNALS_H | | #define _BT_SOFT_BODY_INTERNALS_H | |
| | | | |
| #include "btSoftBody.h" | | #include "btSoftBody.h" | |
| | | | |
| #include "LinearMath/btQuickprof.h" | | #include "LinearMath/btQuickprof.h" | |
| #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" | | #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" | |
| #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" | | #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" | |
| #include "BulletCollision/CollisionShapes/btConvexInternalShape.h" | | #include "BulletCollision/CollisionShapes/btConvexInternalShape.h" | |
| #include "BulletCollision/NarrowPhaseCollision/btGjkEpa2.h" | | #include "BulletCollision/NarrowPhaseCollision/btGjkEpa2.h" | |
|
| | | #include <string.h> //for memset | |
| // | | // | |
| // btSymMatrix | | // btSymMatrix | |
| // | | // | |
| template <typename T> | | template <typename T> | |
| struct btSymMatrix | | struct btSymMatrix | |
| { | | { | |
| btSymMatrix() : dim(0) {} | | btSymMatrix() : dim(0) {} | |
| btSymMatrix(int n,const T& init=T()) { resize(n,init); } | | btSymMatrix(int n,const T& init=T()) { resize(n,init); } | |
| void resize(int n,const T& init=T
()) { dim=n;store.resize((n*(n+1))/2,init); } | | void resize(int n,const T& init=T
()) { dim=n;store.resize((n*(n+1))/2,init); } | |
| int index(int c,int r) c
onst { if(c>r) btSwap(c,r);btAssert(r<dim);r
eturn((r*(r+1))/2+c); } | | int index(int c,int r) c
onst { if(c>r) btSwap(c,r);btAssert(r<dim);r
eturn((r*(r+1))/2+c); } | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 72 | |
| | | | |
| void processAllTriangles(btTriangleCallback* /*callback*/,const b
tVector3& /*aabbMin*/,const btVector3& /*aabbMax*/) const | | void processAllTriangles(btTriangleCallback* /*callback*/,const b
tVector3& /*aabbMin*/,const btVector3& /*aabbMax*/) const | |
| { | | { | |
| //not yet | | //not yet | |
| btAssert(0); | | btAssert(0); | |
| } | | } | |
| | | | |
| ///getAabb returns the axis aligned bounding box in the coordinate f
rame of the given transform t. | | ///getAabb returns the axis aligned bounding box in the coordinate f
rame of the given transform t. | |
| virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto
r3& aabbMax) const | | virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVecto
r3& aabbMax) const | |
| { | | { | |
|
| /* t should be identity, but better be safe than...fast? */ | | /* t should be identity */ | |
| const btVector3 mins=m_body->m_bounds[0]; | | aabbMin=m_body->m_bounds[0]; | |
| const btVector3 maxs=m_body->m_bounds[1]; | | aabbMax=m_body->m_bounds[1]; | |
| const btVector3 crns[]={t*btVector3(mins.x(),mins.y(),mins.z | | | |
| ()), | | | |
| t*btVector3(maxs.x(),mins.y(),mins.z()), | | | |
| t*btVector3(maxs.x(),maxs.y(),mins.z()), | | | |
| t*btVector3(mins.x(),maxs.y(),mins.z()), | | | |
| t*btVector3(mins.x(),mins.y(),maxs.z()), | | | |
| t*btVector3(maxs.x(),mins.y(),maxs.z()), | | | |
| t*btVector3(maxs.x(),maxs.y(),maxs.z()), | | | |
| t*btVector3(mins.x(),maxs.y(),maxs.z())}; | | | |
| aabbMin=aabbMax=crns[0]; | | | |
| for(int i=1;i<8;++i) | | | |
| { | | | |
| aabbMin.setMin(crns[i]); | | | |
| aabbMax.setMax(crns[i]); | | | |
| } | | | |
| } | | } | |
| | | | |
| virtual void setLocalScaling(const btVector3& /*scaling*/) | | virtual void setLocalScaling(const btVector3& /*scaling*/) | |
| { | | { | |
| ///na | | ///na | |
| } | | } | |
| virtual const btVector3& getLocalScaling() const | | virtual const btVector3& getLocalScaling() const | |
| { | | { | |
| static const btVector3 dummy(1,1,1); | | static const btVector3 dummy(1,1,1); | |
| return dummy; | | return dummy; | |
| | | | |
| skipping to change at line 171 | | skipping to change at line 157 | |
| }; | | }; | |
| | | | |
| // | | // | |
| // Inline's | | // Inline's | |
| // | | // | |
| | | | |
| // | | // | |
| template <typename T> | | template <typename T> | |
| static inline void ZeroInitialize(T& value) | | static inline void ZeroInitialize(T& value) | |
| { | | { | |
|
| static const T zerodummy; | | memset(&value,0,sizeof(T)); | |
| value=zerodummy; | | | |
| } | | } | |
| // | | // | |
| template <typename T> | | template <typename T> | |
| static inline bool CompLess(const T& a,const T& b) | | static inline bool CompLess(const T& a,const T& b) | |
| { return(a<b); } | | { return(a<b); } | |
| // | | // | |
| template <typename T> | | template <typename T> | |
| static inline bool CompGreater(const T& a,const T& b) | | static inline bool CompGreater(const T& a,const T& b) | |
| { return(a>b); } | | { return(a>b); } | |
| // | | // | |
| | | | |
| skipping to change at line 732 | | skipping to change at line 717 | |
| btSoftClusterCollisionShape cshape(cluster); | | btSoftClusterCollisionShape cshape(cluster); | |
| | | | |
| const btConvexShape* rshape=(const btConv
exShape*)m_colObj->getCollisionShape(); | | const btConvexShape* rshape=(const btConv
exShape*)m_colObj->getCollisionShape(); | |
| | | | |
| ///don't collide an anchored cluster with a static/k
inematic object | | ///don't collide an anchored cluster with a static/k
inematic object | |
| if(m_colObj->isStaticOrKinematicObject() && cluster-
>m_containsAnchor) | | if(m_colObj->isStaticOrKinematicObject() && cluster-
>m_containsAnchor) | |
| return; | | return; | |
| | | | |
| btGjkEpaSolver2::sResults res; | | btGjkEpaSolver2::sResults res; | |
| if(btGjkEpaSolver2::SignedDistance( &cshape,btTr
ansform::getIdentity(), | | if(btGjkEpaSolver2::SignedDistance( &cshape,btTr
ansform::getIdentity(), | |
|
| rshape,m_colObj->getInterpolationWorldTransf
orm(), | | rshape,m_colObj->getWorldTransform(), | |
| btVector3(1,0,0),res)) | | btVector3(1,0,0),res)) | |
| { | | { | |
| btSoftBody::CJoint joint; | | btSoftBody::CJoint joint; | |
| if(SolveContact(res,cluster,m_colObj,joint))
//prb,joint)) | | if(SolveContact(res,cluster,m_colObj,joint))
//prb,joint)) | |
| { | | { | |
| btSoftBody::CJoint* pj=new(btAli
gnedAlloc(sizeof(btSoftBody::CJoint),16)) btSoftBody::CJoint(); | | btSoftBody::CJoint* pj=new(btAli
gnedAlloc(sizeof(btSoftBody::CJoint),16)) btSoftBody::CJoint(); | |
| *pj=joint;psb->m_joints.push_back(pj
); | | *pj=joint;psb->m_joints.push_back(pj
); | |
| if(m_colObj->isStaticOrKinematicObje
ct()) | | if(m_colObj->isStaticOrKinematicObje
ct()) | |
| { | | { | |
| pj->m_erp *= psb-
>m_cfg.kSKHR_CL; | | pj->m_erp *= psb-
>m_cfg.kSKHR_CL; | |
| | | | |
| skipping to change at line 765 | | skipping to change at line 750 | |
| psb = ps; | | psb = ps; | |
| m_colObj = colOb; | | m_colObj = colOb; | |
| idt = ps->m_sst.isdt; | | idt = ps->m_sst.isdt; | |
| m_margin = m_colObj->getCollisi
onShape()->getMargin()+psb->getCollisionShape()->getMargin(); | | m_margin = m_colObj->getCollisi
onShape()->getMargin()+psb->getCollisionShape()->getMargin(); | |
| ///Bullet rigid body uses multiply instead of minimu
m to determine combined friction. Some customization would be useful. | | ///Bullet rigid body uses multiply instead of minimu
m to determine combined friction. Some customization would be useful. | |
| friction = btMin(psb->m_cfg.kDF,m_colOb
j->getFriction()); | | friction = btMin(psb->m_cfg.kDF,m_colOb
j->getFriction()); | |
| btVector3 mins; | | btVector3 mins; | |
| btVector3 maxs; | | btVector3 maxs; | |
| | | | |
| ATTRIBUTE_ALIGNED16(btDbvtVolume) volu
me; | | ATTRIBUTE_ALIGNED16(btDbvtVolume) volu
me; | |
|
| colOb->getCollisionShape()->getAabb(colOb->getInterp
olationWorldTransform(),mins,maxs); | | colOb->getCollisionShape()->getAabb(colOb->getWorldT
ransform(),mins,maxs); | |
| volume=btDbvtVolume::FromMM(mins,maxs); | | volume=btDbvtVolume::FromMM(mins,maxs); | |
| volume.Expand(btVector3(1,1,1)*m_margin); | | volume.Expand(btVector3(1,1,1)*m_margin); | |
| ps->m_cdbvt.collideTV(ps->m_cdbvt.m_root,volume,*thi
s); | | ps->m_cdbvt.collideTV(ps->m_cdbvt.m_root,volume,*thi
s); | |
| } | | } | |
| }; | | }; | |
| // | | // | |
| // CollideCL_SS | | // CollideCL_SS | |
| // | | // | |
| struct CollideCL_SS : ClusterBase | | struct CollideCL_SS : ClusterBase | |
| { | | { | |
| | | | |
| skipping to change at line 847 | | skipping to change at line 832 | |
| const btScalar m=n.m_im>0?dynmargin
:stamargin; | | const btScalar m=n.m_im>0?dynmargin
:stamargin; | |
| btSoftBody::RContact c; | | btSoftBody::RContact c; | |
| if( (!n.m_battach)&& | | if( (!n.m_battach)&& | |
| psb->checkContact(m_colObj1,n.m_x,m,c.m_cti)
) | | psb->checkContact(m_colObj1,n.m_x,m,c.m_cti)
) | |
| { | | { | |
| const btScalar ima=n.m_im; | | const btScalar ima=n.m_im; | |
| const btScalar imb= m_rigidBody? m_rigidBod
y->getInvMass() : 0.f; | | const btScalar imb= m_rigidBody? m_rigidBod
y->getInvMass() : 0.f; | |
| const btScalar ms=ima+imb; | | const btScalar ms=ima+imb; | |
| if(ms>0) | | if(ms>0) | |
| { | | { | |
|
| const btTransform& wtr=m_rigidB
ody?m_rigidBody->getInterpolationWorldTransform() : m_colObj1->getWorldTran
sform(); | | const btTransform& wtr=m_rigidB
ody?m_rigidBody->getWorldTransform() : m_colObj1->getWorldTransform(); | |
| static const btMatrix3x3 iwiS
tatic(0,0,0,0,0,0,0,0,0); | | static const btMatrix3x3 iwiS
tatic(0,0,0,0,0,0,0,0,0); | |
| const btMatrix3x3& iwi=m_rigidB
ody?m_rigidBody->getInvInertiaTensorWorld() : iwiStatic; | | const btMatrix3x3& iwi=m_rigidB
ody?m_rigidBody->getInvInertiaTensorWorld() : iwiStatic; | |
| const btVector3 ra=n.m_x-wtr
.getOrigin(); | | const btVector3 ra=n.m_x-wtr
.getOrigin(); | |
| const btVector3 va=m_rigidBo
dy ? m_rigidBody->getVelocityInLocalPoint(ra)*psb->m_sst.sdt : btVector3(0,
0,0); | | const btVector3 va=m_rigidBo
dy ? m_rigidBody->getVelocityInLocalPoint(ra)*psb->m_sst.sdt : btVector3(0,
0,0); | |
| const btVector3 vb=n.m_x-n.m
_q; | | const btVector3 vb=n.m_x-n.m
_q; | |
| const btVector3 vr=vb-va; | | const btVector3 vr=vb-va; | |
| const btScalar dn=btDot(vr,
c.m_cti.m_normal); | | const btScalar dn=btDot(vr,
c.m_cti.m_normal); | |
| const btVector3 fv=vr-c.m_ct
i.m_normal*dn; | | const btVector3 fv=vr-c.m_ct
i.m_normal*dn; | |
| const btScalar fc=psb->m_cf
g.kDF*m_colObj1->getFriction(); | | const btScalar fc=psb->m_cf
g.kDF*m_colObj1->getFriction(); | |
| c.m_node = &n; | | c.m_node = &n; | |
| | | | |
End of changes. 6 change blocks. |
| 24 lines changed or deleted | | 8 lines changed or added | |
|
| btSoftRigidDynamicsWorld.h | | btSoftRigidDynamicsWorld.h | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| bool m_ownsSolver; | | bool m_ownsSolver; | |
| | | | |
| protected: | | protected: | |
| | | | |
| virtual void predictUnconstraintMotion(btScalar timeStep); | | virtual void predictUnconstraintMotion(btScalar timeStep); | |
| | | | |
| virtual void internalSingleStepSimulation( btScalar timeStep); | | virtual void internalSingleStepSimulation( btScalar timeStep); | |
| | | | |
| void solveSoftBodiesConstraints( btScalar timeStep ); | | void solveSoftBodiesConstraints( btScalar timeStep ); | |
| | | | |
|
| | | void serializeSoftBodies(btSerializer* serializer); | |
| | | | |
| public: | | public: | |
| | | | |
| btSoftRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterf
ace* pairCache,btConstraintSolver* constraintSolver, btCollisionConfigurati
on* collisionConfiguration, btSoftBodySolver *softBodySolver = 0 ); | | btSoftRigidDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterf
ace* pairCache,btConstraintSolver* constraintSolver, btCollisionConfigurati
on* collisionConfiguration, btSoftBodySolver *softBodySolver = 0 ); | |
| | | | |
| virtual ~btSoftRigidDynamicsWorld(); | | virtual ~btSoftRigidDynamicsWorld(); | |
| | | | |
| virtual void debugDrawWorld(); | | virtual void debugDrawWorld(); | |
| | | | |
| void addSoftBody(btSoftBody* body,short int collisionFilterGroup=
btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphase
Proxy::AllFilter); | | void addSoftBody(btSoftBody* body,short int collisionFilterGroup=
btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphase
Proxy::AllFilter); | |
| | | | |
| | | | |
| skipping to change at line 74 | | skipping to change at line 76 | |
| | | | |
| btSoftBodyWorldInfo& getWorldInfo() | | btSoftBodyWorldInfo& getWorldInfo() | |
| { | | { | |
| return m_sbi; | | return m_sbi; | |
| } | | } | |
| const btSoftBodyWorldInfo& getWorldInfo() const | | const btSoftBodyWorldInfo& getWorldInfo() const | |
| { | | { | |
| return m_sbi; | | return m_sbi; | |
| } | | } | |
| | | | |
|
| | | virtual btDynamicsWorldType getWorldType() const | |
| | | { | |
| | | return BT_SOFT_RIGID_DYNAMICS_WORLD; | |
| | | } | |
| | | | |
| btSoftBodyArray& getSoftBodyArray() | | btSoftBodyArray& getSoftBodyArray() | |
| { | | { | |
| return m_softBodies; | | return m_softBodies; | |
| } | | } | |
| | | | |
| const btSoftBodyArray& getSoftBodyArray() const | | const btSoftBodyArray& getSoftBodyArray() const | |
| { | | { | |
| return m_softBodies; | | return m_softBodies; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 102 | |
| | | | |
| /// rayTestSingle performs a raycast call and calls the resultCallba
ck. It is used internally by rayTest. | | /// rayTestSingle performs a raycast call and calls the resultCallba
ck. It is used internally by rayTest. | |
| /// In a future implementation, we consider moving the ray test as a
virtual method in btCollisionShape. | | /// In a future implementation, we consider moving the ray test as a
virtual method in btCollisionShape. | |
| /// This allows more customization. | | /// This allows more customization. | |
| static void rayTestSingle(const btTransform& rayFromTrans,const
btTransform& rayToTrans, | | static void rayTestSingle(const btTransform& rayFromTrans,const
btTransform& rayToTrans, | |
| btCollisionObject* collisionObject
, | | btCollisionObject* collisionObject
, | |
| const btCollisionShape* collisionS
hape, | | const btCollisionShape* collisionS
hape, | |
| const btTransform& colObjWorldTran
sform, | | const btTransform& colObjWorldTran
sform, | |
| RayResultCallback& resultCallback)
; | | RayResultCallback& resultCallback)
; | |
| | | | |
|
| | | virtual void serialize(btSerializer* serializer); | |
| | | | |
| }; | | }; | |
| | | | |
| #endif //BT_SOFT_RIGID_DYNAMICS_WORLD_H | | #endif //BT_SOFT_RIGID_DYNAMICS_WORLD_H | |
| | | | |
End of changes. 3 change blocks. |
| 0 lines changed or deleted | | 9 lines changed or added | |
|
| btStridingMeshInterface.h | | btStridingMeshInterface.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef STRIDING_MESHINTERFACE_H | | #ifndef BT_STRIDING_MESHINTERFACE_H | |
| #define STRIDING_MESHINTERFACE_H | | #define BT_STRIDING_MESHINTERFACE_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btTriangleCallback.h" | | #include "btTriangleCallback.h" | |
| #include "btConcaveShape.h" | | #include "btConcaveShape.h" | |
| | | | |
| /// The btStridingMeshInterface is the interface class for high performa
nce generic access to triangle meshes, used in combination with btBvhTriang
leMeshShape and some other collision shapes. | | /// The btStridingMeshInterface is the interface class for high performa
nce generic access to triangle meshes, used in combination with btBvhTriang
leMeshShape and some other collision shapes. | |
| /// Using index striding of 3*sizeof(integer) it can use triangle arrays, u
sing index striding of 1*sizeof(integer) it can handle triangle strips. | | /// Using index striding of 3*sizeof(integer) it can use triangle arrays, u
sing index striding of 1*sizeof(integer) it can handle triangle strips. | |
| /// It allows for sharing graphics and collision meshes. Also it provides l
ocking/unlocking of graphics meshes that are in gpu memory. | | /// It allows for sharing graphics and collision meshes. Also it provides l
ocking/unlocking of graphics meshes that are in gpu memory. | |
| class btStridingMeshInterface | | class btStridingMeshInterface | |
| { | | { | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 111 | |
| short m_value; | | short m_value; | |
| char m_pad[2]; | | char m_pad[2]; | |
| }; | | }; | |
| | | | |
| struct btShortIntIndexTripletData | | struct btShortIntIndexTripletData | |
| { | | { | |
| short m_values[3]; | | short m_values[3]; | |
| char m_pad[2]; | | char m_pad[2]; | |
| }; | | }; | |
| | | | |
|
| | | struct btCharIndexTripletData | |
| | | { | |
| | | unsigned char m_values[3]; | |
| | | char m_pad; | |
| | | }; | |
| | | | |
| ///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64 | | ///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64 | |
| struct btMeshPartData | | struct btMeshPartData | |
| { | | { | |
| btVector3FloatData *m_vertices3f; | | btVector3FloatData *m_vertices3f; | |
| btVector3DoubleData *m_vertices3d; | | btVector3DoubleData *m_vertices3d; | |
| | | | |
| btIntIndexData *m_indices32; | | btIntIndexData *m_indices32; | |
| btShortIntIndexTripletData *m_3indices16; | | btShortIntIndexTripletData *m_3indices16; | |
|
| | | btCharIndexTripletData *m_3indices8; | |
| | | | |
| btShortIntIndexData *m_indices16;//backwards com
patibility | | btShortIntIndexData *m_indices16;//backwards com
patibility | |
| | | | |
| int m_numTriangles;//length of m_indices = m_num
Triangles | | int m_numTriangles;//length of m_indices = m_num
Triangles | |
| int m_numVertices; | | int m_numVertices; | |
| }; | | }; | |
| | | | |
| ///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64 | | ///do not change those serialization structures, it requires an updated sBu
lletDNAstr/sBulletDNAstr64 | |
| struct btStridingMeshInterfaceData | | struct btStridingMeshInterfaceData | |
| { | | { | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 147 | |
| btVector3FloatData m_scaling; | | btVector3FloatData m_scaling; | |
| int m_numMeshParts; | | int m_numMeshParts; | |
| char m_padding[4]; | | char m_padding[4]; | |
| }; | | }; | |
| | | | |
| SIMD_FORCE_INLINE int btStridingMeshInterface::calculateSerializeB
ufferSize() const | | SIMD_FORCE_INLINE int btStridingMeshInterface::calculateSerializeB
ufferSize() const | |
| { | | { | |
| return sizeof(btStridingMeshInterfaceData); | | return sizeof(btStridingMeshInterfaceData); | |
| } | | } | |
| | | | |
|
| #endif //STRIDING_MESHINTERFACE_H | | #endif //BT_STRIDING_MESHINTERFACE_H | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 9 lines changed or added | |
|
| btTriangleMesh.h | | btTriangleMesh.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef TRIANGLE_MESH_H | | #ifndef BT_TRIANGLE_MESH_H | |
| #define TRIANGLE_MESH_H | | #define BT_TRIANGLE_MESH_H | |
| | | | |
| #include "btTriangleIndexVertexArray.h" | | #include "btTriangleIndexVertexArray.h" | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "LinearMath/btAlignedObjectArray.h" | | #include "LinearMath/btAlignedObjectArray.h" | |
| | | | |
| ///The btTriangleMesh class is a convenience class derived from btTriangleI
ndexVertexArray, that provides storage for a concave triangle mesh. It can
be used as data for the btBvhTriangleMeshShape. | | ///The btTriangleMesh class is a convenience class derived from btTriangleI
ndexVertexArray, that provides storage for a concave triangle mesh. It can
be used as data for the btBvhTriangleMeshShape. | |
| ///It allows either 32bit or 16bit indices, and 4 (x-y-z-w) or 3 (x-y-z) co
mponent vertices. | | ///It allows either 32bit or 16bit indices, and 4 (x-y-z-w) or 3 (x-y-z) co
mponent vertices. | |
| ///If you want to share triangle/index data between graphics mesh and colli
sion mesh (btBvhTriangleMeshShape), you can directly use btTriangleIndexVer
texArray or derive your own class from btStridingMeshInterface. | | ///If you want to share triangle/index data between graphics mesh and colli
sion mesh (btBvhTriangleMeshShape), you can directly use btTriangleIndexVer
texArray or derive your own class from btStridingMeshInterface. | |
| ///Performance of btTriangleMesh and btTriangleIndexVertexArray used in a b
tBvhTriangleMeshShape is the same. | | ///Performance of btTriangleMesh and btTriangleIndexVertexArray used in a b
tBvhTriangleMeshShape is the same. | |
| class btTriangleMesh : public btTriangleIndexVertexArray | | class btTriangleMesh : public btTriangleIndexVertexArray | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 67 | |
| virtual void preallocateVertices(int numverts){(void) num
verts;} | | virtual void preallocateVertices(int numverts){(void) num
verts;} | |
| virtual void preallocateIndices(int numindices){(void) nu
mindices;} | | virtual void preallocateIndices(int numindices){(void) nu
mindices;} | |
| | | | |
| ///findOrAddVertex is an internal method, use addTriangle in
stead | | ///findOrAddVertex is an internal method, use addTriangle in
stead | |
| int findOrAddVertex(const btVector3& vertex, boo
l removeDuplicateVertices); | | int findOrAddVertex(const btVector3& vertex, boo
l removeDuplicateVertices); | |
| ///addIndex is an internal method, use addTriangle instead | | ///addIndex is an internal method, use addTriangle instead | |
| void addIndex(int index); | | void addIndex(int index); | |
| | | | |
| }; | | }; | |
| | | | |
|
| #endif //TRIANGLE_MESH_H | | #endif //BT_TRIANGLE_MESH_H | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| btTypedConstraint.h | | btTypedConstraint.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef TYPED_CONSTRAINT_H | | #ifndef BT_TYPED_CONSTRAINT_H | |
| #define TYPED_CONSTRAINT_H | | #define BT_TYPED_CONSTRAINT_H | |
| | | | |
| class btRigidBody; | | class btRigidBody; | |
| #include "LinearMath/btScalar.h" | | #include "LinearMath/btScalar.h" | |
| #include "btSolverConstraint.h" | | #include "btSolverConstraint.h" | |
|
| #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" | | | |
| | | | |
| class btSerializer; | | class btSerializer; | |
| | | | |
|
| | | //Don't change any of the existing enum values, so add enum types at the en
d for serialization compatibility | |
| enum btTypedConstraintType | | enum btTypedConstraintType | |
| { | | { | |
|
| POINT2POINT_CONSTRAINT_TYPE=MAX_CONTACT_MANIFOLD_TYPE+1, | | POINT2POINT_CONSTRAINT_TYPE=3, | |
| HINGE_CONSTRAINT_TYPE, | | HINGE_CONSTRAINT_TYPE, | |
| CONETWIST_CONSTRAINT_TYPE, | | CONETWIST_CONSTRAINT_TYPE, | |
| D6_CONSTRAINT_TYPE, | | D6_CONSTRAINT_TYPE, | |
| SLIDER_CONSTRAINT_TYPE, | | SLIDER_CONSTRAINT_TYPE, | |
|
| CONTACT_CONSTRAINT_TYPE | | CONTACT_CONSTRAINT_TYPE, | |
| | | D6_SPRING_CONSTRAINT_TYPE, | |
| | | MAX_CONSTRAINT_TYPE | |
| }; | | }; | |
| | | | |
| enum btConstraintParams | | enum btConstraintParams | |
| { | | { | |
| BT_CONSTRAINT_ERP=1, | | BT_CONSTRAINT_ERP=1, | |
| BT_CONSTRAINT_STOP_ERP, | | BT_CONSTRAINT_STOP_ERP, | |
| BT_CONSTRAINT_CFM, | | BT_CONSTRAINT_CFM, | |
| BT_CONSTRAINT_STOP_CFM | | BT_CONSTRAINT_STOP_CFM | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 63 | |
| class btTypedConstraint : public btTypedObject | | class btTypedConstraint : public btTypedObject | |
| { | | { | |
| int m_userConstraintType; | | int m_userConstraintType; | |
| | | | |
| union | | union | |
| { | | { | |
| int m_userConstraintId; | | int m_userConstraintId; | |
| void* m_userConstraintPtr; | | void* m_userConstraintPtr; | |
| }; | | }; | |
| | | | |
|
| | | btScalar m_breakingImpulseThreshold; | |
| | | bool m_isEnabled; | |
| | | | |
| bool m_needsFeedback; | | bool m_needsFeedback; | |
| | | | |
| btTypedConstraint& operator=(btTypedConstraint& other) | | btTypedConstraint& operator=(btTypedConstraint& other) | |
| { | | { | |
| btAssert(0); | | btAssert(0); | |
| (void) other; | | (void) other; | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| protected: | | protected: | |
| | | | |
| skipping to change at line 154 | | skipping to change at line 159 | |
| void internalSetAppliedImpulse(btScalar appliedImpulse) | | void internalSetAppliedImpulse(btScalar appliedImpulse) | |
| { | | { | |
| m_appliedImpulse = appliedImpulse; | | m_appliedImpulse = appliedImpulse; | |
| } | | } | |
| ///internal method used by the constraint solver, don't use them dir
ectly | | ///internal method used by the constraint solver, don't use them dir
ectly | |
| btScalar internalGetAppliedImpulse() | | btScalar internalGetAppliedImpulse() | |
| { | | { | |
| return m_appliedImpulse; | | return m_appliedImpulse; | |
| } | | } | |
| | | | |
|
| | | btScalar getBreakingImpulseThreshold() const | |
| | | { | |
| | | return m_breakingImpulseThreshold; | |
| | | } | |
| | | | |
| | | void setBreakingImpulseThreshold(btScalar threshold) | |
| | | { | |
| | | m_breakingImpulseThreshold = threshold; | |
| | | } | |
| | | | |
| | | bool isEnabled() const | |
| | | { | |
| | | return m_isEnabled; | |
| | | } | |
| | | | |
| | | void setEnabled(bool enabled) | |
| | | { | |
| | | m_isEnabled=enabled; | |
| | | } | |
| | | | |
| ///internal method used by the constraint solver, don't use them dir
ectly | | ///internal method used by the constraint solver, don't use them dir
ectly | |
| virtual void solveConstraintObsolete(btRigidBody& /*bodyA*/,btRig
idBody& /*bodyB*/,btScalar /*timeStep*/) {}; | | virtual void solveConstraintObsolete(btRigidBody& /*bodyA*/,btRig
idBody& /*bodyB*/,btScalar /*timeStep*/) {}; | |
| | | | |
| const btRigidBody& getRigidBodyA() const | | const btRigidBody& getRigidBodyA() const | |
| { | | { | |
| return m_rbA; | | return m_rbA; | |
| } | | } | |
| const btRigidBody& getRigidBodyB() const | | const btRigidBody& getRigidBodyB() const | |
| { | | { | |
| return m_rbB; | | return m_rbB; | |
| | | | |
| skipping to change at line 309 | | skipping to change at line 334 | |
| int m_disableCollisionsBetweenLinkedBodies; | | int m_disableCollisionsBetweenLinkedBodies; | |
| char m_pad4[4]; | | char m_pad4[4]; | |
| | | | |
| }; | | }; | |
| | | | |
| SIMD_FORCE_INLINE int btTypedConstraint::calculateSerializeBufferS
ize() const | | SIMD_FORCE_INLINE int btTypedConstraint::calculateSerializeBufferS
ize() const | |
| { | | { | |
| return sizeof(btTypedConstraintData); | | return sizeof(btTypedConstraintData); | |
| } | | } | |
| | | | |
|
| #endif //TYPED_CONSTRAINT_H | | class btAngularLimit | |
| | | { | |
| | | private: | |
| | | btScalar | |
| | | m_center, | |
| | | m_halfRange, | |
| | | m_softness, | |
| | | m_biasFactor, | |
| | | m_relaxationFactor, | |
| | | m_correction, | |
| | | m_sign; | |
| | | | |
| | | bool | |
| | | m_solveLimit; | |
| | | | |
| | | public: | |
| | | /// Default constructor initializes limit as inactive, allowing free | |
| | | constraint movement | |
| | | btAngularLimit() | |
| | | :m_center(0.0f), | |
| | | m_halfRange(-1.0f), | |
| | | m_softness(0.9f), | |
| | | m_biasFactor(0.3f), | |
| | | m_relaxationFactor(1.0f), | |
| | | m_correction(0.0f), | |
| | | m_sign(0.0f), | |
| | | m_solveLimit(false) | |
| | | {} | |
| | | | |
| | | /// Sets all limit's parameters. | |
| | | /// When low > high limit becomes inactive. | |
| | | /// When high - low > 2PI limit is ineffective too becouse no angle | |
| | | can exceed the limit | |
| | | void set(btScalar low, btScalar high, btScalar _softness = 0.9f, btS | |
| | | calar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f); | |
| | | | |
| | | /// Checks conastaint angle against limit. If limit is active and th | |
| | | e angle violates the limit | |
| | | /// correction is calculated. | |
| | | void test(const btScalar angle); | |
| | | | |
| | | /// Returns limit's softness | |
| | | inline btScalar getSoftness() const | |
| | | { | |
| | | return m_softness; | |
| | | } | |
| | | | |
| | | /// Returns limit's bias factor | |
| | | inline btScalar getBiasFactor() const | |
| | | { | |
| | | return m_biasFactor; | |
| | | } | |
| | | | |
| | | /// Returns limit's relaxation factor | |
| | | inline btScalar getRelaxationFactor() const | |
| | | { | |
| | | return m_relaxationFactor; | |
| | | } | |
| | | | |
| | | /// Returns correction value evaluated when test() was invoked | |
| | | inline btScalar getCorrection() const | |
| | | { | |
| | | return m_correction; | |
| | | } | |
| | | | |
| | | /// Returns sign value evaluated when test() was invoked | |
| | | inline btScalar getSign() const | |
| | | { | |
| | | return m_sign; | |
| | | } | |
| | | | |
| | | /// Gives half of the distance between min and max limit angle | |
| | | inline btScalar getHalfRange() const | |
| | | { | |
| | | return m_halfRange; | |
| | | } | |
| | | | |
| | | /// Returns true when the last test() invocation recognized limit vi | |
| | | olation | |
| | | inline bool isLimit() const | |
| | | { | |
| | | return m_solveLimit; | |
| | | } | |
| | | | |
| | | /// Checks given angle against limit. If limit is active and angle d | |
| | | oesn't fit it, the angle | |
| | | /// returned is modified so it equals to the limit closest to given | |
| | | angle. | |
| | | void fit(btScalar& angle) const; | |
| | | | |
| | | /// Returns correction value multiplied by sign value | |
| | | btScalar getError() const; | |
| | | | |
| | | btScalar getLow() const; | |
| | | | |
| | | btScalar getHigh() const; | |
| | | | |
| | | }; | |
| | | | |
| | | #endif //BT_TYPED_CONSTRAINT_H | |
| | | | |
End of changes. 8 change blocks. |
| 5 lines changed or deleted | | 30 lines changed or added | |
|
| btUniversalConstraint.h | | btUniversalConstraint.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| In no event will the authors be held liable for any damages arising from th
e use of this software. | | In no event will the authors be held liable for any damages arising from th
e use of this software. | |
| Permission is granted to anyone to use this software for any purpose, | | Permission is granted to anyone to use this software for any purpose, | |
| including commercial applications, and to alter it and redistribute it free
ly, | | including commercial applications, and to alter it and redistribute it free
ly, | |
| subject to the following restrictions: | | subject to the following restrictions: | |
| | | | |
| 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | | 1. The origin of this software must not be misrepresented; you must not cla
im that you wrote the original software. If you use this software in a prod
uct, an acknowledgment in the product documentation would be appreciated bu
t is not required. | |
| 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. | | 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. | | 3. This notice may not be removed or altered from any source distribution. | |
| */ | | */ | |
| | | | |
|
| #ifndef UNIVERSAL_CONSTRAINT_H | | #ifndef BT_UNIVERSAL_CONSTRAINT_H | |
| #define UNIVERSAL_CONSTRAINT_H | | #define BT_UNIVERSAL_CONSTRAINT_H | |
| | | | |
| #include "LinearMath/btVector3.h" | | #include "LinearMath/btVector3.h" | |
| #include "btTypedConstraint.h" | | #include "btTypedConstraint.h" | |
| #include "btGeneric6DofConstraint.h" | | #include "btGeneric6DofConstraint.h" | |
| | | | |
| /// Constraint similar to ODE Universal Joint | | /// Constraint similar to ODE Universal Joint | |
| /// has 2 rotatioonal degrees of freedom, similar to Euler rotations around
Z (axis 1) | | /// has 2 rotatioonal degrees of freedom, similar to Euler rotations around
Z (axis 1) | |
| /// and Y (axis 2) | | /// and Y (axis 2) | |
| /// Description from ODE manual : | | /// Description from ODE manual : | |
| /// "Given axis 1 on body 1, and axis 2 on body 2 that is perpendicular to
axis 1, it keeps them perpendicular. | | /// "Given axis 1 on body 1, and axis 2 on body 2 that is perpendicular to
axis 1, it keeps them perpendicular. | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| // access | | // access | |
| const btVector3& getAnchor() { return m_calculatedTransformA.getOrig
in(); } | | const btVector3& getAnchor() { return m_calculatedTransformA.getOrig
in(); } | |
| const btVector3& getAnchor2() { return m_calculatedTransformB.getOri
gin(); } | | const btVector3& getAnchor2() { return m_calculatedTransformB.getOri
gin(); } | |
| const btVector3& getAxis1() { return m_axis1; } | | const btVector3& getAxis1() { return m_axis1; } | |
| const btVector3& getAxis2() { return m_axis2; } | | const btVector3& getAxis2() { return m_axis2; } | |
| btScalar getAngle1() { return getAngle(2); } | | btScalar getAngle1() { return getAngle(2); } | |
| btScalar getAngle2() { return getAngle(1); } | | btScalar getAngle2() { return getAngle(1); } | |
| // limits | | // limits | |
| void setUpperLimit(btScalar ang1max, btScalar ang2max) { setAngularU
pperLimit(btVector3(0.f, ang1max, ang2max)); } | | void setUpperLimit(btScalar ang1max, btScalar ang2max) { setAngularU
pperLimit(btVector3(0.f, ang1max, ang2max)); } | |
| void setLowerLimit(btScalar ang1min, btScalar ang2min) { setAngularL
owerLimit(btVector3(0.f, ang1min, ang2min)); } | | void setLowerLimit(btScalar ang1min, btScalar ang2min) { setAngularL
owerLimit(btVector3(0.f, ang1min, ang2min)); } | |
|
| | | | |
| | | void setAxis( const btVector3& axis1, const btVector3& axis2); | |
| }; | | }; | |
| | | | |
|
| #endif // UNIVERSAL_CONSTRAINT_H | | #endif // BT_UNIVERSAL_CONSTRAINT_H | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 4 lines changed or added | |
|