本文整理汇总了C++中ViewWidget::getRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewWidget::getRoot方法的具体用法?C++ ViewWidget::getRoot怎么用?C++ ViewWidget::getRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewWidget
的用法示例。
在下文中一共展示了ViewWidget::getRoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSelectedDisplay
void QViewWidget::setSelectedDisplay(int index)
{
if (!viewMap.contains(sceneSelection.currentText()) || (index > ISOMETRIC && index < PERSPECTIVE))
return;
ViewWidget * viewWidget = viewMap.value(sceneSelection.currentText());
osg::StateSet * state = viewWidget->getRoot()->getOrCreateStateSet();
osg::CullFace* cf;
osg::PolygonMode *polyModeObj;
osg::ShadeModel* sm;
switch (index)
{
case WIREFRAME:
polyModeObj = dynamic_cast<osg::PolygonMode*>(state->getAttribute(osg::StateAttribute::POLYGONMODE));
if (!polyModeObj)
{
polyModeObj = new osg::PolygonMode;
state->setAttributeAndModes(polyModeObj,
osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
}
polyModeObj->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE);
break;
case POLYMODE_FILL:
polyModeObj = dynamic_cast<osg::PolygonMode*>(state->getAttribute(osg::StateAttribute::POLYGONMODE));
if (polyModeObj)
polyModeObj->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL);
break;
case BACK_CULL:
cf = dynamic_cast<osg::CullFace*>(state->getAttribute(osg::StateAttribute::CULLFACE));
if (!cf)
cf = new osg::CullFace;
state->setAttributeAndModes(cf, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
break;
case SHADING:
sm = new osg::ShadeModel;
sm->setMode(osg::ShadeModel::FLAT);
state->setAttributeAndModes(sm, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
break;
}
}