2008-11-13 23:35:08 +08:00
|
|
|
#include <osgViewer/Viewer>
|
|
|
|
#include <osgViewer/ViewerEventHandlers>
|
|
|
|
|
2008-11-20 19:28:20 +08:00
|
|
|
#include <osgWidget/Browser>
|
2008-11-18 01:58:59 +08:00
|
|
|
|
2008-12-09 19:05:04 +08:00
|
|
|
int main(int argc,char** argv)
|
2008-11-17 23:49:24 +08:00
|
|
|
{
|
|
|
|
osg::ArgumentParser arguments(&argc, argv);
|
2009-09-04 17:11:49 +08:00
|
|
|
|
2008-11-20 00:58:32 +08:00
|
|
|
osgWidget::BrowserManager::instance()->init(arguments[0]);
|
2008-11-17 23:49:24 +08:00
|
|
|
|
|
|
|
osgViewer::Viewer viewer(arguments);
|
|
|
|
|
2008-12-09 19:05:04 +08:00
|
|
|
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
|
|
|
|
osg::Vec3(1.0f,0.0f,0.0f),
|
|
|
|
osg::Vec3(0.0f,0.0f,1.0f),
|
|
|
|
osg::Vec4(1.0f,1.0f,1.0f,1.0f),
|
|
|
|
osgWidget::GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO);
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Group> group = new osg::Group;
|
2008-11-17 23:49:24 +08:00
|
|
|
|
|
|
|
for(int i=1; i<arguments.argc(); ++i)
|
|
|
|
{
|
|
|
|
if (!arguments.isOption(i))
|
|
|
|
{
|
2008-12-09 19:05:04 +08:00
|
|
|
osg::ref_ptr<osgWidget::Browser> browser = new osgWidget::Browser;
|
|
|
|
if (browser->open(arguments[i], hints))
|
2009-09-04 17:11:49 +08:00
|
|
|
{
|
2008-12-09 19:05:04 +08:00
|
|
|
group->addChild(browser.get());
|
2009-09-04 17:11:49 +08:00
|
|
|
|
2008-12-09 19:05:04 +08:00
|
|
|
hints.position.x() += 1.1f;
|
|
|
|
}
|
2008-11-17 23:49:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-09 19:05:04 +08:00
|
|
|
viewer.setSceneData(group.get());
|
2008-11-17 23:49:24 +08:00
|
|
|
|
|
|
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
2008-12-09 19:05:04 +08:00
|
|
|
|
2008-11-18 21:36:47 +08:00
|
|
|
return viewer.run();
|
2008-11-15 00:48:07 +08:00
|
|
|
}
|