1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 00:36:46 +00:00

insertObjectRendering proposed

This commit is contained in:
Jason Hooks 2011-11-09 15:47:06 -05:00
parent a7652bcb0c
commit 1faa07b279
5 changed files with 10 additions and 14 deletions

View file

@ -9,25 +9,22 @@
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwrender/cellimp.hpp" #include "../mwrender/cellimp.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "containerutil.hpp" #include "containerutil.hpp"
namespace MWClass namespace MWClass
{ {
void Lockpick::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender, void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
MWWorld::Environment& environment) const
{ {
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref = ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
ptr.get<ESM::Tool>(); ptr.get<ESM::Tool>();
assert (ref->base != NULL); assert (ref->base != NULL);
const std::string &model = ref->base->model; const std::string &model = ref->base->model;
MWRender::Objects objects = renderingInterface.getObjects();
if (!model.empty()) if (!model.empty())
{ {
MWRender::Rendering rendering (cellRender, ref->ref, ref->mData); objects.insertMesh(ptr, "meshes\\" + model);
cellRender.insertMesh ("meshes\\" + model);
cellRender.insertObjectPhysics();
ref->mData.setHandle (rendering.end (ref->mData.isEnabled()));
} }
} }

View file

@ -9,8 +9,7 @@ namespace MWClass
{ {
public: public:
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender, virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
MWWorld::Environment& environment) const;
///< Add reference into a cell for rendering ///< Add reference into a cell for rendering
virtual std::string getName (const MWWorld::Ptr& ptr) const; virtual std::string getName (const MWWorld::Ptr& ptr) const;

View file

@ -21,8 +21,7 @@ namespace MWWorld
throw std::runtime_error ("class does not support ID retrieval"); throw std::runtime_error ("class does not support ID retrieval");
} }
void Class::insertObj (const Ptr& ptr, MWRender::CellRenderImp& cellRender, void Class::insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
MWWorld::Environment& environment) const
{ {
} }

View file

@ -9,6 +9,7 @@
#include "action.hpp" #include "action.hpp"
#include "containerstore.hpp" #include "containerstore.hpp"
#include "refdata.hpp" #include "refdata.hpp"
#include "../mwrender/renderinginterface.hpp"
namespace Ogre namespace Ogre
{ {
@ -59,8 +60,9 @@ namespace MWWorld
///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval ///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval
/// (default implementation: throw an exception) /// (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). ///< Add reference into a cell for rendering (default implementation: don't render anything).
virtual void enable (const Ptr& ptr, MWWorld::Environment& environment) const; virtual void enable (const Ptr& ptr, MWWorld::Environment& environment) const;

View file

@ -180,7 +180,6 @@ namespace MWWorld
: mRendering (renderer,resDir, physEng),mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), : mRendering (renderer,resDir, physEng),mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this) mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this)
{ {
std::cout << "Creating myworld\n";
mPhysEngine = physEng; mPhysEngine = physEng;
mPhysics = new PhysicsSystem(renderer, physEng); mPhysics = new PhysicsSystem(renderer, physEng);