From 8db1f296de32572f5875610e6caa8c949f805c00 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Wed, 11 May 2016 15:17:59 -0700 Subject: [PATCH] Check vector access in fbx reader --- libraries/fbx/src/FBXReader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 2df388e1d4..9485660745 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -1331,7 +1331,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS } // NOTE: shapeVertices are in joint-frame - QVector shapeVertices; + std::vector shapeVertices; shapeVertices.resize(geometry.joints.size()); // find our special joints @@ -1522,7 +1522,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS float clusterScale = extractUniformScale(fbxCluster.inverseBindMatrix); glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform; - ShapeVertices& points = shapeVertices[jointIndex]; + ShapeVertices& points = shapeVertices.at(jointIndex); float totalWeight = 0.0f; for (int j = 0; j < cluster.indices.size(); j++) { @@ -1584,7 +1584,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS // transform cluster vertices to joint-frame and save for later float clusterScale = extractUniformScale(firstFBXCluster.inverseBindMatrix); glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform; - ShapeVertices& points = shapeVertices[jointIndex]; + ShapeVertices& points = shapeVertices.at(jointIndex); foreach (const glm::vec3& vertex, extracted.mesh.vertices) { const glm::mat4 vertexTransform = meshToJoint * glm::translate(vertex); points.push_back(extractTranslation(vertexTransform) * clusterScale); @@ -1625,7 +1625,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS FBXJoint& joint = geometry.joints[i]; // NOTE: points are in joint-frame - ShapeVertices& points = shapeVertices[i]; + ShapeVertices& points = shapeVertices.at(i); if (points.size() > 0) { // compute average point glm::vec3 avgPoint = glm::vec3(0.0f);