pioneer/src/TerrainBody.h

50 lines
1.5 KiB
C
Raw Normal View History

#ifndef _TERRAINBODY_H
#define _TERRAINBODY_H
#include "Body.h"
#include "galaxy/StarSystem.h"
#include "GeoSphere.h"
2012-07-09 06:47:47 -07:00
#include "Camera.h"
class Frame;
namespace Graphics { class Renderer; }
class TerrainBody : public Body {
public:
OBJDEF(TerrainBody, Body, TERRAINBODY);
virtual void SetPosition(const vector3d &pos) { m_pos = pos; }
virtual vector3d GetPosition() const { return m_pos; }
virtual double GetBoundingRadius() const;
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) {}
virtual void SetFrame(Frame *f);
virtual bool OnCollision(Object *b, Uint32 flags, double relVel) { return true; }
virtual double GetMass() const { 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 { 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();
}
protected:
2012-04-17 18:53:53 -07:00
TerrainBody(SystemBody*);
TerrainBody();
virtual ~TerrainBody();
2012-04-17 18:53:53 -07:00
void InitTerrainBody(SystemBody *);
virtual void Save(Serializer::Writer &wr, Space *space);
virtual void Load(Serializer::Reader &rd, Space *space);
private:
2012-04-17 18:53:53 -07:00
SystemBody *m_sbody;
vector3d m_pos;
double m_mass;
GeoSphere *m_geosphere;
};
#endif