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