当前位置: 首页>>代码示例>>C++>>正文


C++ Arcball::getQuat方法代码示例

本文整理汇总了C++中Arcball::getQuat方法的典型用法代码示例。如果您正苦于以下问题:C++ Arcball::getQuat方法的具体用法?C++ Arcball::getQuat怎么用?C++ Arcball::getQuat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arcball的用法示例。


在下文中一共展示了Arcball::getQuat方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

void MemExploreApp::update()
{
  Vec2f center = getWindowCenter();

  mCameraArcball.resetQuat();
  mCameraArcball.mouseDown(center);
  mCameraArcball.mouseDrag(getWindowSize() - mMousePos);
  mCamera.setOrientation(mCameraArcball.getQuat() * mCamera.getOrientation());

  // Reset mouse position to center of screen
  if(mIsFullscreen) {
    Vec2f center = getWindowCenter();
    CGSetLocalEventsSuppressionInterval(0.0);
    CGWarpMouseCursorPosition(CGPointMake(center.x, center.y));
    mMousePos = center;
  }

  float speed = 0.01f;
  Vec3f camX = mCamera.getOrientation() * Vec3f::xAxis() * speed;
  Vec3f camY = mCamera.getOrientation() * Vec3f::yAxis() * speed;
  Vec3f camZ = mCamera.getOrientation() * Vec3f::zAxis() * speed;
  
  if(mKeysDown.count('w')) mCameraAcc -= camZ;
  if(mKeysDown.count('a')) mCameraAcc -= camX;
  if(mKeysDown.count('s')) mCameraAcc += camZ;
  if(mKeysDown.count('d')) mCameraAcc += camX;
  if(mKeysDown.count('q')) mCameraAcc += camY;
  if(mKeysDown.count('e')) mCameraAcc -= camY;

  mCameraVel += mCameraAcc;
  mCamera.setEyePoint(mCamera.getEyePoint() + mCameraVel);
  mCameraVel *= 0.975f;
  mCameraAcc *= 0.8f;
}
开发者ID:imclab,项目名称:memdescent,代码行数:34,代码来源:MemExploreApp.cpp

示例2: draw

void fsExperiments::draw()
{
	gl::clear( mBackground );

	CameraPersp cam( getWindowWidth(), getWindowHeight(), 60.0f );
	cam.setPerspective( 60, getWindowAspectRatio(), 1, 5000 );
	cam.lookAt( Vec3f( 0, 0, mEyeDistance ), Vec3f::zero(), Vec3f( 0, -1, 0 ) );
	gl::setMatrices( cam );

	gl::setViewport( getWindowBounds() );

	gl::enableDepthRead();
	gl::enableDepthWrite();

	GlobalData& data = GlobalData::get();

	gl::pushModelView();
	gl::rotate( mArcball.getQuat() );
	gl::rotate( data.mHeadRotation );

	mEffects[ mCurrentEffect ]->draw();

	gl::popModelView();

	params::PInterfaceGl::draw();
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例3: draw

void BasicShaderIIApp::draw()
{
	gl::clear( Color::black() ); 
	// Draw FPS
	gl::color( Color::white() );
	mTextureFont->drawString( toString( floor(getAverageFps()) ) + " FPS", Vec2f( 100, getWindowHeight() - mTextureFont->getDescent() ) );
    
    gl::pushMatrices();
	gl::setMatrices( mCam );
    gl::enableAlphaBlending();
    
	// draw interface
	params::InterfaceGl::draw();
	
	if( mDoSave )
	{	// save non-conflicting image
		// includes interface to record parameters
		saveFrame();
		mDoSave = false;
	}
    
    mShader.bind();
    mShader.uniform("lightDir", mLightDir );   
    
    gl::pushMatrices();
    gl::rotate( mArcball.getQuat() );
    gl::draw( mVBO );
    gl::popMatrices();
    mShader.unbind();     
    
    gl::popMatrices();
}
开发者ID:bytezen,项目名称:Cinder-Examples-MDDN442,代码行数:32,代码来源:BasicShaderIIApp.cpp

示例4: draw

void ImageHFApp::draw()
{
    gl::clear();

    gl::pushModelView();
		gl::translate( vec3( 0.0f, 0.0f, mHeight / 2.0f ) );
		gl::rotate( mArcball.getQuat() );
		if( mVboMesh )
			gl::draw( mVboMesh );
    gl::popModelView();
}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:11,代码来源:ImageHeightFieldApp.cpp

示例5: draw

void ObjLoaderApp::draw()
{
    gl::enableDepthWrite();
    gl::enableDepthRead();

    gl::clear( Color( 0.0f, 0.1f, 0.2f ) );

    gl::setMatrices( mCam );

    gl::pushMatrices();
    gl::rotate( mArcball.getQuat() );
    mBatch->draw();
    gl::popMatrices();
}
开发者ID:ffimusic,项目名称:Cinder,代码行数:14,代码来源:ObjLoaderApp.cpp

示例6: draw

void BasicApp::draw()
{
	dx::clear( Color( 0, 0, 0 ), true );

	dx::pushModelView();
	dx::translate( vec3( 800.0f, 500.0f, mHeight / 2.0f ) );
	dx::rotate( mArcball.getQuat() );
	if ( mVboMesh )
		dx::draw( mVboMesh );
	dx::popModelView();

	std::stringstream s;
	s << "Framerate:" << getAverageFps();
	dx::drawString(s.str(),vec2(10.0f,10.0f),Color::white(),mFont);
}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:15,代码来源:basicApp.cpp

示例7: drawVerbose

// this draws with the sphere and axes to help undertand how arcball works
void ArcballDemoApp::drawVerbose()
{
	// draw the cube
	gl::pushModelView();
		gl::translate( getWindowCenter() );
		gl::scale( Vec3f( 200.0f, 200.0f, 200.0f ) );	
		gl::rotate( mArcball.getQuat() );
		gl::drawColorCube( Vec3f::zero(), Vec3f( 1, 1, 1 ) );
	gl::popModelView();

	// draw the back faces of the sphere
	gl::pushModelView();
		glColor4f( 0.0, 0.0, 0.0, 0.3f );
		gl::disableDepthWrite();
		gl::translate( getWindowCenter() );
		glCullFace( GL_FRONT );
		gl::drawSphere( Vec3f::zero(), mArcball.getRadius(), 50 );
	gl::popModelView();

	gl::enableDepthWrite();
	glCullFace( GL_BACK );

	// draw the axes
	gl::pushModelView();
		gl::translate( getWindowCenter() );
		
		// start
		glColor4f( 1.0, 1.0, 0.0f, 1.0f );
		gl::drawVector( Vec3f::zero(), mArcball.mouseOnSphere( mInitialMouseDown ) * mArcball.getRadius(), 10, 5 );
		
		// end
		glColor4f( 0.0, 1.0, 0.0f, 1.0f );
		gl::drawVector( Vec3f::zero(), mArcball.mouseOnSphere( mCurrentMouseDown ) * mArcball.getRadius(), 10, 5 );
		
		// constraint
		if( mUseConstraintAxis ) {
			glColor4f( 0.0, 0.7f, 1.0f, 1.0f );
			gl::drawVector( mConstraintAxis * -mArcball.getRadius() * 1.5, mConstraintAxis * mArcball.getRadius() * 1.5, 10, 5 );		
		}
	gl::popModelView();

	// draw the front faces of the sphere
	gl::pushModelView();
		glColor4f( 0.0, 0.0, 0.0, 0.3f );
		gl::translate( getWindowCenter() );
		gl::drawSphere( Vec3f::zero(), mArcball.getRadius(), 50 );
	gl::popModelView();	
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:49,代码来源:ArcballDemoApp.cpp

示例8: 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(), &center, &axisA, &axisB );
	gl::drawLine( center - axisA, center + axisA );
	gl::drawLine( center - axisB, center + axisB );
}
开发者ID:AbdelghaniDr,项目名称:Cinder,代码行数:45,代码来源:ArcballTestApp.cpp

示例9: draw

void camerasApp::draw()
{
	gl::clear( Color( 0, 0.1f, 0.2f ) );
    
    // draw the cube
	gl::pushMatrices();
    gl::translate( getWindowCenter() );
    gl::rotate( mArcball.getQuat() );
    if(mTexture) {
        mTexture->enableAndBind();
        gl::drawCube(Vec3f::zero(), Vec3f(320,320,320));
        mTexture->unbind();
    }
	gl::popMatrices();
    


}
开发者ID:deniskovalev,项目名称:ciResonate,代码行数:18,代码来源:camerasApp.cpp

示例10: draw

void ArcballDemoApp::draw()
{
	gl::clear( Color( 0, 0.1f, 0.2f ) );

	if( mDrawVerbose )
		drawVerbose();
	else {
		// the order of operations is important here - we don't want the rotation applied to the scale
		// and likewise, we don't want the translation applied to the scale 
		// So the code below:
		// 1) rotates the cube by the quaternion that arcball has provided
		// 2) scales the cube to be 200 pixels big
		// 3) moves the cube to the center of the window
		gl::pushModelView();
			glCullFace( GL_BACK );
			gl::translate( getWindowSize() / 2.0f );
			gl::scale( Vec3f( 200.0f, 200.0f, 200.0f ) );	
			gl::rotate( mArcball.getQuat() );
			gl::drawColorCube( Vec3f::zero(), Vec3f( 1, 1, 1 ) );
		gl::popModelView();		
	}
}
开发者ID:AKS2346,项目名称:Cinder,代码行数:22,代码来源:ArcballDemoApp.cpp

示例11: draw

void gpuPSApp::draw()
{
	gl::setMatrices( mCam );
	gl::setViewport( getWindowBounds() );
	gl::clear( ColorA( 0.0f, 0.0f, 0.0f, 1.0f ) );
	
	mFBO[mCurrentFBO].bindTexture(0,0);
	mDisplShader.bind();
	mDisplShader.uniform("displacementMap", 0 );
	gl::pushModelView();
	gl::translate( Vec3f( 0.0f, 0.0f, getWindowHeight() / 2.0f ) );
	gl::rotate( mArcball.getQuat() );
	gl::draw( mVboMesh );
    gl::popModelView();
	
	mDisplShader.unbind();
	mFBO[mCurrentFBO].unbindTexture();
	
	gl::setMatricesWindow(getWindowSize());
	gl::drawString( toString( SIDE*SIDE ) + " vertices", Vec2f(32.0f, 32.0f));
	gl::drawString( toString((int) getAverageFps()) + " fps", Vec2f(32.0f, 52.0f));
}
开发者ID:flcc,项目名称:gpuPS,代码行数:22,代码来源:gpuPSApp.cpp

示例12: draw

void wellingtonModelApp::draw()
{
    
    gl::enableDepthRead();
    gl::enableDepthWrite();
    gl::enableAlphaBlending();
    
    // clear out the window with black
	gl::clear( Color( 0, 0, 0 ) );
    
    /*
     if(mWaterModule != NULL){
     gl::pushMatrices();
     mWaterModule->draw();
     gl::popMatrices();
     }
     */
    
    
//    /*
    gl::setMatrices( mMayaCam.getCamera());
    
    gl::pushMatrices();
    myImage.enableAndBind();
    gl::rotate( mArcball.getQuat() );
    gl::scale(Vec3f(0.035,0.035,0.035));
    glLineWidth(0.3f);
    gl::enableWireframe();
    gl::rotate(Vec3f(50.0, -20.0, 0.0));
    gl::draw(mVbo);
    myImage.unbind();
    gl::popMatrices();
     
//     */
    
 
    
}
开发者ID:chalmersgit,项目名称:wellingtonModel_withWater,代码行数:38,代码来源:wellingtonModelApp.cpp

示例13: draw

void ObjLoaderApp::draw()
{
	gl::enableDepthWrite();
	gl::enableDepthRead();
	
	gl::clear( Color( 0.0f, 0.1f, 0.2f ) );
	glDisable( GL_CULL_FACE );

	gl::setMatrices( mMayaCam.getCamera() );

/*	Sphere boundingSphere = Sphere::calculateBoundingSphere( mMesh.getVertices() );
	glColor3f( 1.0f, 1.0f, 1.0f );
	gl::disableDepthWrite();
	mTexture->disable();
	mShader.unbind();
	gl::draw( boundingSphere, 30 );
	gl::enableDepthWrite();
*/
	mShader.bind();
	gl::pushMatrices();
		gl::rotate( mArcball.getQuat() );
		gl::draw( mVBO );
	gl::popMatrices();
}
开发者ID:alexbw,项目名称:Cinder,代码行数:24,代码来源:OBJLoaderApp.cpp

示例14: draw

void CinderProjectionTestApp::draw()
{
	
	// clear out the window with black
	gl::clear( Color( 0, 0, 0 ), true );
	
	
	gl::enableDepthRead();
	gl::enableDepthWrite();
	
	//gl::enableAlphaBlending();
	
	
	if ( mActiveCam == CAM_LOOK )
	{
		gl::setMatrices( mLookCam );
		gl::rotate( mArcball.getQuat() );
	}
	else if ( mActiveCam == CAM_SWEET )
		gl::setMatrices( mSweetCam );
	else if ( mActiveCam == CAM_PROJ )
		gl::setMatrices( mProjCam );
	
	// Green = Cam from 'sweet spot'
	gl::color( Color( 0, 1, 0 ) );
	gl::drawFrustum( mSweetCam );
	
	// Cyan = Cam from projector
	gl::color( Color( 0, 1, 1 ) );
	gl::drawFrustum( mProjCam );
	
	// Draw a grid in the yz plane
	gl::color( Color( 0.2f, 0.2f, 0.2f ) );
	gl::pushMatrices();
	gl::scale(Vec3f::one() /5 );
	for (int i=0; i<=20; ++i)
	{
		gl::drawLine(Vec3f(-100.0f+(i*10.0f), 0.0f, -100.0f),Vec3f(-100.0f+(i*10.0f), 0.0f, 100.0f));
		gl::drawLine(Vec3f(-100.0f, 0.0f, -100.0f+(i*10.0f)),Vec3f(100.0f, 0.0f, -100.0f+(i*10.0f)));
	}
	gl::popMatrices();
	
	gl::color( Color::white() );
	
	//glEnable( GL_LIGHTING );
	//glEnable( GL_LIGHT0 );
	//GLfloat light_position[] = { mMousePos.x, mMousePos.y, 75.0f, 1.0f };
	//glLightfv( GL_LIGHT0, GL_POSITION, light_position );
	
	
	// Bind texture, so it will be avaible to the fragment shader.
	mTexture.bind();
    // Bind the texture projection shader, let the magic happen!
    mProjShader.bind();
    
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    mProjShader.uniform("projMap", 0);
    mProjShader.uniform("TexGenMat", mSweetCam.getProjectionMatrix() );
    mProjShader.uniform("InvViewMat", mProjCam.getInverseModelViewMatrix() );
	mProjShader.uniform("texScaling", mTextureScaling );
	//mProjShader.uniform("alpha", 0.6f );
    //mProjShader.uniform("scaling", 10.0f );
	
	gl::pushModelView();
	//gl::rotate( Vec3f( 0.0f, 45.0f, 0.0f ) );
	gl::rotate( mCubeRotation );
	gl::translate( Vec3f(0.0f, 0.5f * mCubeSize, 0.0f) );
	gl::drawColorCube( Vec3f::zero(), Vec3f::one() * mCubeSize );
	gl::popModelView();
	
	
    
    mProjShader.unbind();
	mTexture.unbind();
	
	glDisable( GL_LIGHTING );
	
	gl::color( Color::white() );
	
	
	// Draw the interface
	params::InterfaceGl::draw();
}
开发者ID:Maff-,项目名称:CinderProjectionTest,代码行数:84,代码来源:CinderProjectionTestApp.cpp


注:本文中的Arcball::getQuat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。