本文整理汇总了C++中Arcball::isUsingConstraint方法的典型用法代码示例。如果您正苦于以下问题:C++ Arcball::isUsingConstraint方法的具体用法?C++ Arcball::isUsingConstraint怎么用?C++ Arcball::isUsingConstraint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arcball
的用法示例。
在下文中一共展示了Arcball::isUsingConstraint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyDown
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 );
}
}
示例2: draw
void ArcballTestApp::draw()
{
CameraPersp &cam = ( mUsingCameraUi ) ? mDebugCam : mCam;
gl::clear( Color( 0, 0.0f, 0.15f ) );
gl::setMatrices( cam );
// draw the earth
gl::enableDepthRead();
gl::enableDepthWrite();
gl::translate( mEarthSphere.getCenter() );
gl::rotate( mArcball.getQuat() );
mEarthTex->bind();
mEarth->draw();
// draw constraint axis
if( mArcball.isUsingConstraint() ) {
gl::setMatrices( cam );
gl::color( 1, 1, 0 );
gl::translate( mEarthSphere.getCenter() );
gl::rotate( glm::rotation( vec3( 0, 1, 0 ), mArcball.getConstraintAxis() ) );
mConstraintAxis->draw();
}
gl::disableDepthRead();
// draw from vector marker
gl::setMatrices( cam );
gl::color( 0, 1, 0.25f );
gl::translate( mEarthSphere.getCenter() + mArcball.getFromVector() * mEarthSphere.getRadius() );
mMarker->draw();
// draw to vector marker
gl::setMatrices( cam );
gl::color( 1, 0.5f, 0.25f );
gl::translate( mEarthSphere.getCenter() + mArcball.getToVector() * mEarthSphere.getRadius() );
mMarker->draw();
// draw the elliptical axes
gl::setMatricesWindow( getWindowSize() );
gl::color( 1, 0, 0 );
vec2 center, axisA, axisB;
mCam.calcScreenProjection( mEarthSphere, getWindowSize(), ¢er, &axisA, &axisB );
gl::drawLine( center - axisA, center + axisA );
gl::drawLine( center - axisB, center + axisB );
}