1SoXtViewer(3IV)()                                            SoXtViewer(3IV)()
2
3
4

NAME

6       SoXtViewer — viewer component lowest base class
7

INHERITS FROM

9       SoXtComponent > SoXtGLWidget > SoXtRenderArea > SoXtViewer
10

SYNOPSIS

12       #include <Inventor/Xt/viewers/SoXtViewer.h>
13
14     typedef void        SoXtViewerCB(void *userData, SoXtViewer *viewer)
15
16     enum Type {
17          SoXtViewer::BROWSER  camera views scene, but is not added to scene
18          SoXtViewer::EDITOR   camera is added to user's scene
19     }
20
21     enum DrawStyle {
22          SoXtViewer::VIEW_AS_IS       unchanged
23          SoXtViewer::VIEW_HIDDEN_LINE render only the front most lines
24          SoXtViewer::VIEW_NO_TEXTURE  render withought textures
25          SoXtViewer::VIEW_LOW_COMPLEXITY
26                                       render low complexity and no texture
27          SoXtViewer::VIEW_LINE        wireframe draw style
28          SoXtViewer::VIEW_LOW_RES_LINE
29                                       low  complexity wireframe with no depth
30                                            comparison
31          SoXtViewer::VIEW_POINT       point draw style
32          SoXtViewer::VIEW_LOW_RES_POINT
33                                       low complexity point with no depth com‐
34                                            parison
35          SoXtViewer::VIEW_BBOX        bounding  box  draw style with no depth
36                                            comparison
37          SoXtViewer::VIEW_SAME_AS_STILL
38                                       forces the INTERACTIVE  draw  style  to
39                                            automatically match STILL
40     }
41
42     enum DrawType {
43          SoXtViewer::STILL        applies to static rendering
44          SoXtViewer::INTERACTIVE  applies   to  rendering  while  interactive
45                                        viewing
46     }
47
48     enum BufferType {
49          SoXtViewer::BUFFER_SINGLE  single buffer
50          SoXtViewer::BUFFER_DOUBLE  double buffer
51          SoXtViewer::BUFFER_INTERACTIVE
52                                     double buffer while interactive viewing
53     }
54
55          Methods from class SoXtViewer:
56
57     virtual void            setCamera(SoCamera *cam)
58     SoCamera *              getCamera()
59     virtual void            setCameraType(SoType type)
60     SoType                  getCameraType()
61     virtual void            viewAll()
62     virtual void            saveHomePosition()
63     virtual void            resetToHomePosition()
64     virtual void            setHeadlight(SbBool onOrOff)
65     SbBool                  isHeadlight()
66     SoDirectionalLight *    getHeadlight()
67     virtual      void            setDrawStyle(SoXtViewer::DrawType      type,
68                                  SoXtViewer::DrawStyle style)
69     SoXtViewer::DrawStyle   getDrawStyle(SoXtViewer::DrawType type)
70     virtual void            setBufferingType(SoXtViewer::BufferType type)
71     SoXtViewer::BufferType  getBufferingType()
72     virtual void            setViewing(SbBool onOrOff)
73     SbBool                  isViewing() const
74     virtual void            setCursorEnabled(SbBool onOrOff)
75     SbBool                  isCursorEnabled() const
76     void                    setAutoClipping(SbBool onOrOff)
77     SbBool                  isAutoClipping() const
78     virtual void            setStereoViewing(SbBool onOrOff)
79     virtual SbBool          isStereoViewing()
80     void                    setStereoOffset(float dist)
81     float                   getStereoOffset()
82     void                    setDetailSeek(SbBool onOrOff)
83     SbBool                  isDetailSeek()
84     void                    setSeekTime(float seconds)
85     float                   getSeekTime()
86     void                    addStartCallback(SoXtViewerCB  *f, void *userData
87                                  = NULL)
88     void                    addFinishCallback(SoXtViewerCB *f, void *userData
89                                  = NULL)
90     void                    removeStartCallback(SoXtViewerCB  *f, void *user‐
91                                  Data = NULL)
92     void                    removeFinishCallback(SoXtViewerCB *f, void *user‐
93                                  Data = NULL)
94     void                    copyView(Time eventTime)
95     void                    pasteView(Time eventTime)
96     virtual void            recomputeSceneSize()
97
98          Methods from class SoXtRenderArea:
99
100     virtual void              setSceneGraph(SoNode *newScene)
101     virtual SoNode *          getSceneGraph()
102     void                      setOverlaySceneGraph(SoNode *newScene)
103     SoNode *                  getOverlaySceneGraph()
104     void                      registerDevice(SoXtDevice *)
105     void                      unregisterDevice(SoXtDevice *)
106     void                      setBackgroundColor(const SbColor &c)
107     const SbColor &           getBackgroundColor() const
108     void                      setBackgroundIndex(int index)
109     int                       getBackgroundIndex() const
110     void                      setOverlayBackgroundIndex(int index)
111     int                       getOverlayBackgroundIndex() const
112     void                      setColorMap(int   startIndex,  int  num,  const
113                                    SbColor *colors)
114     void                      setOverlayColorMap(int  startIndex,  int   num,
115                                    const SbColor *colors)
116     void                      setViewportRegion(const        SbViewportRegion
117                                    &newRegion)
118     const SbViewportRegion &  getViewportRegion() const
119     void                      setTransparencyType(SoGLRenderAction::Trans‐
120                                    parencyType type)
121     SoGLRenderAction::TransparencyType
122                               getTransparencyType() const
123     void                      setAntialiasing(SbBool      smoothing,      int
124                                    numPasses)
125     void                      getAntialiasing(SbBool     &smoothing,      int
126                                    &numPasses) const
127     void                      setClearBeforeRender(SbBool trueOrFalse)
128     SbBool                    isClearBeforeRender() const
129     void                      setClearBeforeOverlayRender(SbBool trueOrFalse)
130     SbBool                    isClearBeforeOverlayRender() const
131     void                      setAutoRedraw(SbBool trueOrFalse)
132     SbBool                    isAutoRedraw() const
133     void                      setRedrawPriority(uint32_t priority)
134     uint32_t                  getRedrawPriority() const
135     static uint32_t           getDefaultRedrawPriority()
136     void                      render()
137     void                      renderOverlay()
138     void                      scheduleRedraw()
139     void                      scheduleOverlayRedraw()
140     void                      redrawOnSelectionChange(SoSelection *s)
141     void                      redrawOverlayOnSelectionChange(SoSelection *s)
142     void                      setEventCallback(SoXtRenderAreaEventCB    *fcn,
143                                    void *userData = NULL)
144     void                      setGLRenderAction(SoGLRenderAction *ra)
145     SoGLRenderAction *        getGLRenderAction() const
146     void                      setOverlayGLRenderAction(SoGLRenderAction *ra)
147     SoGLRenderAction *        getOverlayGLRenderAction() const
148     void                      setSceneManager(SoSceneManager *sm)
149     SoSceneManager *          getSceneManager() const
150     void                      setOverlaySceneManager(SoSceneManager *sm)
151     SoSceneManager *          getOverlaySceneManager() const
152
153          Methods from class SoXtGLWidget:
154
155     void                setBorder(SbBool onOrOff)
156     SbBool              isBorder() const
157     virtual void        setDoubleBuffer(SbBool onOrOff)
158     SbBool              isDoubleBuffer()
159     Window              getNormalWindow()
160     Window              getOverlayWindow()
161     GLXContext          getNormalContext()
162     GLXContext          getOverlayContext()
163     Widget              getNormalWidget()
164     Widget              getOverlayWidget()
165     virtual void        setNormalVisual(XVisualInfo *vis)
166     XVisualInfo *       getNormalVisual()
167     virtual void        setOverlayVisual(XVisualInfo *vis)
168     XVisualInfo *       getOverlayVisual()
169     void                setDrawToFrontBufferEnable(SbBool enableFlag)
170     SbBool              isDrawToFrontBufferEnable() const
171
172          Methods from class SoXtComponent:
173
174     virtual void            show()
175     virtual void            hide()
176     SbBool                  isVisible()
177     Widget                  getWidget() const
178     SbBool                  isTopLevelShell() const
179     Widget                  getShellWidget() const
180     Widget                  getParentWidget() const
181     void                    setSize(const SbVec2s &size)
182     SbVec2s                 getSize()
183     Display *               getDisplay()
184     void                    setTitle(const char *newTitle)
185     const char *            getTitle() const
186     void                    setIconTitle(const char *newIconTitle)
187     const char *            getIconTitle() const
188     void                    setWindowCloseCallback(SoXtComponentCB     *func,
189                                  void *data = NULL)
190     static SoXtComponent *  getComponent(Widget w)
191     const char *            getWidgetName() const
192     const char *            getClassName() const
193
194

DESCRIPTION

196       This  is  the  lowest base class for viewer components. This class adds
197       the notion of a camera to the  SoXtRenderArea  class.  Whenever  a  new
198       scene  is  specified with setSceneGraph(), the first camera encountered
199       will be by default used as the edited camera. If no camera is found  in
200       the scene, the viewer will automatically create one. If the viewer type
201       is SoXtViewer::BROWSER then the camera is told  to  view  the  supplied
202       scene  graph  but  is  not  added beneath that scene graph root. If the
203       viewer type is SoXtViewer::EDITOR then the camera is added beneath  the
204       supplied scene graph root.
205
206       In  addition  to  automatically  creating a camera if needed, this base
207       class also creates a headlight (directional light which is made to fol‐
208       low  the camera), enables the user to change drawing styles (like wire‐
209       frame or move wireframe), and buffering types.  This  base  class  also
210       provides  a  convenient  way  to  have the camera near and far clipping
211       planes be automatically adjusted to minimize the clipping of objects in
212       the scene.
213
214       Viewers  allow  the  application  to  shadow event processing. When the
215       application registers an event processing callback by calling setEvent‐
216       Callback()  the  viewer  will invoke this callback for every X event it
217       receives. However, unlike the  render  area,  the  viewer  ignores  the
218       return  value  of this callback, and processes the event as usual. This
219       allows the application to expand viewing capabilities without  breaking
220       the  viewing paradigm. It is an easy way to hook up other devices, like
221       the spaceball, to an existing viewer.
222

METHODS

224     virtual void            setCamera(SoCamera *cam)
225     SoCamera *              getCamera()
226          Set and get the edited camera. Setting the camera is only needed  if
227          the  first  camera  found  in the scene when setting the scene graph
228          isn't the one the user really wants to edit.
229
230     virtual void            setCameraType(SoType type)
231     SoType                  getCameraType()
232          Set and get the camera type that will be created by the viewer if no
233          cameras  are  found  in the scene graph (see SoPerspectiveCamera and
234          SoOrthographicCamera). By default  an  SoPerspectiveCamera  will  be
235          created if no camera are found.
236
237          Note:  the  set method will only take effect next time a scene graph
238          is specified (and if no camera are found).
239
240     virtual void            viewAll()
241          Changes the camera position to view the  entire  scene  (the  camera
242          zoom or orientation isn't changed).
243
244     virtual void            saveHomePosition()
245     virtual void            resetToHomePosition()
246          Saves and restores the camera values.
247
248     virtual void            setHeadlight(SbBool onOrOff)
249     SbBool                  isHeadlight()
250     SoDirectionalLight *    getHeadlight()
251          Turns  the  headlight  on/off  (default on) and return the headlight
252          node.
253
254     virtual      void            setDrawStyle(SoXtViewer::DrawType      type,
255                                  SoXtViewer::DrawStyle style)
256     SoXtViewer::DrawStyle   getDrawStyle(SoXtViewer::DrawType type)
257          Sets/gets  the current drawing style in the main view — The user can
258          specify the INTERACTIVE draw style (draw style used when  the  scene
259          changes)  independently  from  the  STILL  style.  STILL defaults to
260          VIEW_AS_IS.  INTERACTIVE defaults to VIEW_NO_TEXTURE on machine that
261          do  not support fast texturing, VIEW_SAME_AS_STILL otherwise. Possi‐
262          ble draw styles are:
263
264          VIEW_AS_IS — Leaves the objects unchanged.
265
266          VIEW_HIDDEN_LINE — Renders the object as wireframe,  but  only  show
267          the  object  front faces. This is accomplished using a two pass ren‐
268          dering. In the first pass, the objects are rendered as FILLED  using
269          the background BASE_COLOR (this sets up the wanted z-buffer values).
270          The second pass then renders the objects as LINES,  while  adjusting
271          the z-buffer range to limit overlapping polygons problems.
272
273          VIEW_NO_TEXTURE  — Renders the objects withought any textures.  This
274          is done by setting the override flag on an  SoComplexity  node  with
275          textureQuality = 0.
276
277          VIEW_LOW_COMPLEXITY — Renders the objects withought any textures and
278          with a low complexity. This is done by setting the override flag  on
279          an  SoComplexity node with textureQuality = 0 and complexity value =
280          0.15.
281
282          VIEW_LINE — Renders the objects as LINES (no texture) with  lighting
283          model set to BASE_COLOR.
284
285          VIEW_LOW_RES_LINE  — Renders the objects as LINES (no texture) using
286          a low complexity, with lighting model set to BASE_COLOR and no depth
287          comparison.
288
289          VIEW_POINT  — Renders the objects as POINTS (no texture) with light‐
290          ing model set to BASE_COLOR.
291
292          VIEW_LOW_RES_POINT — Renders the  objects  as  POINTS  (no  texture)
293          using a low complexity, with lighting model set to BASE_COLOR and no
294          depth comparison.
295
296          VIEW_BBOX — Renders the objects with complexity BOUNDING_BOX, light‐
297          ing  model  set  to  BASE_COLOR and drawing style LINES (no texture)
298          with no depth comparison.
299
300          VIEW_SAME_AS_STILL — This only applies to INTERACTIVE draw type.  It
301          enables  the  interactive  draw style mode to match the regular draw
302          style mode withough having to set it explicitly.
303
304     virtual void            setBufferingType(SoXtViewer::BufferType type)
305     SoXtViewer::BufferType  getBufferingType()
306          Sets/gets the current buffering  type  in  the  main  view  (default
307          SoXtViewer::BUFFER_DOUBLE).
308
309     virtual void            setViewing(SbBool onOrOff)
310     SbBool                  isViewing() const
311          Set/get  whether  the  viewer  is  turned on or off. When turned on,
312          events are consumed by the viewer. When viewing is off,  events  are
313          processed by the viewers render area. This means events will be sent
314          down to the scene graph for processing  (i.e.  picking  can  occur).
315          Note  that  if  the application has registered an event callback, it
316          will be invoked on every event, whether viewing is turned on or not.
317          However,  the return value of this callback (which specifies whether
318          the callback handled the event or not) is ignored  when  viewing  is
319          on.  That is, the viewer will process the event even if the callback
320          already did. This is to ensure that the viewing paradigm is not bro‐
321          ken (default viewing is ON).
322
323     virtual void            setCursorEnabled(SbBool onOrOff)
324     SbBool                  isCursorEnabled() const
325          Set/get  whether the viewer is allowed to change the cursor over the
326          renderArea window. When disabled, the cursor  is  undefined  by  the
327          viewer  and  will not change as the mode of the viewer changes. When
328          re-enabled, the viewer will reset it to the appropriate icon.
329
330          Disabling the cursor enables  the  application  to  set  the  cursor
331          directly on the viewer window or on any parent widget of the viewer.
332          This can be used when setting  a  busy  cursor  on  the  application
333          shell.
334
335          Subclasses should redefine this routine to call XUndefineCursor() or
336          XDefineCursor() with the appropariate glyth. The base class  routine
337          only sets the flag.
338
339     void                    setAutoClipping(SbBool onOrOff)
340     SbBool                  isAutoClipping() const
341          Set  and  get the auto clipping plane. When auto clipping is ON, the
342          camera near and far planes are dynamically adjusted to be  as  tight
343          as  possible  around the objects being viewed. When OFF, the user is
344          expected to manually set those planes within  the  preference  sheet
345          (default is on).
346
347     virtual void            setStereoViewing(SbBool onOrOff)
348     virtual SbBool          isStereoViewing()
349     void                    setStereoOffset(float dist)
350     float                   getStereoOffset()
351          Turns  stereo  viewing  on/off  on the viewer (default off). When in
352          stereo mode, which may not work on all machines, the scene  is  ren‐
353          dered  twice  (in the left and right buffers) with an offset between
354          the two views to simulate stereo viewing. Stereo glasses have to  be
355          used to see the effect and /usr/gfx/setmon needs to be called to set
356          the monitor in stereo mode.
357
358          The user can also specify what the  offset  between  the  two  views
359          should be.
360
361     void                    setDetailSeek(SbBool onOrOff)
362     SbBool                  isDetailSeek()
363          When  the viewer is in seek mode, left mouse clicks initiate a pick,
364          and the viewer changes its orientation and position to look  at  the
365          picked object. This routine tells the seeking viewer whether to ori‐
366          ent the camera towards the picked point (detail on), or  the  center
367          of the object's bounding box (detail off). Default is detail on.
368
369     void                    setSeekTime(float seconds)
370     float                   getSeekTime()
371          Set  the  time  a seek takes to change to the new camera location. A
372          value of zero seeks directly to the  point  without  any  animation.
373          Default value is 2 seconds.
374
375     void                    addStartCallback(SoXtViewerCB  *f, void *userData
376                                  = NULL)
377     void                    addFinishCallback(SoXtViewerCB *f, void *userData
378                                  = NULL)
379     void                    removeStartCallback(SoXtViewerCB  *f, void *user‐
380                                  Data = NULL)
381     void                    removeFinishCallback(SoXtViewerCB *f, void *user‐
382                                  Data = NULL)
383          Add/remove  start  and finish callback routines on the viewer. Start
384          callbacks are called whenever  the  user  starts  doing  interactive
385          viewing  (for  example, mouse down), and finish callbacks are called
386          when user is done doing interactive work (for example, mouse up).
387
388          Note: The viewer "this" pointer is passed as callback data.
389
390     void                    copyView(Time eventTime)
391     void                    pasteView(Time eventTime)
392          Copy/paste the view. eventTime should be the time  of  the  X  event
393          which  initiated  the copy or paste (e.g. if copy/paste is initiated
394          from a keystroke, eventTime should be the time  in  the  X  KeyPress
395          event.)
396
397     virtual void            recomputeSceneSize()
398          This  can  be  used  to let the viewer know that the scene graph has
399          changed so that the viewer can recompute  things  like  speed  which
400          depend  on the scene graph size. Note: This routine is automatically
401          called whenever setSceneGraph() is called.
402
403

SEE ALSO

405       SoXtComponent,  SoXtRenderArea,   SoXtExaminerViewer,   SoXtWalkViewer,
406       SoXtFlyViewer, SoXtPlaneViewer
407
408
409
410
411                                                             SoXtViewer(3IV)()
Impressum