雪为啥显示不出来
#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文件,都显示不出来雪,拉近后发现,雪在数字球内部下。 把数字球缩小就可以了,不知道为什么。 你可以用ObjectLocatorNode 怎么用 tinyfog 发表于 2014-5-13 22:56
怎么用
参考实例osgearth_clamp 问题解决了,是坐标的问题,谢谢大家关心! tinyfog 发表于 2014-5-17 22:31
问题解决了,是坐标的问题,谢谢大家关心!
具体怎么解决的
页:
[1]