OSGEarth添加渲染器

Earth的渲染机制和OSG的不一样,具体区别我也说不出一二来,直接上代码。

	_global->Caster->setLight( _global->Viewer->getLight() ); 
	_global->Caster->getShadowCastingGroup()->addChild( _global->MapNode->getModelLayerGroup() ); 
	if ( _global->MapNode->getNumParents() > 0 ) 
	{ 
		osgEarth::insertGroup(_global->Caster, _global->MapNode->getParent(0));
	} 
	else
	{ 
		_global->Caster->addChild(_global->MapNode); 
		_global->Root->addChild(_global->Caster);
	}

为了使得模型支持高亮、半透明,添加的模型需要加入渲染器中

	_global->Caster->getShadowCastingGroup()->addChild(xxx);

还有资料说用下面的方法也可以

osgEarth::Registry::shaderGenerator().run( myNode );

这个我测试了一下,是可以渲染,但是模型不支持高亮、半透明,研究的不深,或许使用错了。

之前论坛发的有效果图

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章