本文整理汇总了C++中osg::SimpleSceneManagerRefPtr::setCamera方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleSceneManagerRefPtr::setCamera方法的具体用法?C++ SimpleSceneManagerRefPtr::setCamera怎么用?C++ SimpleSceneManagerRefPtr::setCamera使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::SimpleSceneManagerRefPtr
的用法示例。
在下文中一共展示了SimpleSceneManagerRefPtr::setCamera方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doMain
//.........这里部分代码省略.........
scene->addChild(stones);
scene->addChild(dinos);
svp = OSG::ShadowStage::create();
OSG::GradientBackgroundUnrecPtr gbg = OSG::GradientBackground::create();
OSG::SolidBackgroundUnrecPtr sbg = OSG::SolidBackground::create();
gbg->addLine(OSG::Color3f(0.7f, 0.7f, 0.8f), 0);
gbg->addLine(OSG::Color3f(0.0f, 0.1f, 0.3f), 1);
rootNode->setCore(svp);
rootNode->addChild(light1);
rootNode->addChild(light1_beacon);
rootNode->addChild(light2_beacon);
rootNode->addChild(cam_beacon);
// Shadow viewport
#ifdef SHADOW_CHECK
svp->setBackground(gbg);
svp->setRoot(rootNode);
svp->setSize(0, 0, 1, 1);
#endif
//svp->setOffFactor(4.0);
//svp->setOffBias(8.0);
//used to set global shadow intensity, ignores shadow intensity from light sources if != 0.0
//svp->setGlobalShadowIntensity(0.8);
svp->setMapSize(1024);
//ShadowSmoothness used for PCF_SHADOW_MAP and VARIANCE_SHADOW_MAP, defines Filter Width. Range can be 0.0 ... 1.0.
//ShadowSmoothness also used to define the light size for PCSS_SHADOW_MAP
svp->setShadowSmoothness(0.5);
// add light sources here
//svp->editMFLightNodes ()->push_back(light1);
//svp->editMFLightNodes ()->push_back(light2);
svp->editMFExcludeNodes()->push_back(obj1_trans_node);
svp->setAutoSearchForLights(true);
//one active light at startup
_light2_core->setOn(true);
_light2_core->setAmbient(0.3f, 0.3f, 0.3f, 1);
_light2_core->setDiffuse(0.8f, 0.8f, 0.8f, 1);
_light1_core->setOn(false);
_light1_core->setAmbient(0.3, 0.3, 0.3, 1);
_light1_core->setDiffuse(0.8, 0.8, 0.8, 1);
gwin->setGlutId(winid);
#ifdef SHADOW_CHECK
gwin->addPort(svp);
#endif
gwin->init();
OSG::Vec3f min, max;
rootNode->updateVolume();
rootNode->getVolume().getBounds(min, max);
// create the SimpleSceneManager helper
mgr = OSG::SimpleSceneManager::create();
mgr->setWindow(gwin);
mgr->setCamera(Pcamera);
mgr->setRoot(rootNode);
_navigator.setMode(OSG::Navigator::TRACKBALL);
#ifdef SHADOW_CHECK
_navigator.setViewport(svp);
#endif
_navigator.setCameraTransformation(cam_beacon);
OSG::Vec3f up(0,1,0);
OSG::Pnt3f at(0,0,0);
OSG::Pnt3f from(0.0f,-100.1f,20.0f);
_navigator.set(from, at, up);
_navigator.setMotionFactor(0.5f);
#ifdef SHADOW_CHECK
svp->setCamera(Pcamera);
#endif
//activate Framecounter
startFpsCounter();
// dynamic_cast<RenderAction *>(mgr->getAction())->setLocalLights(true);
mgr->turnHeadlightOff();
mgr->showAll();
mgr->getCamera()->setNear( 1.0f);
mgr->getCamera()->setFar (1000000.f );
_navigator.setViewport(gwin->getPort(0));
return 0;
}