本文整理汇总了C++中osg::SimpleSceneManagerRefPtr::getRenderAction方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleSceneManagerRefPtr::getRenderAction方法的具体用法?C++ SimpleSceneManagerRefPtr::getRenderAction怎么用?C++ SimpleSceneManagerRefPtr::getRenderAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::SimpleSceneManagerRefPtr
的用法示例。
在下文中一共展示了SimpleSceneManagerRefPtr::getRenderAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
// redraw the window
void display(void)
{
// redraw the client window
_mgr->redraw();
OSG::commitChanges();
try
{
if(_cluster_win != NULL)
{
OSG::Thread::getCurrentChangeList()->dump();
// redraw the server windows
_cluster_win->render((OSG::RenderAction *) _mgr->getRenderAction());
}
}
catch(OSG_STDEXCEPTION_NAMESPACE::exception &e)
{
//printf("error: '%s'\n", e.what());
printf("ClusterServer was killed!\n");
_cluster_win = NULL;
}
OSG::commitChanges();
OSG::clearChangeList();
}
示例2: 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();
}
示例3: keyboard
//.........这里部分代码省略.........
normalsActive = true;
if(normalsGeoN.empty() == true)
constructNormalsGeo(sceneN);
NodeStore::const_iterator ngIt = normalsGeoN.begin();
NodeStore::const_iterator ngEnd = normalsGeoN.end ();
for(; ngIt != ngEnd; ++ngIt)
{
(*ngIt)->setTravMask(OSG::TypeTraits<OSG::UInt32>::BitsSet);
}
std::cout << "Normals enabled" << std::endl;
}
}
break;
case 'm':
{
normalsLen /= 1.25f;
constructNormalsGeo(sceneN);
std::cout << "Normals length " << normalsLen << std::endl;
}
break;
case 'M':
{
normalsLen *= 1.25f;
constructNormalsGeo(sceneN);
std::cout << "Normals length " << normalsLen << std::endl;
}
break;
case 'v':
{
mgr->getRenderAction()->setVolumeDrawing(
!mgr->getRenderAction()->getVolumeDrawing());
std::cout << "Volume drawing: "
<< (mgr->getRenderAction()->getVolumeDrawing() ? "enabled" : "disabled")
<< std::endl;
}
break;
case 'p':
{
OSG::SceneGraphPrinter sgp(mgr->getRoot());
sgp.addPrintFunc(OSG::SkinnedGeometry::getClassType(),
&printVolume );
sgp.printDownTree(std::cout);
NodeStore::const_iterator nIt = skinnedGeoN.begin();
NodeStore::const_iterator nEnd = skinnedGeoN.end ();
for(OSG::UInt32 i = 0; nIt != nEnd; ++nIt, ++i)
{
OSG::SkinnedGeometry *sgeo = dynamic_cast<OSG::SkinnedGeometry *>(
(*nIt)->getCore());
std::cout << "Skeleton:\n";
OSG::SceneGraphPrinter skelPrinter(sgeo->getSkeleton()->getRoots(0));
skelPrinter.addPrintFunc(OSG::Transform ::getClassType(),
&printXForm );
//skelPrinter.addPrintFunc(OSG::SkeletonJoint::getClassType(),
// &printJoint );
skelPrinter.printDownTree(std::cout);
}
}
break;
示例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;
}