本文整理汇总了C++中osg::SimpleSceneManagerRefPtr::getCamera方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleSceneManagerRefPtr::getCamera方法的具体用法?C++ SimpleSceneManagerRefPtr::getCamera怎么用?C++ SimpleSceneManagerRefPtr::getCamera使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::SimpleSceneManagerRefPtr
的用法示例。
在下文中一共展示了SimpleSceneManagerRefPtr::getCamera方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectCluster
static void connectCluster(void)
{
if(_cluster_win != NULL)
return;
OSG::Viewport *clientvp = _client_win->getPort(0);
// create the viewports for the cluster just a simple one ...
OSG::ViewportUnrecPtr vp = OSG::Viewport::create();
vp->setCamera (_mgr->getCamera());
vp->setBackground(clientvp->getBackground());
vp->setRoot (clientvp->getRoot());
vp->setSize (0,0, 1,1);
// the connection between this client and the servers
_cluster_win = OSG::MultiDisplayWindow::create();
// all changes must be enclosed in beginEditCP and endEditCP
// otherwise the changes will not be transfered over the network.
for(OSG::UInt32 i=0;i<_pipenames.size();++i)
_cluster_win->editMFServers()->push_back(_pipenames[i]);
// dummy size for navigator
_cluster_win->setSize(300,300);
_cluster_win->addPort(vp);
OSG::Thread::getCurrentChangeList()->commitChangesAndClear();
OSG::Thread::getCurrentChangeList()->fillFromCurrentState();
OSG::Thread::getCurrentChangeList()->dump();
// create from the current state a changelist.
// initialize window
_cluster_win->init();
// apply changelist to the servers
_cluster_win->render((OSG::RenderAction *) _mgr->getRenderAction());
// clear changelist
OSG::Thread::getCurrentChangeList()->clear();
glutPostRedisplay();
}
示例2: keyboard
//.........这里部分代码省略.........
break;
}
case '3':
{
svp->setShadowMode(OSG::ShadowStage::PERSPECTIVE_SHADOW_MAP);
SLOG << "ShadowMode is: PERSPECTIVE_SHADOW_MAP" << OSG::endLog;
break;
}
case '4':
{
svp->setShadowMode(OSG::ShadowStage::DITHER_SHADOW_MAP);
SLOG << "ShadowMode is: DITHER_SHADOW_MAP" << OSG::endLog;
break;
}
case '5':
{
svp->setShadowMode(OSG::ShadowStage::PCF_SHADOW_MAP);
svp->setShadowSmoothness(0.5);
SLOG << "ShadowMode is: PCF_SHADOW_MAP" << OSG::endLog;
break;
}
case '6':
{
svp->setShadowMode(OSG::ShadowStage::PCF2_SHADOW_MAP);
svp->setShadowSmoothness(0.5);
SLOG << "ShadowMode is: PCF2_SHADOW_MAP" << OSG::endLog;
break;
}
case '7':
{
svp->setShadowMode(OSG::ShadowStage::PCSS_SHADOW_MAP);
svp->setShadowSmoothness(1.0);
SLOG << "ShadowMode is: PCSS_SHADOW_MAP" << OSG::endLog;
break;
}
case '8':
{
svp->setShadowMode(OSG::ShadowStage::VARIANCE_SHADOW_MAP);
svp->setShadowSmoothness(0.5);
SLOG << "ShadowMode is: VARIANCE_SHADOW_MAP" << OSG::endLog;
break;
}
case 'y':
{
svp->setMapSize(512);
SLOG << "ShadowMapSize is: 512" << OSG::endLog;
break;
}
case 'x':
{
svp->setMapSize(1024);
SLOG << "ShadowMapSize is: 1024" << OSG::endLog;
break;
}
case 'c':
{
svp->setMapSize(2048);
SLOG << "ShadowMapSize is: 2048" << OSG::endLog;
break;
}
case '+':
{
OSG::Real32 t = svp->getShadowSmoothness();
svp->setShadowSmoothness(t + 0.1);
SLOG << "ShadowSmoothness is: " << (t + 0.1) << OSG::endLog;
break;
}
case '-':
{
OSG::Real32 t = svp->getShadowSmoothness();
svp->setShadowSmoothness(t - 0.1);
SLOG << "ShadowSmoothness is: " << (t - 0.1) << OSG::endLog;
break;
}
case 'a':
{
bAnim = !bAnim;
}
break;
}
SLOG << "cam near " << mgr->getCamera()->getNear()
<< " cam far " << mgr->getCamera()->getFar()
<< std::endl;
glutPostRedisplay();
}
示例3: 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;
}
示例4: main
//.........这里部分代码省略.........
OSG::GroupRefPtr g = OSG::Group::create();
scene->setCore(g);
if(argc < 2)
{
FWARNING(("No file given!\n"));
FWARNING(("Supported file formats:\n"));
std::list<const char*> suffixes;
OSG::SceneFileHandler::the()->getSuffixList(suffixes);
for(std::list<const char*>::iterator it = suffixes.begin();
it != suffixes.end();
++it)
{
FWARNING(("%s\n", *it));
}
fileroot = OSG::makeTorus(.5, 2, 16, 16);
}
else
{
fileroot = OSG::SceneFileHandler::the()->read(argv[1]);
/*
All scene file loading is handled via the SceneFileHandler.
*/
}
scene->addChild(fileroot);
// Create a small geometry to show the ray and what was hit
// Contains a line and a single triangle.
// The line shows the ray, the triangle whatever was hit.
OSG::SimpleMaterialRefPtr red = OSG::SimpleMaterial::create();
red->setDiffuse (OSG::Color3f( 1,0,0 ));
red->setTransparency(0.5);
red->setLit (false);
isectPoints = OSG::GeoPnt3fProperty::create();
isectPoints->addValue(OSG::Pnt3f(0,0,0));
isectPoints->addValue(OSG::Pnt3f(0,0,0));
isectPoints->addValue(OSG::Pnt3f(0,0,0));
isectPoints->addValue(OSG::Pnt3f(0,0,0));
isectPoints->addValue(OSG::Pnt3f(0,0,0));
OSG::GeoUInt32PropertyRefPtr index = OSG::GeoUInt32Property::create();
index->addValue(0);
index->addValue(1);
index->addValue(2);
index->addValue(3);
index->addValue(4);
OSG::GeoUInt32PropertyRefPtr lens = OSG::GeoUInt32Property::create();
lens->addValue(2);
lens->addValue(3);
OSG::GeoUInt8PropertyRefPtr type = OSG::GeoUInt8Property::create();
type->addValue(GL_LINES);
type->addValue(GL_TRIANGLES);
testgeocore = OSG::Geometry::create();
testgeocore->setPositions(isectPoints);
testgeocore->setIndices(index);
testgeocore->setLengths(lens);
testgeocore->setTypes(type);
testgeocore->setMaterial(red);
OSG::NodeRefPtr testgeo = OSG::Node::create();
testgeo->setCore(testgeocore);
scene->addChild(testgeo);
// create the SimpleSceneManager helper
mgr = OSG::SimpleSceneManager::create();
// tell the manager what to manage
mgr->setWindow(gwin );
mgr->setRoot (scene);
// show the whole scene
mgr->showAll();
mgr->getCamera()->setNear(mgr->getCamera()->getNear() / 10);
// Show the bounding volumes? Not for now
mgr->getRenderAction()->setVolumeDrawing(false);
_idbuff = new IDbuffer();
_idbuff->setCamera(mgr->getCamera());
_idbuff->setRoot(scene);
}
// GLUT main loop
glutMainLoop();
return 0;
}