|
int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer =new osgViewer::Viewer();
osg::ref_ptr<osg::Group> root =new osg::Group();
osg::ref_ptr<osg::Node> node =osgDB::readNodeFile("lz.osg");
osg::ref_ptr<osg::Fog> fog =new osg::Fog();
fog->setDensity(0.1);
fog->setColor(osg::Vec4(0.7,0.8,0.9,0.3));
viewer->getCamera()->setClearColor(fog->getColor());
root->addChild(node.get());
osgUtil::Optimizer optimizer;
optimizer.optimize(root.get());
viewer->setSceneData(root.get());
viewer->realize();
viewer->run();
return 0;
fog效果图
}
出来的效果没有雾效,改变浓度参数也没有用,只是改变了背景色,求大神解疑
|
|