| 1 |
NAME SoXtViewer SoXtVwr SO_XT_VWR_ { |
| 2 |
viewer component lowest base class |
| 3 |
} |
| 4 |
|
| 5 |
TYPEDEF void SoXtViewerCB "(void *userData, SoXtViewer *viewer)" |
| 6 |
|
| 7 |
ENUM Type { |
| 8 |
BROWSER "camera views scene, but is not added to scene", |
| 9 |
EDITOR "camera is added to user's scene" |
| 10 |
} |
| 11 |
|
| 12 |
ENUM DrawStyle { |
| 13 |
VIEW_AS_IS "unchanged", |
| 14 |
VIEW_HIDDEN_LINE "render only the front most lines", |
| 15 |
VIEW_NO_TEXTURE "render withought textures", |
| 16 |
VIEW_LOW_COMPLEXITY "render low complexity and no texture", |
| 17 |
VIEW_LINE "wireframe draw style", |
| 18 |
VIEW_LOW_RES_LINE "low complexity wireframe with no depth comparison", |
| 19 |
VIEW_POINT "point draw style", |
| 20 |
VIEW_LOW_RES_POINT "low complexity point with no depth comparison", |
| 21 |
VIEW_BBOX "bounding box draw style with no depth comparison", |
| 22 |
VIEW_SAME_AS_STILL "forces the INTERACTIVE draw style to automatically match STILL" |
| 23 |
} |
| 24 |
|
| 25 |
ENUM DrawType { |
| 26 |
STILL "applies to static rendering", |
| 27 |
INTERACTIVE "applies to rendering while interactive viewing" |
| 28 |
} |
| 29 |
|
| 30 |
ENUM BufferType { |
| 31 |
BUFFER_SINGLE "single buffer", |
| 32 |
BUFFER_DOUBLE "double buffer", |
| 33 |
BUFFER_INTERACTIVE "double buffer while interactive viewing" |
| 34 |
} |
| 35 |
|
| 36 |
INCLUDE Xt/viewers/SoXtViewer.h |
| 37 |
|
| 38 |
DESC { |
| 39 |
This is the lowest base class for viewer components. This class |
| 40 |
adds the notion of a camera to the |
| 41 |
\cSoXtRenderArea\. |
| 42 |
class. Whenever a new scene is specified with |
| 43 |
\m\+setSceneGraph()\.\-SoXtVwrSetScene()\.\., the first camera encountered |
| 44 |
will be by default used as the edited camera. If no camera is found |
| 45 |
in the scene, the viewer will automatically create one. |
| 46 |
If the viewer type is |
| 47 |
\v\+SoXtViewer::BROWSER\.\-SO_XT_VWR_BROWSER\.\. |
| 48 |
then the camera is told to view the supplied scene graph |
| 49 |
but is not added beneath that scene graph root. |
| 50 |
If the viewer type is |
| 51 |
\v\+SoXtViewer::EDITOR\.\-SO_XT_VWR_EDITOR\.\. |
| 52 |
then the camera is added beneath the supplied scene graph root. |
| 53 |
|
| 54 |
\p |
| 55 |
In addition to automatically creating a camera if needed, this base class |
| 56 |
also creates a headlight (directional light which is made to follow the |
| 57 |
camera), enables the user to change drawing styles (like wireframe or move |
| 58 |
wireframe), and buffering types. This base class also provides a |
| 59 |
convenient way to have the camera near and far clipping planes be |
| 60 |
automatically adjusted to minimize the clipping of objects in the scene. |
| 61 |
|
| 62 |
\p |
| 63 |
Viewers allow the application to shadow event processing. When the |
| 64 |
application registers an event processing callback by calling |
| 65 |
\m\+setEventCallback()\.\-SoXtVwrSetEvCB()\.\. |
| 66 |
the viewer will invoke this callback for every X event it receives. |
| 67 |
However, unlike the render area, the viewer ignores the return value |
| 68 |
of this callback, and processes the event as usual. This allows the |
| 69 |
application to expand viewing capabilities without breaking the |
| 70 |
viewing paradigm. It is an easy way to hook up other devices, like the |
| 71 |
spaceball, to an existing viewer. |
| 72 |
} |
| 73 |
|
| 74 |
METHOD setCam virtual void setCamera(SoCamera *cam) {} |
| 75 |
METHOD getCam SoCamera *getCamera() |
| 76 |
{ |
| 77 |
Set and get the edited camera. Setting the camera is only needed |
| 78 |
if the first camera found in the scene when setting the scene graph |
| 79 |
isn't the one the user really wants to edit. |
| 80 |
} |
| 81 |
|
| 82 |
METHOD setCamType virtual void setCameraType(SoType type) {} |
| 83 |
METHOD getCamType SoType getCameraType() |
| 84 |
{ |
| 85 |
Set and get the camera type that will be created by the viewer if no |
| 86 |
cameras are found in the scene graph (see \cSoPerspectiveCamera\. |
| 87 |
and \cSoOrthographicCamera\.). By default an \cSoPerspectiveCamera\. |
| 88 |
will be created if no camera are found. |
| 89 |
|
| 90 |
\p |
| 91 |
Note: the set method will only take effect next time a scene graph |
| 92 |
is specified (and if no camera are found). |
| 93 |
} |
| 94 |
|
| 95 |
METHOD "" virtual void viewAll() |
| 96 |
{ |
| 97 |
Changes the camera position to view the entire scene (the camera zoom |
| 98 |
or orientation isn't changed). |
| 99 |
} |
| 100 |
|
| 101 |
METHOD saveHomePos virtual void saveHomePosition() {} |
| 102 |
METHOD resetToHomePos virtual void resetToHomePosition() |
| 103 |
{ |
| 104 |
Saves and restores the camera values. |
| 105 |
} |
| 106 |
|
| 107 |
METHOD "" virtual void setHeadlight(SbBool onOrOff) {} |
| 108 |
METHOD "" SbBool isHeadlight() {} |
| 109 |
METHOD "" SoDirectionalLight *getHeadlight() |
| 110 |
{ |
| 111 |
Turns the headlight on/off (default on) and return the headlight |
| 112 |
node. |
| 113 |
} |
| 114 |
|
| 115 |
METHOD setDStyle virtual void setDrawStyle(SoXtViewer::DrawType type, |
| 116 |
SoXtViewer::DrawStyle style) {} |
| 117 |
METHOD getDStyle SoXtViewer::DrawStyle getDrawStyle(SoXtViewer::DrawType type) |
| 118 |
{ |
| 119 |
Sets/gets the current drawing style in the main view \(em The user |
| 120 |
can specify the INTERACTIVE draw style (draw style used when |
| 121 |
the scene changes) independently from the STILL style. |
| 122 |
STILL defaults to VIEW_AS_IS. |
| 123 |
INTERACTIVE defaults to VIEW_NO_TEXTURE on machine that do not support |
| 124 |
fast texturing, VIEW_SAME_AS_STILL otherwise. Possible draw styles are: |
| 125 |
|
| 126 |
\p\+VIEW_AS_IS\.\-SO_XT_VWR_VIEW_AS_IS\. \(em Leaves the objects unchanged. |
| 127 |
|
| 128 |
\p\+VIEW_HIDDEN_LINE\.\-SO_XT_VWR_VIEW_HIDDEN_LINE\. \(em Renders the object |
| 129 |
as wireframe, but only show the object front faces. This is accomplished |
| 130 |
using a two pass rendering. In the first pass, the objects are rendered |
| 131 |
as FILLED using the background BASE_COLOR (this sets up the wanted z-buffer |
| 132 |
values). The second pass then renders the objects as LINES, while adjusting |
| 133 |
the z-buffer range to limit overlapping polygons problems. |
| 134 |
|
| 135 |
\p\+VIEW_NO_TEXTURE\.\-SO_XT_VWR_VIEW_NO_TEXTURE\. \(em Renders the objects |
| 136 |
withought any textures. This is done by setting the override flag on an |
| 137 |
\cSoComplexity\. node with textureQuality = 0. |
| 138 |
|
| 139 |
\p\+VIEW_LOW_COMPLEXITY\.\-SO_XT_VWR_VIEW_LOW_COMPLEXITY\. \(em Renders |
| 140 |
the objects withought any textures and with a low complexity. This is done |
| 141 |
by setting the override flag on an \cSoComplexity\. node with |
| 142 |
textureQuality = 0 and complexity value = 0.15. |
| 143 |
|
| 144 |
\p\+VIEW_LINE\.\-SO_XT_VWR_VIEW_LINE\. \(em Renders the objects as LINES |
| 145 |
(no texture) with lighting model set to BASE_COLOR. |
| 146 |
|
| 147 |
\p\+VIEW_LOW_RES_LINE\.\-SO_XT_VWR_VIEW_LOW_RES_LINE\. \(em Renders the objects as LINES |
| 148 |
(no texture) using a low complexity, with lighting model set to BASE_COLOR and no depth comparison. |
| 149 |
|
| 150 |
\p\+VIEW_POINT\.\-SO_XT_VWR_VIEW_POINT\. \(em Renders the objects as POINTS |
| 151 |
(no texture) with lighting model set to BASE_COLOR. |
| 152 |
|
| 153 |
\p\+VIEW_LOW_RES_POINT\.\-SO_XT_VWR_VIEW_LOW_RES_POINT\. \(em Renders the objects as POINTS |
| 154 |
(no texture) using a low complexity, with lighting model set to BASE_COLOR and no depth comparison. |
| 155 |
|
| 156 |
\p\+VIEW_BBOX\.\-SO_XT_VWR_VIEW_BBOX\. \(em Renders the objects with complexity |
| 157 |
BOUNDING_BOX, lighting model set to BASE_COLOR and drawing style LINES (no texture) |
| 158 |
with no depth comparison. |
| 159 |
|
| 160 |
\p\+VIEW_SAME_AS_STILL\.\-SO_XT_VWR_VIEW_SAME_AS_STILL\. \(em This only applies to |
| 161 |
\+INTERACTIVE\.\-SO_XT_VWR_INTERACTIVE\. draw type. It enables the interactive draw |
| 162 |
style mode to match the regular draw style mode withough having to set it explicitly. |
| 163 |
} |
| 164 |
|
| 165 |
METHOD setBufType virtual void setBufferingType(SoXtViewer::BufferType type) {} |
| 166 |
METHOD getBufType SoXtViewer::BufferType getBufferingType() |
| 167 |
{ |
| 168 |
Sets/gets the current buffering type in the main view (default |
| 169 |
\+SoXtViewer::BUFFER_DOUBLE\.\-SO_XT_VWR_BUFFER_DOUBLE\.). |
| 170 |
} |
| 171 |
|
| 172 |
METHOD "" virtual void setViewing(SbBool onOrOff) {} |
| 173 |
METHOD "" SbBool isViewing() const |
| 174 |
{ |
| 175 |
Set/get whether the viewer is turned on or off. When turned on, |
| 176 |
events are consumed by the viewer. When viewing is off, events are processed |
| 177 |
by the viewers render area. This means events will be sent down |
| 178 |
to the scene graph for processing (i.e. picking can occur). |
| 179 |
Note that if the application has registered an event callback, |
| 180 |
it will be invoked on every event, whether viewing is turned on or not. |
| 181 |
However, the return value of this callback (which specifies whether |
| 182 |
the callback handled the event or not) is ignored when viewing is on. |
| 183 |
That is, the viewer will process the event even if the callback already did. |
| 184 |
This is to ensure that the viewing paradigm is not broken |
| 185 |
(default viewing is ON). |
| 186 |
} |
| 187 |
|
| 188 |
METHOD "" virtual void setCursorEnabled(SbBool onOrOff) {} |
| 189 |
METHOD "" SbBool isCursorEnabled() const |
| 190 |
{ |
| 191 |
Set/get whether the viewer is allowed to change the cursor over |
| 192 |
the renderArea window. When disabled, the cursor is undefined |
| 193 |
by the viewer and will not change as the mode of the viewer changes. |
| 194 |
When re-enabled, the viewer will reset it to the appropriate icon. |
| 195 |
\p |
| 196 |
Disabling the cursor enables the application to set the cursor |
| 197 |
directly on the viewer window or on any parent widget of the viewer. |
| 198 |
This can be used when setting a busy cursor on the application shell. |
| 199 |
\p |
| 200 |
Subclasses should redefine this routine to call XUndefineCursor() |
| 201 |
or XDefineCursor() with the appropariate glyth. The base class |
| 202 |
routine only sets the flag. |
| 203 |
} |
| 204 |
|
| 205 |
METHOD setAutoClip void setAutoClipping(SbBool onOrOff) {} |
| 206 |
METHOD isAutoClip SbBool isAutoClipping() const |
| 207 |
{ |
| 208 |
Set and get the auto clipping plane. When auto clipping is ON, the |
| 209 |
camera near and far planes are dynamically adjusted to be as tight |
| 210 |
as possible around the objects being viewed. When OFF, the user |
| 211 |
is expected to manually set those planes within the preference sheet |
| 212 |
(default is on). |
| 213 |
} |
| 214 |
|
| 215 |
METHOD "" virtual void setStereoViewing(SbBool onOrOff) {} |
| 216 |
METHOD "" virtual SbBool isStereoViewing() {} |
| 217 |
METHOD "" void setStereoOffset(float dist) {} |
| 218 |
METHOD "" float getStereoOffset() |
| 219 |
{ |
| 220 |
Turns stereo viewing on/off on the viewer (default off). When in |
| 221 |
stereo mode, which may not work on all machines, the scene is rendered |
| 222 |
twice (in the left and right buffers) with an offset between the |
| 223 |
two views to simulate stereo viewing. Stereo glasses have to be used |
| 224 |
to see the effect and /usr/gfx/setmon needs to be called to set the |
| 225 |
monitor in stereo mode. |
| 226 |
\p |
| 227 |
The user can also specify what the offset between the two views |
| 228 |
should be. |
| 229 |
} |
| 230 |
|
| 231 |
METHOD setDtlSeek void setDetailSeek(SbBool onOrOff) {} |
| 232 |
METHOD isDtlSeek SbBool isDetailSeek() |
| 233 |
{ |
| 234 |
When the viewer is in seek |
| 235 |
mode, left mouse clicks initiate a pick, and the viewer |
| 236 |
changes its orientation and position to look at the picked object. |
| 237 |
This routine tells the seeking viewer whether to orient the camera towards |
| 238 |
the picked point (detail on), or the center of the object's bounding box |
| 239 |
(detail off). Default is detail on. |
| 240 |
} |
| 241 |
|
| 242 |
METHOD "" void setSeekTime(float seconds) {} |
| 243 |
METHOD "" float getSeekTime() |
| 244 |
{ |
| 245 |
Set the time a seek takes to change to the new camera location. |
| 246 |
A value of zero seeks directly to the point without any animation. |
| 247 |
Default value is 2 seconds. |
| 248 |
} |
| 249 |
|
| 250 |
METHOD addStartCB void addStartCallback(SoXtViewerCB *f, void *userData = NULL) {} |
| 251 |
METHOD addFinishCB void addFinishCallback(SoXtViewerCB *f, void *userData = NULL) {} |
| 252 |
METHOD removeStartCB void removeStartCallback(SoXtViewerCB *f, void *userData = NULL) {} |
| 253 |
METHOD removeFinishCB void removeFinishCallback(SoXtViewerCB *f, void *userData = NULL) |
| 254 |
{ |
| 255 |
Add/remove start and finish callback routines on the viewer. Start callbacks |
| 256 |
are called whenever the user starts doing interactive viewing |
| 257 |
(for example, mouse down), and finish callbacks are called when user |
| 258 |
is done doing interactive work (for example, mouse up). |
| 259 |
\p |
| 260 |
Note: The viewer "this" pointer is passed as callback data. |
| 261 |
} |
| 262 |
|
| 263 |
METHOD "" void copyView(Time eventTime) {} |
| 264 |
METHOD "" void pasteView(Time eventTime) |
| 265 |
{ |
| 266 |
Copy/paste the view. \aeventTime\. should be the time of the X event |
| 267 |
which initiated the copy or paste (e.g. if copy/paste is initiated |
| 268 |
from a keystroke, \aeventTime\. should be the time in the X KeyPress event.) |
| 269 |
} |
| 270 |
|
| 271 |
METHOD recompSceneSiz virtual void recomputeSceneSize() |
| 272 |
{ |
| 273 |
This can be used to let the viewer know that the scene graph |
| 274 |
has changed so that the viewer can recompute things like speed which |
| 275 |
depend on the scene graph size. Note: |
| 276 |
This routine is automatically called whenever |
| 277 |
\m\+setSceneGraph()\.\-SoXtVwrSetScene()\.\. is called. |
| 278 |
} |
| 279 |
|
| 280 |
ALSO { SoXtComponent, SoXtRenderArea, SoXtExaminerViewer, |
| 281 |
SoXtWalkViewer, SoXtFlyViewer, SoXtPlaneViewer } |