本文整理汇总了C++中CameraPersp::getOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ CameraPersp::getOrientation方法的具体用法?C++ CameraPersp::getOrientation怎么用?C++ CameraPersp::getOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CameraPersp
的用法示例。
在下文中一共展示了CameraPersp::getOrientation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: drawCardinalTex
void CompassApp::drawCardinalTex( char d, const vec3 &location, const vec3 &localRotation )
{
const float kRectHalfWidth = kTargetSize / 2.0f;
Rectf destRect( kRectHalfWidth, kRectHalfWidth, -kRectHalfWidth, -kRectHalfWidth );
ivec2 texPos = mCardinalPositions[d];
Area srcArea( texPos.x, texPos.y, texPos.x + mCardinalSize.x, texPos.y + mCardinalSize.y);
gl::pushModelView();
gl::translate( location );
#if 1
gl::rotate( angleAxis( localRotation.x, vec3(1,0,0) ) );
gl::rotate( angleAxis( localRotation.y, vec3(0,1,0) ) );
gl::rotate( angleAxis( localRotation.z, vec3(0,0,1) ) );
#else
// draw billboarded, flip to face eye point
gl::rotate( mCam.getOrientation() );
gl::rotate( M_PI, vec3( 0, 1, 0 ) );
#endif
gl::draw( mCardinalTex, srcArea, destRect );
gl::popModelView();
}
示例3: draw
void MemExploreApp::draw()
{
mTexture = gl::Texture(mDataPointer, GL_RGBA, mVolumeDim * mTilesDim, mVolumeDim * mTilesDim);
mTexture.setWrap(GL_REPEAT, GL_REPEAT);
mTexture.setMinFilter(GL_NEAREST);
mTexture.setMagFilter(GL_NEAREST);
float frustum[6];
mCamera.getFrustum(&frustum[0], &frustum[1], &frustum[2], &frustum[3], &frustum[4], &frustum[5]);
mFbo.bindFramebuffer();
gl::setMatricesWindow(mFbo.getSize(), false);
mProgram.bind();
mProgram.uniform("uTexture", 0);
mProgram.uniform("uVolumeDim", mVolumeDim);
mProgram.uniform("uTilesDim", mTilesDim);
mProgram.uniform("uTime", (float)getElapsedSeconds());
mProgram.uniform("uEyePoint", mCamera.getEyePoint());
mProgram.uniform("uXAxis", mCamera.getOrientation() * Vec3f::xAxis());
mProgram.uniform("uYAxis", mCamera.getOrientation() * Vec3f::yAxis());
mProgram.uniform("uViewDistance", mCamera.getAspectRatio() / abs(frustum[2] - frustum[0]) * mCamera.getNearClip());
mProgram.uniform("uNegViewDir", -mCamera.getViewDirection().normalized());
mProgram.uniform("uAspectRatio", mCamera.getAspectRatio());
mTexture.enableAndBind();
gl::drawSolidRect(mFbo.getBounds());
mTexture.unbind();
mProgram.unbind();
mFbo.unbindFramebuffer();
gl::setMatricesWindow(getWindowSize());
gl::draw(mFbo.getTexture(), getWindowBounds());
}