Fixing trimesh precision

This commit is contained in:
Andrea Catania
2018-08-31 09:40:50 +02:00
parent 9b446f1cc3
commit 88967e4001
8 changed files with 23 additions and 4 deletions

View File

@@ -36,6 +36,7 @@
#include "bullet_utilities.h"
#include "shape_owner_bullet.h"
#include <BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
#include <BulletCollision/CollisionShapes/btConvexPointCloudShape.h>
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
#include <btBulletCollisionCommon.h>
@@ -358,7 +359,8 @@ ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() :
ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() {
if (meshShape) {
delete meshShape->getMeshInterface();
delete meshShape;
delete meshShape->getTriangleInfoMap();
bulletdelete(meshShape);
}
faces = PoolVector<Vector3>();
}
@@ -380,6 +382,7 @@ void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) {
if (meshShape) {
/// Clear previous created shape
delete meshShape->getMeshInterface();
delete meshShape->getTriangleInfoMap();
bulletdelete(meshShape);
}
int src_face_count = faces.size();
@@ -407,6 +410,8 @@ void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) {
const bool useQuantizedAabbCompression = true;
meshShape = bulletnew(btBvhTriangleMeshShape(shapeInterface, useQuantizedAabbCompression));
btTriangleInfoMap *triangleInfoMap = new btTriangleInfoMap();
btGenerateInternalEdgeInfo(meshShape, triangleInfoMap);
} else {
meshShape = NULL;
ERR_PRINT("The faces count are 0, the mesh shape cannot be created");