当前位置: 首页>>代码示例>>C++>>正文


C++ SkyBox::createSkyBox方法代码示例

本文整理汇总了C++中SkyBox::createSkyBox方法的典型用法代码示例。如果您正苦于以下问题:C++ SkyBox::createSkyBox方法的具体用法?C++ SkyBox::createSkyBox怎么用?C++ SkyBox::createSkyBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SkyBox的用法示例。


在下文中一共展示了SkyBox::createSkyBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

osg::ref_ptr<osg::Node> CoreGraph::createSkyBox(){
	if (appConf->getValue("Viewer.SkyBox.Noise").toInt() == 0) {
		SkyBox * skyBox = new SkyBox;
		return skyBox->createSkyBox();
	} else {

		unsigned char red = (unsigned char) appConf->getValue("Viewer.Display.BackGround.R").toInt();
		unsigned char green = (unsigned char) appConf->getValue("Viewer.Display.BackGround.G").toInt();
		unsigned char blue =(unsigned char) appConf->getValue("Viewer.Display.BackGround.B").toInt() ;
		osg::ref_ptr<osg::Texture2D> skymap =
				PerlinNoiseTextureGenerator::getCoudTexture(2048, 1024,
															red,
															green,
															blue,
															255);

		skymap->setDataVariance(osg::Object::DYNAMIC);
		skymap->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
		skymap->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
		skymap->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
		skymap->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);

		osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet();
		stateset->setTextureAttributeAndModes(0, skymap, osg::StateAttribute::ON);
		stateset->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
		stateset->setMode( GL_CULL_FACE, osg::StateAttribute::OFF );
		stateset->setRenderBinDetails(-1,"RenderBin");

		osg::ref_ptr<osg::Depth> depth = new osg::Depth;
		depth->setFunction(osg::Depth::ALWAYS);
		depth->setRange(1, 1);
		stateset->setAttributeAndModes(depth, osg::StateAttribute::ON );

		osg::ref_ptr<osg::Drawable> drawable = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f,0.0f,0.0f), 1));
		osg::ref_ptr<osg::Geode> geode = new osg::Geode;

		geode->setCullingActive(false);
		geode->setStateSet(stateset);
		geode->addDrawable(drawable);

		osg::ref_ptr<osg::Transform> transform = new SkyTransform;
		transform->setCullingActive(false);
		transform->addChild(geode);

		osg::ref_ptr<osg::ClearNode> clearNode = new osg::ClearNode;
		clearNode->setRequiresClear(false);
		clearNode->addChild(transform);

		return clearNode;
	}
}
开发者ID:VolovarMartin,项目名称:3dsoftviz,代码行数:51,代码来源:CoreGraph.cpp


注:本文中的SkyBox::createSkyBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。