2011-09-03 05:11:22 -07:00
|
|
|
#ifndef _TERRAINBODY_H
|
|
|
|
#define _TERRAINBODY_H
|
|
|
|
|
|
|
|
#include "Body.h"
|
2012-04-04 18:53:58 -07:00
|
|
|
#include "galaxy/StarSystem.h"
|
2011-11-09 15:07:12 -08:00
|
|
|
#include "GeoSphere.h"
|
2012-07-09 06:47:47 -07:00
|
|
|
#include "Camera.h"
|
2011-09-03 05:53:03 -07:00
|
|
|
|
|
|
|
class Frame;
|
2012-02-21 02:04:06 -08:00
|
|
|
namespace Graphics { class Renderer; }
|
2011-09-03 05:11:22 -07:00
|
|
|
|
|
|
|
class TerrainBody : public Body {
|
|
|
|
public:
|
|
|
|
OBJDEF(TerrainBody, Body, TERRAINBODY);
|
|
|
|
|
2012-09-03 07:54:22 -07:00
|
|
|
virtual void SetPosition(const vector3d &pos) { m_pos = pos; }
|
2011-09-03 05:53:03 -07:00
|
|
|
virtual vector3d GetPosition() const { return m_pos; }
|
|
|
|
virtual double GetBoundingRadius() const;
|
2012-07-24 22:51:17 -07:00
|
|
|
virtual void Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform);
|
|
|
|
virtual void SubRender(Graphics::Renderer *r, const Camera *camera, const vector3d &camPos) {}
|
2011-09-03 05:53:03 -07:00
|
|
|
virtual void SetFrame(Frame *f);
|
|
|
|
virtual bool OnCollision(Object *b, Uint32 flags, double relVel) { return true; }
|
|
|
|
virtual double GetMass() const { return m_mass; }
|
2012-09-03 07:54:22 -07:00
|
|
|
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 { return m_sbody; }
|
2011-10-22 00:09:09 -07:00
|
|
|
GeoSphere *GetGeoSphere() const { return m_geosphere; }
|
2012-04-01 10:22:47 -07:00
|
|
|
double GetMaxFeatureRadius() const { // returns value in metres
|
2011-09-28 23:32:41 -07:00
|
|
|
return (m_geosphere->GetMaxFeatureHeight() + 1.0) * m_sbody->GetRadius();
|
2012-07-04 12:13:48 -07:00
|
|
|
}
|
2011-09-03 05:53:03 -07:00
|
|
|
|
2011-09-03 05:11:22 -07:00
|
|
|
protected:
|
2012-04-17 18:53:53 -07:00
|
|
|
TerrainBody(SystemBody*);
|
2011-09-03 05:11:22 -07:00
|
|
|
TerrainBody();
|
2011-09-03 05:53:03 -07:00
|
|
|
virtual ~TerrainBody();
|
|
|
|
|
2012-04-17 18:53:53 -07:00
|
|
|
void InitTerrainBody(SystemBody *);
|
2011-09-03 05:53:03 -07:00
|
|
|
|
2011-11-17 21:41:00 -08:00
|
|
|
virtual void Save(Serializer::Writer &wr, Space *space);
|
2011-11-17 13:38:06 -08:00
|
|
|
virtual void Load(Serializer::Reader &rd, Space *space);
|
2011-09-03 05:11:22 -07:00
|
|
|
|
|
|
|
private:
|
2012-04-17 18:53:53 -07:00
|
|
|
SystemBody *m_sbody;
|
2011-09-03 05:53:03 -07:00
|
|
|
vector3d m_pos;
|
|
|
|
double m_mass;
|
|
|
|
GeoSphere *m_geosphere;
|
2011-09-03 05:11:22 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|