1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/openmw/mwclass/static.cpp

62 lines
1.7 KiB
C++
Raw Normal View History

2010-08-03 15:24:44 +02:00
#include "static.hpp"
#include <components/esm/loadstat.hpp>
#include <components/sceneutil/positionattitudetransform.hpp>
2010-08-03 15:24:44 +02:00
#include "../mwworld/ptr.hpp"
#include "../mwphysics/physicssystem.hpp"
2014-02-23 20:11:05 +01:00
#include "../mwworld/cellstore.hpp"
2012-01-27 15:11:02 +01:00
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwrender/vismask.hpp"
2010-08-03 15:24:44 +02:00
namespace MWClass
{
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
if (!model.empty())
{
2015-04-10 15:31:19 +02:00
renderingInterface.getObjects().insertModel(ptr, model);
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
}
}
void Static::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
2012-07-24 20:22:11 +04:00
{
if(!model.empty())
physics.addObject(ptr, model);
2012-07-24 20:22:11 +04:00
}
2014-02-23 20:11:05 +01:00
2015-12-18 15:51:05 +01:00
std::string Static::getModel(const MWWorld::ConstPtr &ptr) const
2011-11-11 23:01:12 -05:00
{
2015-12-18 15:51:05 +01:00
const MWWorld::LiveCellRef<ESM::Static> *ref = ptr.get<ESM::Static>();
2011-11-11 23:01:12 -05:00
2012-11-05 16:07:59 +04:00
const std::string &model = ref->mBase->mModel;
2012-07-24 20:22:11 +04:00
if (!model.empty()) {
return "meshes\\" + model;
2011-11-11 23:01:12 -05:00
}
2012-07-24 20:22:11 +04:00
return "";
2011-11-11 23:01:12 -05:00
}
std::string Static::getName (const MWWorld::ConstPtr& ptr) const
2010-08-03 17:11:41 +02:00
{
return "";
}
2010-08-03 15:24:44 +02:00
void Static::registerSelf()
{
std::shared_ptr<Class> instance (new Static);
2010-08-03 15:24:44 +02:00
registerClass (typeid (ESM::Static).name(), instance);
}
2015-12-18 16:24:24 +01:00
MWWorld::Ptr Static::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const
{
2015-12-18 16:24:24 +01:00
const MWWorld::LiveCellRef<ESM::Static> *ref = ptr.get<ESM::Static>();
return MWWorld::Ptr(cell.insert(ref), &cell);
}
2010-08-03 15:24:44 +02:00
}