查看: 1126|回复: 1

iOS SkyNode无法显示大气层

[复制链接]

该用户从未签到

发表于 2019-8-22 09:53:14 | 显示全部楼层 |阅读模式
本帖最后由 Charles_Yao 于 2019-8-22 09:54 编辑

在iOS平台上添加了SkyNode之后,无法显示大气层。但是太阳和星星都看得见。
这是我的代码:
SkyNode *skyNode = Util::SkyNode::create(_mapNode);
    if(skyNode == 0)
    {
        _root = new osg::Group();
        _root->addChild(_mapNode);
    }
    else
    {
        _root = skyNode;
        skyNode->setStarsVisible(true);
        skyNode->setSunVisible(true);
        skyNode->setMoonVisible(true);
        skyNode->setAtmosphereVisible(true);
        Util::Ephemeris* ephemeris = new Util::Ephemeris;
        skyNode->setEphemeris(ephemeris);
               
        skyNode->addChild( _mapNode);
    }
   
    _viewer->setSceneData( _root );

我也试过使用SimpleSkyNode,但是是一样的结果。请问各位这是什么原因导致的呢?是不是我的代码哪里写错了。。。请大家帮帮我

该用户从未签到

发表于 2019-12-24 16:38:37 | 显示全部楼层
修改osg着色器 在State::convertVertexShaderSourceToOsgBuiltIns中
if ( declPos != std::string::npos )
    {
        declPos = source.find(" ", declPos); // move to the first space after "#version"
        declPos = source.find_first_not_of(std::string(" "), declPos); // skip all the spaces until you reach the version number
        std::string versionNumber(source, declPos, 3);
        int glslVersion = atoi(versionNumber.c_str());
        OSG_INFO<<"shader version found: "<< glslVersion <<std::endl;
        if (glslVersion >= 130) attributeQualifier = "in ";
        // found the string, now find the next linefeed and set the insertion point after it.
        declPos = source.find( '\n', declPos );
#if defined(OSG_GLES3_AVAILABLE)
        declPos = source.find("precision", declPos);
        declPos = source.find( '\n', declPos );
        declPos = source.find("precision", declPos);
        declPos = source.find( '\n', declPos );
#endif
        declPos = declPos != std::string::npos ? declPos+1 : source.length();
    }
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

联系我们

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