X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fmain.cc;h=aeb57a64e2b572cf667323e822792361d1747b9e;hb=HEAD;hp=4e2c72fb853b26240a6590e7c21a8fd44e128143;hpb=9148ff7614b1dc22fd5d1dcf6d74e2fb4ff13706;p=demo diff --git a/src/main.cc b/src/main.cc index 4e2c72f..aeb57a6 100644 --- a/src/main.cc +++ b/src/main.cc @@ -62,7 +62,7 @@ static OrbitCamera *camera; static float fog_density; -static int num_cows = 400; +static int num_cows = 1; static float cow_gap = 4; static Scene *cow_scene; static MorphRenderer *cow_rend; @@ -72,6 +72,7 @@ static TerrainParams p; static Texture *skybox_tex; static Texture *irradiance_tex; static Texture *terrain_tex; +static Texture *dirt_tex; static Material terrain_mat; static Renderer *terrain_rend; @@ -115,7 +116,7 @@ int main(int argc, char **argv) while(!glfwWindowShouldClose(win)) { display(); - glfwSwapBuffers(win); + gfx_swapbuffers(); glfwPollEvents(); } @@ -136,7 +137,13 @@ static bool init(Gfx_API api) terrain_tex = gfx_create_texture(); if(!terrain_tex->load("data/grass.jpeg")) { - fprintf(stderr, "Failed to load ground texture.\n"); + fprintf(stderr, "Failed to load ground grass texture.\n"); + return false; + } + + dirt_tex = gfx_create_texture(); + if(!dirt_tex->load("data/dirt.jpg")) { + fprintf(stderr, "Failed to load ground dirt texture.\n"); return false; } @@ -146,11 +153,11 @@ static bool init(Gfx_API api) return false; } - p.xsz = 200; - p.ysz = 200; - p.max_height = 30; - p.xtiles = 40; - p.ytiles = 40; + 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; @@ -264,12 +271,20 @@ static void clbk_key(GLFWwindow *win, int key, int scancode, int action, int mod break; // case 'F': - // fog_density = fog_density < 1 - 0.0009 ? fog_density + 0.0001 : 1; - // break; + // fog_density = fog_density < 1 - 0.0009 ? fog_density + 0.0001 : 1; + // break; // case 'U': - // fog_density = fog_density > 0.0001 ? fog_density - 0.0001 : 0; - // break; + // fog_density = fog_density > 0.0001 ? fog_density - 0.0001 : 0; + // break; + + case 'P': + gfx_wireframe(true); + break; + + case 'F': + gfx_wireframe(false); + break; default: break; @@ -359,10 +374,14 @@ static void display() camera->set_orbit_params(cam_theta, cam_phi, cam_dist); camera->set_position(cam_pos.x, cam_pos.y, cam_pos.z); + gfx_begin_drawing(); + gfx_clear(0.1, 0.1, 0.1); terrain_rend->draw(); cow_rend->draw(); + + gfx_end_drawing(); } static bool gen_poisson(std::vector &points, float min_dist, float radius)