osgViewer.ViewerBase

class osgViewer.ViewerBase
Represents:c++ class
Wraps:osgViewer::ViewerBase
Bases:osg.Object

osgViewer.ViewerBase is the view base class that is inherited by both osgViewer.Viewer and osgViewer.CompositeViewer.

Methods:

:setViewerStats(osg.Stats stats)

Get the viewer’s object used to collect various frame related timing and scene graph stats.

Parameters:stats (osg.Stats) –
:getViewerStats()

Get the viewer’s osg.Stats object.

Return type:osg.Stats
:readConfiguration(std.string filename)

Read the viewer configuration from a configuration file.

Parameters:filename (std.string) –
Return type:bool
:isRealized()

Get whether at least of one of this viewers windows are realized.

Return type:bool
:realize()

Set up windows and associated threads.

:setUseConfigureAffinity(bool flag)

Set whether the osgViewer.ViewerBase.setUpThreading() method should call osgViewer.ViewerBase.configureAffinity() to set up up the processor affinity of viewer threads.

Parameters:flag (bool) –
:getUseConfigureAffinity()

Get whether the osgViewer.ViewerBase.setUpThreading() method should call osgViewer.ViewerBase.configureAffinity() to set up up the processor affinity of viewer threads.

Return type:bool
:configureAffinity()

Analyse the viewer configuration and select an appropriate Affinity for main thread, and any graphics, camera threads and database pagers that are required.

:setThreadingModel(osgViewer.ViewerBase.ThreadingModel threadingModel)

Set the threading model the rendering traversals will use.

Parameters:threadingModel (osgViewer.ViewerBase.ThreadingModel) –
:getThreadingModel()

Get the threading model the rendering traversals will use.

Return type:osgViewer.ViewerBase.ThreadingModel
:suggestBestThreadingModel()

Let the viewer suggest the best threading model for the viewers camera/window setup and the hardware available.

Return type:osgViewer.ViewerBase.ThreadingModel
:setUpThreading()

Set up the threading and processor affinity as per the viewers threading model.

:areThreadsRunning()

Return true if viewer threads are running.

Return type:bool
:stopThreading()

Stop any threads being run by viewer.

:startThreading()

Start any threads required by the viewer.

:setDone(bool done)

Set the done flag to signal the viewer’s work is done and should exit the frame loop.

Parameters:done (bool) –
:done()

Return true if viewer’s work is done and should exit the frame loop.

Return type:bool
:setEventVisitor(osgGA.EventVisitor eventVisitor)

Parameters:eventVisitor (osgGA.EventVisitor) –
:getEventVisitor()

Return type:osgGA.EventVisitor
:setKeyEventSetsDone(int key)

Set the key event that the viewer checks on each frame to see if the viewer’s done flag should be set to signal end of viewers main loop. Default value is Escape (osgGA.GUIEventAdapter.KEY_Escape). Setting to 0 switches off the feature.

Parameters:key (int) –
:getKeyEventSetsDone()

Get the key event that the viewer checks on each frame to see if the viewer’s done flag.

Return type:int
:setQuitEventSetsDone(bool flag)

If the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature.

Parameters:flag (bool) –
:getQuitEventSetsDone()

Returns true if the viewer respond to the QUIT_APPLICATION-event

Return type:bool
:setReleaseContextAtEndOfFrameHint(bool hint)

Hint to tell the osgViewer.ViewerBase.renderingTraversals() method whether to call osgViewer.ViewerBase.releaseContext() on the last context that was made current by the thread calling osgViewer.ViewerBase.renderingTraversals(). Note, when running multi-threaded viewer no threads will be made current or release current. Setting this hint to false can enable the frame loop to be lazy about calling osgViewer.ViewerBase.makeCurrent() and osgViewer.ViewerBase.releaseContext() on each new frame, helping performance. However, if you frame loop is managing multiple graphics context all from the main frame thread then this hint must be left on, otherwise the wrong context could be left active, introducing errors in rendering.

Parameters:hint (bool) –
:getReleaseContextAtEndOfFrameHint()

Hint to tell the osgViewer.ViewerBase.renderingTraversals() method whether to call osgViewer.ViewerBase.releaseContext().

Return type:bool
:setUpdateVisitor(osgUtil.UpdateVisitor updateVisitor)

Parameters:updateVisitor (osgUtil.UpdateVisitor) –
:getUpdateVisitor()

Return type:osgUtil.UpdateVisitor
:addUpdateOperation(osg.Operation operation)

Add an update operation.

Parameters:operation (osg.Operation) –
:removeUpdateOperation(osg.Operation operation)

Parameters:operation (osg.Operation) –
:setRealizeOperation(osg.Operation operation)

Set the graphics operation to call on realization of the viewers graphics windows.

Parameters:operation (osg.Operation) –
:getRealizeOperation()

Get the graphics operation to call on realization of the viewers graphics windows.

Return type:osg.Operation
:setRunFrameScheme(osgViewer.ViewerBase.FrameScheme fs)

Parameters:fs (osgViewer.ViewerBase.FrameScheme) –
:getRunFrameScheme()

Return type:osgViewer.ViewerBase.FrameScheme
:setRunMaxFrameRate(double frameRate)

Parameters:frameRate (double) –
:getRunMaxFrameRate()

Return type:double
:run()

Execute a main frame loop. Equivalent to while (!viewer:done()) viewer:frame() Also calls osgViewer.ViewerBase.realize() if the viewer is not already realized, and installs trackball manipulator if one is not already assigned.

Return type:int
:checkNeedToDoFrame()

Check to see if the new frame is required, called by osgViewer.ViewerBase.run() when FrameScheme is set to osgViewer.ViewerBase.ON_DEMAND.

Return type:bool
:checkEvents()

Check to see if events have been received, return true if events are now available.

Return type:bool
:frame()

:frame(double simulationTime)

Render a complete new frame. Calls osgViewer.ViewerBase.advance(), osgViewer.ViewerBase.eventTraversal(), osgViewer.ViewerBase.updateTraversal(), osgViewer.ViewerBase.renderingTraversals().

Parameters:simulationTime (double) –
:advance()

:advance(double simulationTime)

Parameters:simulationTime (double) –
:eventTraversal()

:updateTraversal()

:renderingTraversals()

:getCameras()

Return type:osgViewer.ViewerBase.Cameras
:getCameras(bool onlyActive)

Parameters:onlyActive (bool) –
Return type:osgViewer.ViewerBase.Cameras
:getContexts()

Return type:osgViewer.ViewerBase.Contexts
:getContexts(bool onlyValid)

Parameters:onlyValid (bool) –
Return type:osgViewer.ViewerBase.Contexts
:getWindows()

Return type:osgViewer.ViewerBase.Windows
:getWindows(bool onlyValid)

Parameters:onlyValid (bool) –
Return type:osgViewer.ViewerBase.Windows
:getScenes()

Return type:osgViewer.ViewerBase.Scenes
:getScenes(bool onlyValid)

Parameters:onlyValid (bool) –
Return type:osgViewer.ViewerBase.Scenes
:getViews()

Return type:osgViewer.ViewerBase.Views
:getViews(bool onlyValid)

Parameters:onlyValid (bool) –
Return type:osgViewer.ViewerBase.Views
:elapsedTime()

Return type:double
:getViewerFrameStamp()

Return type:osg.FrameStamp