src/camera.c
// processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)
processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)
processes input received from any keyboard - like input system . Accepts input parameter in the form of camera defined ENUM ( to abstract it from windowing systems )
void camera_processKeyboard(camera *camera, enum Camera_Movement direction, float deltaTime) {
    float velocity = camera->MovementSpeed * deltaTime;
    vec3 delta = {0, 0, 0};
    if (direction == FORWARD) {
        glm_vec3_scale(camera->Front, velocity, delta);
        glm_vec3_add(camera->Position, delta, camera->Position);
    }
    if (direction == BACKWARD) {
        glm_vec3_scale(camera->Front, velocity, delta);
        glm_vec3_sub(camera->Position, delta, camera->Position);
    }
    if (direction == LEFT) {
        glm_vec3_scale(camera->Right, velocity, delta);
        glm_vec3_sub(camera->Position, delta, camera->Position);
    }
    if (direction == RIGHT) {
        glm_vec3_scale(camera->Right, velocity, delta);
        glm_vec3_add(camera->Position, delta, camera->Position);
    }
    updateCameraVectors(camera);
}
void camera_processKeyboard ( camera * camera , enum Camera_Movement direction , float deltaTime ) { float velocity = camera -> MovementSpeed * deltaTime ; vec3 delta = { 0 , 0 , 0 } ; if ( direction == FORWARD ) { glm_vec3_scale ( camera -> Front , velocity , delta ) ; glm_vec3_add ( camera -> Position , delta , camera -> Position ) ; } if ( direction == BACKWARD ) { glm_vec3_scale ( camera -> Front , velocity , delta ) ; glm_vec3_sub ( camera -> Position , delta , camera -> Position ) ; } if ( direction == LEFT ) { glm_vec3_scale ( camera -> Right , velocity , delta ) ; glm_vec3_sub ( camera -> Position , delta , camera -> Position ) ; } if ( direction == RIGHT ) { glm_vec3_scale ( camera -> Right , velocity , delta ) ; glm_vec3_add ( camera -> Position , delta , camera -> Position ) ; } updateCameraVectors ( camera ) ; }
processes input received from any keyboard-like input system.
processes input received from any keyboard - like input system .