#include #include Camera* create_camera(vec2 pos) { Camera* camera = new Camera(); camera->position = vec3(pos.x, pos.y, -3.0f); camera->m = new CameraMatrices(); return camera; } void update_camera(Camera* camera, Window window) { int width, height; glfwGetWindowSize(window, &width, &height); assert(camera != NULL); camera->m->view = mat4Transpose(mat4Translate(vec3_spread(camera->position))); switch(camera->projection) { case CAMERA_ORTHOGRAPHIC: camera->m->projection = mat4Transpose(mat4Ortho(0.0f, width, height, 0.0f, 0.0f, 1000.0f)); break; case CAMERA_PERSPECTIVE: camera->m->projection = mat4Transpose(mat4Perspective(45.0f * DEG2RAD, ((double)width / (double)height), 0.1f, 100.0f)); break; } }