From 92bf5b4b6eaa18505b5ba596ba731c062f012142 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 16 Jun 2010 12:58:53 +0200 Subject: [PATCH] added 'Meshes' and 'Textures' sub-directories as Ogre resources location --- game/engine.cpp | 12 ++++++++++++ game/engine.hpp | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/game/engine.cpp b/game/engine.cpp index 4a1133114..a0803838e 100644 --- a/game/engine.cpp +++ b/game/engine.cpp @@ -45,6 +45,15 @@ void OMW::Engine::prepareMaster() } } +// add resources directory +// \note This function works recursively. + +void OMW::Engine::addResourcesDirectory (const boost::filesystem::path& path) +{ + mOgre.getRoot()->addResourceLocation (path.file_string(), "FileSystem", + Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true); +} + // Set data dir void OMW::Engine::setDataDir (const boost::filesystem::path& dataDir) @@ -88,6 +97,9 @@ void OMW::Engine::go() mOgre.configure(!isFile("ogre.cfg"), plugCfg, false); + addResourcesDirectory (mDataDir / "Meshes"); + addResourcesDirectory (mDataDir / "Textures"); + prepareMaster(); boost::filesystem::path masterPath (mDataDir); diff --git a/game/engine.hpp b/game/engine.hpp index 31e94775d..55c8285e0 100644 --- a/game/engine.hpp +++ b/game/engine.hpp @@ -25,6 +25,10 @@ namespace OMW /// adjust name and load bsa void prepareMaster(); + /// add resources directory + /// \note This function works recursively. + void addResourcesDirectory (const boost::filesystem::path& path); + public: Engine();