From d591561a883efa4beec2551c0a2edf9bb2ffd5ea Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 1 Jun 2016 09:53:07 -0700 Subject: [PATCH] remove RenderableModelEntityItem::_points use ShapeInfo::_points instead --- .../src/RenderableModelEntityItem.cpp | 21 ++++++++++--------- .../src/RenderableModelEntityItem.h | 1 - libraries/shared/src/ShapeInfo.h | 1 + 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 7b51283bac..151ac9cb8a 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -612,7 +612,8 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) { const FBXGeometry& renderGeometry = _model->getFBXGeometry(); const FBXGeometry& collisionGeometry = _model->getCollisionFBXGeometry(); - _points.clear(); + QVector>& points = info.getPoints(); + points.clear(); unsigned int i = 0; // 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 QVector newMeshPoints; - _points << newMeshPoints; + points << newMeshPoints; // 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. // also determine the extents of the collision model. AABox box; - for (int i = 0; i < _points.size(); i++) { - for (int j = 0; j < _points[i].size(); j++) { + for (int i = 0; i < points.size(); i++) { + for (int j = 0; j < points[i].size(); j++) { // compensate for registration - _points[i][j] += _model->getOffset(); + points[i][j] += _model->getOffset(); // 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 // the shape-key to change. - _points[i][j] -= _model->getOffset(); - box += _points[i][j]; + points[i][j] -= _model->getOffset(); + box += points[i][j]; } } glm::vec3 collisionModelDimensions = box.getDimensions(); info.setParams(type, collisionModelDimensions, _compoundShapeURL); - info.setConvexHulls(_points); + info.setConvexHulls(points); info.setOffset(_model->getOffset()); } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index d2de45f538..339c907532 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -103,7 +103,6 @@ private: QVariantMap _currentTextures; QVariantMap _originalTextures; bool _originalTexturesRead = false; - QVector> _points; bool _dimensionsInitialized = true; AnimationPropertyGroup _renderAnimationProperties; diff --git a/libraries/shared/src/ShapeInfo.h b/libraries/shared/src/ShapeInfo.h index 1632d22450..6d1edbc261 100644 --- a/libraries/shared/src/ShapeInfo.h +++ b/libraries/shared/src/ShapeInfo.h @@ -60,6 +60,7 @@ public: const glm::vec3& getHalfExtents() const { return _halfExtents; } const glm::vec3& getOffset() const { return _offset; } + QVector>& getPoints() { return _points; } const QVector>& getPoints() const { return _points; } uint32_t getNumSubShapes() const;