From 07afe3362d09286a494ff46060cd0b7e618d1339 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 16 Feb 2024 23:16:15 +0200 Subject: [PATCH] Fix reloading meshes with ResourceManager Unloading was clearing the format of VertexSetup and it wouldn't accept the vertex array. Setting storage format should also be skipped while loading from a file if the same format was set previously. --- source/core/mesh.cpp | 3 ++- source/core/vertexsetup.cpp | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/source/core/mesh.cpp b/source/core/mesh.cpp index 6e3a2b93..84a7b731 100644 --- a/source/core/mesh.cpp +++ b/source/core/mesh.cpp @@ -255,7 +255,8 @@ void Mesh::Loader::storage(const vector &attrs) VertexFormat fmt; for(VertexAttribute a: attrs) fmt = (fmt, a); - obj.storage(fmt); + if(fmt!=obj.vertices.get_format()) + obj.storage(fmt); } void Mesh::Loader::vertices() diff --git a/source/core/vertexsetup.cpp b/source/core/vertexsetup.cpp index 7df3b67b..98b6fc0d 100644 --- a/source/core/vertexsetup.cpp +++ b/source/core/vertexsetup.cpp @@ -87,9 +87,7 @@ void VertexSetup::unload() VertexSetupBackend::unload(); vertex_array = nullptr; - vertex_format = VertexFormat(); inst_array = nullptr; - inst_format = VertexFormat(); index_buffer = nullptr; } -- 2.45.2