Feature #37 (In Progress) Render Path Grid

workaround for strange ESMStore bug
This commit is contained in:
Nikolay Kasyanov 2012-03-10 20:45:55 +04:00
parent 11f957a64d
commit 4659076129
4 changed files with 9 additions and 10 deletions

View file

@ -10,6 +10,7 @@
#include "OgreTextureManager.h" #include "OgreTextureManager.h"
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone #include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwworld/environment.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include <components/esm/loadstat.hpp> #include <components/esm/loadstat.hpp>
#include <components/esm/loadpgrd.hpp> #include <components/esm/loadpgrd.hpp>
@ -19,8 +20,8 @@
using namespace MWRender; using namespace MWRender;
using namespace Ogre; using namespace Ogre;
Debugging::Debugging(const ESMS::ESMStore &store, SceneManager* sceneMgr, OEngine::Physic::PhysicEngine *engine) : Debugging::Debugging(MWWorld::Environment &env, SceneManager* sceneMgr, OEngine::Physic::PhysicEngine *engine) :
mStore(store), mSceneMgr(sceneMgr), mEngine(engine), pathgridEnabled(false) mEnvironment(env), mSceneMgr(sceneMgr), mEngine(engine), pathgridEnabled(false)
{ {
} }
@ -83,7 +84,7 @@ void Debugging::togglePathgrid()
void Debugging::togglePathgridForCell(MWWorld::Ptr::CellStore *store, bool enabled) void Debugging::togglePathgridForCell(MWWorld::Ptr::CellStore *store, bool enabled)
{ {
ESM::Pathgrid *pathgrid = mStore.pathgrids.search(*store->cell); ESM::Pathgrid *pathgrid = mEnvironment.mWorld->getStore().pathgrids.search(*store->cell);
if (!pathgrid) if (!pathgrid)
{ {
std::cout << "No path grid :(" << std::endl; std::cout << "No path grid :(" << std::endl;

View file

@ -23,6 +23,7 @@ namespace Ogre
namespace MWWorld namespace MWWorld
{ {
class World; class World;
class Environment;
} }
namespace MWRender namespace MWRender
@ -33,7 +34,8 @@ namespace MWRender
{ {
OEngine::Physic::PhysicEngine* mEngine; OEngine::Physic::PhysicEngine* mEngine;
Ogre::SceneManager* mSceneMgr; Ogre::SceneManager* mSceneMgr;
const ESMS::ESMStore& mStore; MWWorld::Environment& mEnvironment;
//const ESMS::ESMStore& mStore;
// Path grid stuff // Path grid stuff
bool pathgridEnabled; bool pathgridEnabled;
@ -53,7 +55,7 @@ namespace MWRender
void togglePathgridForCell(MWWorld::Ptr::CellStore *store, bool enabled); void togglePathgridForCell(MWWorld::Ptr::CellStore *store, bool enabled);
public: public:
Debugging(const ESMS::ESMStore &store, Ogre::SceneManager *mSceneMgr, OEngine::Physic::PhysicEngine* engine); Debugging(MWWorld::Environment &env, Ogre::SceneManager *mSceneMgr, OEngine::Physic::PhysicEngine* engine);
bool toggleRenderMode (int mode); bool toggleRenderMode (int mode);
void cellAdded(MWWorld::Ptr::CellStore* store); void cellAdded(MWWorld::Ptr::CellStore* store);

View file

@ -24,7 +24,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
{ {
mRendering.createScene("PlayerCam", 55, 5); mRendering.createScene("PlayerCam", 55, 5);
mDebugging = new Debugging(environment.mWorld->getStore(), mRendering.getScene(), engine); mDebugging = new Debugging(environment, mRendering.getScene(), engine);
// Set default mipmap level (NB some APIs ignore this) // Set default mipmap level (NB some APIs ignore this)
TextureManager::getSingleton().setDefaultNumMipmaps(5); TextureManager::getSingleton().setDefaultNumMipmaps(5);

View file

@ -123,8 +123,6 @@ namespace ESMS
CellRefList<Static, D> statics; CellRefList<Static, D> statics;
CellRefList<Weapon, D> weapons; CellRefList<Weapon, D> weapons;
ESM::Pathgrid *pathgrid;
void load (const ESMStore &store, ESMReader &esm) void load (const ESMStore &store, ESMReader &esm)
{ {
if (mState!=State_Loaded) if (mState!=State_Loaded)
@ -136,8 +134,6 @@ namespace ESMS
loadRefs (store, esm); loadRefs (store, esm);
pathgrid = store.pathgrids.search(*cell);
mState = State_Loaded; mState = State_Loaded;
} }
} }