tinyfog 发表于 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::PrecipitationEffect> 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文件,都显示不出来雪,拉近后发现,雪在数字球内部下。

tinyfog 发表于 2014-5-12 22:18:41

把数字球缩小就可以了,不知道为什么。

Jensen1736 发表于 2014-5-13 22:40:07

你可以用ObjectLocatorNode

tinyfog 发表于 2014-5-13 22:56:45

怎么用

Jensen1736 发表于 2014-5-13 23:11:45

tinyfog 发表于 2014-5-13 22:56
怎么用

参考实例osgearth_clamp

tinyfog 发表于 2014-5-17 22:31:10

问题解决了,是坐标的问题,谢谢大家关心!

jshj1982 发表于 2014-8-28 20:21:07

tinyfog 发表于 2014-5-17 22:31
问题解决了,是坐标的问题,谢谢大家关心!

具体怎么解决的
页: [1]
查看完整版本: 雪为啥显示不出来