mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
Fixed bug in CTOR for BulletCylinderShape, and added copy constructor for all shapes.
This commit is contained in:
parent
6d630e2cf1
commit
3345f207b8
@ -24,3 +24,23 @@ INLINE BulletBoxShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletBoxShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletBoxShape::
|
||||
BulletBoxShape(const BulletBoxShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletBoxShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletBoxShape::
|
||||
operator = (const BulletBoxShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,8 @@ class EXPCL_PANDABULLET BulletBoxShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletBoxShape(const LVecBase3 &halfExtents);
|
||||
INLINE BulletBoxShape(const BulletBoxShape ©);
|
||||
INLINE void operator = (const BulletBoxShape ©);
|
||||
INLINE ~BulletBoxShape();
|
||||
|
||||
LVecBase3 get_half_extents_without_margin() const;
|
||||
|
@ -23,6 +23,26 @@ INLINE BulletCapsuleShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletCapsuleShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletCapsuleShape::
|
||||
BulletCapsuleShape(const BulletCapsuleShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletCapsuleShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletCapsuleShape::
|
||||
operator = (const BulletCapsuleShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletCapsuleShape::get_radius
|
||||
// Access: Published
|
||||
|
@ -29,6 +29,8 @@ class EXPCL_PANDABULLET BulletCapsuleShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up);
|
||||
INLINE BulletCapsuleShape(const BulletCapsuleShape ©);
|
||||
INLINE void operator = (const BulletCapsuleShape ©);
|
||||
INLINE ~BulletCapsuleShape();
|
||||
|
||||
INLINE PN_stdfloat get_radius() const;
|
||||
|
@ -23,6 +23,26 @@ INLINE BulletConeShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletConeShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletConeShape::
|
||||
BulletConeShape(const BulletConeShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletConeShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletConeShape::
|
||||
operator = (const BulletConeShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletConeShape::get_radius
|
||||
// Access: Published
|
||||
|
@ -29,6 +29,8 @@ class EXPCL_PANDABULLET BulletConeShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletConeShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up);
|
||||
INLINE BulletConeShape(const BulletConeShape ©);
|
||||
INLINE void operator = (const BulletConeShape ©);
|
||||
INLINE ~BulletConeShape();
|
||||
|
||||
INLINE PN_stdfloat get_radius() const;
|
||||
|
@ -23,3 +23,23 @@ INLINE BulletConvexHullShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletConvexHullShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletConvexHullShape::
|
||||
BulletConvexHullShape(const BulletConvexHullShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletConvexHullShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletConvexHullShape::
|
||||
operator = (const BulletConvexHullShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,8 @@ class EXPCL_PANDABULLET BulletConvexHullShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletConvexHullShape();
|
||||
INLINE BulletConvexHullShape(const BulletConvexHullShape ©);
|
||||
INLINE void operator = (const BulletConvexHullShape ©);
|
||||
INLINE ~BulletConvexHullShape();
|
||||
|
||||
void add_point(const LPoint3 &p);
|
||||
|
@ -23,6 +23,26 @@ INLINE BulletConvexPointCloudShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletConvexPointCloudShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletConvexPointCloudShape::
|
||||
BulletConvexPointCloudShape(const BulletConvexPointCloudShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletConvexPointCloudShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletConvexPointCloudShape::
|
||||
operator = (const BulletConvexPointCloudShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletConvexPointCloudShape::get_num_points
|
||||
// Access: Published
|
||||
|
@ -32,6 +32,8 @@ class EXPCL_PANDABULLET BulletConvexPointCloudShape : public BulletShape {
|
||||
PUBLISHED:
|
||||
BulletConvexPointCloudShape(const PTA_LVecBase3 &points, LVecBase3 scale=LVecBase3(1.));
|
||||
BulletConvexPointCloudShape(const Geom *geom, LVecBase3 scale=LVecBase3(1.));
|
||||
INLINE BulletConvexPointCloudShape(const BulletConvexPointCloudShape ©);
|
||||
INLINE void operator = (const BulletConvexPointCloudShape ©);
|
||||
INLINE ~BulletConvexPointCloudShape();
|
||||
|
||||
INLINE int get_num_points() const;
|
||||
|
@ -23,6 +23,26 @@ INLINE BulletCylinderShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletCylinderShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletCylinderShape::
|
||||
BulletCylinderShape(const BulletCylinderShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletCylinderShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletCylinderShape::
|
||||
operator = (const BulletCylinderShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletCylinderShape::get_radius
|
||||
// Access: Published
|
||||
|
@ -54,13 +54,13 @@ BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) {
|
||||
|
||||
switch (up) {
|
||||
case X_up:
|
||||
_shape = new btCylinderShapeX(btVector3(0.5 * height, radius, 0.0f));
|
||||
_shape = new btCylinderShapeX(btVector3(0.5 * height, radius, radius));
|
||||
break;
|
||||
case Y_up:
|
||||
_shape = new btCylinderShape(btVector3(radius, 0.5 * height, 0.0f));
|
||||
_shape = new btCylinderShape(btVector3(radius, 0.5 * height, radius));
|
||||
break;
|
||||
case Z_up:
|
||||
_shape = new btCylinderShapeZ(btVector3(radius, 0.0f, 0.5 * height));
|
||||
_shape = new btCylinderShapeZ(btVector3(radius, radius, 0.5 * height));
|
||||
break;
|
||||
default:
|
||||
bullet_cat.error() << "invalid up-axis:" << up << endl;
|
||||
|
@ -28,8 +28,10 @@
|
||||
class EXPCL_PANDABULLET BulletCylinderShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up=Z_up);
|
||||
BulletCylinderShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up);
|
||||
BulletCylinderShape(const LVector3 &half_extents, BulletUpAxis up=Z_up);
|
||||
INLINE BulletCylinderShape(const BulletCylinderShape ©);
|
||||
INLINE void operator = (const BulletCylinderShape ©);
|
||||
INLINE ~BulletCylinderShape();
|
||||
|
||||
INLINE PN_stdfloat get_radius() const;
|
||||
|
@ -24,3 +24,34 @@ INLINE BulletHeightfieldShape::
|
||||
delete _data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletHeightfieldShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletHeightfieldShape::
|
||||
BulletHeightfieldShape(const BulletHeightfieldShape ©) :
|
||||
_shape(copy._shape),
|
||||
_num_rows(copy._num_rows),
|
||||
_num_cols(copy._num_cols) {
|
||||
|
||||
_data = new float[_num_rows * _num_cols];
|
||||
memcpy(_data, copy._data, _num_rows * _num_cols * sizeof(float));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletHeightfieldShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletHeightfieldShape::
|
||||
operator = (const BulletHeightfieldShape ©) {
|
||||
|
||||
_shape = copy._shape;
|
||||
_num_rows = copy._num_rows;
|
||||
_num_cols = copy._num_cols;
|
||||
|
||||
_data = new float[_num_rows * _num_cols];
|
||||
memcpy(_data, copy._data, _num_rows * _num_cols * sizeof(float));
|
||||
}
|
||||
|
||||
|
@ -24,19 +24,20 @@ TypeHandle BulletHeightfieldShape::_type_handle;
|
||||
BulletHeightfieldShape::
|
||||
BulletHeightfieldShape(const PNMImage &image, PN_stdfloat max_height, BulletUpAxis up) {
|
||||
|
||||
int num_rows = image.get_x_size();
|
||||
int num_columns = image.get_y_size();
|
||||
_num_rows = image.get_x_size();
|
||||
_num_cols = image.get_y_size();
|
||||
|
||||
_data = new float[num_rows * num_columns];
|
||||
_data = new float[_num_rows * _num_cols];
|
||||
|
||||
for (int row=0; row < num_rows; row++) {
|
||||
for (int column=0; column < num_columns; column++) {
|
||||
_data[num_columns * row + column] =
|
||||
max_height * image.get_bright(column, num_columns - row - 1);
|
||||
for (int row=0; row < _num_rows; row++) {
|
||||
for (int column=0; column < _num_cols; column++) {
|
||||
_data[_num_cols * row + column] =
|
||||
max_height * image.get_bright(column, _num_cols - row - 1);
|
||||
}
|
||||
}
|
||||
|
||||
_shape = new btHeightfieldTerrainShape(num_rows, num_columns,
|
||||
_shape = new btHeightfieldTerrainShape(_num_rows,
|
||||
_num_cols,
|
||||
_data,
|
||||
max_height,
|
||||
up,
|
||||
|
@ -31,6 +31,8 @@ class EXPCL_PANDABULLET BulletHeightfieldShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletHeightfieldShape(const PNMImage &image, PN_stdfloat max_height, BulletUpAxis up=Z_up);
|
||||
INLINE BulletHeightfieldShape(const BulletHeightfieldShape ©);
|
||||
INLINE void operator = (const BulletHeightfieldShape ©);
|
||||
INLINE ~BulletHeightfieldShape();
|
||||
|
||||
void set_use_diamond_subdivision(bool flag=true);
|
||||
@ -39,6 +41,8 @@ public:
|
||||
virtual btCollisionShape *ptr() const;
|
||||
|
||||
private:
|
||||
int _num_rows;
|
||||
int _num_cols;
|
||||
float *_data;
|
||||
btHeightfieldTerrainShape *_shape;
|
||||
|
||||
|
@ -23,6 +23,26 @@ INLINE BulletMultiSphereShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMultiSphereShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletMultiSphereShape::
|
||||
BulletMultiSphereShape(const BulletMultiSphereShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMultiSphereShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletMultiSphereShape::
|
||||
operator = (const BulletMultiSphereShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMultiSphereShape::get_sphere_count
|
||||
// Access: Published
|
||||
|
@ -31,6 +31,8 @@ class EXPCL_PANDABULLET BulletMultiSphereShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletMultiSphereShape(const PTA_LVecBase3 &points, const PTA_stdfloat &radii);
|
||||
INLINE BulletMultiSphereShape(const BulletMultiSphereShape ©);
|
||||
INLINE void operator = (const BulletMultiSphereShape ©);
|
||||
INLINE ~BulletMultiSphereShape();
|
||||
|
||||
INLINE int get_sphere_count() const;
|
||||
|
@ -23,6 +23,26 @@ INLINE BulletPlaneShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletPlaneShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletPlaneShape::
|
||||
BulletPlaneShape(const BulletPlaneShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletPlaneShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletPlaneShape::
|
||||
operator = (const BulletPlaneShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletPlaneShape::get_plane_constant
|
||||
// Access: Published
|
||||
|
@ -32,6 +32,8 @@ class EXPCL_PANDABULLET BulletPlaneShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant);
|
||||
INLINE BulletPlaneShape(const BulletPlaneShape ©);
|
||||
INLINE void operator = (const BulletPlaneShape ©);
|
||||
INLINE ~BulletPlaneShape();
|
||||
|
||||
INLINE LVector3 get_plane_normal() const;
|
||||
|
@ -23,6 +23,26 @@ INLINE BulletSphereShape::
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletSphereShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletSphereShape::
|
||||
BulletSphereShape(const BulletSphereShape ©) :
|
||||
_shape(copy._shape) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletSphereShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletSphereShape::
|
||||
operator = (const BulletSphereShape ©) {
|
||||
_shape = copy._shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletSphereShape::get_radius
|
||||
// Access: Published
|
||||
|
@ -31,6 +31,8 @@ class EXPCL_PANDABULLET BulletSphereShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletSphereShape(PN_stdfloat radius);
|
||||
INLINE BulletSphereShape(const BulletSphereShape ©);
|
||||
INLINE void operator = (const BulletSphereShape ©);
|
||||
INLINE ~BulletSphereShape();
|
||||
|
||||
INLINE PN_stdfloat get_radius() const;
|
||||
|
@ -12,6 +12,31 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletTriangleMeshShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletTriangleMeshShape::
|
||||
BulletTriangleMeshShape(const BulletTriangleMeshShape ©) :
|
||||
_bvh_shape(copy._bvh_shape),
|
||||
_gimpact_shape(copy._gimpact_shape),
|
||||
_mesh(copy._mesh) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletTriangleMeshShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletTriangleMeshShape::
|
||||
operator = (const BulletTriangleMeshShape ©) {
|
||||
|
||||
_bvh_shape = copy._bvh_shape;
|
||||
_gimpact_shape = copy._gimpact_shape;
|
||||
_mesh = copy._mesh;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletTriangleMeshShape::Destructor
|
||||
// Access: Published
|
||||
|
@ -32,6 +32,8 @@ class EXPCL_PANDABULLET BulletTriangleMeshShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress=true, bool bvh=true);
|
||||
INLINE BulletTriangleMeshShape(const BulletTriangleMeshShape ©);
|
||||
INLINE void operator = (const BulletTriangleMeshShape ©);
|
||||
INLINE ~BulletTriangleMeshShape();
|
||||
|
||||
void refit_tree(const LPoint3 &aabb_min, const LPoint3 &aabb_max);
|
||||
|
Loading…
x
Reference in New Issue
Block a user