查看: 1801|回复: 1

android上大气被裁减掉,有人遇到过没

[复制链接]

该用户从未签到

发表于 2015-12-31 23:47:29 | 显示全部楼层 |阅读模式
成功编译运行osgearth到android上,发现其他的还ok,但是大气始终显示不出来,不知道什么原因,pc上正常的。
大神建议看源码写渲染测试,硬啃之前,想问问有人遇到过没?
Screenshot_2015-12-31-22-59-16.png
Screenshot_2015-12-31-22-59-21.png
Screenshot_2015-12-31-22-59-26.png
Screenshot_2015-12-31-22-59-31.png

该用户从未签到

 楼主| 发表于 2015-12-31 23:48:14 | 显示全部楼层
我的代码如下:
osgEarth::Map *map = new osgEarth::Map();
        createImageLayers(map);
        _mapNode = new osgEarth::MapNode(map);
        _viewer->setCameraManipulator(new EarthMultiTouchManipulator());
        EarthMultiTouchManipulator* manip = dynamic_cast<EarthMultiTouchManipulator*>(_viewer->getCameraManipulator());
        osgEarth::Util::EarthManipulator::ActionOptions options;
        manip->getSettings()->setMouseSensitivity(0.30);
        manip->getSettings()->setThrowingEnabled(true);
        manip->getSettings()->setThrowDecayRate(0.1);
        manip->getSettings()->setLockAzimuthWhilePanning(false);
        manip->getSettings()->setArcViewpointTransitions(false);
        manip->getSettings()->bindTwist(osgEarth::Util::EarthManipulator::ACTION_NULL, options);
        manip->getSettings()->bindMultiDrag(osgEarth::Util::EarthManipulator::ACTION_NULL, options);
        manip->getSettings()->setMinMaxPitch(-90.0, -90.0);

       osgEarth::Util::SkyOptions sOptions;
        sOptions.ambient() = 1.0;
        osg::ref_ptr<osgEarth::Util::SkyNode> sky = osgEarth::Util::SkyNode::create(sOptions, _mapNode);
        sky->setDateTime( osgEarth:ateTime(2011, 3, 6, 12.0) );
        sky->attach(_viewer, 0);
        if ( _mapNode->getNumParents() > 0 )
        {
                osgEarth::insertGroup(sky.get(), _mapNode->getParent(0));
        }
        else
        {
                sky->addChild( _mapNode );
        }
        osg::Group* root = new osg::Group();
        root->addChild(sky);

osg::Material* material = new osg::Material();
        material->setAmbient(osg::Material::FRONT, osg::Vec4(0.4,0.4,0.4,1.0));
        material->setDiffuse(osg::Material::FRONT, osg::Vec4(0.9,0.9,0.9,1.0));
        material->setSpecular(osg::Material::FRONT, osg::Vec4(0.4,0.4,0.4,1.0));
        root->getOrCreateStateSet()->setAttribute(material);
        root->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE);
        root->getOrCreateStateSet()->setAttribute(_viewer->getLight());

        _viewer->setSceneData(root);

        _viewer->realize();
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表