cleanup after code review

This commit is contained in:
Andrew Meadows 2016-05-19 09:14:48 -07:00
parent 9fae1a7edd
commit 5a826d696a
3 changed files with 5 additions and 7 deletions

View file

@ -218,7 +218,6 @@ void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& re
ShapeInfo shapeInfo;
entity->computeShapeInfo(shapeInfo);
int numPoints = shapeInfo.getMaxNumPoints();
const int MAX_HULL_POINTS = 42;
if (numPoints > MAX_HULL_POINTS) {
glm::vec3 p = entity->getPosition();
qWarning().nospace() << "convex hull with " << numPoints

View file

@ -66,18 +66,16 @@ btConvexHullShape* ShapeFactory::createConvexHull(const QVector<glm::vec3>& poin
hull->addPoint(btVector3(correctedPoint[0], correctedPoint[1], correctedPoint[2]), false);
}
const int MAX_HULL_POINTS = 42;
if (points.size() > MAX_HULL_POINTS) {
// create hull approximation
btShapeHull* shapeHull = new btShapeHull(hull);
shapeHull->buildHull(margin);
btShapeHull shapeHull(hull);
shapeHull.buildHull(margin);
btConvexHullShape* newHull = new btConvexHullShape();
const btVector3* newPoints = shapeHull->getVertexPointer();
for (int i = 0; i < shapeHull->numVertices(); ++i) {
const btVector3* newPoints = shapeHull.getVertexPointer();
for (int i = 0; i < shapeHull.numVertices(); ++i) {
newHull->addPoint(newPoints[i], false);
}
delete hull;
delete shapeHull;
hull = newHull;
qDebug() << "reduced hull with" << points.size() << "points down to" << hull->getNumPoints(); // TODO: remove after testing
}

View file

@ -21,6 +21,7 @@
#include "DoubleHashKey.h"
const float MIN_SHAPE_OFFSET = 0.001f; // offsets less than 1mm will be ignored
const int MAX_HULL_POINTS = 42;
enum ShapeType {
SHAPE_TYPE_NONE,