1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-01 20:15:34 +00:00
openmw/components/detournavigator/recastmeshobject.hpp

69 lines
1.8 KiB
C++
Raw Normal View History

2018-05-26 14:44:25 +00:00
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHOBJECT_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHOBJECT_H
2018-07-18 19:09:50 +00:00
#include "areatype.hpp"
#include <components/resource/bulletshape.hpp>
2018-05-26 14:44:25 +00:00
#include <LinearMath/btTransform.h>
#include <osg/ref_ptr>
2018-05-26 14:44:25 +00:00
#include <functional>
#include <vector>
class btCollisionShape;
class btCompoundShape;
namespace DetourNavigator
{
class CollisionShape
{
public:
CollisionShape(osg::ref_ptr<const Resource::BulletShapeInstance> instance, const btCollisionShape& shape)
: mShapeInstance(std::move(instance))
, mShape(shape)
{}
const osg::ref_ptr<const Resource::BulletShapeInstance>& getShapeInstance() const { return mShapeInstance; }
const btCollisionShape& getShape() const { return mShape; }
private:
osg::ref_ptr<const Resource::BulletShapeInstance> mShapeInstance;
std::reference_wrapper<const btCollisionShape> mShape;
};
2018-05-26 14:44:25 +00:00
class RecastMeshObject
{
public:
RecastMeshObject(const CollisionShape& shape, const btTransform& transform, const AreaType areaType);
2018-05-26 14:44:25 +00:00
2018-07-18 19:09:50 +00:00
bool update(const btTransform& transform, const AreaType areaType);
2018-05-26 14:44:25 +00:00
const btCollisionShape& getShape() const
{
return mShape;
}
const btTransform& getTransform() const
{
return mTransform;
}
2018-07-18 19:09:50 +00:00
AreaType getAreaType() const
2018-07-12 08:44:11 +00:00
{
2018-07-18 19:09:50 +00:00
return mAreaType;
2018-07-12 08:44:11 +00:00
}
2018-05-26 14:44:25 +00:00
private:
osg::ref_ptr<const Resource::BulletShapeInstance> mShapeInstance;
2018-05-26 14:44:25 +00:00
std::reference_wrapper<const btCollisionShape> mShape;
btTransform mTransform;
2018-07-18 19:09:50 +00:00
AreaType mAreaType;
2019-03-03 12:51:02 +00:00
btVector3 mLocalScaling;
2018-05-26 14:44:25 +00:00
std::vector<RecastMeshObject> mChildren;
};
}
#endif