From de70a17fd3c169f2358d02ea83241b96f1040f5e Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 3 Dec 2020 11:51:18 -0800 Subject: GLTF loader: updated mesh BB handling --- AssetLoader/interface/GLTFLoader.hpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'AssetLoader/interface') diff --git a/AssetLoader/interface/GLTFLoader.hpp b/AssetLoader/interface/GLTFLoader.hpp index e86dec7..daa61e6 100644 --- a/AssetLoader/interface/GLTFLoader.hpp +++ b/AssetLoader/interface/GLTFLoader.hpp @@ -182,7 +182,12 @@ struct Mesh BoundBox BB; - bool IsValidBB = false; + // There may be no primitives in the mesh, in which + // case the bounding box will be invalid. + bool IsValidBB() const + { + return !Primitives.empty(); + } struct TransformData { @@ -193,7 +198,6 @@ struct Mesh TransformData Transforms; Mesh(IRenderDevice* pDevice, const float4x4& matrix); - void SetBoundingBox(const float3& min, const float3& max); }; @@ -216,15 +220,16 @@ struct Node std::vector> Children; float4x4 Matrix; - std::unique_ptr _Mesh; - Skin* _Skin = nullptr; + std::unique_ptr Mesh; + Skin* Skin = nullptr; Int32 SkinIndex = -1; float3 Translation; float3 Scale = float3{1, 1, 1}; Quaternion Rotation; BoundBox BVH; BoundBox AABB; - bool IsValidBVH = false; + + bool IsValidBVH = false; float4x4 LocalMatrix() const; float4x4 GetMatrix() const; -- cgit v1.2.3