From 14b91fb2715b258c6c75f4ac790b74718d5943f8 Mon Sep 17 00:00:00 2001 From: Nicolay Korslund Date: Wed, 13 Jan 2010 19:28:12 +0100 Subject: [PATCH] Cosmetic changes --- nifogre/ogre_nif_loader.cpp | 8 ++++++++ nifogre/tests/ogre_nif_test.cpp | 1 + 2 files changed, 9 insertions(+) diff --git a/nifogre/ogre_nif_loader.cpp b/nifogre/ogre_nif_loader.cpp index 303c4e87b..7d62839d0 100644 --- a/nifogre/ogre_nif_loader.cpp +++ b/nifogre/ogre_nif_loader.cpp @@ -164,5 +164,13 @@ void NIFLoader::loadResource(Resource *resource) MeshPtr NIFLoader::load(const char* name, const char* group) { + MeshManager *m = MeshManager::getSingletonPtr(); + + // Check if the resource already exists + ResourcePtr ptr = m->getByName(name/*, group*/); + if(!ptr.isNull()) + return MeshPtr(ptr); + + // Nope, create a new one. return MeshManager::getSingleton().createManual(name, group, &g_sing); } diff --git a/nifogre/tests/ogre_nif_test.cpp b/nifogre/tests/ogre_nif_test.cpp index e132ca6b7..8292e5603 100644 --- a/nifogre/tests/ogre_nif_test.cpp +++ b/nifogre/tests/ogre_nif_test.cpp @@ -75,6 +75,7 @@ int main(int argc, char**args) // Insert the mesh const char* mesh = "meshes\\a\\towershield_steel.nif"; NIFLoader::load(mesh); + NIFLoader::load(mesh); // Display it SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("node");