查看: 1665|回复: 6

雪为啥显示不出来

[复制链接]

该用户从未签到

发表于 2014-5-12 17:56:42 | 显示全部楼层 |阅读模式
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osgParticle/PrecipitationEffect>
#include <osg/Node>
#include <osg/MatrixTransform>
#include <osgParticle/PrecipitationEffect>

#define dN 3.1415927

void main()
{
        osgViewer::Viewer viewer;

        osg::Group * root = new osg::Group() ;
        osg::Node* ceep = osgDB::readNodeFile("d:/aa/earth/earth.ive") ;
        root ->addChild(ceep) ;




        osg::ref_ptr<osg::EllipsoidModel>pEll = new osg::EllipsoidModel;
        double posx = 0.0;
        double posy = 0.0;
        double posz = 0.0;


        pEll->convertLatLongHeightToXYZ(26.557861*dN/180,104.957843*dN/180,100000.0, posx, posy, posz);

        pEll->convertLatLongHeightToXYZ(26.557861*dN/180,104.957843*dN/180,1000.0, posx, posy, posz);

        osg::ref_ptr<osg::MatrixTransform> treffect = new osg::MatrixTransform;
        treffect->setMatrix(osg::Matrix::translate(posx, posy, posz));

        osg::ref_ptr<osgParticle:recipitationEffect> precipitationEffect = new osgParticle::PrecipitationEffect;
        precipitationEffect->snow(0.5);
        precipitationEffect->setParticleColor(osg::Vec4(1, 1, 1, 1));
        precipitationEffect->setWind(osg::Vec3(posx, posy, posz));


        treffect->addChild(precipitationEffect.get ()) ;

        root->addChild(treffect.get());



        viewer.setSceneData(root);
        viewer.realize();
        viewer.run();
}


我无论是用osgdem生成的earth.ive,还是用earth文件,都显示不出来雪,拉近后发现,雪在数字球内部下。

该用户从未签到

 楼主| 发表于 2014-5-12 22:18:41 | 显示全部楼层
把数字球缩小就可以了,不知道为什么。

该用户从未签到

发表于 2014-5-13 22:40:07 | 显示全部楼层
你可以用ObjectLocatorNode

该用户从未签到

发表于 2014-5-13 23:11:45 | 显示全部楼层

参考实例osgearth_clamp

该用户从未签到

 楼主| 发表于 2014-5-17 22:31:10 | 显示全部楼层
问题解决了,是坐标的问题,谢谢大家关心!

该用户从未签到

发表于 2014-8-28 20:21:07 | 显示全部楼层
tinyfog 发表于 2014-5-17 22:31
问题解决了,是坐标的问题,谢谢大家关心!

具体怎么解决的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

联系我们

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