void ArcballTestApp::keyDown( KeyEvent event ) { if( event.getChar() == 'f' ) { mCam.setPerspective( randFloat( 5, 140 ), getWindowAspectRatio(), 1.0f, 10.0f ); } else if( event.getChar() == 'd' ) { mUsingCameraUi = ! mUsingCameraUi; if( mUsingCameraUi ) mDebugCam = mCam; } else if ( event.getChar() == 'c' ) { if( mArcball.isUsingConstraint() ) mArcball.setNoConstraintAxis(); else mArcball.setConstraintAxis( normalize( vec3( randFloat(), randFloat(), randFloat() ) ) ); } else if( event.getChar() == 'z' ) { mZLookAt /= 10; mCam.lookAt( vec3( 0, 0, 5 ), vec3( mZLookAt ) ); } else if( event.getChar() == 'r' ) { mEarthSphere.setCenter( vec3( randFloat(2), randFloat(1), randFloat( -4, 0 ) ) ); mEarth = gl::Batch::create( geom::Sphere( Sphere( vec3(0), mEarthSphere.getRadius() ) ).subdivisions( 50 ), gl::getStockShader( gl::ShaderDef().texture() ) ); mArcball.setSphere( mEarthSphere ); } }
void ArcballDemoApp::keyDown( KeyEvent event ) { if( event.getChar() == 'v' ) mDrawVerbose = ! mDrawVerbose; else if( event.getChar() == 'c' ) { mUseConstraintAxis = ! mUseConstraintAxis; if( mUseConstraintAxis ) { // make a random constraint axis mConstraintAxis = Rand::randVec3f(); mArcball.setConstraintAxis( mConstraintAxis ); } else mArcball.setNoConstraintAxis(); } }