summaryrefslogtreecommitdiff
path: root/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp')
-rw-r--r--thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp79
1 files changed, 38 insertions, 41 deletions
diff --git a/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp b/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp
index 05f96a14bc..98a02d0c45 100644
--- a/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp
+++ b/thirdparty/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp
@@ -13,42 +13,41 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
-
#include "btCollisionObject.h"
#include "LinearMath/btSerializer.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
btCollisionObject::btCollisionObject()
- : m_interpolationLinearVelocity(0.f, 0.f, 0.f),
- m_interpolationAngularVelocity(0.f, 0.f, 0.f),
- m_anisotropicFriction(1.f,1.f,1.f),
- m_hasAnisotropicFriction(false),
- m_contactProcessingThreshold(BT_LARGE_FLOAT),
- m_broadphaseHandle(0),
- m_collisionShape(0),
- m_extensionPointer(0),
- m_rootCollisionShape(0),
- m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT),
- m_islandTag1(-1),
- m_companionId(-1),
- m_worldArrayIndex(-1),
- m_activationState1(1),
- m_deactivationTime(btScalar(0.)),
- m_friction(btScalar(0.5)),
- m_restitution(btScalar(0.)),
- m_rollingFriction(0.0f),
- m_spinningFriction(0.f),
- m_contactDamping(.1),
- m_contactStiffness(BT_LARGE_FLOAT),
- m_internalType(CO_COLLISION_OBJECT),
- m_userObjectPointer(0),
- m_userIndex2(-1),
- m_userIndex(-1),
- m_hitFraction(btScalar(1.)),
- m_ccdSweptSphereRadius(btScalar(0.)),
- m_ccdMotionThreshold(btScalar(0.)),
- m_checkCollideWith(false),
- m_updateRevision(0)
+ : m_interpolationLinearVelocity(0.f, 0.f, 0.f),
+ m_interpolationAngularVelocity(0.f, 0.f, 0.f),
+ m_anisotropicFriction(1.f, 1.f, 1.f),
+ m_hasAnisotropicFriction(false),
+ m_contactProcessingThreshold(BT_LARGE_FLOAT),
+ m_broadphaseHandle(0),
+ m_collisionShape(0),
+ m_extensionPointer(0),
+ m_rootCollisionShape(0),
+ m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT),
+ m_islandTag1(-1),
+ m_companionId(-1),
+ m_worldArrayIndex(-1),
+ m_activationState1(1),
+ m_deactivationTime(btScalar(0.)),
+ m_friction(btScalar(0.5)),
+ m_restitution(btScalar(0.)),
+ m_rollingFriction(0.0f),
+ m_spinningFriction(0.f),
+ m_contactDamping(.1),
+ m_contactStiffness(BT_LARGE_FLOAT),
+ m_internalType(CO_COLLISION_OBJECT),
+ m_userObjectPointer(0),
+ m_userIndex2(-1),
+ m_userIndex(-1),
+ m_hitFraction(btScalar(1.)),
+ m_ccdSweptSphereRadius(btScalar(0.)),
+ m_ccdMotionThreshold(btScalar(0.)),
+ m_checkCollideWith(false),
+ m_updateRevision(0)
{
m_worldTransform.setIdentity();
m_interpolationWorldTransform.setIdentity();
@@ -59,8 +58,8 @@ btCollisionObject::~btCollisionObject()
}
void btCollisionObject::setActivationState(int newState) const
-{
- if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION))
+{
+ if ((m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION))
m_activationState1 = newState;
}
@@ -71,7 +70,7 @@ void btCollisionObject::forceActivationState(int newState) const
void btCollisionObject::activate(bool forceActivation) const
{
- if (forceActivation || !(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT)))
+ if (forceActivation || !(m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT)))
{
setActivationState(ACTIVE_TAG);
m_deactivationTime = btScalar(0.);
@@ -80,7 +79,6 @@ void btCollisionObject::activate(bool forceActivation) const
const char* btCollisionObject::serialize(void* dataBuffer, btSerializer* serializer) const
{
-
btCollisionObjectData* dataOut = (btCollisionObjectData*)dataBuffer;
m_worldTransform.serialize(dataOut->m_worldTransform);
@@ -92,7 +90,7 @@ const char* btCollisionObject::serialize(void* dataBuffer, btSerializer* seriali
dataOut->m_contactProcessingThreshold = m_contactProcessingThreshold;
dataOut->m_broadphaseHandle = 0;
dataOut->m_collisionShape = serializer->getUniquePointer(m_collisionShape);
- dataOut->m_rootCollisionShape = 0;//@todo
+ dataOut->m_rootCollisionShape = 0; //@todo
dataOut->m_collisionFlags = m_collisionFlags;
dataOut->m_islandTag1 = m_islandTag1;
dataOut->m_companionId = m_companionId;
@@ -104,8 +102,8 @@ const char* btCollisionObject::serialize(void* dataBuffer, btSerializer* seriali
dataOut->m_contactStiffness = m_contactStiffness;
dataOut->m_restitution = m_restitution;
dataOut->m_internalType = m_internalType;
-
- char* name = (char*) serializer->findNameForPointer(this);
+
+ char* name = (char*)serializer->findNameForPointer(this);
dataOut->m_name = (char*)serializer->getUniquePointer(name);
if (dataOut->m_name)
{
@@ -130,11 +128,10 @@ const char* btCollisionObject::serialize(void* dataBuffer, btSerializer* seriali
return btCollisionObjectDataName;
}
-
void btCollisionObject::serializeSingleObject(class btSerializer* serializer) const
{
int len = calculateSerializeBufferSize();
- btChunk* chunk = serializer->allocate(len,1);
+ btChunk* chunk = serializer->allocate(len, 1);
const char* structType = serialize(chunk->m_oldPtr, serializer);
- serializer->finalizeChunk(chunk,structType,BT_COLLISIONOBJECT_CODE,(void*)this);
+ serializer->finalizeChunk(chunk, structType, BT_COLLISIONOBJECT_CODE, (void*)this);
}