2020-12-31 07:32:16 -08:00
|
|
|
// Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details
|
2012-09-15 17:59:15 -07:00
|
|
|
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
|
2012-09-12 04:38:30 -07:00
|
|
|
|
2011-09-03 05:11:22 -07:00
|
|
|
#ifndef _TERRAINBODY_H
|
|
|
|
#define _TERRAINBODY_H
|
|
|
|
|
2019-01-02 08:59:07 -08:00
|
|
|
#include "Body.h"
|
2019-05-03 17:53:44 -07:00
|
|
|
#include "JsonFwd.h"
|
2019-10-16 12:10:22 -07:00
|
|
|
#include "matrix4x4.h"
|
2011-09-03 05:53:03 -07:00
|
|
|
|
2019-10-16 12:10:22 -07:00
|
|
|
class BaseSphere;
|
2019-05-03 17:53:44 -07:00
|
|
|
class Camera;
|
2011-09-03 05:53:03 -07:00
|
|
|
class Frame;
|
2019-10-16 12:10:22 -07:00
|
|
|
class Space;
|
2019-05-03 19:30:27 -07:00
|
|
|
class SystemBody;
|
2019-05-03 17:53:44 -07:00
|
|
|
|
2019-01-02 08:59:07 -08:00
|
|
|
namespace Graphics {
|
|
|
|
class Renderer;
|
|
|
|
}
|
2011-09-03 05:11:22 -07:00
|
|
|
|
|
|
|
class TerrainBody : public Body {
|
|
|
|
public:
|
|
|
|
OBJDEF(TerrainBody, Body, TERRAINBODY);
|
|
|
|
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override;
|
2013-06-29 08:17:21 -07:00
|
|
|
virtual void SubRender(Graphics::Renderer *r, const matrix4x4d &modelView, const vector3d &camPos) {}
|
2019-10-07 09:12:28 -07:00
|
|
|
virtual void SetFrame(FrameId fId) override;
|
2020-11-11 16:33:04 -08:00
|
|
|
virtual bool OnCollision(Body *b, Uint32 flags, double relVel) override { return true; }
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual double GetMass() const override { return m_mass; }
|
2012-09-03 07:54:22 -07:00
|
|
|
double GetTerrainHeight(const vector3d &pos) const;
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual const SystemBody *GetSystemBody() const override { return m_sbody; }
|
2012-11-25 19:05:43 -08:00
|
|
|
|
2012-11-26 15:40:03 -08:00
|
|
|
// returns value in metres
|
|
|
|
double GetMaxFeatureRadius() const { return m_maxFeatureHeight; }
|
2011-09-03 05:53:03 -07:00
|
|
|
|
2014-03-05 12:28:17 -08:00
|
|
|
// implements calls to all relevant terrain management sub-systems
|
|
|
|
static void OnChangeDetailLevel();
|
|
|
|
|
2011-09-03 05:11:22 -07:00
|
|
|
protected:
|
2019-02-02 10:37:07 -08:00
|
|
|
TerrainBody() = delete;
|
2019-01-02 08:59:07 -08:00
|
|
|
TerrainBody(SystemBody *);
|
2019-02-02 10:37:07 -08:00
|
|
|
TerrainBody(const Json &jsonObj, Space *space);
|
2011-09-03 05:53:03 -07:00
|
|
|
virtual ~TerrainBody();
|
|
|
|
|
2014-03-05 12:28:17 -08:00
|
|
|
void InitTerrainBody();
|
2011-09-03 05:53:03 -07:00
|
|
|
|
2018-10-11 08:10:23 -07:00
|
|
|
virtual void SaveToJson(Json &jsonObj, Space *space) override;
|
2011-09-03 05:11:22 -07:00
|
|
|
|
|
|
|
private:
|
2014-03-05 12:28:17 -08:00
|
|
|
const SystemBody *m_sbody;
|
2011-09-03 05:53:03 -07:00
|
|
|
double m_mass;
|
2014-03-05 12:28:17 -08:00
|
|
|
std::unique_ptr<BaseSphere> m_baseSphere;
|
2012-11-26 15:40:03 -08:00
|
|
|
double m_maxFeatureHeight;
|
2011-09-03 05:11:22 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|