From a8a2e90c266435602bc5013de13cc9852d379c30 Mon Sep 17 00:00:00 2001 From: Xiao Qi Date: Sat, 24 Sep 2022 13:36:43 +0800 Subject: [PATCH] SP3-237 Added header data type into mesh asset in preparation for compilation of mesh --- SHADE_Engine/src/Assets/Asset Types/SHMeshAsset.h | 11 +++++++++++ SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/SHADE_Engine/src/Assets/Asset Types/SHMeshAsset.h b/SHADE_Engine/src/Assets/Asset Types/SHMeshAsset.h index e2a3c373..8babfa67 100644 --- a/SHADE_Engine/src/Assets/Asset Types/SHMeshAsset.h +++ b/SHADE_Engine/src/Assets/Asset Types/SHMeshAsset.h @@ -5,8 +5,19 @@ namespace SHADE { + struct SHMeshAssetHeader + { + uint32_t vertexCount; + uint32_t indexCount; + }; + struct SHMeshAsset { + bool compiled; + bool changed; + + SHMeshAssetHeader header; + std::vector vertexPosition; std::vector texCoords; std::vector vertexTangent; diff --git a/SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp b/SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp index 60ae7ed0..c48cc2a5 100644 --- a/SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp +++ b/SHADE_Engine/src/Assets/Libraries/SHMeshLoader.cpp @@ -24,7 +24,11 @@ namespace SHADE { (void)scene; - SHMeshAsset result; + SHMeshAsset result + { + .compiled = false, + .changed = false + }; for (size_t i{0}; i < mesh.mNumVertices; ++i) { @@ -74,6 +78,9 @@ namespace SHADE } } + result.header.vertexCount = result.vertexPosition.size(); + result.header.indexCount = result.indices.size(); + return result; }