openmw-tes3coop/apps/openmw/mwclass/static.cpp

53 lines
1.3 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"
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;
2011-11-12 04:01:12 +00:00
if (!model.empty())
{
2011-11-12 04:01:12 +00:00
MWRender::Objects objects = renderingInterface.getObjects();
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
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>();
const std::string &model = ref->base->model;
assert (ref->base != NULL);
if(!model.empty()){
physics.insertObjectPhysics(ptr);
}
}
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);
}
}