From 1faa07b2794a076daacca441e0341c0c5a3a101f Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Wed, 9 Nov 2011 15:47:06 -0500 Subject: [PATCH] insertObjectRendering proposed --- apps/openmw/mwclass/lockpick.cpp | 11 ++++------- apps/openmw/mwclass/lockpick.hpp | 3 +-- apps/openmw/mwworld/class.cpp | 3 +-- apps/openmw/mwworld/class.hpp | 6 ++++-- apps/openmw/mwworld/world.cpp | 1 - 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index 3a94fce26..1296a4144 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -9,25 +9,22 @@ #include "../mwworld/actiontake.hpp" #include "../mwrender/cellimp.hpp" - +#include "../mwrender/renderinginterface.hpp" #include "containerutil.hpp" namespace MWClass { - void Lockpick::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender, - MWWorld::Environment& environment) const + void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { ESMS::LiveCellRef *ref = ptr.get(); assert (ref->base != NULL); const std::string &model = ref->base->model; + MWRender::Objects objects = renderingInterface.getObjects(); if (!model.empty()) { - MWRender::Rendering rendering (cellRender, ref->ref, ref->mData); - cellRender.insertMesh ("meshes\\" + model); - cellRender.insertObjectPhysics(); - ref->mData.setHandle (rendering.end (ref->mData.isEnabled())); + objects.insertMesh(ptr, "meshes\\" + model); } } diff --git a/apps/openmw/mwclass/lockpick.hpp b/apps/openmw/mwclass/lockpick.hpp index bb9866b8c..9b02dce7f 100644 --- a/apps/openmw/mwclass/lockpick.hpp +++ b/apps/openmw/mwclass/lockpick.hpp @@ -9,8 +9,7 @@ namespace MWClass { public: - virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender, - MWWorld::Environment& environment) const; + virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; ///< Add reference into a cell for rendering virtual std::string getName (const MWWorld::Ptr& ptr) const; diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index 670cf90b2..396d92cac 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -21,8 +21,7 @@ namespace MWWorld throw std::runtime_error ("class does not support ID retrieval"); } - void Class::insertObj (const Ptr& ptr, MWRender::CellRenderImp& cellRender, - MWWorld::Environment& environment) const + void Class::insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { } diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 8ad9ba58f..470235bb0 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -9,6 +9,7 @@ #include "action.hpp" #include "containerstore.hpp" #include "refdata.hpp" +#include "../mwrender/renderinginterface.hpp" namespace Ogre { @@ -59,8 +60,9 @@ namespace MWWorld ///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval /// (default implementation: throw an exception) - virtual void insertObj (const Ptr& ptr, MWRender::CellRenderImp& cellRender, - MWWorld::Environment& environment) const; + + + virtual void insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const; ///< Add reference into a cell for rendering (default implementation: don't render anything). virtual void enable (const Ptr& ptr, MWWorld::Environment& environment) const; diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index fbe388427..a4e909ffc 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -180,7 +180,6 @@ namespace MWWorld : mRendering (renderer,resDir, physEng),mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this) { - std::cout << "Creating myworld\n"; mPhysEngine = physEng; mPhysics = new PhysicsSystem(renderer, physEng);