viewer = osgViewer.Viewer()

    typedef std.list< gsc.CaptureSettings > CaptureSettingsList
    frameCaptureList = CaptureSettingsList()

    fc = gsc.CaptureSettings()

    duration = 0.0
    fps = 0.0
    nframes = 0

    readCaptureSettings = False
    filename = str()
    if arguments.read("--cs",filename) :
        object = osgDB.readObjectFile(filename)
        input_cs = dynamic_cast<gsc.CaptureSettings*>(object)
        if input_cs :  fc = input_cs readCaptureSettings = True 
        else:
            OSG_NOTICE, "Unable to read CaptureSettings from file: ", filename
            if object.valid() : OSG_NOTICE, "Object read, ", object, ", className()=", object.className()
            return 1

    screenWidth = fc.getScreenWidth() not  fc.getScreenWidth() : osg.DisplaySettings: if (=0.0) else instance().getScreenWidth()
    if arguments.read("--screen-width",screenWidth) : 

    screenHeight = fc.getScreenHeight() not  fc.getScreenHeight() : osg.DisplaySettings: if (=0.0) else instance().getScreenHeight()
    if arguments.read("--screen-height",screenHeight) : 

    screenDistance = fc.getScreenDistance() not  fc.getScreenDistance() : osg.DisplaySettings: if (=0.0) else instance().getScreenDistance()
    if arguments.read("--screen-distance",screenDistance) : 
Esempio n. 2
0
    # alternative viewer window setups.
    while arguments.read("-1") :  singleWindowMultipleCameras(viewer) 
    while arguments.read("-2") :  multipleWindowMultipleCameras(viewer, False) 
    while arguments.read("-3") :  multipleWindowMultipleCameras(viewer, True) 

    if apm.valid() : viewer.setCameraManipulator(apm)
    else viewer.setCameraManipulator( osgGA.TrackballManipulator() )
    
    viewer.addEventHandler(osgViewer.StatsHandler)()
    viewer.addEventHandler(osgViewer.ThreadingHandler)()

    configfile = str()
    while arguments.read("--config", configfile) :
        osg.notify(osg.NOTICE), "Trying to read config file ", configfile
        object = osgDB.readObjectFile(configfile)
        view = dynamic_cast<osgViewer.View*>(object)
        if view :
            osg.notify(osg.NOTICE), "Read config file succesfully"
        else:
            osg.notify(osg.NOTICE), "Failed to read config file : ", configfile
            return 1

    while arguments.read("--write-config", configfile) :  osgDB.writeObjectFile(viewer, configfile) 


    if arguments.read("-m") :
        modelHandler = ModelHandler()
        for(int i=1 i<arguments.argc()++i)
            modelHandler.add(arguments[i])
Esempio n. 3
0
            tex_coords = dynamic_cast<osg.Vec2Array*>(_geo.getTexCoordArray(0))
            if tex_coords : 

                (*tex_coords)[0].set(l,t)
                (*tex_coords)[1].set(l,b)
                (*tex_coords)[2].set(r,b)
                (*tex_coords)[3].set(r,t)
                tex_coords.dirty()
                _geo.dirtyDisplayList()
    _tex = osg.observer_ptr<osg.Texture>()
    _geo = osg.observer_ptr<osg.Geometry>()


static osg.Node* readImageStream( str file_name, osg.Vec3 p, float desired_height, osgDB.Options* options)
    obj = osgDB.readObjectFile(file_name, options)
    tex = dynamic_cast<osg.Texture*>(obj)
    geo = osg.Geometry*(NULL)
    w = float(0)

    if  not tex :
        img_stream = dynamic_cast<osg.ImageStream*>(obj)

        # try readImageFile if readObjectFile failed
        if  not img_stream :
            img_stream = dynamic_cast<osg.ImageStream*>(osgDB.readImageFile(file_name, options))

        if img_stream :
            tex = osg.Texture2D(img_stream)
            tex.setResizeNonPowerOfTwoHint(False)