osg::ref_ptr<osg::Node>
xcModel
= osgDB::readNodeFile("Models/www.ive");
if(xcModel.valid())
{
osg::ref_ptr<osg::MatrixTransform> xcTrans = new osg::MatrixTransform;
xcTrans->addChild(xcModel.get());
double tH = GetTerrainHeight(m_pMapNode,113.71665,34.0225);
tH -= 0.0;
osg::Matrix posMat;
getEllipseModel()->computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadians(34.0225),
osg::DegreesToRadians(113.71665),
tH,posMat);
osg::Matrix scaleMat;
scaleMat.makeScale(0.39,0.6,0.39);
osg::Matrix rotateMat;
rotateMat.makeRotate(osg::DegreesToRadians(-3.5),osg::Vec3(0,0,1.0));
xcTrans->setMatrix(rotateMat*scaleMat*posMat);//这里一定要先旋转再乘缩放再乘移动 否则不会显示在正确的位置
m_pSceneData->addChild(xcTrans.get());
}
一定要这样做的原因貌似是osg中的矩阵是从前乘矩阵 下次再研究
点滴收获 记录学习osg的心路历程