mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 21:35:24 +00:00
ce263af393
Remove WindowManager wrappers. It's not safe to use WindowManager in all places and it's not required. Environment stores resource system providing VFS required to call these functions. In the case of ObjectPaging it's available from the member variable. Also ObjectPaging::createChunk may access WindowManager when it's already destructed when exiting the game because it's destructed before CellPreloader finishes all background jobs. Engine::mResourceSystem is destructed after all other systems so it's safe to use it.
64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
#include "static.hpp"
|
|
|
|
#include <components/esm3/loadstat.hpp>
|
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
|
|
|
#include "../mwworld/ptr.hpp"
|
|
#include "../mwphysics/physicssystem.hpp"
|
|
#include "../mwworld/cellstore.hpp"
|
|
|
|
#include "../mwrender/objects.hpp"
|
|
#include "../mwrender/renderinginterface.hpp"
|
|
#include "../mwrender/vismask.hpp"
|
|
|
|
#include "classmodel.hpp"
|
|
|
|
namespace MWClass
|
|
{
|
|
Static::Static()
|
|
: MWWorld::RegisteredClass<Static>(ESM::Static::sRecordId)
|
|
{
|
|
}
|
|
|
|
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
|
{
|
|
if (!model.empty())
|
|
{
|
|
renderingInterface.getObjects().insertModel(ptr, model);
|
|
ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
|
|
}
|
|
}
|
|
|
|
void Static::insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
|
{
|
|
insertObjectPhysics(ptr, model, rotation, physics);
|
|
}
|
|
|
|
void Static::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const
|
|
{
|
|
physics.addObject(ptr, model, rotation, MWPhysics::CollisionType_World);
|
|
}
|
|
|
|
std::string Static::getModel(const MWWorld::ConstPtr &ptr) const
|
|
{
|
|
return getClassModel<ESM::Static>(ptr);
|
|
}
|
|
|
|
std::string Static::getName (const MWWorld::ConstPtr& ptr) const
|
|
{
|
|
return "";
|
|
}
|
|
|
|
bool Static::hasToolTip(const MWWorld::ConstPtr& ptr) const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
MWWorld::Ptr Static::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const
|
|
{
|
|
const MWWorld::LiveCellRef<ESM::Static> *ref = ptr.get<ESM::Static>();
|
|
|
|
return MWWorld::Ptr(cell.insert(ref), &cell);
|
|
}
|
|
}
|