added function that procedurally generates heightfield
[demo] / src / terrain.cc
index e69de29..6bfabe8 100644 (file)
@@ -0,0 +1,39 @@
+#include "camera.h"
+#include "image.h"
+#include "scene.h"
+#include "terrain.h"
+
+Terrain::Terrain() {}
+
+Terrain::~Terrain()
+{
+}
+
+bool Terrain::generate(const TerrainParams &params)
+{
+       // if(xsz <= 0 || ysz <=0) {
+       //      fprintf(stderr, "Invalid terrain size.\n");
+       //      return false;
+       // }
+
+       // if(xtiles <= 0 || ytiles <= 0) {
+       //      fprintf(stderr, "Invalid number of terrain tiles.\n");
+       //      return false;
+       // }
+
+       // if(tiles)
+       //      tiles.clear();
+
+       // int tsz = xtiles * ytiles;
+       // tiles.resize(tsz);
+
+       // for(int i=0; i<tsz; i++) {
+
+       // }
+       return true;
+}
+
+Scene *Terrain::get_visible(const Camera *camera) const
+{
+       return 0;
+}