2010-08-03 15:24:44 +02:00
|
|
|
#include "static.hpp"
|
|
|
|
|
2022-01-22 15:58:41 +01:00
|
|
|
#include <components/esm3/loadstat.hpp>
|
2023-01-22 19:03:19 +01:00
|
|
|
#include <components/esm4/loadstat.hpp>
|
2019-02-21 20:14:18 +04:00
|
|
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
2010-08-03 15:24:44 +02:00
|
|
|
|
2015-05-10 01:09:00 +02:00
|
|
|
#include "../mwphysics/physicssystem.hpp"
|
2014-02-23 20:11:05 +01:00
|
|
|
#include "../mwworld/cellstore.hpp"
|
2010-08-14 10:02:54 +02:00
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
|
2012-01-27 15:11:02 +01:00
|
|
|
#include "../mwrender/objects.hpp"
|
2012-07-03 13:15:20 +02:00
|
|
|
#include "../mwrender/renderinginterface.hpp"
|
2020-04-20 18:47:14 +02:00
|
|
|
#include "../mwrender/vismask.hpp"
|
2010-08-14 10:02:54 +02:00
|
|
|
|
2022-06-29 00:32:11 +02:00
|
|
|
#include "classmodel.hpp"
|
2022-05-13 19:28:53 +02:00
|
|
|
|
2010-08-03 15:24:44 +02:00
|
|
|
namespace MWClass
|
|
|
|
{
|
2022-04-04 02:44:53 +02:00
|
|
|
Static::Static()
|
|
|
|
: MWWorld::RegisteredClass<Static>(ESM::Static::sRecordId)
|
|
|
|
{
|
|
|
|
}
|
2014-07-18 09:56:58 +02:00
|
|
|
|
2015-01-12 11:29:56 +01:00
|
|
|
void Static::insertObjectRendering(
|
|
|
|
const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
2010-08-14 10:02:54 +02:00
|
|
|
{
|
2019-02-21 20:14:18 +04:00
|
|
|
if (!model.empty())
|
|
|
|
{
|
2015-04-10 15:31:19 +02:00
|
|
|
renderingInterface.getObjects().insertModel(ptr, model);
|
2020-04-20 18:47:14 +02:00
|
|
|
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
|
2010-08-14 10:02:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-30 22:58:16 +02:00
|
|
|
void Static::insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
|
|
|
|
MWPhysics::PhysicsSystem& physics) const
|
2021-03-05 22:21:53 +01:00
|
|
|
{
|
2021-09-30 22:58:16 +02:00
|
|
|
insertObjectPhysics(ptr, model, rotation, physics);
|
2021-03-05 22:21:53 +01:00
|
|
|
}
|
|
|
|
|
2021-09-30 22:58:16 +02:00
|
|
|
void Static::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
|
|
|
|
MWPhysics::PhysicsSystem& physics) const
|
2012-07-24 20:22:11 +04:00
|
|
|
{
|
2022-04-03 17:38:33 +00:00
|
|
|
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
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
|
|
|
{
|
2022-06-29 00:32:11 +02:00
|
|
|
return getClassModel<ESM::Static>(ptr);
|
2011-11-11 23:01:12 -05:00
|
|
|
}
|
|
|
|
|
2022-08-16 21:15:03 +02:00
|
|
|
std::string_view Static::getName(const MWWorld::ConstPtr& ptr) const
|
2010-08-03 17:11:41 +02:00
|
|
|
{
|
2022-08-16 21:15:03 +02:00
|
|
|
return {};
|
2010-08-03 17:11:41 +02:00
|
|
|
}
|
|
|
|
|
2019-09-10 21:56:10 +03:00
|
|
|
bool Static::hasToolTip(const MWWorld::ConstPtr& ptr) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-18 16:24:24 +01:00
|
|
|
MWWorld::Ptr Static::copyToCellImpl(const MWWorld::ConstPtr& ptr, MWWorld::CellStore& cell) const
|
2012-07-25 17:18:17 +04:00
|
|
|
{
|
2015-12-18 16:24:24 +01:00
|
|
|
const MWWorld::LiveCellRef<ESM::Static>* ref = ptr.get<ESM::Static>();
|
2012-07-25 17:18:17 +04:00
|
|
|
|
2015-11-14 17:12:05 +01:00
|
|
|
return MWWorld::Ptr(cell.insert(ref), &cell);
|
2012-07-25 17:18:17 +04:00
|
|
|
}
|
2010-08-03 15:24:44 +02:00
|
|
|
}
|