mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -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() {
|
get_manifold_point() {
|
||||||
|
|
||||||
return _mp;
|
return _mp;
|
||||||
|
@ -21,9 +21,13 @@ BulletContact BulletContactResult::_empty;
|
|||||||
*/
|
*/
|
||||||
BulletContact::
|
BulletContact::
|
||||||
BulletContact() : _mp(_empty) {
|
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 *obj0 = wrap0->getCollisionObject();
|
||||||
const btCollisionObject *obj1 = wrap1->getCollisionObject();
|
const btCollisionObject *obj1 = wrap1->getCollisionObject();
|
||||||
|
|
||||||
BulletContact contact;
|
BulletContact contact(mp);
|
||||||
|
|
||||||
contact._mp = BulletManifoldPoint(mp);
|
|
||||||
contact._node0 = obj0 ? (PandaNode *)obj0->getUserPointer() : nullptr;
|
contact._node0 = obj0 ? (PandaNode *)obj0->getUserPointer() : nullptr;
|
||||||
contact._node1 = obj1 ? (PandaNode *)obj1->getUserPointer() : nullptr;
|
contact._node1 = obj1 ? (PandaNode *)obj1->getUserPointer() : nullptr;
|
||||||
contact._part_id0 = part_id0;
|
contact._part_id0 = part_id0;
|
||||||
@ -116,9 +118,7 @@ addSingleResult(btManifoldPoint &mp,
|
|||||||
const btCollisionObject *obj0, int part_id0, int idx0,
|
const btCollisionObject *obj0, int part_id0, int idx0,
|
||||||
const btCollisionObject *obj1, int part_id1, int idx1) {
|
const btCollisionObject *obj1, int part_id1, int idx1) {
|
||||||
|
|
||||||
BulletContact contact;
|
BulletContact contact(mp);
|
||||||
|
|
||||||
contact._mp = BulletManifoldPoint(mp);
|
|
||||||
contact._node0 = obj0 ? (PandaNode *)obj0->getUserPointer() : nullptr;
|
contact._node0 = obj0 ? (PandaNode *)obj0->getUserPointer() : nullptr;
|
||||||
contact._node1 = obj1 ? (PandaNode *)obj1->getUserPointer() : nullptr;
|
contact._node1 = obj1 ? (PandaNode *)obj1->getUserPointer() : nullptr;
|
||||||
contact._part_id0 = part_id0;
|
contact._part_id0 = part_id0;
|
||||||
|
@ -28,10 +28,11 @@ struct EXPCL_PANDABULLET BulletContact {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
BulletContact();
|
BulletContact();
|
||||||
|
BulletContact(btManifoldPoint &mp);
|
||||||
BulletContact(const BulletContact &other);
|
BulletContact(const BulletContact &other);
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE BulletManifoldPoint &get_manifold_point();
|
INLINE BulletManifoldPoint get_manifold_point();
|
||||||
INLINE PandaNode *get_node0() const;
|
INLINE PandaNode *get_node0() const;
|
||||||
INLINE PandaNode *get_node1() const;
|
INLINE PandaNode *get_node1() const;
|
||||||
INLINE int get_idx0() const;
|
INLINE int get_idx0() const;
|
||||||
|
@ -10,11 +10,3 @@
|
|||||||
* @author enn0x
|
* @author enn0x
|
||||||
* @date 2010-03-07
|
* @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 {
|
class EXPCL_PANDABULLET BulletManifoldPoint {
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE ~BulletManifoldPoint();
|
~BulletManifoldPoint() = default;
|
||||||
|
|
||||||
int get_life_time() const;
|
int get_life_time() const;
|
||||||
PN_stdfloat get_distance() const;
|
PN_stdfloat get_distance() const;
|
||||||
@ -95,8 +95,8 @@ PUBLISHED:
|
|||||||
public:
|
public:
|
||||||
BulletManifoldPoint(btManifoldPoint &pt);
|
BulletManifoldPoint(btManifoldPoint &pt);
|
||||||
|
|
||||||
BulletManifoldPoint(const BulletManifoldPoint &other);
|
BulletManifoldPoint(const BulletManifoldPoint &other) = default;
|
||||||
BulletManifoldPoint& operator=(const BulletManifoldPoint& other);
|
BulletManifoldPoint& operator=(const BulletManifoldPoint& other) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
btManifoldPoint &_pt;
|
btManifoldPoint &_pt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user