From f7b91c2eae24ecb7a20b638246fb849d6c63615a Mon Sep 17 00:00:00 2001 From: Omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 30 Mar 2024 21:39:31 +1100 Subject: start adding mouse input processing --- src/maths/maths.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/maths') diff --git a/src/maths/maths.h b/src/maths/maths.h index 6816415..baa75e9 100644 --- a/src/maths/maths.h +++ b/src/maths/maths.h @@ -9,6 +9,7 @@ #pragma once #include +#include #include "maths_types.h" // --- Helpers @@ -48,6 +49,10 @@ static inline vec3 vec3_cross(vec3 a, vec3 b) { #define VEC3_Z ((vec3){ .x = 0.0, .y = 0.0, .z = 1.0 }) #define VEC3_NEG_Z ((vec3){ .x = 0.0, .y = 0.0, .z = -1.0 }) +static inline void print_vec3(vec3 v) { + printf("{ x: %f, y: %f, z: %f )\n", v.x, v.y, v.z); +} + // TODO: Dimension 2 static inline vec2 vec2_create(f32 x, f32 y) { return (vec2){ x, y }; } -- cgit v1.2.3-70-g09d2 From 2c55e9a73ae1321c14f5186ecc75ac949ad19bbd Mon Sep 17 00:00:00 2001 From: Omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 30 Mar 2024 21:46:10 +1100 Subject: chore: format --- examples/input/ex_input.c | 4 +--- src/maths/maths.h | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/maths') diff --git a/examples/input/ex_input.c b/examples/input/ex_input.c index d3d1fbd..4bbf76a 100644 --- a/examples/input/ex_input.c +++ b/examples/input/ex_input.c @@ -79,8 +79,6 @@ void update_camera_rotation(input_state* input, game_state* game, camera* cam) { game->first_mouse_update = false; } - printf("x offset: %f y offset %f\n", xoffset, yoffset); - float sensitivity = 0.1f; // change this value to your liking xoffset *= sensitivity; yoffset *= sensitivity; @@ -107,7 +105,7 @@ void update_camera_rotation(input_state* input, game_state* game, camera* cam) { // save it back cam->front.x = front.x; cam->front.y = front.y; - // cam->front.z = front.z; + // roll is static print_vec3(cam->front); } diff --git a/src/maths/maths.h b/src/maths/maths.h index baa75e9..6fbdfdf 100644 --- a/src/maths/maths.h +++ b/src/maths/maths.h @@ -49,9 +49,7 @@ static inline vec3 vec3_cross(vec3 a, vec3 b) { #define VEC3_Z ((vec3){ .x = 0.0, .y = 0.0, .z = 1.0 }) #define VEC3_NEG_Z ((vec3){ .x = 0.0, .y = 0.0, .z = -1.0 }) -static inline void print_vec3(vec3 v) { - printf("{ x: %f, y: %f, z: %f )\n", v.x, v.y, v.z); -} +static inline void print_vec3(vec3 v) { printf("{ x: %f, y: %f, z: %f )\n", v.x, v.y, v.z); } // TODO: Dimension 2 static inline vec2 vec2_create(f32 x, f32 y) { return (vec2){ x, y }; } -- cgit v1.2.3-70-g09d2