mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:06:41 +02:00
cleanup after code review
This commit is contained in:
parent
9fae1a7edd
commit
5a826d696a
3 changed files with 5 additions and 7 deletions
|
@ -218,7 +218,6 @@ void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& re
|
||||||
ShapeInfo shapeInfo;
|
ShapeInfo shapeInfo;
|
||||||
entity->computeShapeInfo(shapeInfo);
|
entity->computeShapeInfo(shapeInfo);
|
||||||
int numPoints = shapeInfo.getMaxNumPoints();
|
int numPoints = shapeInfo.getMaxNumPoints();
|
||||||
const int MAX_HULL_POINTS = 42;
|
|
||||||
if (numPoints > MAX_HULL_POINTS) {
|
if (numPoints > MAX_HULL_POINTS) {
|
||||||
glm::vec3 p = entity->getPosition();
|
glm::vec3 p = entity->getPosition();
|
||||||
qWarning().nospace() << "convex hull with " << numPoints
|
qWarning().nospace() << "convex hull with " << numPoints
|
||||||
|
|
|
@ -66,18 +66,16 @@ btConvexHullShape* ShapeFactory::createConvexHull(const QVector<glm::vec3>& poin
|
||||||
hull->addPoint(btVector3(correctedPoint[0], correctedPoint[1], correctedPoint[2]), false);
|
hull->addPoint(btVector3(correctedPoint[0], correctedPoint[1], correctedPoint[2]), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int MAX_HULL_POINTS = 42;
|
|
||||||
if (points.size() > MAX_HULL_POINTS) {
|
if (points.size() > MAX_HULL_POINTS) {
|
||||||
// create hull approximation
|
// create hull approximation
|
||||||
btShapeHull* shapeHull = new btShapeHull(hull);
|
btShapeHull shapeHull(hull);
|
||||||
shapeHull->buildHull(margin);
|
shapeHull.buildHull(margin);
|
||||||
btConvexHullShape* newHull = new btConvexHullShape();
|
btConvexHullShape* newHull = new btConvexHullShape();
|
||||||
const btVector3* newPoints = shapeHull->getVertexPointer();
|
const btVector3* newPoints = shapeHull.getVertexPointer();
|
||||||
for (int i = 0; i < shapeHull->numVertices(); ++i) {
|
for (int i = 0; i < shapeHull.numVertices(); ++i) {
|
||||||
newHull->addPoint(newPoints[i], false);
|
newHull->addPoint(newPoints[i], false);
|
||||||
}
|
}
|
||||||
delete hull;
|
delete hull;
|
||||||
delete shapeHull;
|
|
||||||
hull = newHull;
|
hull = newHull;
|
||||||
qDebug() << "reduced hull with" << points.size() << "points down to" << hull->getNumPoints(); // TODO: remove after testing
|
qDebug() << "reduced hull with" << points.size() << "points down to" << hull->getNumPoints(); // TODO: remove after testing
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "DoubleHashKey.h"
|
#include "DoubleHashKey.h"
|
||||||
|
|
||||||
const float MIN_SHAPE_OFFSET = 0.001f; // offsets less than 1mm will be ignored
|
const float MIN_SHAPE_OFFSET = 0.001f; // offsets less than 1mm will be ignored
|
||||||
|
const int MAX_HULL_POINTS = 42;
|
||||||
|
|
||||||
enum ShapeType {
|
enum ShapeType {
|
||||||
SHAPE_TYPE_NONE,
|
SHAPE_TYPE_NONE,
|
||||||
|
|
Loading…
Reference in a new issue