added function that procedurally generates heightfield
[demo] / src / terrain.h
index d6f4844..f2ecd69 100644 (file)
@@ -1,6 +1,44 @@
 #ifndef TERRAIN_H_
 #define TERRAIN_H_
 
+class Camera;
+class Image;
+class Scene;
 
+// terrain 8a ftiaxnei skini k taisma renderer
+class TerrainTile {
+private:
+       Mesh *mesh;
+
+};
+
+/* parameters needed in terrain generation */
+
+struct TerrainParams {
+       float xsz; /* terrain size in x axis */
+       float ysz; /* terrain size in y axis */
+       float max_height; /* max height of the heightfield */
+       int xtiles; /* number of tiles in x axis */
+       int ytiles; /* number of tiles in y axis */
+       int tile_usub;
+       int tile_vsub;
+       int num_octaves; /* Perlin noise sums */
+       Image *coarse_heightmap; /* mask for low detail heightmap */
+};
+
+class Terrain {
+private:
+       TerrainParams params;
+       mutable Scene *vis_scene; /* set of visible tiles returned by get_visible */
+
+       std::vector<TerrainTile> tiles;
+       
+public:
+       Terrain();
+       ~Terrain();
+
+       bool generate(const TerrainParams &params);
+       Scene *get_visible(const Camera *camera) const;
+};
 
 #endif // TERRAIN_H_
\ No newline at end of file