|
求教下!我做的模板测试!飞机在地形下面!在有树的地方怎么会无效啊?我使用的是lz.osg和cessna.osg
模板测试 有树无效
模板测试
代码:
osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("lz.osg");
node1->setName("first");
osg::ref_ptr<osg::Node> node2 = osgDB::readNodeFile("cessna.osg");
node2->setName("second");
osg::ref_ptr<osg::Stencil> stencil2 = new osg::Stencil();
stencil2->setFunction(osg::Stencil::ALWAYS,2,0xFF);
stencil2->setOperation(osg::Stencil::ZERO,osg::Stencil::REPLACE,osg::Stencil::REPLACE);
osg::ref_ptr<osg::StateSet> stateset2 = new osg::StateSet();
stateset2->setAttributeAndModes(stencil2.get(),osg::StateAttribute::ON);
node2->setStateSet(stateset2.get());
osg::ref_ptr<osg::Stencil> stencil3 = new osg::Stencil();
stencil3->setFunction(osg::Stencil::EQUAL,0,0xFF);
stencil3->setOperation(osg::Stencil::REPLACE,osg::Stencil::KEEP,osg::Stencil::KEEP);
osg::ref_ptr<osg::StateSet> stateset3 = new osg::StateSet();
stateset3->setAttributeAndModes(stencil3.get(),osg::StateAttribute::ON);
node1->setStateSet(stateset3.get()); |
|