man SoXtViewer () - viewer component lowest base class

NAME

SoXtViewer - viewer component lowest base class

INHERITS FROM

SoXtComponent > SoXtGLWidget > SoXtRenderArea > SoXtViewer

SYNOPSIS

#include <Inventor/Xt/viewers/SoXtViewer.h> c } c } SoXtViewerCB(void *userData, SoXtViewer *viewer) enum Type { c } c } camera views scene, but is not added to scene

c } c } camera is added to user's scene

} enum DrawStyle { c } c } unchanged

c } c } render only the front most lines

c } c } render withought textures

c } c } render low complexity and no texture

c } c } wireframe draw style

c } c } low complexity wireframe with no depth comparison

c } c } point draw style

c } c } low complexity point with no depth comparison

c } c } bounding box draw style with no depth comparison

c } c } forces the INTERACTIVE draw style to automatically match STILL

} enum DrawType { c } c } applies to static rendering

c } c } applies to rendering while interactive viewing

} enum BufferType { c } c } single buffer

c } c } double buffer

c } c } double buffer while interactive viewing

} Methods from class SoXtViewer: c } c } setCamera(SoCamera *cam)

c } c } getCamera()

c } c } setCameraType(SoType type)

c } c } getCameraType()

c } c } viewAll()

c } c } saveHomePosition()

c } c } resetToHomePosition()

c } c } setHeadlight(SbBool onOrOff)

c } c } isHeadlight()

c } c } getHeadlight()

c } c } setDrawStyle(SoXtViewer::DrawType type, SoXtViewer::DrawStyle style)

c } c } getDrawStyle(SoXtViewer::DrawType type)

c } c } setBufferingType(SoXtViewer::BufferType type)

c } c } getBufferingType()

c } c } setViewing(SbBool onOrOff)

c } c } isViewing() const

c } c } setCursorEnabled(SbBool onOrOff)

c } c } isCursorEnabled() const

c } c } setAutoClipping(SbBool onOrOff)

c } c } isAutoClipping() const

c } c } setStereoViewing(SbBool onOrOff)

c } c } isStereoViewing()

c } c } setStereoOffset(float dist)

c } c } getStereoOffset()

c } c } setDetailSeek(SbBool onOrOff)

c } c } isDetailSeek()

c } c } setSeekTime(float seconds)

c } c } getSeekTime()

c } c } addStartCallback(SoXtViewerCB *f, void *userData = NULL)

c } c } addFinishCallback(SoXtViewerCB *f, void *userData = NULL)

c } c } removeStartCallback(SoXtViewerCB *f, void *userData = NULL)

c } c } removeFinishCallback(SoXtViewerCB *f, void *userData = NULL)

c } c } copyView(Time eventTime)

c } c } pasteView(Time eventTime)

c } c } recomputeSceneSize() Methods from class SoXtRenderArea: c } c } setSceneGraph(SoNode *newScene)

c } c } getSceneGraph()

c } c } setOverlaySceneGraph(SoNode *newScene)

c } c } getOverlaySceneGraph()

c } c } registerDevice(SoXtDevice *)

c } c } unregisterDevice(SoXtDevice *)

c } c } setBackgroundColor(const SbColor &c)

c } c } getBackgroundColor() const

c } c } setBackgroundIndex(int index)

c } c } getBackgroundIndex() const

c } c } setOverlayBackgroundIndex(int index)

c } c } getOverlayBackgroundIndex() const

c } c } setColorMap(int startIndex, int num, const SbColor *colors)

c } c } setOverlayColorMap(int startIndex, int num, const SbColor *colors)

c } c } setViewportRegion(const SbViewportRegion &newRegion)

c } c } getViewportRegion() const

c } c } setTransparencyType(SoGLRenderAction::TransparencyType type)

c } c } getTransparencyType() const

c } c } setAntialiasing(SbBool smoothing, int numPasses)

c } c } getAntialiasing(SbBool &smoothing, int &numPasses) const

c } c } setClearBeforeRender(SbBool trueOrFalse)

c } c } isClearBeforeRender() const

c } c } setClearBeforeOverlayRender(SbBool trueOrFalse)

c } c } isClearBeforeOverlayRender() const

c } c } setAutoRedraw(SbBool trueOrFalse)

c } c } isAutoRedraw() const

c } c } setRedrawPriority(uint32_t priority)

c } c } getRedrawPriority() const

c } c } getDefaultRedrawPriority()

c } c } render()

c } c } renderOverlay()

c } c } scheduleRedraw()

c } c } scheduleOverlayRedraw()

c } c } redrawOnSelectionChange(SoSelection *s)

c } c } redrawOverlayOnSelectionChange(SoSelection *s)

c } c } setEventCallback(SoXtRenderAreaEventCB *fcn, void *userData = NULL)

c } c } setGLRenderAction(SoGLRenderAction *ra)

c } c } getGLRenderAction() const

c } c } setOverlayGLRenderAction(SoGLRenderAction *ra)

c } c } getOverlayGLRenderAction() const

c } c } setSceneManager(SoSceneManager *sm)

c } c } getSceneManager() const

c } c } setOverlaySceneManager(SoSceneManager *sm)

c } c } getOverlaySceneManager() const Methods from class SoXtGLWidget: c } c } setBorder(SbBool onOrOff)

c } c } isBorder() const

c } c } setDoubleBuffer(SbBool onOrOff)

c } c } isDoubleBuffer()

c } c } getNormalWindow()

c } c } getOverlayWindow()

c } c } getNormalContext()

c } c } getOverlayContext()

c } c } getNormalWidget()

c } c } getOverlayWidget()

c } c } setNormalVisual(XVisualInfo *vis)

c } c } getNormalVisual()

c } c } setOverlayVisual(XVisualInfo *vis)

c } c } getOverlayVisual()

c } c } setDrawToFrontBufferEnable(SbBool enableFlag)

c } c } isDrawToFrontBufferEnable() const Methods from class SoXtComponent: c } c } show()

c } c } hide()

c } c } isVisible()

c } c } getWidget() const

c } c } isTopLevelShell() const

c } c } getShellWidget() const

c } c } getParentWidget() const

c } c } setSize(const SbVec2s &size)

c } c } getSize()

c } c } getDisplay()

c } c } setTitle(const char *newTitle)

c } c } getTitle() const

c } c } setIconTitle(const char *newIconTitle)

c } c } getIconTitle() const

c } c } setWindowCloseCallback(SoXtComponentCB *func, void *data = NULL)

c } c } getComponent(Widget w)

c } c } getWidgetName() const

c } c } getClassName() const

DESCRIPTION

This is the lowest base class for viewer components. This class adds the notion of a camera to the SoXtRenderArea class. Whenever a new scene is specified with setSceneGraph(), the first camera encountered will be by default used as the edited camera. If no camera is found in the scene, the viewer will automatically create one. If the viewer type is SoXtViewer::BROWSER then the camera is told to view the supplied scene graph but is not added beneath that scene graph root. If the viewer type is SoXtViewer::EDITOR then the camera is added beneath the supplied scene graph root. In addition to automatically creating a camera if needed, this base class also creates a headlight (directional light which is made to follow the camera), enables the user to change drawing styles (like wireframe or move wireframe), and buffering types. This base class also provides a convenient way to have the camera near and far clipping planes be automatically adjusted to minimize the clipping of objects in the scene. Viewers allow the application to shadow event processing. When the application registers an event processing callback by calling setEventCallback() the viewer will invoke this callback for every X event it receives. However, unlike the render area, the viewer ignores the return value of this callback, and processes the event as usual. This allows the application to expand viewing capabilities without breaking the viewing paradigm. It is an easy way to hook up other devices, like the spaceball, to an existing viewer.

METHODS

c } c } setCamera(SoCamera *cam)

c } c } getCamera()

Set and get the edited camera. Setting the camera is only needed if the first camera found in the scene when setting the scene graph isn't the one the user really wants to edit. c } c } setCameraType(SoType type)

c } c } getCameraType()

Set and get the camera type that will be created by the viewer if no cameras are found in the scene graph (see SoPerspectiveCamera and SoOrthographicCamera). By default an SoPerspectiveCamera will be created if no camera are found. Note: the set method will only take effect next time a scene graph is specified (and if no camera are found). c } c } viewAll()

Changes the camera position to view the entire scene (the camera zoom or orientation isn't changed). c } c } saveHomePosition()

c } c } resetToHomePosition()

Saves and restores the camera values. c } c } setHeadlight(SbBool onOrOff)

c } c } isHeadlight()

c } c } getHeadlight()

Turns the headlight on/off (default on) and return the headlight node. c } c } setDrawStyle(SoXtViewer::DrawType type, SoXtViewer::DrawStyle style)

c } c } getDrawStyle(SoXtViewer::DrawType type)

Sets/gets the current drawing style in the main view - The user can specify the INTERACTIVE draw style (draw style used when the scene changes) independently from the STILL style. STILL defaults to VIEW_AS_IS. INTERACTIVE defaults to VIEW_NO_TEXTURE on machine that do not support fast texturing, VIEW_SAME_AS_STILL otherwise. Possible draw styles are: VIEW_AS_IS - Leaves the objects unchanged. VIEW_HIDDEN_LINE - Renders the object as wireframe, but only show the object front faces. This is accomplished using a two pass rendering. In the first pass, the objects are rendered as FILLED using the background BASE_COLOR (this sets up the wanted z-buffer values). The second pass then renders the objects as LINES, while adjusting the z-buffer range to limit overlapping polygons problems. VIEW_NO_TEXTURE - Renders the objects withought any textures. This is done by setting the override flag on an SoComplexity node with textureQuality = 0. VIEW_LOW_COMPLEXITY - Renders the objects withought any textures and with a low complexity. This is done by setting the override flag on an SoComplexity node with textureQuality = 0 and complexity value = 0.15. VIEW_LINE - Renders the objects as LINES (no texture) with lighting model set to BASE_COLOR. VIEW_LOW_RES_LINE - Renders the objects as LINES (no texture) using a low complexity, with lighting model set to BASE_COLOR and no depth comparison. VIEW_POINT - Renders the objects as POINTS (no texture) with lighting model set to BASE_COLOR. VIEW_LOW_RES_POINT - Renders the objects as POINTS (no texture) using a low complexity, with lighting model set to BASE_COLOR and no depth comparison. VIEW_BBOX - Renders the objects with complexity BOUNDING_BOX, lighting model set to BASE_COLOR and drawing style LINES (no texture) with no depth comparison. VIEW_SAME_AS_STILL - This only applies to INTERACTIVE draw type. It enables the interactive draw style mode to match the regular draw style mode withough having to set it explicitly. c } c } setBufferingType(SoXtViewer::BufferType type)

c } c } getBufferingType()

Sets/gets the current buffering type in the main view (default SoXtViewer::BUFFER_DOUBLE). c } c } setViewing(SbBool onOrOff)

c } c } isViewing() const

Set/get whether the viewer is turned on or off. When turned on, events are consumed by the viewer. When viewing is off, events are processed by the viewers render area. This means events will be sent down to the scene graph for processing (i.e. picking can occur). Note that if the application has registered an event callback, it will be invoked on every event, whether viewing is turned on or not. However, the return value of this callback (which specifies whether the callback handled the event or not) is ignored when viewing is on. That is, the viewer will process the event even if the callback already did. This is to ensure that the viewing paradigm is not broken (default viewing is ON). c } c } setCursorEnabled(SbBool onOrOff)

c } c } isCursorEnabled() const

Set/get whether the viewer is allowed to change the cursor over the renderArea window. When disabled, the cursor is undefined by the viewer and will not change as the mode of the viewer changes. When re-enabled, the viewer will reset it to the appropriate icon. Disabling the cursor enables the application to set the cursor directly on the viewer window or on any parent widget of the viewer. This can be used when setting a busy cursor on the application shell. Subclasses should redefine this routine to call XUndefineCursor() or XDefineCursor() with the appropariate glyth. The base class routine only sets the flag. c } c } setAutoClipping(SbBool onOrOff)

c } c } isAutoClipping() const

Set and get the auto clipping plane. When auto clipping is ON, the camera near and far planes are dynamically adjusted to be as tight as possible around the objects being viewed. When OFF, the user is expected to manually set those planes within the preference sheet (default is on). c } c } setStereoViewing(SbBool onOrOff)

c } c } isStereoViewing()

c } c } setStereoOffset(float dist)

c } c } getStereoOffset()

Turns stereo viewing on/off on the viewer (default off). When in stereo mode, which may not work on all machines, the scene is rendered twice (in the left and right buffers) with an offset between the two views to simulate stereo viewing. Stereo glasses have to be used to see the effect and /usr/gfx/setmon needs to be called to set the monitor in stereo mode. The user can also specify what the offset between the two views should be. c } c } setDetailSeek(SbBool onOrOff)

c } c } isDetailSeek()

When the viewer is in seek mode, left mouse clicks initiate a pick, and the viewer changes its orientation and position to look at the picked object. This routine tells the seeking viewer whether to orient the camera towards the picked point (detail on), or the center of the object's bounding box (detail off). Default is detail on. c } c } setSeekTime(float seconds)

c } c } getSeekTime()

Set the time a seek takes to change to the new camera location. A value of zero seeks directly to the point without any animation. Default value is 2 seconds. c } c } addStartCallback(SoXtViewerCB *f, void *userData = NULL)

c } c } addFinishCallback(SoXtViewerCB *f, void *userData = NULL)

c } c } removeStartCallback(SoXtViewerCB *f, void *userData = NULL)

c } c } removeFinishCallback(SoXtViewerCB *f, void *userData = NULL)

Add/remove start and finish callback routines on the viewer. Start callbacks are called whenever the user starts doing interactive viewing (for example, mouse down), and finish callbacks are called when user is done doing interactive work (for example, mouse up). Note: The viewer "this" pointer is passed as callback data. c } c } copyView(Time eventTime)

c } c } pasteView(Time eventTime)

Copy/paste the view. eventTime should be the time of the X event which initiated the copy or paste (e.g. if copy/paste is initiated from a keystroke, eventTime should be the time in the X KeyPress event.) c } c } recomputeSceneSize()

This can be used to let the viewer know that the scene graph has changed so that the viewer can recompute things like speed which depend on the scene graph size. Note: This routine is automatically called whenever setSceneGraph() is called.

SEE ALSO

SoXtComponent, SoXtRenderArea, SoXtExaminerViewer, SoXtWalkViewer, SoXtFlyViewer, SoXtPlaneViewer