get height, camera + cow movement with keys
[demo] / src / terrain.h
index bf9df09..db9464d 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef TERRAIN_H_
 #define TERRAIN_H_
 
+#include "image.h"
+
 class Camera;
-class Image;
 class Scene;
 
 // terrain 8a ftiaxnei skini k taisma renderer
@@ -25,7 +26,7 @@ struct TerrainParams {
        int tile_vsub;
        int num_octaves; /* Perlin noise sums */
        float noise_freq; /* Perlin noise scaling factor */
-       Image *coarse_heightmap; /* mask for low detail heightmap */
+       Image coarse_heightmap; /* mask for low detail heightmap */
 };
 
 class Terrain {
@@ -46,6 +47,9 @@ public:
 
        bool generate(const TerrainParams &params);
        Scene *get_visible(const Camera *camera) const;
+
+       float get_height(float u, float v) const;       
+       float get_height(const Vec3 &pos) const; /* world coordinates */ 
 };
 
 #endif // TERRAIN_H_
\ No newline at end of file