|
发表于 2012-8-17 10:32:04
|
显示全部楼层
int main()
{
setlocale(LC_ALL, "chinese-simplified");
osg::ref_ptr<osgViewer::Viewer>viewer = new osgViewer::Viewer;
osg::ref_ptr<osg::Group>root =new osg::Group;
osg::ref_ptr<osg::Node> city =osgDB::readNodeFile("cow.osg");
root->addChild(city);
city->getOrCreateStateSet()->setMode( GL_CLIP_PLANE0, osg::StateAttribute::ON );
city->getOrCreateStateSet()->setMode( GL_CLIP_PLANE1, osg::StateAttribute::ON );
osg::ClipPlane* reflClipPlane = new osg::ClipPlane(0);
reflClipPlane->setClipPlane( 0.0, 0.0, -1.0, 1 );
osg::ClipPlane* reflClipPlane1 = new osg::ClipPlane(1);
reflClipPlane1->setClipPlane( 0.0, 0.0, 1.0, 1 );
osg::ClipNode*_reflectionClipNode = new osg::ClipNode;
_reflectionClipNode->addClipPlane( reflClipPlane );
_reflectionClipNode->addClipPlane( reflClipPlane1 );
osg::Group * clipgroup = new osg::Group;
clipgroup->addChild(_reflectionClipNode);
root->addChild(clipgroup);
viewer->setSceneData(root);
return viewer->run();
}
这应该是你想要的 |
|