2018-03-18 11:32:45 +00:00
|
|
|
#ifndef OPENMW_MWPHYSICS_HEIGHTFIELD_H
|
|
|
|
#define OPENMW_MWPHYSICS_HEIGHTFIELD_H
|
|
|
|
|
|
|
|
#include <osg/ref_ptr>
|
|
|
|
|
2018-11-25 08:46:09 +00:00
|
|
|
#include <LinearMath/btScalar.h>
|
|
|
|
|
2020-12-25 17:20:42 +00:00
|
|
|
#include <memory>
|
2018-11-25 08:46:09 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2018-03-18 11:32:45 +00:00
|
|
|
class btCollisionObject;
|
|
|
|
class btHeightfieldTerrainShape;
|
|
|
|
|
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class Object;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWPhysics
|
|
|
|
{
|
2020-12-25 17:20:42 +00:00
|
|
|
class PhysicsTaskScheduler;
|
|
|
|
|
2018-03-18 11:32:45 +00:00
|
|
|
class HeightField
|
|
|
|
{
|
|
|
|
public:
|
2021-10-11 17:23:08 +00:00
|
|
|
HeightField(const float* heights, int x, int y, int size, int verts, float minH, float maxH,
|
|
|
|
const osg::Object* holdObject, PhysicsTaskScheduler* scheduler);
|
2018-03-18 11:32:45 +00:00
|
|
|
~HeightField();
|
|
|
|
|
|
|
|
btCollisionObject* getCollisionObject();
|
|
|
|
const btCollisionObject* getCollisionObject() const;
|
|
|
|
const btHeightfieldTerrainShape* getShape() const;
|
|
|
|
|
|
|
|
private:
|
2020-12-25 17:20:42 +00:00
|
|
|
std::unique_ptr<btHeightfieldTerrainShape> mShape;
|
|
|
|
std::unique_ptr<btCollisionObject> mCollisionObject;
|
2018-03-18 11:32:45 +00:00
|
|
|
osg::ref_ptr<const osg::Object> mHoldObject;
|
2021-03-11 23:27:42 +00:00
|
|
|
#if BT_BULLET_VERSION < 310
|
2018-11-25 08:46:09 +00:00
|
|
|
std::vector<btScalar> mHeights;
|
2021-03-11 23:27:42 +00:00
|
|
|
#endif
|
2018-03-18 11:32:45 +00:00
|
|
|
|
2020-12-25 17:20:42 +00:00
|
|
|
PhysicsTaskScheduler* mTaskScheduler;
|
|
|
|
|
2018-03-18 11:32:45 +00:00
|
|
|
void operator=(const HeightField&);
|
|
|
|
HeightField(const HeightField&);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|