#include <GL/glew.h>
+#include <GLFW/glfw3.h>
#include <stdio.h>
#include <stdlib.h>
{
Gfx_API api;
- for(int i=0; i<argc; ++i) {
+ for(int i=1; i<argc; i++) {
if(strcmp(argv[i], "-opengl") == 0) {
api = GFX_GL;
printf("Backend: OpenGL.\n");
return 1;
}
+ //TODO
+ //return 0;
+
glfwSetKeyCallback(win, clbk_key);
glfwSetCursorPosCallback(win, clbk_motion);
glfwSetMouseButtonCallback(win, clbk_mouse);
}
cleanup();
- // atexit(cleanup);
return 0;
}
Object *cow = new Object;
*cow = *cow0;
- if (!gen_poisson(cow_pos, cow_gap, disk_radius))
+ if(!gen_poisson(cow_pos, cow_gap, disk_radius))
goto cowgen_end;
Vec2 pos = cow_pos.back();
float y = terrain.get_height(Vec3(pos.x, 1, pos.y));
cam_dist = 0.0;
}
}
- }
+}
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);
static bool gen_poisson(std::vector<Vec2> &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;
p.x = cos(angle) * r;
p.y = sin(angle) * r;
- bool valid = true;
+ bool valid = true;
for(size_t j=0; j<points.size(); j++) {
if(length_sq(points[j] - p) < min_dist * min_dist) {
valid = false;
}
}
return false;
-}
\ No newline at end of file
+}