15 #include "bulletTriangleMeshShape.h"
16 #include "bulletTriangleMesh.h"
18 #include "nodePathCollection.h"
20 #include "geomVertexReader.h"
22 TypeHandle BulletTriangleMeshShape::_type_handle;
35 bullet_cat.warning() <<
"mesh is NULL! creating new mesh." << endl;
40 if (mesh->get_num_triangles() == 0) {
41 bullet_cat.warning() <<
"mesh has zero triangles! adding degenerated triangle." << endl;
51 _gimpact_shape =
new btGImpactMeshShape(mesh->ptr());
52 _gimpact_shape->updateBound();
53 _gimpact_shape->setUserPointer(
this);
61 _bvh_shape =
new btBvhTriangleMeshShape(mesh->ptr(), compress, bvh);
62 _bvh_shape->setUserPointer(
this);
64 _gimpact_shape = NULL;
73 btCollisionShape *BulletTriangleMeshShape::
81 return _gimpact_shape;
92 void BulletTriangleMeshShape::
95 nassertv(!aabb_max.
is_nan());
96 nassertv(!aabb_max.
is_nan());
98 nassertv(this->is_static());
100 _bvh_shape->refitTree(LVecBase3_to_btVector3(aabb_min),
101 LVecBase3_to_btVector3(aabb_max));
static const LPoint3f & zero()
Returns a zero-length point.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
TypeHandle is the identifier used to differentiate C++ class types.
BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress=true, bool bvh=true)
The parameters 'compress' and 'bvh' are only used if 'dynamic' is set to FALSE.