Fudge some constants

This commit is contained in:
Michael Zhang 2023-04-25 20:01:36 -05:00
parent ef22869e48
commit ac5aa57d80
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B

View file

@ -129,10 +129,14 @@ float aspect;
GLuint verts_vbo[1], colors_vbo[1], normals_vbo[1], faces_ibo[1], tris_vao;
TriMesh mesh;
// In world coordinates
Vec3f eye_pos(0., 0., 0.);
// These are all world coordinates
// This starting position has been determined experimentally
Vec3f eye_pos(-17.384075, -13.250000, 0.0);
Vec3f eye_dir;
float view_angle = 0.0f;
float view_angle = -PI / 2;
float vertical_view_angle = 0.0f;
Vec3f up_dir(0., -1., 0.);
namespace viewing_window {
@ -148,7 +152,7 @@ float bottom = -val, top = val;
const auto WIDTH_ZOOM = 1.0 / 30.0, HEIGHT_ZOOM = 1.0 / 30.0;
const float MOVE_BY = 0.25; // 0.75 is actually really fast?
const float ANGLE_BY = 0.05;
const float ANGLE_BY = PI / 120;
float horizontal_fov = 1.0, vertical_fov = 1.0;
@ -158,7 +162,8 @@ namespace controls {
bool is_left_held = false, is_right_held = false, is_up_held = false,
is_down_held = false;
bool is_raise_held = false, is_lower_held = false;
bool is_spin_left_held = false, is_spin_right_held = false;
bool is_spin_left_held = false, is_spin_right_held = false,
is_spin_up_held = false, is_spin_down_held = false;
} // namespace controls
// Model, view and projection matrices, initialized to the identity
@ -206,6 +211,15 @@ static void key_callback(GLFWwindow *window, int key, int scancode, int action,
if (key == GLFW_KEY_RIGHT_BRACKET)
is_lower_held = action == GLFW_PRESS || action == GLFW_REPEAT;
// These have alternatives because my keyboard doesn't have arrow keys so
// it's mapped to IJKL
if (key == GLFW_KEY_I || key == GLFW_KEY_UP)
is_spin_up_held = action == GLFW_PRESS || action == GLFW_REPEAT;
if (key == GLFW_KEY_K || key == GLFW_KEY_DOWN)
is_spin_down_held = action == GLFW_PRESS || action == GLFW_REPEAT;
if (key == GLFW_KEY_J || key == GLFW_KEY_LEFT)
is_spin_left_held = action == GLFW_PRESS || action == GLFW_REPEAT;
@ -325,7 +339,8 @@ int main(int argc, char *argv[]) {
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
// TODO: REMOVE THIS BEFORE TURNING IN
// This is here because I have a tiling window manager that automatically
// snaps the size of the window
// glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
// Create the glfw window
@ -524,8 +539,9 @@ void update() {
if (is_up_held || is_down_held || is_left_held || is_right_held ||
is_raise_held || is_lower_held) {
eye_pos += move_by;
printf("Move by (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f)\n", move_by[0],
move_by[1], move_by[2], eye_pos[0], eye_pos[1], eye_pos[2]);
// printf("Move by (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f)\n",
// move_by[0],
// move_by[1], move_by[2], eye_pos[0], eye_pos[1], eye_pos[2]);
}
if (is_spin_left_held)