File tree Expand file tree Collapse file tree 1 file changed +26
-3
lines changed
Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -39,21 +39,44 @@ void Scene::clear()
3939{
4040 if (loaded)
4141 {
42- for (const Mesh& mesh : meshes)
42+ for (Mesh& mesh : meshes)
4343 {
4444 bgfx::destroy (mesh.vertexBuffer );
4545 bgfx::destroy (mesh.indexBuffer );
46+ mesh.vertexBuffer = BGFX_INVALID_HANDLE;
47+ mesh.indexBuffer = BGFX_INVALID_HANDLE;
4648 }
47- meshes. clear ();
48- for (const Material& mat : materials)
49+
50+ for (Material& mat : materials)
4951 {
5052 if (bgfx::isValid (mat.baseColorTexture ))
53+ {
5154 bgfx::destroy (mat.baseColorTexture );
55+ mat.baseColorTexture = BGFX_INVALID_HANDLE;
56+ }
5257 if (bgfx::isValid (mat.metallicRoughnessTexture ))
58+ {
5359 bgfx::destroy (mat.metallicRoughnessTexture );
60+ mat.metallicRoughnessTexture = BGFX_INVALID_HANDLE;
61+ }
5462 if (bgfx::isValid (mat.normalTexture ))
63+ {
5564 bgfx::destroy (mat.normalTexture );
65+ mat.normalTexture = BGFX_INVALID_HANDLE;
66+ }
67+ if (bgfx::isValid (mat.occlusionTexture ))
68+ {
69+ bgfx::destroy (mat.occlusionTexture );
70+ mat.occlusionTexture = BGFX_INVALID_HANDLE;
71+ }
72+ if (bgfx::isValid (mat.emissiveTexture ))
73+ {
74+ bgfx::destroy (mat.emissiveTexture );
75+ mat.emissiveTexture = BGFX_INVALID_HANDLE;
76+ }
5677 }
78+
79+ meshes.clear ();
5780 materials.clear ();
5881 pointLights.shutdown ();
5982 pointLights.lights .clear ();
You can’t perform that action at this time.
0 commit comments