Remove name field and replace it with btTypedUserInfo field

This commit is contained in:
johnmccutchan
2008-02-05 18:55:05 +00:00
parent 7be6c98c60
commit d368ef3d71
3 changed files with 15 additions and 20 deletions

View File

@@ -26,7 +26,7 @@ btCollisionObject::btCollisionObject()
m_deactivationTime(btScalar(0.)),
m_friction(btScalar(0.5)),
m_restitution(btScalar(0.)),
m_objectName (0),
m_typedUserInfo (NULL),
m_userObjectPointer(0),
m_internalOwner(0),
m_hitFraction(btScalar(1.)),

View File

@@ -27,6 +27,7 @@ subject to the following restrictions:
struct btBroadphaseProxy;
class btCollisionShape;
class btTypedUserInfo;
#include "LinearMath/btMotionState.h"
#include "LinearMath/btAlignedAllocator.h"
@@ -69,8 +70,7 @@ protected:
///m_internalOwner is reserved to point to Bullet's btRigidBody. Don't use this, use m_userObjectPointer instead.
void* m_internalOwner;
// setName, getName
char* m_objectName;
btTypedUserInfo* m_typedUserInfo;
///time of impact calculation
btScalar m_hitFraction;
@@ -337,16 +337,14 @@ public:
m_userObjectPointer = userPointer;
}
char* getName () const
btTypedUserInfo* getTypedUserInfo () const
{
return m_objectName;
return m_typedUserInfo;
}
/// the user is responsible for the memory management of name
void setName (char* name)
void setTypedUserInfo (btTypedUserInfo* typedUserInfo)
{
m_objectName = name;
m_typedUserInfo = typedUserInfo;
}
inline bool checkCollideWith(btCollisionObject* co)
@@ -356,9 +354,6 @@ public:
return true;
}
}
;
};
#endif //COLLISION_OBJECT_H

View File

@@ -16,6 +16,7 @@ subject to the following restrictions:
#ifndef COLLISION_SHAPE_H
#define COLLISION_SHAPE_H
class btTypedUserInfo;
#include "LinearMath/btTransform.h"
#include "LinearMath/btVector3.h"
#include "LinearMath/btMatrix3x3.h"
@@ -27,11 +28,11 @@ class btCollisionShape
{
void* m_userPointer;
char* m_shapeName;
btTypedUserInfo* m_typedUserInfo;
public:
btCollisionShape() : m_userPointer(0), m_shapeName (0)
btCollisionShape() : m_userPointer(0), m_typedUserInfo (0)
{
}
virtual ~btCollisionShape()
@@ -104,15 +105,14 @@ public:
return m_userPointer;
}
char* getShapeName () const
btTypedUserInfo* getTypedUserInfo () const
{
return m_shapeName;
return m_typedUserInfo;
}
/// the user is responsible for the memory management of name
void setShapeName (char* name)
void setTypedUserInfo (btTypedUserInfo* typedUserInfo)
{
m_shapeName = name;
m_typedUserInfo = typedUserInfo;
}
};