mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-11-04 12:26:42 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			66 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
 | 
						|
#include "static.hpp"
 | 
						|
 | 
						|
#include <components/esm/loadstat.hpp>
 | 
						|
 | 
						|
#include "../mwworld/ptr.hpp"
 | 
						|
#include "../mwworld/physicssystem.hpp"
 | 
						|
#include "../mwworld/cellstore.hpp"
 | 
						|
 | 
						|
#include "../mwrender/objects.hpp"
 | 
						|
#include "../mwrender/renderinginterface.hpp"
 | 
						|
 | 
						|
namespace MWClass
 | 
						|
{
 | 
						|
    void Static::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
 | 
						|
    {
 | 
						|
        MWWorld::LiveCellRef<ESM::Static> *ref =
 | 
						|
            ptr.get<ESM::Static>();
 | 
						|
 | 
						|
        const std::string model = getModel(ptr);
 | 
						|
        if (!model.empty()) {
 | 
						|
            renderingInterface.getObjects().insertModel(ptr, model, !ref->mBase->mPersistent);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
 | 
						|
    {
 | 
						|
        const std::string model = getModel(ptr);
 | 
						|
        if(!model.empty())
 | 
						|
            physics.addObject(ptr);
 | 
						|
    }
 | 
						|
 | 
						|
    std::string Static::getModel(const MWWorld::Ptr &ptr) const
 | 
						|
    {
 | 
						|
        MWWorld::LiveCellRef<ESM::Static> *ref =
 | 
						|
            ptr.get<ESM::Static>();
 | 
						|
        assert(ref->mBase != NULL);
 | 
						|
 | 
						|
        const std::string &model = ref->mBase->mModel;
 | 
						|
        if (!model.empty()) {
 | 
						|
            return "meshes\\" + model;
 | 
						|
        }
 | 
						|
        return "";
 | 
						|
    }
 | 
						|
 | 
						|
    std::string Static::getName (const MWWorld::Ptr& ptr) const
 | 
						|
    {
 | 
						|
        return "";
 | 
						|
    }
 | 
						|
 | 
						|
    void Static::registerSelf()
 | 
						|
    {
 | 
						|
        boost::shared_ptr<Class> instance (new Static);
 | 
						|
 | 
						|
        registerClass (typeid (ESM::Static).name(), instance);
 | 
						|
    }
 | 
						|
 | 
						|
    MWWorld::Ptr
 | 
						|
    Static::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
 | 
						|
    {
 | 
						|
        MWWorld::LiveCellRef<ESM::Static> *ref =
 | 
						|
            ptr.get<ESM::Static>();
 | 
						|
 | 
						|
        return MWWorld::Ptr(&cell.get<ESM::Static>().insert(*ref), &cell);
 | 
						|
    }
 | 
						|
}
 |