X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fmain.cc;h=92dc433348b04b13016e5b20fa30da2964be67a4;hb=fb89e67e6550d207d2a28599a420455d3c8f0f29;hp=491dd9c4c2c17dcdfb523dcce0bbdab3affc79e1;hpb=73b9db25a6deff93da45f3c45290ca8a56fefed3;p=demo diff --git a/src/main.cc b/src/main.cc index 491dd9c..92dc433 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,4 +1,5 @@ #include +#include #include #include @@ -80,7 +81,7 @@ int main(int argc, char **argv) { Gfx_API api; - for(int i=0; i 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; @@ -305,7 +316,7 @@ static void clbk_motion(GLFWwindow *win, double x, double y) cam_dist = 0.0; } } - } +} static void clbk_mouse(GLFWwindow *win, int bn, int action, int mods) { @@ -315,6 +326,7 @@ static void clbk_mouse(GLFWwindow *win, int bn, int action, int mods) static void clbk_reshape(GLFWwindow *win, int width, int height) { + gfx_reshape(width, height); gfx_viewport(0, 0, width, height); aspect = (float)width / (float)height; mprojection = calc_projection_matrix(45, aspect, 0.5, 1000.0); @@ -355,17 +367,20 @@ 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) { /* poisson radius */ - for (int i = 0; i < 1000; i++) - { + for(int i = 0; i < 1000; i++) { float angle = (float)rand() / (float)RAND_MAX * 2 * M_PI; float r = sqrt((float)rand() / (float)RAND_MAX) * radius; @@ -373,7 +388,7 @@ static bool gen_poisson(std::vector &points, float min_dist, float radius) p.x = cos(angle) * r; p.y = sin(angle) * r; - bool valid = true; + bool valid = true; for(size_t j=0; j &points, float min_dist, float radius) } } return false; -} \ No newline at end of file +}