mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 15:53:55 -04:00
bullet: Clean up BulletContact/BulletManifoldPoint reference handling a bit
Still looks kinda sketchy though Related to #1192
This commit is contained in:
parent
bf65624298
commit
f64dcbd3df
@ -32,7 +32,7 @@ get_node1() const {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE BulletManifoldPoint &BulletContact::
|
||||
INLINE BulletManifoldPoint BulletContact::
|
||||
get_manifold_point() {
|
||||
|
||||
return _mp;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -10,11 +10,3 @@
|
||||
* @author enn0x
|
||||
* @date 2010-03-07
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE BulletManifoldPoint::
|
||||
~BulletManifoldPoint() {
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user