- // scene_ground = new Scene;
- // if(!scene_ground->load("data/ground.obj")) {
- // fprintf(stderr, "Failed to load scene: ground.obj.\n");
- // return false;
- // }
+ terrain_tex = gfx_create_texture();
+ if(!terrain_tex->load("data/grass.jpeg")) {
+ fprintf(stderr, "Failed to load ground texture.\n");
+ return false;
+ }
+
+ Image ter_hmap;
+ if(!ter_hmap.load("data/terhmap.png")) {
+ fprintf(stderr, "Failed to load terrain heightmap.\n");
+ return false;
+ }
+
+ p.xsz = 200;
+ p.ysz = 200;
+ p.max_height = 30;
+ p.xtiles = 40;
+ p.ytiles = 40;
+ p.tile_usub = 10;
+ p.tile_vsub = 10;
+ p.num_octaves = 3;
+ p.noise_freq = 5;
+ p.coarse_heightmap = ter_hmap;
+
+ terrain.init();
+ terrain.generate(p);
+
+ terrain_mat.diffuse = Vec3(1, 1, 1);
+ terrain_mat.specular = Vec3(0, 0, 0);
+ terrain_mat.shininess = 40;
+ terrain_mat.dtex = terrain_tex;
+ terrain_mat.name = "tt";
+
+ terrain.material = terrain_mat;