#ifndef OPENMW_NAVMESHTOOL_WORLDSPACEDATA_H #define OPENMW_NAVMESHTOOL_WORLDSPACEDATA_H #include #include #include #include #include #include #include #include #include #include #include namespace ESM { class ESMReader; class ReadersCache; } namespace VFS { class Manager; } namespace Resource { class BulletShapeManager; } namespace EsmLoader { struct EsmData; } namespace DetourNavigator { struct Settings; } namespace NavMeshTool { using DetourNavigator::ObjectTransform; using DetourNavigator::TileCachedRecastMeshManager; struct WorldspaceNavMeshInput { ESM::RefId mWorldspace; TileCachedRecastMeshManager mTileCachedRecastMeshManager; btAABB mAabb; bool mAabbInitialized = false; explicit WorldspaceNavMeshInput(ESM::RefId worldspace, const DetourNavigator::RecastSettings& settings); }; class BulletObject { public: BulletObject(osg::ref_ptr&& shapeInstance, const ESM::Position& position, float localScaling) : mShapeInstance(std::move(shapeInstance)) , mObjectTransform{ position, localScaling } , mCollisionObject(BulletHelpers::makeCollisionObject(mShapeInstance->mCollisionShape.get(), Misc::Convert::toBullet(position.asVec3()), Misc::Convert::toBullet(Misc::Convert::makeOsgQuat(position)))) { mShapeInstance->setLocalScaling(btVector3(localScaling, localScaling, localScaling)); } const osg::ref_ptr& getShapeInstance() const noexcept { return mShapeInstance; } const DetourNavigator::ObjectTransform& getObjectTransform() const noexcept { return mObjectTransform; } btCollisionObject& getCollisionObject() const noexcept { return *mCollisionObject; } private: osg::ref_ptr mShapeInstance; DetourNavigator::ObjectTransform mObjectTransform; std::unique_ptr mCollisionObject; }; struct WorldspaceData { std::vector> mNavMeshInputs; std::vector mObjects; std::vector> mLandData; std::vector> mHeightfields; }; WorldspaceData gatherWorldspaceData(const DetourNavigator::Settings& settings, ESM::ReadersCache& readers, const VFS::Manager& vfs, Resource::BulletShapeManager& bulletShapeManager, const EsmLoader::EsmData& esmData, bool processInteriorCells, bool writeBinaryLog); } #endif