From e2e0d741a22ae321f06ca640d51a982612967265 Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Tue, 28 Nov 2017 01:22:43 -0800 Subject: [PATCH] Style tweaks. --- src/Fbx2Raw.cpp | 8 +++----- src/Raw2Gltf.cpp | 15 ++++++--------- src/RawModel.cpp | 1 - 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Fbx2Raw.cpp b/src/Fbx2Raw.cpp index d0c7243..9355faa 100644 --- a/src/Fbx2Raw.cpp +++ b/src/Fbx2Raw.cpp @@ -612,14 +612,12 @@ static void ReadMesh(RawModel &raw, FbxScene *pScene, FbxNode *pNode, const std: // Associate the node to this surface int nodeId = raw.GetNodeByName(pNode->GetName()); - if (nodeId >= 0) - { - RawNode& node = raw.GetNode(nodeId); + if (nodeId >= 0) { + RawNode &node = raw.GetNode(nodeId); node.surfaceId = surfaceId; } - if (raw.GetSurfaceById(surfaceId) >= 0) - { + if (raw.GetSurfaceById(surfaceId) >= 0) { // This surface is already loaded return; } diff --git a/src/Raw2Gltf.cpp b/src/Raw2Gltf.cpp index 76d94b1..19f2e96 100644 --- a/src/Raw2Gltf.cpp +++ b/src/Raw2Gltf.cpp @@ -293,7 +293,7 @@ ModelData *Raw2Gltf( std::map> nodesByName; std::map> materialsByName; - std::map> meshBySurfaceId; + std::map> meshBySurfaceId; // for now, we only have one buffer; data->binary points to the same vector as that BufferData does. BufferData &buffer = *gltf->buffers.hold( @@ -475,20 +475,18 @@ ModelData *Raw2Gltf( assert(surfaceModel.GetSurfaceCount() == 1); const RawSurface &rawSurface = surfaceModel.GetSurface(0); + const int surfaceId = rawSurface.id; const RawMaterial &rawMaterial = surfaceModel.GetMaterial(surfaceModel.GetTriangle(0).materialIndex); const MaterialData &mData = require(materialsByName, materialHash(rawMaterial)); - int surfaceId = rawSurface.id; - //NodeData &meshNode = require(nodesByName, nodeName); MeshData *mesh = nullptr; - auto meshIter = meshBySurfaceId.find(surfaceId); + auto meshIter = meshBySurfaceId.find(surfaceId); if (meshIter != meshBySurfaceId.end()) { mesh = meshIter->second.get(); - } - else { + } else { std::vector defaultDeforms; for (const auto &channel : rawSurface.blendChannels) { defaultDeforms.push_back(channel.defaultDeform); @@ -517,8 +515,7 @@ ModelData *Raw2Gltf( AccessorData &indexes = *gltf->accessors.hold(new AccessorData(GLT_USHORT)); indexes.count = 3 * triangleCount; primitive.reset(new PrimitiveData(indexes, mData, dracoMesh)); - } - else { + } else { const AccessorData &indexes = *gltf->AddAccessorWithView( *gltf->GetAlignedBufferView(buffer, BufferViewData::GL_ELEMENT_ARRAY_BUFFER), GLT_USHORT, getIndexArray(surfaceModel)); @@ -650,7 +647,7 @@ ModelData *Raw2Gltf( // // Assign mesh to node - // + // if (node.surfaceId > 0) { int surfaceIndex = raw.GetSurfaceById(node.surfaceId); diff --git a/src/RawModel.cpp b/src/RawModel.cpp index d6ea545..3dcd051 100644 --- a/src/RawModel.cpp +++ b/src/RawModel.cpp @@ -549,4 +549,3 @@ int RawModel::GetSurfaceById(const long surfaceId) const } return -1; } -