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