PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/OpenSceneGraph-3.0.1/OpenSceneGraph-3.0.1/examples/osgpdf/osgpdf.cpp

#
C++ | 39 lines | 29 code | 10 blank | 0 comment | 3 complexity | 2c5475e88ac097eaafadc7dbcca0891d MD5 | raw file
 1#include <osgViewer/Viewer>
 2#include <osgViewer/ViewerEventHandlers>
 3
 4#include <osgWidget/PdfReader>
 5
 6int main(int argc,char** argv)
 7{
 8    osg::ArgumentParser arguments(&argc, argv);
 9    osgViewer::Viewer viewer(arguments);
10
11    osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
12                                   osg::Vec3(1.0f,0.0f,0.0f),
13                                   osg::Vec3(0.0f,0.0f,1.0f),
14                                   osg::Vec4(1.0f,1.0f,1.0f,1.0f),
15                                   osgWidget::GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO);
16
17    osg::ref_ptr<osg::Group> group = new osg::Group;
18
19    for(int i=1; i<arguments.argc(); ++i)
20    {
21        if (!arguments.isOption(i))
22        {
23            osg::ref_ptr<osgWidget::PdfReader> pdfReader = new osgWidget::PdfReader;
24            if (pdfReader->open(arguments[i], hints))
25            {            
26                group->addChild(pdfReader.get());
27                
28                hints.position.x() += 1.1f;
29            }
30        }
31    }
32
33    viewer.setSceneData(group.get());
34
35    viewer.addEventHandler(new osgViewer::StatsHandler);
36
37    return viewer.run();
38}
39