bullet: Clean up BulletContact/BulletManifoldPoint reference handling a bit

Still looks kinda sketchy though

Related to #1192
This commit is contained in:
rdb 2022-10-25 12:14:20 +02:00
parent bf65624298
commit f64dcbd3df
6 changed files with 14 additions and 40 deletions

View File

@ -32,7 +32,7 @@ get_node1() const {
/**
*
*/
INLINE BulletManifoldPoint &BulletContact::
INLINE BulletManifoldPoint BulletContact::
get_manifold_point() {
return _mp;

View File

@ -21,9 +21,13 @@ BulletContact BulletContactResult::_empty;
*/
BulletContact::
BulletContact() : _mp(_empty) {
}
_node0 = nullptr;
_node1 = nullptr;
/**
*
*/
BulletContact::
BulletContact(btManifoldPoint &mp) : _mp(mp) {
}
/**
@ -93,9 +97,7 @@ addSingleResult(btManifoldPoint &mp,
const btCollisionObject *obj0 = wrap0->getCollisionObject();
const btCollisionObject *obj1 = wrap1->getCollisionObject();
BulletContact contact;
contact._mp = BulletManifoldPoint(mp);
BulletContact contact(mp);
contact._node0 = obj0 ? (PandaNode *)obj0->getUserPointer() : nullptr;
contact._node1 = obj1 ? (PandaNode *)obj1->getUserPointer() : nullptr;
contact._part_id0 = part_id0;
@ -116,9 +118,7 @@ addSingleResult(btManifoldPoint &mp,
const btCollisionObject *obj0, int part_id0, int idx0,
const btCollisionObject *obj1, int part_id1, int idx1) {
BulletContact contact;
contact._mp = BulletManifoldPoint(mp);
BulletContact contact(mp);
contact._node0 = obj0 ? (PandaNode *)obj0->getUserPointer() : nullptr;
contact._node1 = obj1 ? (PandaNode *)obj1->getUserPointer() : nullptr;
contact._part_id0 = part_id0;

View File

@ -28,10 +28,11 @@ struct EXPCL_PANDABULLET BulletContact {
public:
BulletContact();
BulletContact(btManifoldPoint &mp);
BulletContact(const BulletContact &other);
PUBLISHED:
INLINE BulletManifoldPoint &get_manifold_point();
INLINE BulletManifoldPoint get_manifold_point();
INLINE PandaNode *get_node0() const;
INLINE PandaNode *get_node1() const;
INLINE int get_idx0() const;

View File

@ -10,11 +10,3 @@
* @author enn0x
* @date 2010-03-07
*/
/**
*
*/
INLINE BulletManifoldPoint::
~BulletManifoldPoint() {
}

View File

@ -24,25 +24,6 @@ BulletManifoldPoint(btManifoldPoint &pt)
}
/**
*
*/
BulletManifoldPoint::
BulletManifoldPoint(const BulletManifoldPoint &other)
: _pt(other._pt) {
}
/**
*
*/
BulletManifoldPoint& BulletManifoldPoint::
operator=(const BulletManifoldPoint& other) {
this->_pt = other._pt;
return *this;
}
/**
*
*/

View File

@ -27,7 +27,7 @@
class EXPCL_PANDABULLET BulletManifoldPoint {
PUBLISHED:
INLINE ~BulletManifoldPoint();
~BulletManifoldPoint() = default;
int get_life_time() const;
PN_stdfloat get_distance() const;
@ -95,8 +95,8 @@ PUBLISHED:
public:
BulletManifoldPoint(btManifoldPoint &pt);
BulletManifoldPoint(const BulletManifoldPoint &other);
BulletManifoldPoint& operator=(const BulletManifoldPoint& other);
BulletManifoldPoint(const BulletManifoldPoint &other) = default;
BulletManifoldPoint& operator=(const BulletManifoldPoint& other) = delete;
private:
btManifoldPoint &_pt;