/// NOTE: not the same function as the one in common.rs!
not the same function as the one in common.rs!
not the same function as the one in common . rs!
fn process_input(
    input: &KeyboardInput,
    delta_time: f32,
    camera_pos: &mut Point3<f32>,
    // CAMERA_FRONT: &mut Vector3<f32>,
) {
    let camera_speed = 2.5 * delta_time;
    match input {
        KeyboardInput {
            state: ElementState::Pressed,
            virtual_keycode: Some(VirtualKeyCode::W),
            ..
        } => *camera_pos += camera_speed * CAMERA_FRONT,
        KeyboardInput {
            state: ElementState::Pressed,
            virtual_keycode: Some(VirtualKeyCode::S),
            ..
        } => *camera_pos += -(camera_speed * CAMERA_FRONT),
        KeyboardInput {
            state: ElementState::Pressed,
            virtual_keycode: Some(VirtualKeyCode::A),
            ..
        } => *camera_pos += -(CAMERA_FRONT.cross(CAMERA_UP).normalize() * camera_speed),
        KeyboardInput {
            state: ElementState::Pressed,
            virtual_keycode: Some(VirtualKeyCode::D),
            ..
        } => *camera_pos += CAMERA_FRONT.cross(CAMERA_UP).normalize() * camera_speed,
        _ => {}
    }
}
fn process_input ( input : & KeyboardInput , delta_time : f32 , camera_pos : & mut Point3 < f32 > , // CAMERA_FRONT: &mut Vector3<f32>, ) { let camera_speed = 2.5 * delta_time ; match input { KeyboardInput { state : ElementState :: Pressed , virtual_keycode : Some ( VirtualKeyCode :: W ) , .. } => * camera_pos += camera_speed * CAMERA_FRONT , KeyboardInput { state : ElementState :: Pressed , virtual_keycode : Some ( VirtualKeyCode :: S ) , .. } => * camera_pos += - ( camera_speed * CAMERA_FRONT ) , KeyboardInput { state : ElementState :: Pressed , virtual_keycode : Some ( VirtualKeyCode :: A ) , .. } => * camera_pos += - ( CAMERA_FRONT . cross ( CAMERA_UP ) . normalize ( ) * camera_speed ) , KeyboardInput { state : ElementState :: Pressed , virtual_keycode : Some ( VirtualKeyCode :: D ) , .. } => * camera_pos += CAMERA_FRONT . cross ( CAMERA_UP ) . normalize ( ) * camera_speed , _ => { } } }
NOTE: not the same function as the one in common.rs!
NOTE : not the same function as the one in common . rs!
input
&KeyboardInput
delta_time
f32
camera_pos
&mut Point3<f32>