From a6339f1cb8757a1f349083e8c5e5ee2c2c342e5d Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 7 Jan 2021 21:36:58 -0800 Subject: GLTF Loader: added camera loading --- AssetLoader/interface/GLTFLoader.hpp | 50 +++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'AssetLoader/interface') diff --git a/AssetLoader/interface/GLTFLoader.hpp b/AssetLoader/interface/GLTFLoader.hpp index bdd8fc4..a6a9e0b 100644 --- a/AssetLoader/interface/GLTFLoader.hpp +++ b/AssetLoader/interface/GLTFLoader.hpp @@ -217,6 +217,37 @@ struct Skin std::vector Joints; }; +struct Camera +{ + enum class Projection + { + Unknown, + Perspective, + Orthographic + } Type = Projection::Unknown; + + std::string Name; + + union + { + struct PerspectiveCamera + { + float AspectRatio = 0; + float YFov = 0; + float ZFar = 0; + float ZNear = 0; + } Perspective; + struct OrthographicCamera + { + float XMag; + float YMag; + float ZFar; + float ZNear; + } Orthographic; + }; + + float4x4 matrix; +}; struct Node { @@ -226,15 +257,16 @@ struct Node std::vector> Children; - float4x4 Matrix; - std::unique_ptr pMesh; - Skin* pSkin = nullptr; - Int32 SkinIndex = -1; - float3 Translation; - float3 Scale = float3{1, 1, 1}; - Quaternion Rotation; - BoundBox BVH; - BoundBox AABB; + float4x4 Matrix; + std::unique_ptr pMesh; + std::unique_ptr pCamera; + Skin* pSkin = nullptr; + Int32 SkinIndex = -1; + float3 Translation; + float3 Scale = float3{1, 1, 1}; + Quaternion Rotation; + BoundBox BVH; + BoundBox AABB; bool IsValidBVH = false; -- cgit v1.2.3