本文整理汇总了C++中ci::CameraPersp类的典型用法代码示例。如果您正苦于以下问题:C++ CameraPersp类的具体用法?C++ CameraPersp怎么用?C++ CameraPersp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CameraPersp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void UserApp::setup()
{
mBones.push_back( Bone( nite::JOINT_HEAD, nite::JOINT_NECK ) );
mBones.push_back( Bone( nite::JOINT_LEFT_SHOULDER, nite::JOINT_LEFT_ELBOW ) );
mBones.push_back( Bone( nite::JOINT_LEFT_ELBOW, nite::JOINT_LEFT_HAND ) );
mBones.push_back( Bone( nite::JOINT_RIGHT_SHOULDER, nite::JOINT_RIGHT_ELBOW ) );
mBones.push_back( Bone( nite::JOINT_RIGHT_ELBOW, nite::JOINT_RIGHT_HAND ) );
mBones.push_back( Bone( nite::JOINT_LEFT_SHOULDER, nite::JOINT_RIGHT_SHOULDER ) );
mBones.push_back( Bone( nite::JOINT_LEFT_SHOULDER, nite::JOINT_TORSO ) );
mBones.push_back( Bone( nite::JOINT_RIGHT_SHOULDER, nite::JOINT_TORSO ) );
mBones.push_back( Bone( nite::JOINT_TORSO, nite::JOINT_LEFT_HIP ) );
mBones.push_back( Bone( nite::JOINT_TORSO, nite::JOINT_RIGHT_HIP ) );
mBones.push_back( Bone( nite::JOINT_LEFT_HIP, nite::JOINT_RIGHT_HIP ) );
mBones.push_back( Bone( nite::JOINT_LEFT_HIP, nite::JOINT_LEFT_KNEE ) );
mBones.push_back( Bone( nite::JOINT_LEFT_KNEE, nite::JOINT_LEFT_FOOT ) );
mBones.push_back( Bone( nite::JOINT_RIGHT_HIP, nite::JOINT_RIGHT_KNEE ) );
mBones.push_back( Bone( nite::JOINT_RIGHT_KNEE, nite::JOINT_RIGHT_FOOT ) );
mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 45.0f, 1.0f, 5000.0f );
mCamera.lookAt( Vec3f::zero(), Vec3f::zAxis(), Vec3f::yAxis() );
mDeviceManager = OpenNI::DeviceManager::create();
try {
mDevice = mDeviceManager->createDevice( OpenNI::DeviceOptions().enableUserTracking() );
} catch ( OpenNI::ExcDeviceNotAvailable ex ) {
console() << ex.what() << endl;
quit();
return;
}
mDevice->getUserTracker().setSkeletonSmoothingFactor( 0.5f );
mDevice->connectUserEventHandler( &UserApp::onUser, this );
mDevice->start();
}
示例2: setup
// Set up
void LeapApp::setup()
{
// Set up OpenGL
gl::enable( GL_LINE_SMOOTH );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
gl::enable( GL_POLYGON_SMOOTH );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
// Set up camera
mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
mCamera.lookAt( Vec3f( 0.0f, 125.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
// Start device
mLeap = Device::create();
mLeap->addCallback( &LeapApp::onFrame, this );
// Params
mFrameRate = 0.0f;
mFullScreen = false;
mParams = params::InterfaceGl( "Params", Vec2i( 200, 105 ) );
mParams.addParam( "Frame rate", &mFrameRate, "", true );
mParams.addParam( "Full screen", &mFullScreen, "key=f" );
mParams.addButton( "Screen shot", bind( &LeapApp::screenShot, this ), "key=space" );
mParams.addButton( "Quit", bind( &LeapApp::quit, this ), "key=q" );
}
示例3: setup
void LeapPalmDirectionApp::setup()
{
mLeap = LeapSdk::Device::create();
mCallbackId = mLeap->addCallback( &LeapPalmDirectionApp::onFrame, this );
mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
mCamera.lookAt( Vec3f( 0.0f, 250.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
}
示例4: setup
// Set up
void TracerApp::setup()
{
// Set up camera
mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
mCamera.lookAt( Vec3f( 0.0f, 93.75f, 250.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
// Start device
mDevice = Device::create();
mDevice->connectEventHandler( &TracerApp::onFrame, this );
// Load shaders
try {
mShader[ 0 ] = gl::GlslProg( loadResource( RES_GLSL_PASS_THROUGH_VERT ), loadResource( RES_GLSL_BLUR_X_FRAG ) );
} catch ( gl::GlslProgCompileExc ex ) {
console() << "Unable to compile blur X shader: \n" << string( ex.what() ) << "\n";
quit();
}
try {
mShader[ 1 ] = gl::GlslProg( loadResource( RES_GLSL_PASS_THROUGH_VERT ), loadResource( RES_GLSL_BLUR_Y_FRAG ) );
} catch ( gl::GlslProgCompileExc ex ) {
console() << "Unable to compile blur Y shader: \n" << string( ex.what() ) << "\n";
quit();
}
// Params
mFrameRate = 0.0f;
mParams = params::InterfaceGl( "Params", Vec2i( 200, 105 ) );
mParams.addParam( "Frame rate", &mFrameRate, "", true );
mParams.addButton( "Screen shot", bind( &TracerApp::screenShot, this ), "key=space" );
mParams.addButton( "Quit", bind( &TracerApp::quit, this ), "key=q" );
// Enable polygon smoothing
gl::enable( GL_POLYGON_SMOOTH );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
// Set up FBOs
gl::Fbo::Format format;
#if defined( CINDER_MSW )
format.setColorInternalFormat( GL_RGBA32F );
#else
format.setColorInternalFormat( GL_RGBA32F_ARB );
#endif
format.setMinFilter( GL_LINEAR );
format.setMagFilter( GL_LINEAR );
format.setWrap( GL_CLAMP, GL_CLAMP );
for ( size_t i = 0; i < 3; ++i ) {
mFbo[ i ] = gl::Fbo( getWindowWidth(), getWindowHeight(), format );
mFbo[ i ].bindFramebuffer();
gl::setViewport( mFbo[ i ].getBounds() );
gl::clear();
mFbo[ i ].unbindFramebuffer();
}
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
}
示例5: setup
void CinderProjectApp::setup()
{
// Set up OpenGL
gl::enableAlphaBlending();
gl::enableDepthRead();
gl::enableDepthWrite();
// Set up camera
mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
mCamera.lookAt( Vec3f( 0.0f, 125.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
// Start device
mLeap = LeapMotion::Device::create();
mLeap->connectEventHandler( &CinderProjectApp::onFrame, this );
}
示例6: setup
void _TBOX_PREFIX_App::setup()
{
// Set up OpenGL
gl::enableAlphaBlending();
gl::enableDepthRead();
gl::enableDepthWrite();
// Set up camera
mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 0.01f, 1000.0f );
mCamera.lookAt( Vec3f( 0.0f, 125.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
// Start device
mLeap = LeapSdk::Device::create();
mCallbackId = mLeap->addCallback( &_TBOX_PREFIX_App::onFrame, this );
}
示例7: resetCamera
void PaintingBeingsApp::resetCamera()
{
float eyeZ = static_cast<float>(_rectangleTextutre.getWidth()) * 2.5f;
if (_showImageBeing)
eyeZ = static_cast<float>(_image.getMiniatureSize()) * 2.5f;
float radiusArcBall = static_cast<float>(getWindowHeight() * 0.5f);
float fieldOfView = 75.0f;
float nearCamera = 0.1f;
float farCamera = 1000000.0f;
_camera = CameraPersp(getWindowWidth(), getWindowHeight(), fieldOfView, nearCamera, farCamera);
_camera.lookAt(Vec3f(0.0f, 0.0f, eyeZ), Vec3f::zero());
_arcball = Arcball(getWindowSize());
_arcball.setRadius(radiusArcBall);
}
示例8: setup
void LeapApp::setup()
{
gl::enable( GL_LINE_SMOOTH );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
gl::enable( GL_POLYGON_SMOOTH );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
mCamera = CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 1.0f, 1000.0f );
mCamera.lookAt( Vec3f( 0.0f, 250.0f, 500.0f ), Vec3f( 0.0f, 250.0f, 0.0f ) );
mDevice = Device::create();
mDevice->connectEventHandler( &LeapApp::onFrame, this );
mFrameRate = 0.0f;
mFullScreen = false;
mParams = params::InterfaceGl::create( "Params", Vec2i( 200, 105 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addButton( "Screen shot", bind( &LeapApp::screenShot, this ), "key=space" );
mParams->addButton( "Quit", bind( &LeapApp::quit, this ), "key=q" );
}
示例9: mouseWheel
void VboMeshSampleApp::mouseWheel( MouseEvent event )
{
// Zoom in/out with mouse wheel
Vec3f eye = mCamera.getEyePoint();
eye.z += event.getWheelIncrement() * 0.1f;
mCamera.setEyePoint( eye );
}
示例10: resize
void resize() noexcept override {
float aspect = ci::app::getWindowAspectRatio();
ui_camera_.setAspectRatio(aspect);
if (aspect < 1.0) {
// 画面が縦長になったら、幅基準でfovを求める
// fovとnear_zから投影面の幅の半分を求める
float half_w = std::tan(ci::toRadians(fov_ / 2)) * near_z_;
// 表示画面の縦横比から、投影面の高さの半分を求める
float half_h = half_w / aspect;
// 投影面の高さの半分とnear_zから、fovが求まる
float fov = std::atan(half_h / near_z_) * 2;
ui_camera_.setFov(ci::toDegrees(fov));
}
else {
// 横長の場合、fovは固定
ui_camera_.setFov(fov_);
}
autolayout_.resize(ui_camera_);
for (auto& child : children_) {
child->resize();
}
}
示例11: mouseDown
void BulletTestApp::mouseDown( MouseEvent event )
{
Vec2f pos = Vec2f( event.getPos() ) / Vec2f( getWindowSize() );
pos.y = 1.0f - pos.y;
Ray ray = mCamera.generateRay( pos.x, pos.y, getWindowAspectRatio() );
mDragging = mWorld->intersects( ray, mCamera.getFarClip(), &mDragConstraint );
if ( mDragging ) {
mWorld->addConstraint( mDragConstraint, 0.0f, 0.01f );
}
}
示例12: setup
void BasicAnimationApp::setup()
{
auto kicking = "VC/glTF/VC.gltf";
mFile = gltf::File::create( loadAsset( kicking ) );
mScene = make_shared<gltf::simple::Scene>( mFile, &mFile->getDefaultScene() );
mCam.setPerspective( 60.0f, getWindowAspectRatio(), 0.01, 100000.0 );
mCam.lookAt( vec3( 0, 0, -6.0 ), vec3( 0 ) );
mCamUi.setCamera( &mCam );
mCamUi.connect( getWindow() );
}
示例13: mouseWheel
void PaintingBeingsApp::mouseWheel(MouseEvent event)
{
if (_launchAlgoGen)
{
Vec3f eye = _camera.getEyePoint();
eye.z -= event.getWheelIncrement() * 1.5f;
float eyeMaxZ = static_cast<float>(_image.getMiniatureSize()) * 10.0f;
if (eye.z > 1.0f && eye.z < eyeMaxZ)
_camera.setEyePoint(eye);
}
}
示例14: setup
void MetaBallsApp::setup()
{
try {
setupCl();
setupScene();
}
catch( const ocl::Error &e ) {
CI_LOG_E( e.what() << " " << ocl::errorToString( e.err() ) );
}
mCam.setPerspective( 60, ci::app::getWindowAspectRatio(), 0.01, 1000 );
mCam.lookAt( vec3( 10, 10, 10 ), vec3( 0, 0, 0 ) );
mCamUI.setCamera( &mCam );
mCamUI.connect( getWindow() );
}
示例15: mouseDrag
void BulletTestApp::mouseDrag( MouseEvent event )
{
if ( mDragging ) {
Vec2f pos = Vec2f( event.getPos() ) / Vec2f( getWindowSize() );
pos.y = 1.0f - pos.y;
Ray ray = mCamera.generateRay( pos.x, pos.y, getWindowAspectRatio() );
mDragConstraint.update( ray );
}
}