| 49 | {} |
| 50 | |
| 51 | void FreeCamera::update(float delta_time) |
| 52 | { |
| 53 | glm::vec3 delta_translation(0.0f, 0.0f, 0.0f); |
| 54 | glm::vec3 delta_rotation(0.0f, 0.0f, 0.0f); |
| 55 | |
| 56 | float mul_translation = speed_multiplier; |
| 57 | |
| 58 | if (key_pressed[KeyCode::W]) |
| 59 | { |
| 60 | delta_translation.z -= TRANSLATION_MOVE_STEP; |
| 61 | } |
| 62 | if (key_pressed[KeyCode::S]) |
| 63 | { |
| 64 | delta_translation.z += TRANSLATION_MOVE_STEP; |
| 65 | } |
| 66 | if (key_pressed[KeyCode::A]) |
| 67 | { |
| 68 | delta_translation.x -= TRANSLATION_MOVE_STEP; |
| 69 | } |
| 70 | if (key_pressed[KeyCode::D]) |
| 71 | { |
| 72 | delta_translation.x += TRANSLATION_MOVE_STEP; |
| 73 | } |
| 74 | if (key_pressed[KeyCode::Q]) |
| 75 | { |
| 76 | delta_translation.y -= TRANSLATION_MOVE_STEP; |
| 77 | } |
| 78 | if (key_pressed[KeyCode::E]) |
| 79 | { |
| 80 | delta_translation.y += TRANSLATION_MOVE_STEP; |
| 81 | } |
| 82 | if (key_pressed[KeyCode::LeftControl]) |
| 83 | { |
| 84 | mul_translation *= (1.0f * TRANSLATION_MOVE_SPEED); |
| 85 | } |
| 86 | if (key_pressed[KeyCode::LeftShift]) |
| 87 | { |
| 88 | mul_translation *= (1.0f / TRANSLATION_MOVE_SPEED); |
| 89 | } |
| 90 | |
| 91 | if (key_pressed[KeyCode::I]) |
| 92 | { |
| 93 | delta_rotation.x += KEY_ROTATION_MOVE_WEIGHT; |
| 94 | } |
| 95 | if (key_pressed[KeyCode::K]) |
| 96 | { |
| 97 | delta_rotation.x -= KEY_ROTATION_MOVE_WEIGHT; |
| 98 | } |
| 99 | if (key_pressed[KeyCode::J]) |
| 100 | { |
| 101 | delta_rotation.y += KEY_ROTATION_MOVE_WEIGHT; |
| 102 | } |
| 103 | if (key_pressed[KeyCode::L]) |
| 104 | { |
| 105 | delta_rotation.y -= KEY_ROTATION_MOVE_WEIGHT; |
| 106 | } |
| 107 | |
| 108 | if (mouse_button_pressed[MouseButton::Left] && mouse_button_pressed[MouseButton::Right]) |
nothing calls this directly
no test coverage detected