void Renderer::UpdateCamera(float elapsedTimeSec)
{
    float heading = 0.0f;
    float pitch = 0.0f;
    float roll = 0.0f;
    glm::vec3 direction(0.0f, 0.0f, 0.0f);
    //direction.z += 0.001;
    
    //GetMovementDirection(direction);
    
    switch (RenderMemData.camera->getBehavior())
    {
        case Camera::CAMERA_BEHAVIOR_FIRST_PERSON:
            pitch = yDistanceFromWindowCenter() * g_cameraRotationSpeed;
            heading = -xDistanceFromWindowCenter() * g_cameraRotationSpeed;
            
            RenderMemData.camera->rotate(heading, pitch, 0.0f);
            break;
            
        case Camera::CAMERA_BEHAVIOR_FLIGHT:
            heading = -direction.x * CAMERA_SPEED_FLIGHT_YAW * elapsedTimeSec;
            pitch = -yDistanceFromWindowCenter() * g_cameraRotationSpeed;
            roll = -xDistanceFromWindowCenter() * g_cameraRotationSpeed;
            
            RenderMemData.camera->rotate(heading, pitch, roll);
            direction.x = 0.0f; // ignore yaw motion when updating camera velocity
            break;
    }
    
    RenderMemData.camera->updatePosition(direction, elapsedTimeSec);
    PerformCameraCollisionDetection();
    
    moveToWindowCenter();
}
void UpdateCamera(float elapsedTimeSec)
{
    Mouse &mouse = Mouse::instance();
    float dx = -mouse.xPosRelative();
    float dy = -mouse.yPosRelative();

    g_camera.rotateSmoothly(dx, dy, 0.0f);
    g_camera.updatePosition(GetMovementDirection(), elapsedTimeSec);

    mouse.setPosition(g_windowWidth / 2, g_windowHeight / 2);

    PerformCameraCollisionDetection();
}