本文整理汇总了C++中osg::NodeRefPtr::subChild方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeRefPtr::subChild方法的具体用法?C++ NodeRefPtr::subChild怎么用?C++ NodeRefPtr::subChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::NodeRefPtr
的用法示例。
在下文中一共展示了NodeRefPtr::subChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyboard
//
// react to keys
//
void keyboard(unsigned char k, int, int)
{
static OSG::Real32 val0 = 0.f;
static OSG::Real32 val1 = 0.f;
static OSG::Real32 x1 = 0.f;
static OSG::Real32 y1 = 0.f;
static OSG::Real32 z1 = 0.f;
static OSG::Real32 x2 = 0.f;
static OSG::Real32 y2 = 0.f;
static OSG::Real32 z2 = 0.f;
switch(k)
{
case ' ':
{
OSG::SceneGraphPrinter sgp(mgr->getRoot());
sgp.printDownTree(std::cout);
}
break;
case '1': // enable/disable clip plane 0
{
vecClipPlaneData[0]._enabled = !vecClipPlaneData[0]._enabled;
updateClipPlanes(vecClipPlaneData);
}
break;
case '2': // enable/disable clip plane 1
{
vecClipPlaneData[1]._enabled = !vecClipPlaneData[1]._enabled;
updateClipPlanes(vecClipPlaneData);
}
break;
case '3': // enable/disable box geometry
{
if(vecGeometries[0] == NULL)
{
OSG::Matrix matrix;
OSG::Vec3f v(10.f, 0.f, 15.f);
matrix.setTranslate(v);
OSG::GeometryRefPtr boxGeo =
OSG::makeBoxGeo(15, 15, 15, 1, 1, 1);
OSG::NodeRefPtr boxTree = buildGeoTree(scene,
boxGeo,
matrix);
vecGeometries[0] = boxTree;
scene->addChild(boxTree);
}
else
{
scene->subChild(vecGeometries[0]);
vecGeometries[0] = NULL;
}
// mgr->showAll();
// mgr->redraw();
}
break;
case '4': // enable/disable torus geometry
{
if (vecGeometries[1] == NULL)
{
OSG::Matrix matrix;
OSG::Vec3f v( 0.f, 10.f, 0.f);
matrix.setTranslate(v);
OSG::GeometryRefPtr torusGeo = OSG::makeTorusGeo(2, 6, 8, 16);
OSG::NodeRefPtr torusTree = buildGeoTree(scene,
torusGeo, matrix);
vecGeometries[1] = torusTree;
scene->addChild(torusTree);
}
else
{
scene->subChild(vecGeometries[1]);
vecGeometries[1] = NULL;
}
// mgr->showAll();
// mgr->redraw();
}
break;
case '5':
{
OSG::SceneFileHandler::the()->write(mgr->getRoot(),
"clipplane_model.osb", true);
}
break;
case 'n': // move clip plane 0 opposite to the normal direction of the plane
{
val0 -= 0.2;
//.........这里部分代码省略.........