Properly cleanup mesh cache, fixes crash on second play

This commit is contained in:
Marianne Gagnon
2014-09-29 18:42:10 -04:00
parent d0e30c15a5
commit c26a2413b2
2 changed files with 13 additions and 0 deletions

View File

@@ -434,6 +434,8 @@ scene::IMesh* MeshTools::createMeshWithTangents(scene::IMesh* mesh, bool(*predic
clone->recalculateBoundingBox();
if (calculateTangents)
recalculateTangents(clone, recalculateNormals, smooth, angleWeighted);
irr_driver->removeMeshFromCache(mesh);
return clone;
}

View File

@@ -426,6 +426,17 @@ void Track::cleanup()
}
#endif
} // if verbose
#ifdef __DEBUG_DUMP_MESH_CACHE_AFTER_CLEANUP__
scene::IMeshCache* meshCache = irr_driver->getSceneManager()->getMeshCache();
int count = meshCache->getMeshCount();
for (int i = 0; i < count; i++)
{
scene::IAnimatedMesh* mesh = meshCache->getMeshByIndex(i);
io::SNamedPath path = meshCache->getMeshName(mesh);
Log::info("CACHE", "[%i] %s", i, path.getPath().c_str());
}
#endif
} // cleanup
//-----------------------------------------------------------------------------