-// TODO delete: debugging
- for(size_t i=0; i<scene->objects.size(); ++i) {
- printf("object: %d\n", (int)i);
- printf("mesh: %s\n", scene->objects[i]->mesh->name.c_str());
- printf("material: %s\n", scene->objects[i]->material->name.c_str());
- printf("transform:\n");
- scene->objects[i]->transform.print();
+ p.xsz = 20;//200;
+ p.ysz = 20; //200;
+ p.max_height = 3;//30;
+ p.xtiles = 4;//40;
+ p.ytiles = 4;//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;
+
+ terrain_rend = new Renderer;
+ terrain_rend->camera = camera;
+ terrain_rend->scene = terrain.get_visible(camera);
+
+ skybox_tex = gfx_create_texture();
+ skybox_tex->load("data/cubemap/cubemap.hdr");
+ terrain_rend->set_sky_tex(skybox_tex);
+
+ irradiance_tex = gfx_create_texture();
+ irradiance_tex->load("data/cubemap/irradiance.hdr");
+ terrain_rend->set_diffuse_sky_tex(irradiance_tex);
+
+ if(!terrain_rend->create()) {
+ fprintf(stderr, "terrain fail\n");
+ return false;
+ }
+ terrain_rend->fog_density = fog_density;
+
+ cow_scene = new Scene;
+ if(!cow_scene->load("data/spot/spot.obj")) {
+ fprintf(stderr, "Failed to load scene: spot.obj.\n");
+ return false;
+ }
+
+ cow_rend = new MorphRenderer;
+ cow_rend->camera = camera;
+ cow_rend->scene = cow_scene;
+ cow_rend->fog_density = fog_density;
+
+ if(!cow_rend->create()) {
+ fprintf(stderr, "Failed to create renderer for cows.\n");
+ return false;