1 #ifndef LIBR2C2_TERRAIN_H_
2 #define LIBR2C2_TERRAIN_H_
5 #include "terraintype.h"
9 class Terrain: public Object
12 class Loader: public Msp::DataFile::ObjectLoader<Terrain>
21 void position(float, float, float);
23 void size(unsigned, unsigned);
25 void tile_coords(unsigned, unsigned);
30 class Loader: public Msp::DataFile::ObjectLoader<Node>
36 Loader(Terrain &, Node &);
39 void ground(unsigned);
48 void save(std::list<Msp::DataFile::Statement> &) const;
53 class Loader: public Msp::DataFile::ObjectLoader<Tile>
59 Loader(Terrain &, Tile &);
62 void ground(unsigned);
63 void elevation(float);
72 void set_node_elevation(unsigned, float);
73 void save(std::list<Msp::DataFile::Statement> &) const;
76 struct NodeCoordinates
82 NodeCoordinates(unsigned, unsigned, unsigned);
85 sigc::signal<void, unsigned, unsigned> signal_size_changed;
86 sigc::signal<void, unsigned, unsigned> signal_tile_changed;
89 const TerrainType &type;
92 std::vector<Tile> tiles;
95 Terrain(Layout &, const TerrainType &);
98 virtual Terrain *clone(Layout *) const;
100 virtual const TerrainType &get_type() const { return type; }
101 virtual void set_position(const Vector &);
102 virtual void set_rotation(const Angle &);
103 virtual void set_tilt(const Angle &) { }
105 void set_size(unsigned, unsigned);
106 unsigned get_width() const { return width; }
107 unsigned get_height() const { return height; }
108 const Tile &get_tile(unsigned, unsigned) const;
109 void set_node_elevation(const NodeCoordinates &, float, bool = false);
110 float get_node_elevation(const NodeCoordinates &) const;
111 Vector get_node_position(const NodeCoordinates &) const;
112 NodeCoordinates get_closest_node(const Ray &) const;
114 void save(std::list<Msp::DataFile::Statement> &) const;