TA的每日心情 | 开心 2019-11-11 10:36 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
发表于 2008-4-14 10:34:48
|
显示全部楼层
源文件:StateSetManipulator
167行往后:
void StateSetManipulator::setPolygonMode(osg:olygonMode::Mode newpolygonmode)
{
osg::PolygonMode* polyModeObj = getOrCreatePolygonMode();
polyModeObj->setMode(osg::PolygonMode::FRONT_AND_BACK,newpolygonmode);
}
void StateSetManipulator::cyclePolygonMode()
{
osg::PolygonMode* polyModeObj = getOrCreatePolygonMode();
osg::PolygonMode::Mode currentMode = getPolygonMode();
// cycle through the available modes.
switch(currentMode)
{
case osg::PolygonMode::FILL : polyModeObj->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode:INE); break;
case osg::PolygonMode::LINE : polyModeObj->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::POINT); break;
case osg::PolygonMode::POINT : polyModeObj->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::FILL); break;
}
}
osg::PolygonMode::Mode StateSetManipulator::getPolygonMode() const
{
osg::PolygonMode* polyModeObj = dynamic_cast<osg::PolygonMode*>(_stateset->getAttribute(osg::StateAttribute::POLYGONMODE));
if (polyModeObj) return polyModeObj->getMode(osg::PolygonMode::FRONT_AND_BACK);
else return osg::PolygonMode::FILL;
}
osg::PolygonMode* StateSetManipulator::getOrCreatePolygonMode()
{
osg::PolygonMode* polyModeObj = dynamic_cast<osg::PolygonMode*>(_stateset->getAttribute(osg::StateAttribute::POLYGONMODE));
if (!polyModeObj)
{
polyModeObj = new osg::PolygonMode;
_stateset->setAttribute(polyModeObj);
}
return polyModeObj;
} |
|