本文整理汇总了C++中osg::Trackball::setTranslationGen方法的典型用法代码示例。如果您正苦于以下问题:C++ Trackball::setTranslationGen方法的具体用法?C++ Trackball::setTranslationGen怎么用?C++ Trackball::setTranslationGen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Trackball
的用法示例。
在下文中一共展示了Trackball::setTranslationGen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
//.........这里部分代码省略.........
deco=OSG::ShearedStereoCameraDecorator::create();
deco->setLeftEye(false);
deco->setEyeSeparation(eyedistance);
deco->setDecoratee(cam);
deco->setZeroParallaxDistance(zeroparallax);
vp2 = OSG::Viewport::create();
vp2->setCamera ( deco );
vp2->setBackground( bkgnd );
vp2->setRoot ( root );
vp2->setSize ( .5,0,1,1 );
}
else if(stereoMode == 2)
{
OSG::ShearedStereoCameraDecoratorUnrecPtr deco;
// left
deco=OSG::ShearedStereoCameraDecorator::create();
deco->setLeftEye(true);
deco->setEyeSeparation(eyedistance);
deco->setDecoratee(cam);
deco->setZeroParallaxDistance(zeroparallax);
OSG::ColorBufferViewportUnrecPtr cvp1 =
OSG::ColorBufferViewport::create();
cvp1->setCamera ( deco );
cvp1->setBackground( bkgnd );
cvp1->setRoot ( root );
cvp1->setSize ( 0,0, 1,1 );
cvp1->setRed(GL_FALSE);
cvp1->setGreen(GL_TRUE);
cvp1->setBlue(GL_TRUE);
cvp1->setAlpha(GL_TRUE);
vp1 = cvp1;
// right
deco=OSG::ShearedStereoCameraDecorator::create();
deco->setLeftEye(false);
deco->setEyeSeparation(eyedistance);
deco->setDecoratee(cam);
deco->setZeroParallaxDistance(zeroparallax);
OSG::ColorBufferViewportUnrecPtr cvp2 =
OSG::ColorBufferViewport::create();
cvp2->setCamera ( deco );
cvp2->setBackground( bkgnd );
cvp2->setRoot ( root );
cvp2->setSize ( 0,0,1,1 );
cvp2->setRed(GL_TRUE);
cvp2->setGreen(GL_FALSE);
cvp2->setBlue(GL_FALSE);
cvp2->setAlpha(GL_FALSE);
vp2 = cvp2;
}
GLint glvp[4];
glGetIntegerv( GL_VIEWPORT, glvp );
if(serverx>0 && servery>0)
clusterWindow->setSize( serverx, servery );
else
clusterWindow->setSize( glvp[2], glvp[3] );
clusterWindow->addPort( vp1 );
if(multiport || stereoMode > 0)
clusterWindow->addPort( vp2 );
if(serviceInterfaceValid == true)
{
clusterWindow->setServiceInterface(serviceInterface);
fprintf(stderr, "tcclient use if %s\n", serviceInterface.c_str());
}
if(serviceAddressValid == true)
{
clusterWindow->setServiceAddress(serviceAddress);
fprintf(stderr, "tcclient use ba %s\n", serviceAddress.c_str());
}
// tball
OSG::Vec3f pos(min[0] + ((max[0] - min[0]) * 0.5),
min[1] + ((max[1] - min[1]) * 0.5),
max[2] + ( max[2] - min[2] ) * 1.5 );
float scale = (max[2] - min[2] + max[1] - min[1] + max[0] - min[0]) / 6;
tball.setMode( OSG::Trackball::OSGObject );
tball.setStartPosition( pos, true );
tball.setSum( true );
tball.setTranslationMode( OSG::Trackball::OSGFree );
tball.setTranslationScale(scale);
tball.setRotationCenter(center);
tball.setTranslationGen(OSG::Trackball::OSGAbsoluteTranslation);
// run...
std::cout << size.length() << std::endl;
cam->setFar (size.length() * 100.0);
cam->setNear(size.length() * 100.0 / 100000.0);
}