SoXtViewer(3IV)

SoXtViewer (SoXtVwr) - viewer component lowest base class

Showing IRIX 6.5.30 (default release). Added in IRIX 6.5.22.

NAME
     SoXtViewer (SoXtVwr) - viewer component lowest base class

INHERITS FROM
     SoXtComponent > SoXtGLWidget > SoXtRenderArea > SoXtViewer

SYNOPSIS
     #include <Inventor_c/Xt/viewers/SoXtViewer.h>

     typedef void        SoXtViewerCB(void *userData, SoXtViewer *viewer)
     typedef SoXtViewer  SoXtVwr

     enum SoXtViewerType {
          SO_XT_VWR_BROWSER   camera views scene, but is not added to scene
          SO_XT_VWR_EDITOR    camera is added to user's scene
     }

     enum SoXtViewerDrawStyle {
          SO_XT_VWR_VIEW_AS_IS         unchanged
          SO_XT_VWR_VIEW_HIDDEN_LINE   render only the front most lines
          SO_XT_VWR_VIEW_NO_TEXTURE    render withought textures
          SO_XT_VWR_VIEW_LOW_COMPLEXITY
                                       render low complexity and no texture
          SO_XT_VWR_VIEW_LINE          wireframe draw style
          SO_XT_VWR_VIEW_LOW_RES_LINE  low complexity wireframe with no depth
                                            comparison
          SO_XT_VWR_VIEW_POINT         point draw style
          SO_XT_VWR_VIEW_LOW_RES_POINT low complexity point with no depth
                                            comparison
          SO_XT_VWR_VIEW_BBOX          bounding box draw style with no depth
                                            comparison
          SO_XT_VWR_VIEW_SAME_AS_STILL forces the INTERACTIVE draw style to
                                            automatically match STILL
     }

     enum SoXtViewerDrawType {
          SO_XT_VWR_STILL        applies to static rendering
          SO_XT_VWR_INTERACTIVE  applies to rendering while interactive
                                      viewing
     }

     enum SoXtViewerBufferType {
          SO_XT_VWR_BUFFER_SINGLE  single buffer
          SO_XT_VWR_BUFFER_DOUBLE  double buffer
          SO_XT_VWR_BUFFER_INTERACTIVE
                                   double buffer while interactive viewing
     }

          Functions from class SoXtViewer:

     void                    SoXtVwrSetCam(SoXtVwr *this, SoCamera *cam)

     SoCamera *              SoXtVwrGetCam(SoXtVwr *this)
     void                    SoXtVwrSetCamType(SoXtVwr *this, SoType type)
     SoType                  SoXtVwrGetCamType(SoXtVwr *this)
     void                    SoXtVwrViewAll(SoXtVwr *this)
     void                    SoXtVwrSaveHomePos(SoXtVwr *this)
     void                    SoXtVwrResetToHomePos(SoXtVwr *this)
     void                    SoXtVwrSetHeadlight(SoXtVwr *this, SbBool
                                  onOrOff)
     SbBool                  SoXtVwrIsHeadlight(SoXtVwr *this)
     SoDirectionalLight *    SoXtVwrGetHeadlight(SoXtVwr *this)
     void                    SoXtVwrSetDStyle(SoXtVwr *this,
                                  SoXtViewer::DrawType type,
                                  SoXtViewer::DrawStyle style)
     SoXtViewer::DrawStyle   SoXtVwrGetDStyle(SoXtVwr *this,
                                  SoXtViewer::DrawType type)
     void                    SoXtVwrSetBufType(SoXtVwr *this,
                                  SoXtViewer::BufferType type)
     SoXtViewer::BufferType  SoXtVwrGetBufType(SoXtVwr *this)
     void                    SoXtVwrSetViewing(SoXtVwr *this, SbBool onOrOff)
     SbBool                  SoXtVwrIsViewing(const SoXtVwr *this)
     void                    SoXtVwrSetCursorEnabled(SoXtVwr *this, SbBool
                                  onOrOff)
     SbBool                  SoXtVwrIsCursorEnabled(const SoXtVwr *this)
     void                    SoXtVwrSetAutoClip(SoXtVwr *this, SbBool onOrOff)
     SbBool                  SoXtVwrIsAutoClip(const SoXtVwr *this)
     void                    SoXtVwrSetStereoViewing(SoXtVwr *this, SbBool
                                  onOrOff)
     SbBool                  SoXtVwrIsStereoViewing(SoXtVwr *this)
     void                    SoXtVwrSetStereoOffset(SoXtVwr *this, float dist)
     float                   SoXtVwrGetStereoOffset(SoXtVwr *this)
     void                    SoXtVwrSetDtlSeek(SoXtVwr *this, SbBool onOrOff)
     SbBool                  SoXtVwrIsDtlSeek(SoXtVwr *this)
     void                    SoXtVwrSetSeekTime(SoXtVwr *this, float seconds)
     float                   SoXtVwrGetSeekTime(SoXtVwr *this)
     void                    SoXtVwrAddStartCB(SoXtVwr *this, SoXtViewerCB *f,
                                  void *userData = NULL)
     void                    SoXtVwrAddFinishCB(SoXtVwr *this, SoXtViewerCB
                                  *f, void *userData = NULL)
     void                    SoXtVwrRemoveStartCB(SoXtVwr *this, SoXtViewerCB
                                  *f, void *userData = NULL)
     void                    SoXtVwrRemoveFinishCB(SoXtVwr *this, SoXtViewerCB
                                  *f, void *userData = NULL)
     void                    SoXtVwrCopyView(SoXtVwr *this, Time eventTime)
     void                    SoXtVwrPasteView(SoXtVwr *this, Time eventTime)
     void                    SoXtVwrRecompSceneSiz(SoXtVwr *this)

          Functions from class SoXtRenderArea:

     void                      SoXtVwrDelete(SoXtVwr *this)
     void                      SoXtVwrSetScene(SoXtVwr *this, SoNode
                                    *newScene)

     SoNode *                  SoXtVwrGetScene(SoXtVwr *this)
     void                      SoXtVwrSetOverScene(SoXtVwr *this, SoNode
                                    *newScene)
     SoNode *                  SoXtVwrGetOverScene(SoXtVwr *this)
     void                      SoXtVwrRegisterDevice(SoXtVwr *this, SoXtDevice
                                    *)
     void                      SoXtVwrUnregisterDevice(SoXtVwr *this,
                                    SoXtDevice *)
     void                      SoXtVwrSetBkgCol(SoXtVwr *this, const SbColor
                                    *c)
     const SbColor *           SoXtVwrGetBkgCol(const SoXtVwr *this)
     void                      SoXtVwrSetBkgInd(SoXtVwr *this, int index)
     int                       SoXtVwrGetBkgInd(const SoXtVwr *this)
     void                      SoXtVwrSetOverBkgInd(SoXtVwr *this, int index)
     int                       SoXtVwrGetOverBkgInd(const SoXtVwr *this)
     void                      SoXtVwrSetColMap(SoXtVwr *this, int startIndex,
                                    int num, const SbColor *colors)
     void                      SoXtVwrSetOverColMap(SoXtVwr *this, int
                                    startIndex, int num, const SbColor
                                    *colors)
     void                      SoXtVwrSetVPReg(SoXtVwr *this, const
                                    SbViewportRegion *newRegion)
     const SbViewportRegion *  SoXtVwrGetVPReg(const SoXtVwr *this)
     void                      SoXtVwrSetTranspType(SoXtVwr *this,
                                    SoGLRenderAction::TransparencyType type)
     SoGLRenderAction::TransparencyType
                               SoXtVwrGetTranspType(const SoXtVwr *this)
     void                      SoXtVwrSetAntialiasing(SoXtVwr *this, SbBool
                                    smoothing, int numPasses)
     void                      SoXtVwrGetAntialiasing(const SoXtVwr *this,
                                    SbBool *smoothing, int *numPasses)
     void                      SoXtVwrSetClearBeforeRender(SoXtVwr *this,
                                    SbBool trueOrFalse)
     SbBool                    SoXtVwrIsClearBeforeRender(const SoXtVwr *this)
     void                      SoXtVwrSetClearBeforeOverRender(SoXtVwr *this,
                                    SbBool trueOrFalse)
     SbBool                    SoXtVwrIsClearBeforeOverRender(const SoXtVwr
                                    *this)
     void                      SoXtVwrSetAutoRedraw(SoXtVwr *this, SbBool
                                    trueOrFalse)
     SbBool                    SoXtVwrIsAutoRedraw(const SoXtVwr *this)
     void                      SoXtVwrSetRedrawPriority(SoXtVwr *this,
                                    uint32_t priority)
     uint32_t                  SoXtVwrGetRedrawPriority(const SoXtVwr *this)
     uint32_t                  SoXtVwrGetDefaultRedrawPriority()
     void                      SoXtVwrRender(SoXtVwr *this)
     void                      SoXtVwrRenderOverlay(SoXtVwr *this)
     void                      SoXtVwrScheduleRedraw(SoXtVwr *this)
     void                      SoXtVwrScheduleOverRedraw(SoXtVwr *this)
     void                      SoXtVwrRedrawOnSelChange(SoXtVwr *this,
                                    SoSelection *s)

     void                      SoXtVwrRedrawOverOnSelChange(SoXtVwr *this,
                                    SoSelection *s)
     void                      SoXtVwrSetEvCB(SoXtVwr *this,
                                    SoXtRenderAreaEventCB *fcn, void *userData
                                    = NULL)
     void                      SoXtVwrSetGLRenderAct(SoXtVwr *this,
                                    SoGLRenderAction *ra)
     SoGLRenderAction *        SoXtVwrGetGLRenderAct(const SoXtVwr *this)
     void                      SoXtVwrSetOverGLRenderAct(SoXtVwr *this,
                                    SoGLRenderAction *ra)
     SoGLRenderAction *        SoXtVwrGetOverGLRenderAct(const SoXtVwr *this)
     void                      SoXtVwrSetSceneMgr(SoXtVwr *this,
                                    SoSceneManager *sm)
     SoSceneManager *          SoXtVwrGetSceneMgr(const SoXtVwr *this)
     void                      SoXtVwrSetOverSceneMgr(SoXtVwr *this,
                                    SoSceneManager *sm)
     SoSceneManager *          SoXtVwrGetOverSceneMgr(const SoXtVwr *this)

          Functions from class SoXtGLWidget:

     void                SoXtVwrSetBorder(SoXtVwr *this, SbBool onOrOff)
     SbBool              SoXtVwrIsBorder(const SoXtVwr *this)
     void                SoXtVwrSetDblBuf(SoXtVwr *this, SbBool onOrOff)
     SbBool              SoXtVwrIsDblBuf(SoXtVwr *this)
     Window              SoXtVwrGetNormWin(SoXtVwr *this)
     Window              SoXtVwrGetOverWin(SoXtVwr *this)
     GLXContext          SoXtVwrGetNormCtx(SoXtVwr *this)
     GLXContext          SoXtVwrGetOverCtx(SoXtVwr *this)
     Widget              SoXtVwrGetNormWidget(SoXtVwr *this)
     Widget              SoXtVwrGetOverWidget(SoXtVwr *this)
     void                SoXtVwrSetNormVis(SoXtVwr *this, XVisualInfo *vis)
     XVisualInfo *       SoXtVwrGetNormVis(SoXtVwr *this)
     void                SoXtVwrSetOverVis(SoXtVwr *this, XVisualInfo *vis)
     XVisualInfo *       SoXtVwrGetOverVis(SoXtVwr *this)
     void                SoXtVwrSetDrwFrontBuf(SoXtVwr *this, SbBool
                              enableFlag)
     SbBool              SoXtVwrIsDrwFrontBuf(const SoXtVwr *this)

          Functions from class SoXtComponent:

     void                SoXtVwrShow(SoXtVwr *this)
     void                SoXtVwrHide(SoXtVwr *this)
     SbBool              SoXtVwrIsVisible(SoXtVwr *this)
     Widget              SoXtVwrGetWidget(const SoXtVwr *this)
     SbBool              SoXtVwrIsTopLevelShell(const SoXtVwr *this)
     Widget              SoXtVwrGetShellWidget(const SoXtVwr *this)
     Widget              SoXtVwrGetParentWidget(const SoXtVwr *this)
     void                SoXtVwrSetSize(SoXtVwr *this, const SbVec2s *size)
     SbVec2s             SoXtVwrGetSize(SoXtVwr *this)
     Display *           SoXtVwrGetDisplay(SoXtVwr *this)
     void                SoXtVwrSetTitle(SoXtVwr *this, const char *newTitle)

     const char *        SoXtVwrGetTitle(const SoXtVwr *this)
     void                SoXtVwrSetIconTitle(SoXtVwr *this, const char
                              *newIconTitle)
     const char *        SoXtVwrGetIconTitle(const SoXtVwr *this)
     void                SoXtVwrSetWinCloseCB(SoXtVwr *this, SoXtComponentCB
                              *func, void *data = NULL)
     SoXtComponent *     SoXtVwrGetComp(Widget w)
     const char *        SoXtVwrGetWidgetName(const SoXtVwr *this)
     const char *        SoXtVwrGetClassName(const SoXtVwr *this)


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 SoXtVwrSetScene(), 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
     SO_XT_VWR_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 SO_XT_VWR_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
     SoXtVwrSetEvCB() 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.

FUNCTIONS
     void                    SoXtVwrSetCam(SoXtVwr *this, SoCamera *cam)
     SoCamera *              SoXtVwrGetCam(SoXtVwr *this)
          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.

     void                    SoXtVwrSetCamType(SoXtVwr *this, SoType type)
     SoType                  SoXtVwrGetCamType(SoXtVwr *this)
          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).

     void                    SoXtVwrViewAll(SoXtVwr *this)
          Changes the camera position to view the entire scene (the camera
          zoom or orientation isn't changed).

     void                    SoXtVwrSaveHomePos(SoXtVwr *this)
     void                    SoXtVwrResetToHomePos(SoXtVwr *this)
          Saves and restores the camera values.

     void                    SoXtVwrSetHeadlight(SoXtVwr *this, SbBool
                                  onOrOff)
     SbBool                  SoXtVwrIsHeadlight(SoXtVwr *this)
     SoDirectionalLight *    SoXtVwrGetHeadlight(SoXtVwr *this)
          Turns the headlight on/off (default on) and return the headlight
          node.

     void                    SoXtVwrSetDStyle(SoXtVwr *this,
                                  SoXtViewer::DrawType type,
                                  SoXtViewer::DrawStyle style)
     SoXtViewer::DrawStyle   SoXtVwrGetDStyle(SoXtVwr *this,
                                  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:

          SO_XT_VWR_VIEW_AS_IS - Leaves the objects unchanged.

          SO_XT_VWR_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.

          SO_XT_VWR_VIEW_NO_TEXTURE - Renders the objects withought any
          textures.  This is done by setting the override flag on an
          SoComplexity node with textureQuality = 0.

          SO_XT_VWR_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.

          SO_XT_VWR_VIEW_LINE - Renders the objects as LINES (no texture) with
          lighting model set to BASE_COLOR.

          SO_XT_VWR_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.

          SO_XT_VWR_VIEW_POINT - Renders the objects as POINTS (no texture)
          with lighting model set to BASE_COLOR.

          SO_XT_VWR_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.

          SO_XT_VWR_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.

          SO_XT_VWR_VIEW_SAME_AS_STILL - This only applies to
          SO_XT_VWR_INTERACTIVE draw type. It enables the interactive draw
          style mode to match the regular draw style mode withough having to
          set it explicitly.

     void                    SoXtVwrSetBufType(SoXtVwr *this,
                                  SoXtViewer::BufferType type)
     SoXtViewer::BufferType  SoXtVwrGetBufType(SoXtVwr *this)
          Sets/gets the current buffering type in the main view (default
          SO_XT_VWR_BUFFER_DOUBLE).

     void                    SoXtVwrSetViewing(SoXtVwr *this, SbBool onOrOff)
     SbBool                  SoXtVwrIsViewing(const SoXtVwr *this)
          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).

     void                    SoXtVwrSetCursorEnabled(SoXtVwr *this, SbBool
                                  onOrOff)
     SbBool                  SoXtVwrIsCursorEnabled(const SoXtVwr *this)
          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.

     void                    SoXtVwrSetAutoClip(SoXtVwr *this, SbBool onOrOff)
     SbBool                  SoXtVwrIsAutoClip(const SoXtVwr *this)
          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).

     void                    SoXtVwrSetStereoViewing(SoXtVwr *this, SbBool
                                  onOrOff)
     SbBool                  SoXtVwrIsStereoViewing(SoXtVwr *this)
     void                    SoXtVwrSetStereoOffset(SoXtVwr *this, float dist)
     float                   SoXtVwrGetStereoOffset(SoXtVwr *this)
          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.

     void                    SoXtVwrSetDtlSeek(SoXtVwr *this, SbBool onOrOff)
     SbBool                  SoXtVwrIsDtlSeek(SoXtVwr *this)
          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.

     void                    SoXtVwrSetSeekTime(SoXtVwr *this, float seconds)
     float                   SoXtVwrGetSeekTime(SoXtVwr *this)
          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.

     void                    SoXtVwrAddStartCB(SoXtVwr *this, SoXtViewerCB *f,
                                  void *userData = NULL)
     void                    SoXtVwrAddFinishCB(SoXtVwr *this, SoXtViewerCB
                                  *f, void *userData = NULL)
     void                    SoXtVwrRemoveStartCB(SoXtVwr *this, SoXtViewerCB
                                  *f, void *userData = NULL)
     void                    SoXtVwrRemoveFinishCB(SoXtVwr *this, 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.

     void                    SoXtVwrCopyView(SoXtVwr *this, Time eventTime)
     void                    SoXtVwrPasteView(SoXtVwr *this, 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.)

     void                    SoXtVwrRecompSceneSiz(SoXtVwr *this)
          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 SoXtVwrSetScene() is called.


SEE ALSO
     SoXtComponent, SoXtRenderArea, SoXtExaminerViewer, SoXtWalkViewer,
     SoXtFlyViewer, SoXtPlaneViewer