]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/terraintype.h
Add editable terrain objects
[r2c2.git] / source / libr2c2 / terraintype.h
diff --git a/source/libr2c2/terraintype.h b/source/libr2c2/terraintype.h
new file mode 100644 (file)
index 0000000..f0013ad
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef LIBR2C2_TERRAINTYPE_H_
+#define LIBR2C2_TERRAINTYPE_H_
+
+#include <vector>
+#include "objecttype.h"
+
+namespace R2C2 {
+
+class TerrainType: public ObjectType
+{
+public:
+       class Loader: public Msp::DataFile::ObjectLoader<TerrainType>
+       {
+       public:
+               Loader(TerrainType &);
+
+       private:
+               void surface();
+       };
+
+       struct SurfaceType
+       {
+               class Loader: public Msp::DataFile::ObjectLoader<SurfaceType>
+               {
+               public:
+                       Loader(SurfaceType &);
+               };
+
+               float r, g, b;
+
+               SurfaceType();
+       };
+
+private:
+       std::vector<SurfaceType> surface_types;
+       float tile_size;
+       float elevation_granularity;
+
+public:
+       TerrainType(const ArticleNumber &);
+
+       unsigned get_n_surface_types() const { return surface_types.size(); }
+       const SurfaceType &get_surface_type(unsigned) const;
+       float get_tile_size() const { return tile_size; }
+       float get_elevation_granularity() const { return elevation_granularity; }
+};
+
+} // namespace R2C2
+
+#endif