mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 01:26:39 +00:00 
			
		
		
		
	Choose a parent base on which node is used to iterate over children nodes. This leads to duplicate handing of child nodes. A node will be handled so many times how many parents it has. For example: p1 p2 \ / c Will be handled as: p1 p2 | | c c If c has children they will be handled X times c is handled.
		
			
				
	
	
		
			81 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			81 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef OPENMW_COMPONENTS_NIFBULLET_BULLETNIFLOADER_HPP
 | 
						|
#define OPENMW_COMPONENTS_NIFBULLET_BULLETNIFLOADER_HPP
 | 
						|
 | 
						|
#include <cassert>
 | 
						|
#include <string>
 | 
						|
#include <set>
 | 
						|
#include <map>
 | 
						|
 | 
						|
#include <osg/Matrixf>
 | 
						|
#include <osg/BoundingBox>
 | 
						|
#include <osg/ref_ptr>
 | 
						|
#include <osg/Referenced>
 | 
						|
 | 
						|
#include <BulletCollision/CollisionShapes/btCompoundShape.h>
 | 
						|
 | 
						|
#include <components/debug/debuglog.hpp>
 | 
						|
#include <components/nif/niffile.hpp>
 | 
						|
#include <components/resource/bulletshape.hpp>
 | 
						|
 | 
						|
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<Resource::BulletShape> load(const Nif::File& file);
 | 
						|
 | 
						|
private:
 | 
						|
    bool findBoundingBox(const Nif::Node& node, const std::string& filename);
 | 
						|
 | 
						|
    void handleNode(const std::string& fileName, const Nif::Node& node, const Nif::Parent* parent, int flags,
 | 
						|
        bool isCollisionNode, bool isAnimated=false, bool autogenerated=false, bool avoid=false);
 | 
						|
 | 
						|
    bool hasAutoGeneratedCollision(const Nif::Node& rootNode);
 | 
						|
 | 
						|
    void handleNiTriShape(const Nif::Node& nifNode, const Nif::Parent* parent, int flags, const osg::Matrixf& transform,
 | 
						|
        bool isAnimated, bool avoid);
 | 
						|
 | 
						|
    void handleNiTriShape(const Nif::NiGeometry& nifNode, const Nif::Parent* parent, const osg::Matrixf& transform,
 | 
						|
        bool isAnimated, bool avoid);
 | 
						|
 | 
						|
    std::unique_ptr<btCompoundShape, Resource::DeleteCollisionShape> mCompoundShape;
 | 
						|
 | 
						|
    std::unique_ptr<btTriangleMesh> mStaticMesh;
 | 
						|
 | 
						|
    std::unique_ptr<btTriangleMesh> mAvoidStaticMesh;
 | 
						|
 | 
						|
    osg::ref_ptr<Resource::BulletShape> mShape;
 | 
						|
};
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
#endif
 |