#ifndef OPENMW_COMPONENTS_NIFBULLET_BULLETNIFLOADER_HPP #define OPENMW_COMPONENTS_NIFBULLET_BULLETNIFLOADER_HPP #include #include #include #include #include #include #include #include #include #include #include class btTriangleMesh; class btCompoundShape; class btCollisionShape; namespace Nif { struct Node; struct Transformation; struct NiTriShape; struct NiTriStrips; struct NiGeometry; struct Parent; } namespace NifBullet { /** *Load bulletShape from NIF files. */ class BulletNifLoader { public: void warn(const std::string& msg) { Log(Debug::Warning) << "NIFLoader: Warn: " << msg; } [[noreturn]] void fail(const std::string& msg) { Log(Debug::Error) << "NIFLoader: Fail: " << msg; abort(); } osg::ref_ptr load(Nif::FileView file); private: bool findBoundingBox(const Nif::Node& node, const std::string& filename); struct HandleNodeArgs { bool mHasMarkers{ false }; bool mAnimated{ false }; bool mIsCollisionNode{ false }; bool mAutogenerated{ false }; bool mAvoid{ false }; }; void handleNode(const std::string& fileName, const Nif::Node& node, const Nif::Parent* parent, HandleNodeArgs args, Resource::VisualCollisionType& visualCollisionType); bool hasRootCollisionNode(const Nif::Node& rootNode) const; bool collisionShapeIsEmpty(const Nif::Node& rootNode) const; void handleNiTriShape(const Nif::NiGeometry& nifNode, const Nif::Parent* parent, HandleNodeArgs args); std::unique_ptr mCompoundShape; std::unique_ptr mAvoidCompoundShape; osg::ref_ptr mShape; }; } #endif