本文整理汇总了C++中Navigator::setDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ Navigator::setDistance方法的具体用法?C++ Navigator::setDistance怎么用?C++ Navigator::setDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigator
的用法示例。
在下文中一共展示了Navigator::setDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
osgInit(argc,argv);
// GLUT init
glutInit(&argc, argv);
bool stereobuffer = false;
bool amberblue = false;
if(argc >= 2 && !strcmp(argv[1],"-s"))
{
stereobuffer = true;
--argc, ++argv;
}
if(argc >= 2 && !strcmp(argv[1],"-a"))
{
amberblue = true;
--argc, ++argv;
}
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE |
(stereobuffer?GLUT_STEREO:0) );
glutCreateWindow("OpenSG");
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutIdleFunc(display);
glutMouseFunc(mouse);
glutMotionFunc(motion);
glutKeyboardFunc(keyboard);
PassiveWindowPtr pwin=PassiveWindow::create();
pwin->init();
// create the scene
NodePtr scene;
if(argc > 1)
{
scene = SceneFileHandler::the().read(argv[1]);
}
else
{
scene = makeBox(2,2,2, 1,1,1);
}
// create the SimpleSceneManager helper
mgr = new SimpleSceneManager;
// create the window and initial camera/viewport
mgr->setWindow(pwin );
// tell the manager what to manage
mgr->setRoot (scene);
// now create the second vp for stereo
ViewportPtr vp = pwin->getPort(0);
PerspectiveCameraPtr cam = PerspectiveCameraPtr::dcast(vp->getCamera());
beginEditCP(cam);
cam->setFov(deg2rad(90));
cam->setAspect(1);
endEditCP (cam);
Navigator *nav = mgr->getNavigator();
nav->setAt(Pnt3f(0,0,0));
nav->setDistance(1.5);
mgr->showAll();
// create the decorators and the second viewport
ViewportPtr vpleft,vpright;
decoleft = ShearedStereoCameraDecorator::create();
decoright = ShearedStereoCameraDecorator::create();
beginEditCP(decoleft);
decoleft->setEyeSeparation(ed);
decoleft->setZeroParallaxDistance(zpp);
decoleft->setLeftEye(true);
decoleft->setDecoratee(cam);
endEditCP (decoleft);
beginEditCP(decoright);
decoright->setEyeSeparation(ed);
decoright->setZeroParallaxDistance(zpp);
decoright->setLeftEye(false);
decoright->setDecoratee(cam);
endEditCP (decoright);
if(amberblue)
{
ColorBufferViewportPtr svpleft = ColorBufferViewport::create();
ColorBufferViewportPtr svpright = ColorBufferViewport::create();
beginEditCP(svpleft);
svpleft->setLeft(0);
svpleft->setRight(1);
svpleft->setBottom(0);
//.........这里部分代码省略.........