|
发表于 2009-10-9 17:49:05
|
显示全部楼层
还有一个问题,osgEphemeris正确编译成功了,但是下面的程序编译成功,但是执行没有看到任何效果。
有编译过osgEphemeris的指导一下撒?谢谢先
---------------------------------------
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osgEphemeris/EphemerisModel>
#pragma comment(lib,"osg.lib")
#pragma comment(lib,"osgDB.lib")
#pragma comment(lib,"osgEphemeris.lib")
int main()
{
osgViewer::Viewer viewer;
osg::ref_ptr<osg::Group> root = new osg::Group;
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(args);
if( model.valid() )
root->addChild( model.get() );
// Define the Ephemeris Model and its radius
osg::BoundingSphere bs = model->getBound();
osg::ref_ptr<osgEphemeris::EphemerisModel> ephemerisModel = new osgEphemeris::EphemerisModel;
ephemerisModel->setSkyDomeRadius( bs.radius()*2 );
ephemerisModel->setSkyDomeCenter( bs.center() );
// Optionally, Set the AutoDate and Time to false so we can control it with the GUI
//ephemerisModel->setAutoDateTime( false );
// Optionally, uncomment this if you want to move the Skydome, Moon, Planets and StarField with the mouse
//ephemerisModel->setMoveWithEyePoint(false);
root->addChild( ephemerisModel.get() );
// set the scene to render
viewer.setSceneData(root.get());
return viewer.run();
} |
|