From 40fe156c8b25ec2a3124d6c5f9d3fd02fe46fc0e Mon Sep 17 00:00:00 2001 From: raveenajain Date: Mon, 8 Apr 2019 19:54:31 +0100 Subject: [PATCH] naming, condition --- libraries/fbx/src/GLTFSerializer.cpp | 14 +++++++------- libraries/fbx/src/GLTFSerializer.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/fbx/src/GLTFSerializer.cpp b/libraries/fbx/src/GLTFSerializer.cpp index ec58f15a95..21df5bc2dc 100755 --- a/libraries/fbx/src/GLTFSerializer.cpp +++ b/libraries/fbx/src/GLTFSerializer.cpp @@ -751,7 +751,7 @@ void GLTFSerializer::getSkinInverseBindMatrices(std::vector>& } } -void GLTFSerializer::getNodeQueueByDepthFirstChildren(std::vector& children, int stride, bool order, std::vector& result) { +void GLTFSerializer::getNodeQueueByDepthFirstChildren(std::vector& children, int stride, bool needToSort, std::vector& result) { int startingIndex = 0; int finalIndex = (int)children.size(); if (stride == -1) { @@ -763,12 +763,12 @@ void GLTFSerializer::getNodeQueueByDepthFirstChildren(std::vector& children result.push_back(c); std::vector nested = _file.nodes[c].children.toStdVector(); if (nested.size() != 0) { - if (order) { + if (needToSort) { std::sort(nested.begin(), nested.end()); } for (int r : nested) { if (result.end() == std::find(result.begin(), result.end(), r)) { - getNodeQueueByDepthFirstChildren(nested, stride, order, result); + getNodeQueueByDepthFirstChildren(nested, stride, needToSort, result); } } } @@ -813,7 +813,7 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::URL& url) { // initialize order in which nodes will be parsed - bool sortNodes = (!parentOutOfOrder && skinnedModel) || !skinnedModel; + bool needToSort = !parentOutOfOrder || !skinnedModel; std::vector nodeQueue; nodeQueue.reserve(numNodes); int rootNode = 0; @@ -830,7 +830,7 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::URL& url) { if (!rootAtStartOfList) { nodeListStride = -1; } QVector initialSceneNodes = _file.scenes[_file.scene].nodes; - if (sortNodes) { + if (needToSort) { std::sort(initialSceneNodes.begin(), initialSceneNodes.end()); } @@ -844,10 +844,10 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::URL& url) { int i = initialSceneNodes[index]; nodeQueue.push_back(i); std::vector children = _file.nodes[i].children.toStdVector(); - if (sortNodes) { + if (needToSort) { std::sort(children.begin(), children.end()); } - getNodeQueueByDepthFirstChildren(children, nodeListStride, sortNodes, nodeQueue); + getNodeQueueByDepthFirstChildren(children, nodeListStride, needToSort, nodeQueue); } diff --git a/libraries/fbx/src/GLTFSerializer.h b/libraries/fbx/src/GLTFSerializer.h index dd3649478e..3eee24284e 100755 --- a/libraries/fbx/src/GLTFSerializer.h +++ b/libraries/fbx/src/GLTFSerializer.h @@ -713,7 +713,7 @@ private: glm::mat4 getModelTransform(const GLTFNode& node); void getSkinInverseBindMatrices(std::vector>& inverseBindMatrixValues); - void getNodeQueueByDepthFirstChildren(std::vector& children, int stride, bool order, std::vector& result); + void getNodeQueueByDepthFirstChildren(std::vector& children, int stride, bool needToSort, std::vector& result); bool buildGeometry(HFMModel& hfmModel, const hifi::URL& url); bool parseGLTF(const hifi::ByteArray& data);