mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:24:07 +02:00
cleanups
This commit is contained in:
parent
5241dc5394
commit
59804a0f54
2 changed files with 2 additions and 24 deletions
|
@ -704,10 +704,6 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
|
|||
AABox box;
|
||||
for (int i = 0; i < _points.size(); i++) {
|
||||
for (int j = 0; j < _points[i].size(); j++) {
|
||||
// compensate for registraion
|
||||
_points[i][j] += _model->getOffset();
|
||||
// _points[i][j] += info.getOffset();
|
||||
// scale so the collision points match the model points
|
||||
_points[i][j] *= scale;
|
||||
box += _points[i][j];
|
||||
}
|
||||
|
@ -719,13 +715,9 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
|
|||
QString::number(_registrationPoint.y) + "," +
|
||||
QString::number(_registrationPoint.z);
|
||||
|
||||
qDebug() << "NEW SHAPE FOR" << getName() << shapeKey;
|
||||
qDebug() << " model-offset:" << _model->getOffset();
|
||||
|
||||
info.setParams(type, collisionModelDimensions, shapeKey);
|
||||
info.setConvexHulls(_points);
|
||||
adjustShapeInfoByRegistration(info);
|
||||
qDebug() << " info-offset:" << info.getOffset();
|
||||
info.setOffset(_model->getOffset());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
#include "ShapeFactory.h"
|
||||
#include "BulletUtil.h"
|
||||
#include "StreamUtils.h"
|
||||
|
||||
|
||||
btConvexHullShape* ShapeFactory::createConvexHull(const QVector<glm::vec3>& points) {
|
||||
assert(points.size() > 0);
|
||||
|
@ -65,11 +63,6 @@ btConvexHullShape* ShapeFactory::createConvexHull(const QVector<glm::vec3>& poin
|
|||
hull->addPoint(btVector3(correctedPoint[0], correctedPoint[1], correctedPoint[2]), false);
|
||||
}
|
||||
hull->recalcLocalAabb();
|
||||
|
||||
qDebug() << "------- NEW COMPOUND SHAPE ------";
|
||||
qDebug() << " low = " << minCorner;
|
||||
qDebug() << " high = " << maxCorner;
|
||||
|
||||
return hull;
|
||||
}
|
||||
|
||||
|
@ -97,13 +90,11 @@ btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info) {
|
|||
const QVector<QVector<glm::vec3>>& points = info.getPoints();
|
||||
uint32_t numSubShapes = info.getNumSubShapes();
|
||||
if (numSubShapes == 1) {
|
||||
// XXX offset?
|
||||
shape = createConvexHull(info.getPoints()[0]);
|
||||
} else {
|
||||
auto compound = new btCompoundShape();
|
||||
btTransform trans;
|
||||
trans.setIdentity();
|
||||
// trans.setOrigin(-glmToBullet(info.getOffset()));
|
||||
foreach (QVector<glm::vec3> hullPoints, points) {
|
||||
btConvexHullShape* hull = createConvexHull(hullPoints);
|
||||
compound->addChildShape (trans, hull);
|
||||
|
@ -113,7 +104,7 @@ btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
if (shape && type != SHAPE_TYPE_COMPOUND) {
|
||||
if (shape) {
|
||||
if (glm::length2(info.getOffset()) > MIN_SHAPE_OFFSET * MIN_SHAPE_OFFSET) {
|
||||
// this shape has an offset, which we support by wrapping the true shape
|
||||
// in a btCompoundShape with a local transform
|
||||
|
@ -126,10 +117,5 @@ btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info) {
|
|||
}
|
||||
}
|
||||
|
||||
if (type == SHAPE_TYPE_COMPOUND) {
|
||||
qDebug() << " offset = " << info.getOffset();
|
||||
}
|
||||
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue