remove RenderableModelEntityItem::_points

use ShapeInfo::_points instead
This commit is contained in:
Andrew Meadows 2016-06-01 09:53:07 -07:00
parent c85923c69b
commit d591561a88
3 changed files with 12 additions and 11 deletions

View file

@ -612,7 +612,8 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
const FBXGeometry& renderGeometry = _model->getFBXGeometry(); const FBXGeometry& renderGeometry = _model->getFBXGeometry();
const FBXGeometry& collisionGeometry = _model->getCollisionFBXGeometry(); const FBXGeometry& collisionGeometry = _model->getCollisionFBXGeometry();
_points.clear(); QVector<QVector<glm::vec3>>& points = info.getPoints();
points.clear();
unsigned int i = 0; unsigned int i = 0;
// the way OBJ files get read, each section under a "g" line is its own meshPart. We only expect // the way OBJ files get read, each section under a "g" line is its own meshPart. We only expect
@ -675,9 +676,9 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
// add next convex hull // add next convex hull
QVector<glm::vec3> newMeshPoints; QVector<glm::vec3> newMeshPoints;
_points << newMeshPoints; points << newMeshPoints;
// add points to the new convex hull // add points to the new convex hull
_points[i++] << pointsInPart; points[i++] << pointsInPart;
} }
} }
@ -691,22 +692,22 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
// multiply each point by scale before handing the point-set off to the physics engine. // multiply each point by scale before handing the point-set off to the physics engine.
// also determine the extents of the collision model. // also determine the extents of the collision model.
AABox box; AABox box;
for (int i = 0; i < _points.size(); i++) { for (int i = 0; i < points.size(); i++) {
for (int j = 0; j < _points[i].size(); j++) { for (int j = 0; j < points[i].size(); j++) {
// compensate for registration // compensate for registration
_points[i][j] += _model->getOffset(); points[i][j] += _model->getOffset();
// scale so the collision points match the model points // scale so the collision points match the model points
_points[i][j] *= scale; points[i][j] *= scale;
// this next subtraction is done so we can give info the offset, which will cause // this next subtraction is done so we can give info the offset, which will cause
// the shape-key to change. // the shape-key to change.
_points[i][j] -= _model->getOffset(); points[i][j] -= _model->getOffset();
box += _points[i][j]; box += points[i][j];
} }
} }
glm::vec3 collisionModelDimensions = box.getDimensions(); glm::vec3 collisionModelDimensions = box.getDimensions();
info.setParams(type, collisionModelDimensions, _compoundShapeURL); info.setParams(type, collisionModelDimensions, _compoundShapeURL);
info.setConvexHulls(_points); info.setConvexHulls(points);
info.setOffset(_model->getOffset()); info.setOffset(_model->getOffset());
} }
} }

View file

@ -103,7 +103,6 @@ private:
QVariantMap _currentTextures; QVariantMap _currentTextures;
QVariantMap _originalTextures; QVariantMap _originalTextures;
bool _originalTexturesRead = false; bool _originalTexturesRead = false;
QVector<QVector<glm::vec3>> _points;
bool _dimensionsInitialized = true; bool _dimensionsInitialized = true;
AnimationPropertyGroup _renderAnimationProperties; AnimationPropertyGroup _renderAnimationProperties;

View file

@ -60,6 +60,7 @@ public:
const glm::vec3& getHalfExtents() const { return _halfExtents; } const glm::vec3& getHalfExtents() const { return _halfExtents; }
const glm::vec3& getOffset() const { return _offset; } const glm::vec3& getOffset() const { return _offset; }
QVector<QVector<glm::vec3>>& getPoints() { return _points; }
const QVector<QVector<glm::vec3>>& getPoints() const { return _points; } const QVector<QVector<glm::vec3>>& getPoints() const { return _points; }
uint32_t getNumSubShapes() const; uint32_t getNumSubShapes() const;