bullet: Cleanup copying of shapes

- Fixed copy constructors
        - Dropped operator= from shapes

Signed-off-by: deflected <deflected@users.noreply.github.com>

Closes #283
This commit is contained in:
deflected 2018-03-17 18:32:52 +02:00 committed by rdb
parent 733085e38e
commit 3a88308f45
25 changed files with 130 additions and 158 deletions

View File

@ -35,19 +35,11 @@ BulletBoxShape::
BulletBoxShape(const BulletBoxShape &copy) { BulletBoxShape(const BulletBoxShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
_half_extents = copy._half_extents; _half_extents = copy._half_extents;
} btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents);
/** _shape = new btBoxShape(btHalfExtents);
* _shape->setUserPointer(this);
*/
void BulletBoxShape::
operator = (const BulletBoxShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
_half_extents = copy._half_extents;
} }
/** /**

View File

@ -34,7 +34,6 @@ private:
PUBLISHED: PUBLISHED:
explicit BulletBoxShape(const LVecBase3 &halfExtents); explicit BulletBoxShape(const LVecBase3 &halfExtents);
BulletBoxShape(const BulletBoxShape &copy); BulletBoxShape(const BulletBoxShape &copy);
void operator = (const BulletBoxShape &copy);
INLINE ~BulletBoxShape(); INLINE ~BulletBoxShape();
LVecBase3 get_half_extents_without_margin() const; LVecBase3 get_half_extents_without_margin() const;

View File

@ -18,7 +18,8 @@ INLINE BulletCapsuleShape::
BulletCapsuleShape() : BulletCapsuleShape() :
_shape(nullptr), _shape(nullptr),
_radius(0), _radius(0),
_height(0) { _height(0),
_up(X_up) {
} }
/** /**

View File

@ -21,7 +21,8 @@ TypeHandle BulletCapsuleShape::_type_handle;
BulletCapsuleShape:: BulletCapsuleShape::
BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) : BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) :
_radius(radius), _radius(radius),
_height(height) { _height(height),
_up(up) {
switch (up) { switch (up) {
case X_up: case X_up:
@ -49,24 +50,29 @@ BulletCapsuleShape::
BulletCapsuleShape(const BulletCapsuleShape &copy) { BulletCapsuleShape(const BulletCapsuleShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
_radius = copy._radius; _radius = copy._radius;
_height = copy._height; _height = copy._height;
_up = copy._up;
switch (_up) {
case X_up:
_shape = new btCapsuleShapeX(_radius, _height);
break;
case Y_up:
_shape = new btCapsuleShape(_radius, _height);
break;
case Z_up:
_shape = new btCapsuleShapeZ(_radius, _height);
break;
default:
bullet_cat.error() << "invalid up-axis:" << _up << endl;
break;
}
nassertv(_shape);
_shape->setUserPointer(this);
} }
/**
*
*/
void BulletCapsuleShape::
operator = (const BulletCapsuleShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
_radius = copy._radius;
_height = copy._height;
}
/** /**
* *
*/ */
@ -131,9 +137,9 @@ fillin(DatagramIterator &scan, BamReader *manager) {
// parameters to serialize: radius, height, up // parameters to serialize: radius, height, up
_radius = scan.get_stdfloat(); _radius = scan.get_stdfloat();
_height = scan.get_stdfloat(); _height = scan.get_stdfloat();
int up = (int) scan.get_int8(); _up = (BulletUpAxis) scan.get_int8();
switch (up) { switch (_up) {
case X_up: case X_up:
_shape = new btCapsuleShapeX(_radius, _height); _shape = new btCapsuleShapeX(_radius, _height);
break; break;
@ -144,7 +150,7 @@ fillin(DatagramIterator &scan, BamReader *manager) {
_shape = new btCapsuleShapeZ(_radius, _height); _shape = new btCapsuleShapeZ(_radius, _height);
break; break;
default: default:
bullet_cat.error() << "invalid up-axis:" << up << endl; bullet_cat.error() << "invalid up-axis:" << _up << endl;
break; break;
} }

View File

@ -31,7 +31,6 @@ private:
PUBLISHED: PUBLISHED:
explicit BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up); explicit BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up);
BulletCapsuleShape(const BulletCapsuleShape &copy); BulletCapsuleShape(const BulletCapsuleShape &copy);
void operator = (const BulletCapsuleShape &copy);
INLINE ~BulletCapsuleShape(); INLINE ~BulletCapsuleShape();
INLINE PN_stdfloat get_radius() const; INLINE PN_stdfloat get_radius() const;
@ -50,6 +49,7 @@ private:
btCapsuleShape *_shape; btCapsuleShape *_shape;
PN_stdfloat _radius; PN_stdfloat _radius;
PN_stdfloat _height; PN_stdfloat _height;
BulletUpAxis _up;
public: public:
static void register_with_read_factory(); static void register_with_read_factory();

View File

@ -18,7 +18,8 @@ INLINE BulletConeShape::
BulletConeShape() : BulletConeShape() :
_shape(nullptr), _shape(nullptr),
_radius(0), _radius(0),
_height(0) { _height(0),
_up(X_up) {
} }
/** /**

View File

@ -21,7 +21,8 @@ TypeHandle BulletConeShape::_type_handle;
BulletConeShape:: BulletConeShape::
BulletConeShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) : BulletConeShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) :
_radius(radius), _radius(radius),
_height(height) { _height(height),
_up(up) {
switch (up) { switch (up) {
case X_up: case X_up:
@ -49,21 +50,27 @@ BulletConeShape::
BulletConeShape(const BulletConeShape &copy) { BulletConeShape(const BulletConeShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape; _up = copy._up;
_radius = copy._radius; _radius = copy._radius;
_height = copy._height; _height = copy._height;
}
/** switch (_up) {
* case X_up:
*/ _shape = new btConeShapeX((btScalar)_radius, (btScalar)_height);
void BulletConeShape:: break;
operator = (const BulletConeShape &copy) { case Y_up:
LightMutexHolder holder(BulletWorld::get_global_lock()); _shape = new btConeShape((btScalar)_radius, (btScalar)_height);
break;
case Z_up:
_shape = new btConeShapeZ((btScalar)_radius, (btScalar)_height);
break;
default:
bullet_cat.error() << "invalid up-axis:" << _up << endl;
break;
}
_shape = copy._shape; nassertv(_shape);
_radius = copy._radius; _shape->setUserPointer(this);
_height = copy._height;
} }
/** /**
@ -95,7 +102,7 @@ write_datagram(BamWriter *manager, Datagram &dg) {
// parameters to serialize: radius, height, upIndex // parameters to serialize: radius, height, upIndex
dg.add_stdfloat(_radius); dg.add_stdfloat(_radius);
dg.add_stdfloat(_height); dg.add_stdfloat(_height);
dg.add_int8((int8_t)_shape->getConeUpIndex()); dg.add_int8((int8_t)_up);
} }
/** /**
@ -130,9 +137,9 @@ fillin(DatagramIterator &scan, BamReader *manager) {
// parameters to serialize: radius, height, up // parameters to serialize: radius, height, up
_radius = scan.get_stdfloat(); _radius = scan.get_stdfloat();
_height = scan.get_stdfloat(); _height = scan.get_stdfloat();
_up = (BulletUpAxis) scan.get_int8();
int up_index = (int) scan.get_int8(); switch (_up) {
switch (up_index) {
case 0: case 0:
_shape = new btConeShapeX((btScalar)_radius, (btScalar)_height); _shape = new btConeShapeX((btScalar)_radius, (btScalar)_height);
break; break;
@ -143,7 +150,7 @@ fillin(DatagramIterator &scan, BamReader *manager) {
_shape = new btConeShapeZ((btScalar)_radius, (btScalar)_height); _shape = new btConeShapeZ((btScalar)_radius, (btScalar)_height);
break; break;
default: default:
bullet_cat.error() << "invalid up-axis:" << up_index << endl; bullet_cat.error() << "invalid up-axis:" << _up << endl;
break; break;
} }

View File

@ -31,7 +31,6 @@ private:
PUBLISHED: PUBLISHED:
explicit BulletConeShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up); explicit BulletConeShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up);
BulletConeShape(const BulletConeShape &copy); BulletConeShape(const BulletConeShape &copy);
void operator = (const BulletConeShape &copy);
INLINE ~BulletConeShape(); INLINE ~BulletConeShape();
INLINE PN_stdfloat get_radius() const; INLINE PN_stdfloat get_radius() const;
@ -47,6 +46,7 @@ private:
btConeShape *_shape; btConeShape *_shape;
PN_stdfloat _radius; PN_stdfloat _radius;
PN_stdfloat _height; PN_stdfloat _height;
BulletUpAxis _up;
public: public:
static void register_with_read_factory(); static void register_with_read_factory();

View File

@ -36,17 +36,13 @@ BulletConvexHullShape::
BulletConvexHullShape(const BulletConvexHullShape &copy) { BulletConvexHullShape(const BulletConvexHullShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape; _shape = new btConvexHullShape(NULL, 0);
} _shape->setUserPointer(this);
/** for(int i = 0; i < copy._shape->getNumPoints(); i++)
* _shape->addPoint(copy._shape->getUnscaledPoints()[i], false);
*/
void BulletConvexHullShape::
operator = (const BulletConvexHullShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape; _shape->recalcLocalAabb();
} }
/** /**
@ -117,6 +113,9 @@ add_geom(const Geom *geom, const TransformState *ts) {
points.push_back(m.xform_point(reader.get_data3())); points.push_back(m.xform_point(reader.get_data3()));
} }
if (_shape)
delete _shape;
// Create shape // Create shape
_shape = new btConvexHullShape(NULL, 0); _shape = new btConvexHullShape(NULL, 0);
_shape->setUserPointer(this); _shape->setUserPointer(this);

View File

@ -30,7 +30,6 @@ class EXPCL_PANDABULLET BulletConvexHullShape : public BulletShape {
PUBLISHED: PUBLISHED:
BulletConvexHullShape(); BulletConvexHullShape();
BulletConvexHullShape(const BulletConvexHullShape &copy); BulletConvexHullShape(const BulletConvexHullShape &copy);
void operator = (const BulletConvexHullShape &copy);
INLINE ~BulletConvexHullShape(); INLINE ~BulletConvexHullShape();
void add_point(const LPoint3 &p); void add_point(const LPoint3 &p);

View File

@ -92,18 +92,13 @@ BulletConvexPointCloudShape(const BulletConvexPointCloudShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_scale = copy._scale; _scale = copy._scale;
_shape = copy._shape;
}
/** btVector3 *btPoints = copy._shape->getUnscaledPoints();
* int numPoints = copy._shape->getNumPoints();
*/ btVector3 btScale = LVecBase3_to_btVector3(_scale);
void BulletConvexPointCloudShape::
operator = (const BulletConvexPointCloudShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock());
_scale = copy._scale; _shape = new btConvexPointCloudShape(btPoints, numPoints, btScale);
_shape = copy._shape; _shape->setUserPointer(this);
} }
/** /**

View File

@ -34,7 +34,6 @@ PUBLISHED:
explicit BulletConvexPointCloudShape(const PTA_LVecBase3 &points, LVecBase3 scale=LVecBase3(1.)); explicit BulletConvexPointCloudShape(const PTA_LVecBase3 &points, LVecBase3 scale=LVecBase3(1.));
explicit BulletConvexPointCloudShape(const Geom *geom, LVecBase3 scale=LVecBase3(1.)); explicit BulletConvexPointCloudShape(const Geom *geom, LVecBase3 scale=LVecBase3(1.));
BulletConvexPointCloudShape(const BulletConvexPointCloudShape &copy); BulletConvexPointCloudShape(const BulletConvexPointCloudShape &copy);
void operator = (const BulletConvexPointCloudShape &copy);
INLINE ~BulletConvexPointCloudShape(); INLINE ~BulletConvexPointCloudShape();
int get_num_points() const; int get_num_points() const;

View File

@ -17,7 +17,8 @@
INLINE BulletCylinderShape:: INLINE BulletCylinderShape::
BulletCylinderShape() : BulletCylinderShape() :
_half_extents(LVector3::zero()), _half_extents(LVector3::zero()),
_shape(nullptr) { _shape(nullptr),
_up(X_up) {
} }
/** /**

View File

@ -20,7 +20,8 @@ TypeHandle BulletCylinderShape::_type_handle;
*/ */
BulletCylinderShape:: BulletCylinderShape::
BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up) : BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up) :
_half_extents(half_extents){ _half_extents(half_extents),
_up(up) {
btVector3 btHalfExtents = LVecBase3_to_btVector3(half_extents); btVector3 btHalfExtents = LVecBase3_to_btVector3(half_extents);
@ -47,7 +48,8 @@ BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up) :
* *
*/ */
BulletCylinderShape:: BulletCylinderShape::
BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) { BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) :
_up(up) {
switch (up) { switch (up) {
case X_up: case X_up:
@ -78,19 +80,28 @@ BulletCylinderShape::
BulletCylinderShape(const BulletCylinderShape &copy) { BulletCylinderShape(const BulletCylinderShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape; _up = copy._up;
_half_extents = copy._half_extents; _half_extents = copy._half_extents;
}
/** btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents);
*
*/
void BulletCylinderShape::
operator = (const BulletCylinderShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape; switch (_up) {
_half_extents = copy._half_extents; case X_up:
_shape = new btCylinderShapeX(btHalfExtents);
break;
case Y_up:
_shape = new btCylinderShape(btHalfExtents);
break;
case Z_up:
_shape = new btCylinderShapeZ(btHalfExtents);
break;
default:
bullet_cat.error() << "invalid up-axis:" << _up << endl;
break;
}
nassertv(_shape);
_shape->setUserPointer(this);
} }
/** /**
@ -185,11 +196,11 @@ fillin(DatagramIterator &scan, BamReader *manager) {
// parameters to serialize: radius, height, up // parameters to serialize: radius, height, up
_half_extents.read_datagram(scan); _half_extents.read_datagram(scan);
int up = (int) scan.get_int8(); _up = (BulletUpAxis) scan.get_int8();
btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents); btVector3 btHalfExtents = LVecBase3_to_btVector3(_half_extents);
switch (up) { switch (_up) {
case X_up: case X_up:
_shape = new btCylinderShapeX(btHalfExtents); _shape = new btCylinderShapeX(btHalfExtents);
break; break;
@ -200,7 +211,7 @@ fillin(DatagramIterator &scan, BamReader *manager) {
_shape = new btCylinderShapeZ(btHalfExtents); _shape = new btCylinderShapeZ(btHalfExtents);
break; break;
default: default:
bullet_cat.error() << "invalid up-axis:" << up << endl; bullet_cat.error() << "invalid up-axis:" << _up << endl;
break; break;
} }

View File

@ -32,7 +32,6 @@ PUBLISHED:
explicit BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up); explicit BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up);
explicit BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up=Z_up); explicit BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up=Z_up);
BulletCylinderShape(const BulletCylinderShape &copy); BulletCylinderShape(const BulletCylinderShape &copy);
void operator = (const BulletCylinderShape &copy);
INLINE ~BulletCylinderShape(); INLINE ~BulletCylinderShape();
PN_stdfloat get_radius() const; PN_stdfloat get_radius() const;
@ -49,6 +48,7 @@ public:
private: private:
LVector3 _half_extents; LVector3 _half_extents;
btCylinderShape *_shape; btCylinderShape *_shape;
BulletUpAxis _up;
public: public:
static void register_with_read_factory(); static void register_with_read_factory();

View File

@ -112,7 +112,6 @@ BulletHeightfieldShape::
BulletHeightfieldShape(const BulletHeightfieldShape &copy) { BulletHeightfieldShape(const BulletHeightfieldShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
_num_rows = copy._num_rows; _num_rows = copy._num_rows;
_num_cols = copy._num_cols; _num_cols = copy._num_cols;
_max_height = copy._max_height; _max_height = copy._max_height;
@ -121,24 +120,14 @@ BulletHeightfieldShape(const BulletHeightfieldShape &copy) {
size_t size = (size_t)_num_rows * (size_t)_num_cols; size_t size = (size_t)_num_rows * (size_t)_num_cols;
_data = new btScalar[size]; _data = new btScalar[size];
memcpy(_data, copy._data, size * sizeof(btScalar)); memcpy(_data, copy._data, size * sizeof(btScalar));
}
/** _shape = new btHeightfieldTerrainShape(_num_rows,
* _num_cols,
*/ _data,
void BulletHeightfieldShape:: _max_height,
operator = (const BulletHeightfieldShape &copy) { _up,
LightMutexHolder holder(BulletWorld::get_global_lock()); true, false);
_shape->setUserPointer(this);
_shape = copy._shape;
_num_rows = copy._num_rows;
_num_cols = copy._num_cols;
_max_height = copy._max_height;
_up = copy._up;
size_t size = (size_t)_num_rows * (size_t)_num_cols;
_data = new btScalar[size];
memcpy(_data, copy._data, size * sizeof(btScalar));
} }
/** /**

View File

@ -35,7 +35,6 @@ PUBLISHED:
explicit BulletHeightfieldShape(const PNMImage &image, PN_stdfloat max_height, BulletUpAxis up=Z_up); explicit BulletHeightfieldShape(const PNMImage &image, PN_stdfloat max_height, BulletUpAxis up=Z_up);
explicit BulletHeightfieldShape(Texture *tex, PN_stdfloat max_height, BulletUpAxis up=Z_up); explicit BulletHeightfieldShape(Texture *tex, PN_stdfloat max_height, BulletUpAxis up=Z_up);
BulletHeightfieldShape(const BulletHeightfieldShape &copy); BulletHeightfieldShape(const BulletHeightfieldShape &copy);
void operator = (const BulletHeightfieldShape &copy);
INLINE ~BulletHeightfieldShape(); INLINE ~BulletHeightfieldShape();
void set_use_diamond_subdivision(bool flag=true); void set_use_diamond_subdivision(bool flag=true);

View File

@ -40,21 +40,14 @@ BulletMinkowskiSumShape::
BulletMinkowskiSumShape(const BulletMinkowskiSumShape &copy) { BulletMinkowskiSumShape(const BulletMinkowskiSumShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
_shape_a = copy._shape_a; _shape_a = copy._shape_a;
_shape_b = copy._shape_b; _shape_b = copy._shape_b;
}
/** const btConvexShape *ptr_a = (const btConvexShape *)_shape_a->ptr();
* const btConvexShape *ptr_b = (const btConvexShape *)_shape_b->ptr();
*/
void BulletMinkowskiSumShape::
operator = (const BulletMinkowskiSumShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape; _shape = new btMinkowskiSumShape(ptr_a, ptr_b);
_shape_a = copy._shape_a; _shape->setUserPointer(this);
_shape_b = copy._shape_b;
} }
/** /**

View File

@ -33,7 +33,6 @@ private:
PUBLISHED: PUBLISHED:
explicit BulletMinkowskiSumShape(const BulletShape *shape_a, const BulletShape *shape_b); explicit BulletMinkowskiSumShape(const BulletShape *shape_a, const BulletShape *shape_b);
BulletMinkowskiSumShape(const BulletMinkowskiSumShape &copy); BulletMinkowskiSumShape(const BulletMinkowskiSumShape &copy);
void operator = (const BulletMinkowskiSumShape &copy);
INLINE ~BulletMinkowskiSumShape(); INLINE ~BulletMinkowskiSumShape();
void set_transform_a(const TransformState *ts); void set_transform_a(const TransformState *ts);

View File

@ -34,17 +34,11 @@ BulletPlaneShape::
BulletPlaneShape(const BulletPlaneShape &copy) { BulletPlaneShape(const BulletPlaneShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape; btVector3 btNormal = copy._shape->getPlaneNormal();
} PN_stdfloat constant = (PN_stdfloat)_shape->getPlaneConstant();
/** _shape = new btStaticPlaneShape(btNormal, constant);
* _shape->setUserPointer(this);
*/
void BulletPlaneShape::
operator = (const BulletPlaneShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
} }
/** /**

View File

@ -34,7 +34,6 @@ private:
PUBLISHED: PUBLISHED:
explicit BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant); explicit BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant);
BulletPlaneShape(const BulletPlaneShape &copy); BulletPlaneShape(const BulletPlaneShape &copy);
void operator = (const BulletPlaneShape &copy);
INLINE ~BulletPlaneShape(); INLINE ~BulletPlaneShape();
LVector3 get_plane_normal() const; LVector3 get_plane_normal() const;

View File

@ -32,19 +32,10 @@ BulletSphereShape::
BulletSphereShape(const BulletSphereShape &copy) { BulletSphereShape(const BulletSphereShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
_radius = copy._radius; _radius = copy._radius;
}
/** _shape = new btSphereShape(_radius);
* _shape->setUserPointer(this);
*/
void BulletSphereShape::
operator = (const BulletSphereShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock());
_shape = copy._shape;
_radius = copy._radius;
} }

View File

@ -33,7 +33,6 @@ private:
PUBLISHED: PUBLISHED:
explicit BulletSphereShape(PN_stdfloat radius); explicit BulletSphereShape(PN_stdfloat radius);
BulletSphereShape(const BulletSphereShape &copy); BulletSphereShape(const BulletSphereShape &copy);
void operator = (const BulletSphereShape &copy);
INLINE ~BulletSphereShape(); INLINE ~BulletSphereShape();
INLINE PN_stdfloat get_radius() const; INLINE PN_stdfloat get_radius() const;

View File

@ -86,21 +86,21 @@ BulletTriangleMeshShape::
BulletTriangleMeshShape(const BulletTriangleMeshShape &copy) { BulletTriangleMeshShape(const BulletTriangleMeshShape &copy) {
LightMutexHolder holder(BulletWorld::get_global_lock()); LightMutexHolder holder(BulletWorld::get_global_lock());
_bvh_shape = copy._bvh_shape; _dynamic = copy._dynamic;
_gimpact_shape = copy._gimpact_shape; _compress = copy._compress;
_bvh = copy._bvh;
_mesh = copy._mesh; _mesh = copy._mesh;
}
/** if (_dynamic) {
* _gimpact_shape = new btGImpactMeshShape(_mesh->ptr());
*/ _gimpact_shape->updateBound();
void BulletTriangleMeshShape:: _gimpact_shape->setUserPointer(this);
operator = (const BulletTriangleMeshShape &copy) { _bvh_shape = NULL;
LightMutexHolder holder(BulletWorld::get_global_lock()); } else {
_bvh_shape = new btBvhTriangleMeshShape(_mesh->ptr(), _compress, _bvh);
_bvh_shape = copy._bvh_shape; _bvh_shape->setUserPointer(this);
_gimpact_shape = copy._gimpact_shape; _gimpact_shape = NULL;
_mesh = copy._mesh; }
} }
/** /**

View File

@ -33,7 +33,6 @@ private:
PUBLISHED: PUBLISHED:
explicit BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress=true, bool bvh=true); explicit BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress=true, bool bvh=true);
BulletTriangleMeshShape(const BulletTriangleMeshShape &copy); BulletTriangleMeshShape(const BulletTriangleMeshShape &copy);
void operator = (const BulletTriangleMeshShape &copy);
INLINE ~BulletTriangleMeshShape(); INLINE ~BulletTriangleMeshShape();
void refit_tree(const LPoint3 &aabb_min, const LPoint3 &aabb_max); void refit_tree(const LPoint3 &aabb_min, const LPoint3 &aabb_max);