创建root顶节点, 设置:关闭光照
osg::ref_ptr<osg::Node> createSceneGraph()
{
//创建Group根节点,指定了一个光照模式
osg::ref_ptr<osg::Group> root = new osg::Group;
{
osg::StateSet *state = root->getOrCreateStateSet();
state->setMode(GL_LIGHTING,
osg::StateAttribute::OFF|
osg::StateAttribute::PROTECTED);
}
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(createDrawable().get() or createGeometry().get());
//左上
...
//右上
...
//左下
...
//右下
..
}
左上
osg::Matrix m;
{
m.makeTranslate(-2.f,0.f,2.f);
osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform;
mt->setMatrix(m);
root->addChild(mt.get());
mt->addchild(geode.get());
}