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);
74 void save(std::list<Msp::DataFile::Statement> &) const;
76 T find_mode(T Node::*) const;
79 struct NodeCoordinates
85 NodeCoordinates(unsigned, unsigned, unsigned);
88 sigc::signal<void, unsigned, unsigned> signal_size_changed;
89 sigc::signal<void, unsigned, unsigned> signal_tile_changed;
92 const TerrainType &type;
95 std::vector<Tile> tiles;
98 Terrain(Layout &, const TerrainType &);
101 virtual Terrain *clone(Layout *) const;
103 virtual const TerrainType &get_type() const { return type; }
104 virtual void set_position(const Vector &);
105 virtual void set_rotation(const Angle &);
106 virtual void set_tilt(const Angle &) { }
108 void set_size(unsigned, unsigned);
109 unsigned get_width() const { return width; }
110 unsigned get_height() const { return height; }
111 const Tile &get_tile(unsigned, unsigned) const;
112 void set_node_elevation(const NodeCoordinates &, float, bool = false);
113 float get_node_elevation(const NodeCoordinates &) const;
114 Vector get_node_position(const NodeCoordinates &) const;
115 NodeCoordinates get_closest_node(const Ray &) const;
117 void save(std::list<Msp::DataFile::Statement> &) const;