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

Language C++ Lines 40
MD5 Hash 2c5475e88ac097eaafadc7dbcca0891d Estimated Cost $656 (why?)
Repository git://pkgs.fedoraproject.org/OpenSceneGraph View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>

#include <osgWidget/PdfReader>

int main(int argc,char** argv)
{
    osg::ArgumentParser arguments(&argc, argv);
    osgViewer::Viewer viewer(arguments);

    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;

    for(int i=1; i<arguments.argc(); ++i)
    {
        if (!arguments.isOption(i))
        {
            osg::ref_ptr<osgWidget::PdfReader> pdfReader = new osgWidget::PdfReader;
            if (pdfReader->open(arguments[i], hints))
            {            
                group->addChild(pdfReader.get());
                
                hints.position.x() += 1.1f;
            }
        }
    }

    viewer.setSceneData(group.get());

    viewer.addEventHandler(new osgViewer::StatsHandler);

    return viewer.run();
}
Back to Top