1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00
OpenMW/apps/openmw/mwclass/static.cpp

53 lines
1.4 KiB
C++
Raw Normal View History

2010-08-03 13:24:44 +00:00
#include "static.hpp"
#include <components/esm/loadstat.hpp>
#include "../mwworld/ptr.hpp"
2012-01-27 14:11:02 +00:00
#include "../mwrender/objects.hpp"
2010-08-03 13:24:44 +00:00
namespace MWClass
{
2011-11-12 04:01:12 +00:00
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
ptr.get<ESM::Static>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
2012-01-27 14:11:02 +00:00
if (!model.empty())
{
MWRender::Objects& objects = renderingInterface.getObjects();
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), true);
2011-11-12 04:01:12 +00:00
objects.insertMesh(ptr, "meshes\\" + model);
}
}
2011-11-12 04:01:12 +00:00
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
{
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
ptr.get<ESM::Static>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
2011-11-12 04:01:12 +00:00
if(!model.empty()){
2011-11-18 00:38:52 +00:00
physics.insertObjectPhysics(ptr, "meshes\\" + model);
2011-11-12 04:01:12 +00:00
}
}
2010-08-03 15:11:41 +00:00
std::string Static::getName (const MWWorld::Ptr& ptr) const
{
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);
}
}