mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
Adding minkowski sum shape.
This commit is contained in:
parent
e3301b8896
commit
a343eef6b1
@ -51,6 +51,7 @@ class btManifoldArray;
|
||||
class btManifoldPoint;
|
||||
class btMatrix3x3;
|
||||
class btMotionState;
|
||||
class btMinkowskiSumShape;
|
||||
class btMultiSphereShape;
|
||||
class btOverlapFilterCallback;
|
||||
class btPairCachingGhostObject;
|
||||
|
@ -35,6 +35,7 @@
|
||||
bulletHelper.h bulletHelper.I \
|
||||
bulletHingeConstraint.h bulletHingeConstraint.I \
|
||||
bulletManifoldPoint.h bulletManifoldPoint.I \
|
||||
bulletMinkowskiSumShape.h bulletMinkowskiSumShape.I \
|
||||
bulletMultiSphereShape.h bulletMultiSphereShape.I \
|
||||
bulletPersistentManifold.h bulletPersistentManifold.I \
|
||||
bulletPlaneShape.h bulletPlaneShape.I \
|
||||
@ -84,6 +85,7 @@
|
||||
bulletHelper.cxx \
|
||||
bulletHingeConstraint.cxx \
|
||||
bulletManifoldPoint.cxx \
|
||||
bulletMinkowskiSumShape.cxx \
|
||||
bulletMultiSphereShape.cxx \
|
||||
bulletPersistentManifold.cxx \
|
||||
bulletPlaneShape.cxx \
|
||||
@ -133,6 +135,7 @@
|
||||
bulletHelper.h bulletHelper.I \
|
||||
bulletHingeConstraint.h bulletHingeConstraint.I \
|
||||
bulletManifoldPoint.h bulletManifoldPoint.I \
|
||||
bulletMinkowskiSumShape.h bulletMinkowskiSumShape.I \
|
||||
bulletMultiSphereShape.h bulletMultiSphereShape.I \
|
||||
bulletPersistentManifold.h bulletPersistentManifold.I \
|
||||
bulletPlaneShape.h bulletPlaneShape.I \
|
||||
|
128
panda/src/bullet/bulletMinkowskiSumShape.I
Normal file
128
panda/src/bullet/bulletMinkowskiSumShape.I
Normal file
@ -0,0 +1,128 @@
|
||||
// Filename: bulletMinkowskiSumShape.I
|
||||
// Created by: enn0x (23Jan10)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::Destructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletMinkowskiSumShape::
|
||||
~BulletMinkowskiSumShape() {
|
||||
|
||||
delete _shape;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::Copy Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BulletMinkowskiSumShape::
|
||||
BulletMinkowskiSumShape(const BulletMinkowskiSumShape ©) :
|
||||
_shape(copy._shape),
|
||||
_shape_a(copy._shape_a),
|
||||
_shape_b(copy._shape_b) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::Copy Assignment Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletMinkowskiSumShape::
|
||||
operator = (const BulletMinkowskiSumShape ©) {
|
||||
_shape = copy._shape;
|
||||
_shape_a = copy._shape_a;
|
||||
_shape_b = copy._shape_b;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::set_transform_a
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletMinkowskiSumShape::
|
||||
set_transform_a(const TransformState *ts) {
|
||||
|
||||
nassertv(ts);
|
||||
_shape->setTransformA(TransformState_to_btTrans(ts));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::set_transform_b
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BulletMinkowskiSumShape::
|
||||
set_transform_b(const TransformState *ts) {
|
||||
|
||||
nassertv(ts);
|
||||
_shape->setTransformB(TransformState_to_btTrans(ts));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::get_transform_a
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE CPT(TransformState) BulletMinkowskiSumShape::
|
||||
get_transform_a() const {
|
||||
|
||||
return btTrans_to_TransformState(_shape->getTransformA());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::get_transform_b
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE CPT(TransformState) BulletMinkowskiSumShape::
|
||||
get_transform_b() const {
|
||||
|
||||
return btTrans_to_TransformState(_shape->GetTransformB());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::get_shape_a
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const BulletShape *BulletMinkowskiSumShape::
|
||||
get_shape_a() const {
|
||||
|
||||
return _shape_a;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::get_shape_b
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const BulletShape *BulletMinkowskiSumShape::
|
||||
get_shape_b() const {
|
||||
|
||||
return _shape_b;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::get_margin
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PN_stdfloat BulletMinkowskiSumShape::
|
||||
get_margin() const {
|
||||
|
||||
return (PN_stdfloat)_shape->getMargin();
|
||||
}
|
||||
|
50
panda/src/bullet/bulletMinkowskiSumShape.cxx
Normal file
50
panda/src/bullet/bulletMinkowskiSumShape.cxx
Normal file
@ -0,0 +1,50 @@
|
||||
// Filename: bulletMinkowskiSumShape.cxx
|
||||
// Created by: enn0x (15Aug13)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "bulletMinkowskiSumShape.h"
|
||||
|
||||
TypeHandle BulletMinkowskiSumShape::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
BulletMinkowskiSumShape::
|
||||
BulletMinkowskiSumShape(const BulletShape *shape_a, const BulletShape *shape_b) {
|
||||
|
||||
nassertv(shape_a->is_convex());
|
||||
nassertv(shape_b->is_convex());
|
||||
|
||||
const btConvexShape *ptr_a = (const btConvexShape *)shape_a->ptr();
|
||||
const btConvexShape *ptr_b = (const btConvexShape *)shape_b->ptr();
|
||||
|
||||
_shape = new btMinkowskiSumShape(ptr_a, ptr_b);
|
||||
_shape->setUserPointer(this);
|
||||
|
||||
_shape_a = shape_a;
|
||||
_shape_b = shape_b;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletMinkowskiSumShape::ptr
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
btCollisionShape *BulletMinkowskiSumShape::
|
||||
ptr() const {
|
||||
|
||||
return _shape;
|
||||
}
|
||||
|
81
panda/src/bullet/bulletMinkowskiSumShape.h
Normal file
81
panda/src/bullet/bulletMinkowskiSumShape.h
Normal file
@ -0,0 +1,81 @@
|
||||
// Filename: bulletMinkowskiSumShape.h
|
||||
// Created by: enn0x (15Aug13)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __BULLET_MINKOWSKI_SUM_SHAPE_H__
|
||||
#define __BULLET_MINKOWSKI_SUM_SHAPE_H__
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "bullet_includes.h"
|
||||
#include "bullet_utils.h"
|
||||
#include "bulletShape.h"
|
||||
|
||||
#include "transformState.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : BulletMinkowskiSumShape
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDABULLET BulletMinkowskiSumShape : public BulletShape {
|
||||
|
||||
PUBLISHED:
|
||||
BulletMinkowskiSumShape(const BulletShape *shape_a, const BulletShape *shape_b);
|
||||
INLINE BulletMinkowskiSumShape(const BulletMinkowskiSumShape ©);
|
||||
INLINE void operator = (const BulletMinkowskiSumShape ©);
|
||||
INLINE ~BulletMinkowskiSumShape();
|
||||
|
||||
INLINE void set_transform_a(const TransformState *ts);
|
||||
INLINE void set_transform_b(const TransformState *ts);
|
||||
INLINE CPT(TransformState) get_transform_a() const;
|
||||
INLINE CPT(TransformState) get_transform_b() const;
|
||||
|
||||
INLINE const BulletShape *get_shape_a() const;
|
||||
INLINE const BulletShape *get_shape_b() const;
|
||||
|
||||
INLINE PN_stdfloat get_margin() const;
|
||||
|
||||
public:
|
||||
virtual btCollisionShape *ptr() const;
|
||||
|
||||
private:
|
||||
btMinkowskiSumShape *_shape;
|
||||
|
||||
CPT(BulletShape) _shape_a;
|
||||
CPT(BulletShape) _shape_b;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
BulletShape::init_type();
|
||||
register_type(_type_handle, "BulletMinkowskiSumShape",
|
||||
BulletShape::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {
|
||||
init_type();
|
||||
return get_class_type();
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "bulletMinkowskiSumShape.I"
|
||||
|
||||
#endif // __BULLET_MINKOWSKI_SUM_SHAPE_H__
|
@ -25,6 +25,7 @@
|
||||
#include "BulletCollision/CollisionDispatch/btManifoldResult.h"
|
||||
#include "BulletCollision/CollisionShapes/btConvexPointCloudShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h"
|
||||
#include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
|
||||
#include "BulletCollision/Gimpact/btGImpactShape.h"
|
||||
#include "BulletDynamics/Character/btKinematicCharacterController.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "bulletConvexHullShape.h"
|
||||
#include "bulletConvexPointCloudShape.h"
|
||||
#include "bulletCylinderShape.h"
|
||||
#include "bulletMinkowskiSumShape.h"
|
||||
#include "bulletDebugNode.h"
|
||||
#include "bulletFilterCallbackData.h"
|
||||
#include "bulletGenericConstraint.h"
|
||||
@ -159,6 +160,7 @@ init_libbullet() {
|
||||
BulletConvexHullShape::init_type();
|
||||
BulletConvexPointCloudShape::init_type();
|
||||
BulletCylinderShape::init_type();
|
||||
BulletMinkowskiSumShape::init_type();
|
||||
BulletDebugNode::init_type();
|
||||
BulletFilterCallbackData::init_type();
|
||||
BulletGenericConstraint::init_type();
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "bulletHeightfieldShape.cxx"
|
||||
#include "bulletHingeConstraint.cxx"
|
||||
#include "bulletManifoldPoint.cxx"
|
||||
#include "bulletMinkowskiSumShape.cxx"
|
||||
#include "bulletMultiSphereShape.cxx"
|
||||
#include "bulletPersistentManifold.cxx"
|
||||
#include "bulletPlaneShape.cxx"
|
||||
|
Loading…
x
Reference in New Issue
Block a user