fixed terrain tiles generation
[demo] / src / main.cc
index 933bd62..107fb9d 100644 (file)
@@ -45,7 +45,7 @@ int win_h = 600;
 
 float phi = 25;
 float theta = 0;
-float dist = 4;
+float dist = 16;
 
 ShaderManager *sdr_man;
 
@@ -119,7 +119,6 @@ static bool init(Gfx_API api)
        sdr_man = new ShaderManager;
 
        camera = new OrbitCamera;
-       camera->set_orbit_params(phi, theta, dist);
 
        // scene_ground = new Scene;
        // if(!scene_ground->load("data/ground.obj")) {
@@ -158,11 +157,11 @@ static bool init(Gfx_API api)
        TerrainParams p;
        p.xsz = 50;
        p.ysz = 50;
-       p.max_height = 1;
-       p.xtiles = 1; //40;
-       p.ytiles = 1; // 40;
-       p.tile_usub = 8;
-       p.tile_vsub = 8;
+       p.max_height = 2;
+       p.xtiles = 20;
+       p.ytiles = 20;
+       p.tile_usub = 10;
+       p.tile_vsub = 10;
        p.num_octaves = 3;
        p.noise_freq = 10;
        p.coarse_heightmap = 0;
@@ -233,11 +232,11 @@ static void clbk_motion(GLFWwindow *win, double x, double y)
        prev_y = y;
 
        if(button[0]) {
-               theta += dx;
-               phi += dy;
+               theta += dx * 0.5;
+               phi += dy * 0.5;
 
-               if(phi < -90)
-                       phi = -90;
+               if(phi < 0)
+                       phi = 0;
                if(phi > 90)
                        phi = 90;
        }
@@ -268,7 +267,7 @@ static void clbk_reshape(GLFWwindow *win, int width, int height)
 
 static void display()
 {
-       camera->set_orbit_params(phi, theta, dist);
+       camera->set_orbit_params(theta, phi, dist);
 
        // gfx_clear(0.76, 0.3, 0.43);
        gfx_clear(0.1, 0.1, 0.1);