aboutsummaryrefslogtreecommitdiff
path: root/samples/OpenGL/qt_terr/terrain.h
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2014-10-07 03:38:55 +0200
committerWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2014-10-07 03:38:55 +0200
commit1e387fc8eee4925616967edd26de0ee416dbce3f (patch)
treef6be0b844c724d6c4891f325912bb4f3f2f26c4b /samples/OpenGL/qt_terr/terrain.h
parent3ce7214d2300e2769667649625d160dcdc01499c (diff)
parentb62b7bf28ec0069e6f460fa0f07b64a0dba72557 (diff)
downloadcodesamples-1e387fc8eee4925616967edd26de0ee416dbce3f.tar.gz
codesamples-1e387fc8eee4925616967edd26de0ee416dbce3f.tar.bz2
Merge branch 'master' of git://github.com/datenwolf/codesamples
Diffstat (limited to 'samples/OpenGL/qt_terr/terrain.h')
-rw-r--r--samples/OpenGL/qt_terr/terrain.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/samples/OpenGL/qt_terr/terrain.h b/samples/OpenGL/qt_terr/terrain.h
new file mode 100644
index 0000000..3382a4c
--- /dev/null
+++ b/samples/OpenGL/qt_terr/terrain.h
@@ -0,0 +1,33 @@
+#ifndef TERRAIN_H
+#define TERRAIN_H
+
+#include "quad.h"
+
+#include <vector>
+#include <math.h>
+
+class Terrain : public Quad
+{
+public:
+ double z_mean_;
+ double z_mean() {
+ if( isnan(z_mean_) ) {
+ return z_mean_ =
+ ( z[0][0] + z[0][1] +
+ z[1][0] + z[1][1] ) / 4.;
+ }
+ return z_mean_;
+ };
+ double z[2][2];
+
+public:
+ Terrain(std::vector<double>* V_) : Quad(V_) { z_mean_ = NAN; }
+
+ virtual void split();
+ virtual void track_down(double x, double y, double nz, int levels);
+
+/*protected:
+ virtual void set_range(double nx1, double nx2, double ny1, double ny2);*/
+};
+
+#endif/*TERRAIN_H*/