mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-05 04:21:13 +02:00
Merge pull request #7869 from zzmp/fix/fbx-access
Check vector access in fbx reader
This commit is contained in:
commit
c443138dd2
1 changed files with 4 additions and 4 deletions
|
@ -1332,7 +1332,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: shapeVertices are in joint-frame
|
// NOTE: shapeVertices are in joint-frame
|
||||||
QVector<ShapeVertices> shapeVertices;
|
std::vector<ShapeVertices> shapeVertices;
|
||||||
shapeVertices.resize(geometry.joints.size());
|
shapeVertices.resize(geometry.joints.size());
|
||||||
|
|
||||||
// find our special joints
|
// find our special joints
|
||||||
|
@ -1523,7 +1523,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
|
|
||||||
float clusterScale = extractUniformScale(fbxCluster.inverseBindMatrix);
|
float clusterScale = extractUniformScale(fbxCluster.inverseBindMatrix);
|
||||||
glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform;
|
glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform;
|
||||||
ShapeVertices& points = shapeVertices[jointIndex];
|
ShapeVertices& points = shapeVertices.at(jointIndex);
|
||||||
|
|
||||||
float totalWeight = 0.0f;
|
float totalWeight = 0.0f;
|
||||||
for (int j = 0; j < cluster.indices.size(); j++) {
|
for (int j = 0; j < cluster.indices.size(); j++) {
|
||||||
|
@ -1585,7 +1585,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
// transform cluster vertices to joint-frame and save for later
|
// transform cluster vertices to joint-frame and save for later
|
||||||
float clusterScale = extractUniformScale(firstFBXCluster.inverseBindMatrix);
|
float clusterScale = extractUniformScale(firstFBXCluster.inverseBindMatrix);
|
||||||
glm::mat4 meshToJoint = glm::inverse(joint.bindTransform) * modelTransform;
|
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) {
|
foreach (const glm::vec3& vertex, extracted.mesh.vertices) {
|
||||||
const glm::mat4 vertexTransform = meshToJoint * glm::translate(vertex);
|
const glm::mat4 vertexTransform = meshToJoint * glm::translate(vertex);
|
||||||
points.push_back(extractTranslation(vertexTransform) * clusterScale);
|
points.push_back(extractTranslation(vertexTransform) * clusterScale);
|
||||||
|
@ -1626,7 +1626,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
||||||
FBXJoint& joint = geometry.joints[i];
|
FBXJoint& joint = geometry.joints[i];
|
||||||
|
|
||||||
// NOTE: points are in joint-frame
|
// NOTE: points are in joint-frame
|
||||||
ShapeVertices& points = shapeVertices[i];
|
ShapeVertices& points = shapeVertices.at(i);
|
||||||
if (points.size() > 0) {
|
if (points.size() > 0) {
|
||||||
// compute average point
|
// compute average point
|
||||||
glm::vec3 avgPoint = glm::vec3(0.0f);
|
glm::vec3 avgPoint = glm::vec3(0.0f);
|
||||||
|
|
Loading…
Reference in a new issue