]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix reloading meshes with ResourceManager
authorMikko Rasa <tdb@tdb.fi>
Fri, 16 Feb 2024 21:16:15 +0000 (23:16 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 16 Feb 2024 21:16:15 +0000 (23:16 +0200)
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
source/core/vertexsetup.cpp

index 6e3a2b93a922a73e80e41d230a46735bd6872b06..84a7b73183a20e2236c0f24ce387b4a0b3a47088 100644 (file)
@@ -255,7 +255,8 @@ void Mesh::Loader::storage(const vector<VertexAttribute> &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()
index 7df3b67b443e6a3a52e48270629bf8f304053ddf..98b6fc0d840a912ac86c21a7df1ee974b450db7d 100644 (file)
@@ -87,9 +87,7 @@ void VertexSetup::unload()
        VertexSetupBackend::unload();
 
        vertex_array = nullptr;
-       vertex_format = VertexFormat();
        inst_array = nullptr;
-       inst_format = VertexFormat();
        index_buffer = nullptr;
 }