2008-11-12 22:21:05 +08:00
|
|
|
#include <osgViewer/Viewer>
|
|
|
|
#include <osgViewer/ViewerEventHandlers>
|
|
|
|
|
2008-12-08 01:02:30 +08:00
|
|
|
#include <osgWidget/PdfReader>
|
2008-11-12 22:21:05 +08:00
|
|
|
|
|
|
|
int main(int argc,char** argv)
|
|
|
|
{
|
|
|
|
osg::ArgumentParser arguments(&argc, argv);
|
|
|
|
osgViewer::Viewer viewer(arguments);
|
2008-12-08 01:02:30 +08:00
|
|
|
|
2008-12-09 19:05:04 +08:00
|
|
|
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
|
2008-12-08 01:02:30 +08:00
|
|
|
osg::Vec3(1.0f,0.0f,0.0f),
|
|
|
|
osg::Vec3(0.0f,0.0f,1.0f),
|
2008-12-09 17:26:51 +08:00
|
|
|
osg::Vec4(1.0f,1.0f,1.0f,1.0f),
|
2008-12-08 01:02:30 +08:00
|
|
|
osgWidget::GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO);
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Group> group = new osg::Group;
|
2008-11-12 22:21:05 +08:00
|
|
|
|
|
|
|
for(int i=1; i<arguments.argc(); ++i)
|
|
|
|
{
|
|
|
|
if (!arguments.isOption(i))
|
|
|
|
{
|
2008-12-08 01:02:30 +08:00
|
|
|
osg::ref_ptr<osgWidget::PdfReader> pdfReader = new osgWidget::PdfReader;
|
|
|
|
if (pdfReader->open(arguments[i], hints))
|
2008-11-12 22:21:05 +08:00
|
|
|
{
|
2008-12-08 01:02:30 +08:00
|
|
|
group->addChild(pdfReader.get());
|
|
|
|
|
|
|
|
hints.position.x() += 1.1f;
|
2008-11-12 22:21:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-08 01:02:30 +08:00
|
|
|
viewer.setSceneData(group.get());
|
2008-11-12 22:21:05 +08:00
|
|
|
|
|
|
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
|
|
|
|
|
|
|
return viewer.run();
|
|
|
|
}
|
|
|
|
|