osgEarth2.8添加模型


#include <osgEarthDrivers/model_simple/SimpleModelOptions>

 

SimpleModelOptions modelOptions;
modelOptions.url() = "cow.osg.(100,100,100).scale";
modelOptions.location() = osg::Vec3(116, 40, 100);//北京地區坐標
map->addModelLayer(new ModelLayer("model layer", modelOptions));

//視點定位北京地區
osgEarth::Viewpoint vp("", 116, 40, 0.0, -2.50, -90.0, 1.5e6);
(dynamic_cast<EarthManipulator*>(viewer.getCameraManipulator()))->setViewpoint(vp);

 

 

有時候模型沒有紋理,需要.osgearth_shadergen插件

osg::Node* cessna = osgDB::readNodeFile("data/model/su33.ive.osgearth_shadergen.1.scale");


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM