summaryrefslogtreecommitdiffstats
path: root/AssetLoader/src/GLTFLoader.cpp
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-03 19:34:23 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-03 19:34:23 +0000
commitdca98748aa1c1ef04f8ed50492f8b780354ccdb9 (patch)
treeaa61bf4b1ab55ddbd778da93b8b857c738ab8c4f /AssetLoader/src/GLTFLoader.cpp
parentGLTF Loader: using dynamic array of joint transform matrices instead of the f... (diff)
downloadDiligentTools-dca98748aa1c1ef04f8ed50492f8b780354ccdb9.tar.gz
DiligentTools-dca98748aa1c1ef04f8ed50492f8b780354ccdb9.zip
GLTF Loader: updated primitives handling
Diffstat (limited to 'AssetLoader/src/GLTFLoader.cpp')
-rw-r--r--AssetLoader/src/GLTFLoader.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/AssetLoader/src/GLTFLoader.cpp b/AssetLoader/src/GLTFLoader.cpp
index 6665b89..f54a330 100644
--- a/AssetLoader/src/GLTFLoader.cpp
+++ b/AssetLoader/src/GLTFLoader.cpp
@@ -531,30 +531,27 @@ void Model::LoadNode(IRenderDevice* pDevice,
return;
}
}
- std::unique_ptr<Primitive> newPrimitive(
- new Primitive //
- {
- indexStart,
- indexCount,
- vertexCount,
- primitive.material > -1 ? Materials[primitive.material] : Materials.back() //
- } //
+ NewMesh->Primitives.emplace_back( //
+ indexStart,
+ indexCount,
+ vertexCount,
+ primitive.material >= 0 ? static_cast<Uint32>(primitive.material) : static_cast<Uint32>(Materials.size() - 1),
+ PosMin,
+ PosMax
+ //
);
-
- newPrimitive->SetBoundingBox(PosMin, PosMax);
- NewMesh->Primitives.push_back(std::move(newPrimitive));
}
// Mesh BB from BBs of primitives
for (const auto& prim : NewMesh->Primitives)
{
- if (prim->IsValidBB && !NewMesh->IsValidBB)
+ if (!NewMesh->IsValidBB)
{
- NewMesh->BB = prim->BB;
+ NewMesh->BB = prim.BB;
NewMesh->IsValidBB = true;
}
- float3 bb_min = std::min(NewMesh->BB.Min, prim->BB.Min);
- float3 bb_max = std::max(NewMesh->BB.Max, prim->BB.Max);
+ float3 bb_min = std::min(NewMesh->BB.Min, prim.BB.Min);
+ float3 bb_max = std::max(NewMesh->BB.Max, prim.BB.Max);
NewMesh->SetBoundingBox(bb_min, bb_max);
}
NewNode->_Mesh = std::move(NewMesh);