diff options
author | Omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-03-31 15:35:04 +1100 |
---|---|---|
committer | Omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-03-31 15:35:04 +1100 |
commit | a56349f682862f065c5e5af6183643fcb1f19617 (patch) | |
tree | 65dbee62ec2519f5d39b125f2d551c669b09703f /examples/input | |
parent | 6463c6c1090644438d8449f7ae1a152a4a196123 (diff) |
redo cube primitive vertex and normals
Diffstat (limited to 'examples/input')
-rw-r--r-- | examples/input/ex_input.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/examples/input/ex_input.c b/examples/input/ex_input.c index f102fad..3101968 100644 --- a/examples/input/ex_input.c +++ b/examples/input/ex_input.c @@ -23,20 +23,19 @@ void update_camera_rotation(input_state* input, game_state* game, camera* cam); int main() { core* core = core_bringup(); - vec3 cam_pos = vec3_create(-15, 20.0, 13); + vec3 cam_pos = vec3_create(5, 5, 5); game_state game = { .camera = camera_create(cam_pos, vec3_negate(cam_pos), VEC3_Y, deg_to_rad(45.0)), .camera_euler = vec3_create(90, 0, 0), .first_mouse_update = true, }; - // model_handle cube_handle = prim_cube_new(core); - printf("Starting look direction: "); print_vec3(game.camera.front); // Main loop - const f32 camera_speed = 0.4; + const f32 camera_lateral_speed = 0.2; + const f32 camera_zoom_speed = 0.15; while (!should_exit(core)) { input_update(&core->input); @@ -44,18 +43,18 @@ int main() { vec3 translation = VEC3_ZERO; if (key_is_pressed(KEYCODE_W) || key_is_pressed(KEYCODE_KEY_UP)) { printf("Move Forwards\n"); - translation = vec3_mult(game.camera.front, camera_speed); + translation = vec3_mult(game.camera.front, camera_zoom_speed); } else if (key_is_pressed(KEYCODE_S) || key_is_pressed(KEYCODE_KEY_DOWN)) { printf("Move Backwards\n"); - translation = vec3_mult(game.camera.front, -camera_speed); + translation = vec3_mult(game.camera.front, -camera_zoom_speed); } else if (key_is_pressed(KEYCODE_A) || key_is_pressed(KEYCODE_KEY_LEFT)) { printf("Move Left\n"); vec3 lateral = vec3_normalise(vec3_cross(game.camera.front, game.camera.up)); - translation = vec3_mult(lateral, -camera_speed); + translation = vec3_mult(lateral, -camera_lateral_speed); } else if (key_is_pressed(KEYCODE_D) || key_is_pressed(KEYCODE_KEY_RIGHT)) { printf("Move Right\n"); vec3 lateral = vec3_normalise(vec3_cross(game.camera.front, game.camera.up)); - translation = vec3_mult(lateral, camera_speed); + translation = vec3_mult(lateral, camera_lateral_speed); } game.camera.position = vec3_add(game.camera.position, translation); // update_camera_rotation(&core->input, &game, &game.camera); @@ -64,7 +63,6 @@ int main() { render_frame_begin(&core->renderer); - // model cube = core->models->data[cube_handle.raw]; mat4 model = mat4_translation(VEC3_ZERO); gfx_backend_draw_frame(&core->renderer, &game.camera, model); @@ -86,7 +84,7 @@ void update_camera_rotation(input_state* input, game_state* game, camera* cam) { game->first_mouse_update = false; } - float sensitivity = 0.1f; // change this value to your liking + float sensitivity = 0.2f; // change this value to your liking xoffset *= sensitivity; yoffset *= sensitivity; |