pioneer/src/TerrainBody.h

54 lines
1.6 KiB
C
Raw Normal View History

// Copyright © 2008-2019 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
#ifndef _TERRAINBODY_H
#define _TERRAINBODY_H
#include "BaseSphere.h"
#include "Body.h"
2012-07-09 06:47:47 -07:00
#include "Camera.h"
#include "galaxy/StarSystem.h"
class Frame;
namespace Graphics {
class Renderer;
}
class TerrainBody : public Body {
public:
OBJDEF(TerrainBody, Body, TERRAINBODY);
virtual void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform) override;
virtual void SubRender(Graphics::Renderer *r, const matrix4x4d &modelView, const vector3d &camPos) {}
virtual void SetFrame(Frame *f) override;
virtual bool OnCollision(Object *b, Uint32 flags, double relVel) override { return true; }
virtual double GetMass() const override { return m_mass; }
double GetTerrainHeight(const vector3d &pos) const;
2012-04-17 18:53:53 -07:00
bool IsSuperType(SystemBody::BodySuperType t) const;
virtual const SystemBody *GetSystemBody() const override { return m_sbody; }
2012-11-26 15:40:03 -08:00
// returns value in metres
double GetMaxFeatureRadius() const { return m_maxFeatureHeight; }
// implements calls to all relevant terrain management sub-systems
static void OnChangeDetailLevel();
protected:
TerrainBody() = delete;
TerrainBody(SystemBody *);
TerrainBody(const Json &jsonObj, Space *space);
virtual ~TerrainBody();
void InitTerrainBody();
virtual void SaveToJson(Json &jsonObj, Space *space) override;
private:
const SystemBody *m_sbody;
double m_mass;
std::unique_ptr<BaseSphere> m_baseSphere;
2012-11-26 15:40:03 -08:00
double m_maxFeatureHeight;
};
#endif