1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00
OpenMW/apps/openmw/mwclass/static.cpp
2015-12-18 16:58:38 +01:00

58 lines
1.5 KiB
C++

#include "static.hpp"
#include <components/esm/loadstat.hpp>
#include "../mwworld/ptr.hpp"
#include "../mwphysics/physicssystem.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
namespace MWClass
{
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
if (!model.empty()) {
renderingInterface.getObjects().insertModel(ptr, model);
}
}
void Static::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
{
if(!model.empty())
physics.addObject(ptr, model);
}
std::string Static::getModel(const MWWorld::ConstPtr &ptr) const
{
const MWWorld::LiveCellRef<ESM::Static> *ref = ptr.get<ESM::Static>();
const std::string &model = ref->mBase->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
return "";
}
std::string Static::getName (const MWWorld::ConstPtr& ptr) const
{
return "";
}
void Static::registerSelf()
{
boost::shared_ptr<Class> instance (new Static);
registerClass (typeid (ESM::Static).name(), instance);
}
MWWorld::Ptr Static::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const
{
const MWWorld::LiveCellRef<ESM::Static> *ref = ptr.get<ESM::Static>();
return MWWorld::Ptr(cell.insert(ref), &cell);
}
}