void CameraLensShiftTestApp::setup() { CameraPersp cam( getWindowWidth() * 0.5f, getWindowHeight(), 40.0f, 0.1f, 1000.0f ); cam.setEyePoint( Vec3f(-50.0f, 0.0f, 0.0f) ); cam.setCenterOfInterestPoint( Vec3f::zero() ); mOverview.setCurrentCam(cam); // set camera to size of half the window mCamera = CameraPersp( getWindowWidth() * 0.5f, getWindowHeight(), 40.0f, 2.5f, 20.0f ); mCamera.setEyePoint( Vec3f(0.0f, 0.0f, -15.0f) ); mCamera.setCenterOfInterestPoint( Vec3f::zero() ); // mFont = Font("Tahoma", 18); mLensShift = mCamera.getLensShift(); }
void CameraLensShiftTestApp::update() { // gradually shift to desired value Vec2f shift = mCamera.getLensShift(); mCamera.setLensShift( shift + 0.1f * (mLensShift - shift) ); }