| 1 |
NAME SoXtRenderArea SoXtRA "" { |
| 2 |
Xt Component for rendering Inventor scene graphs |
| 3 |
} |
| 4 |
|
| 5 |
BEGIN C |
| 6 |
DEFINE { SoXtRACreateStd(parent, name) SoXtRACreate(parent, name, TRUE, TRUE, TRUE) } |
| 7 |
END |
| 8 |
|
| 9 |
TYPEDEF SbBool SoXtRenderAreaEventCB "(void *userData, XAnyEvent *anyevent)" |
| 10 |
|
| 11 |
INCLUDE Xt/SoXtRenderArea.h |
| 12 |
|
| 13 |
DESC { |
| 14 |
This class provides Inventor rendering |
| 15 |
and event handling inside a GLX Motif widget. There |
| 16 |
is a routine to specify the scene to render. The scene is automatically |
| 17 |
rendered whenever anything under it changes (a data sensor is attached to |
| 18 |
the root of the scene), unless explicitly told not to do so (manual |
| 19 |
redraws). Users can also set Inventor rendering attributes such as the |
| 20 |
transparency type, antialiasing on or off, etc. This class employs |
| 21 |
an \cSoSceneManager\. to manage rendering and event handling. |
| 22 |
\p |
| 23 |
|
| 24 |
X events that occur in the render area can be handled by the |
| 25 |
application, by the viewer (if this is really a viewer) or by the nodes |
| 26 |
in the scene graph. When an event occurs, it is first passed to the |
| 27 |
application event callback function registered with the |
| 28 |
\msetEventCallback()\. method on \cSoXtRenderArea\.. If this function |
| 29 |
does not exist or returns FALSE, the X event is either used directly by |
| 30 |
the viewer or translated to an \cSoEvent\. for further scene graph |
| 31 |
processing. If the viewer does not handle the event, and an overlay |
| 32 |
scene graph exists, the \cSoEvent\. is sent to that scene graph by way |
| 33 |
of an \cSoHandleEventAction\.. If no node in the overlay scene graph |
| 34 |
handles the event (i.e., calls \msetHandled()\. on the |
| 35 |
\cSoHandleEventAction\.), the \cSoEvent\. is passed to the normal scene |
| 36 |
graph in the same manner. } |
| 37 |
|
| 38 |
METHOD "" SoXtRenderArea( |
| 39 |
Widget parent = NULL, |
| 40 |
const char *name = NULL, |
| 41 |
SbBool buildInsideParent = TRUE, |
| 42 |
SbBool getMouseInput = TRUE, |
| 43 |
SbBool getKeyboardInput = TRUE) {} |
| 44 |
METHOD "" ~SoXtRenderArea() |
| 45 |
{ |
| 46 |
Constructor which is passed arguments which tell it whether to register the |
| 47 |
mouse and keyboard devices by default (\cSoXtMouse\. and \cSoXtKeyboard\.). |
| 48 |
\-For a constructor short cut look at the \mSoXtRACreateStd\. #define.\. |
| 49 |
} |
| 50 |
|
| 51 |
METHOD setScene virtual void setSceneGraph(SoNode *newScene) {} |
| 52 |
METHOD getScene virtual SoNode * getSceneGraph() |
| 53 |
{ |
| 54 |
Set/get the scene graph to be rendered in this component's window. |
| 55 |
} |
| 56 |
|
| 57 |
METHOD setOverScene void setOverlaySceneGraph(SoNode *newScene) {} |
| 58 |
METHOD getOverScene SoNode * getOverlaySceneGraph() |
| 59 |
{ |
| 60 |
Sets/gets the scene graph to render in the overlay bit planes. |
| 61 |
\p |
| 62 |
Note: since the overlay bit planes are in color index mode, single |
| 63 |
buffer with a limited number of colors, the user should limit rendering |
| 64 |
in the overlay planes to simple objects. |
| 65 |
\p |
| 66 |
Typically rendering in color index mode is done using the \cSoColorIndex\. |
| 67 |
node with a \cSoLightModel\. set to BASE_COLOR. |
| 68 |
} |
| 69 |
|
| 70 |
METHOD "" void registerDevice(SoXtDevice *) {} |
| 71 |
METHOD "" void unregisterDevice(SoXtDevice *) |
| 72 |
{ |
| 73 |
Register/unregister interest in devices. When a device is registered, |
| 74 |
events from that device will be processed by the render area, and passed |
| 75 |
into the scene graph. Events from unregistered devices will be ignored. |
| 76 |
} |
| 77 |
|
| 78 |
METHOD setBkgCol void setBackgroundColor(const SbColor &c) {} |
| 79 |
METHOD getBkgCol const SbColor & getBackgroundColor() const |
| 80 |
{ |
| 81 |
Set/get the background color for this window. Default is black (0,0,0). |
| 82 |
} |
| 83 |
|
| 84 |
METHOD setBkgInd void setBackgroundIndex(int index) {} |
| 85 |
METHOD getBkgInd int getBackgroundIndex() const |
| 86 |
{ |
| 87 |
Sets/gets the window background color when in color index mode. |
| 88 |
(default to black (index 0)). |
| 89 |
} |
| 90 |
|
| 91 |
METHOD setOverBkgInd void setOverlayBackgroundIndex(int index) {} |
| 92 |
METHOD getOverBkgInd int getOverlayBackgroundIndex() const |
| 93 |
{ |
| 94 |
Sets/gets the overlay window background color index. |
| 95 |
(default to 0 (clear color)). |
| 96 |
} |
| 97 |
|
| 98 |
METHOD setColMap void setColorMap(int startIndex, int num, const SbColor *colors) |
| 99 |
{ |
| 100 |
Sets the colors to use when displaying in color index mode. This will |
| 101 |
load the color map with the given colors at the starting index. |
| 102 |
} |
| 103 |
|
| 104 |
METHOD setOverColMap void setOverlayColorMap(int startIndex, int num, const SbColor *colors) |
| 105 |
{ |
| 106 |
Sets the colors to use for overlay bit planes.This will |
| 107 |
load the color map with the given colors at the starting index. |
| 108 |
} |
| 109 |
|
| 110 |
METHOD setVPReg void setViewportRegion(const SbViewportRegion &newRegion) {} |
| 111 |
METHOD getVPReg const SbViewportRegion &getViewportRegion() const |
| 112 |
{ |
| 113 |
Sets/gets current viewport region to use for rendering |
| 114 |
} |
| 115 |
|
| 116 |
METHOD setTranspType void setTransparencyType(SoGLRenderAction::TransparencyType type) {} |
| 117 |
METHOD getTranspType SoGLRenderAction::TransparencyType getTransparencyType() const |
| 118 |
{ |
| 119 |
Set/get the quality level for rendering transparent objects. See |
| 120 |
\cSoGLRenderAction\. |
| 121 |
for possible transparency types. |
| 122 |
} |
| 123 |
|
| 124 |
METHOD "" void setAntialiasing(SbBool smoothing, int numPasses) {} |
| 125 |
METHOD "" void getAntialiasing(SbBool &smoothing, int &numPasses) const |
| 126 |
{ |
| 127 |
Set/get the antialiasing for rendering. There are two kinds of |
| 128 |
antialiasing available: smoothing and multipass antialiasing. |
| 129 |
If \asmoothing\. is set to TRUE, smoothing is enabled. |
| 130 |
Smoothing uses OpenGL's line- and point-smoothing features |
| 131 |
to provide cheap antialiasing of lines and points. |
| 132 |
The value of \anumPasses\. controls multipass antialiasing. Each time |
| 133 |
a render action is applied, Inventor renders the scene \anumPasses\. |
| 134 |
times from slightly different camera positions, averaging the results. |
| 135 |
\anumPasses\. can be from one to 255, inclusive. Setting \anumPasses\. to |
| 136 |
one disables multipass antialiasing. You can use either, both, or neither |
| 137 |
of these antialiasing techniques. By default, both smoothing and |
| 138 |
multipass antialiasing are disabled. |
| 139 |
} |
| 140 |
|
| 141 |
METHOD "" void setClearBeforeRender(SbBool trueOrFalse) {} |
| 142 |
METHOD "" SbBool isClearBeforeRender() const |
| 143 |
{ |
| 144 |
Enable/prevent window clearing from happening before a rendering starts |
| 145 |
(default is clear TRUE). This can be useful to limit flickering when doing |
| 146 |
single buffering and geometry covers the entire window (used in the |
| 147 |
material editor). |
| 148 |
} |
| 149 |
|
| 150 |
METHOD setClearBeforeOverRender void setClearBeforeOverlayRender(SbBool trueOrFalse) {} |
| 151 |
METHOD isClearBeforeOverRender SbBool isClearBeforeOverlayRender() const |
| 152 |
{ |
| 153 |
Enable/prevent overlay window clearing from happening before a rendering starts |
| 154 |
(default is clear TRUE). |
| 155 |
} |
| 156 |
|
| 157 |
METHOD "" void setAutoRedraw(SbBool trueOrFalse) {} |
| 158 |
METHOD "" SbBool isAutoRedraw() const |
| 159 |
{ |
| 160 |
The render area will automatically redraw whenever something in the scene |
| 161 |
graph changes. Passing FALSE will disable this feature. |
| 162 |
} |
| 163 |
|
| 164 |
METHOD "" void setRedrawPriority(uint32_t priority) {} |
| 165 |
METHOD "" uint32_t getRedrawPriority() const {} |
| 166 |
METHOD "" static uint32_t getDefaultRedrawPriority() |
| 167 |
{ |
| 168 |
Sets/gets the priority of the redraw sensor and get the default |
| 169 |
priority number. |
| 170 |
} |
| 171 |
|
| 172 |
METHOD "" void render() {} |
| 173 |
METHOD "" void renderOverlay() |
| 174 |
{ |
| 175 |
Calling this forces the render area to be redrawn now. |
| 176 |
It is not necessary to call this method if auto redraw is enabled |
| 177 |
(which is the default). |
| 178 |
} |
| 179 |
|
| 180 |
METHOD "" void scheduleRedraw() {} |
| 181 |
METHOD scheduleOverRedraw void scheduleOverlayRedraw() |
| 182 |
{ |
| 183 |
Schedule a redraw to happen sometime soon (as opposed to immediately). |
| 184 |
This can be used to compress multiple redraws. |
| 185 |
} |
| 186 |
|
| 187 |
METHOD redrawOnSelChange void redrawOnSelectionChange(SoSelection *s) {} |
| 188 |
METHOD redrawOverOnSelChange void redrawOverlayOnSelectionChange(SoSelection *s) |
| 189 |
{ |
| 190 |
Call this convenience method to have this render area redraw |
| 191 |
whenever the selection list changes in the passed node. This |
| 192 |
is useful if using a highlight render action like the |
| 193 |
\cSoBoxHighlightRenderAction\. to correctly render whenever the |
| 194 |
selection changes. Pass NULL to turn this off. |
| 195 |
} |
| 196 |
|
| 197 |
METHOD setEvCB void setEventCallback( |
| 198 |
SoXtRenderAreaEventCB *fcn, |
| 199 |
void *userData = NULL) |
| 200 |
{ |
| 201 |
|
| 202 |
X events which occur in the render area window are either directly |
| 203 |
handled by the viewer (when this is really a viewer) or automatically |
| 204 |
translated to \cSoEvents\., then passed into the scene graph (via the |
| 205 |
\cSoHandleEventAction\.) so that live scene graph objects can handle |
| 206 |
the event (when viewers are not in viewing mode). This |
| 207 |
\+method\.\-function\. allows the application to register a callback |
| 208 |
for handling events that occur in the window, instead of sending them |
| 209 |
to the viewers or down the graph. The callback is passed the X event, |
| 210 |
and should return TRUE if it handled the event. If the callback |
| 211 |
returns FALSE, then the event will be handled by the render area. |
| 212 |
|
| 213 |
} |
| 214 |
|
| 215 |
METHOD setGLRenderAct void setGLRenderAction(SoGLRenderAction *ra) {} |
| 216 |
METHOD getGLRenderAct SoGLRenderAction *getGLRenderAction() const |
| 217 |
{ |
| 218 |
Sets/gets the GL render action to use. |
| 219 |
This is used to set selection highlighting with the |
| 220 |
\cSoBoxHighlightRenderAction\. and \cSoLineHighlightRenderAction\. |
| 221 |
classes. |
| 222 |
} |
| 223 |
|
| 224 |
METHOD setOverGLRenderAct void setOverlayGLRenderAction(SoGLRenderAction *ra) {} |
| 225 |
METHOD getOverGLRenderAct SoGLRenderAction *getOverlayGLRenderAction() const |
| 226 |
{ |
| 227 |
Sets/gets the GL render action for the overlay window. |
| 228 |
} |
| 229 |
|
| 230 |
METHOD setSceneMgr void setSceneManager(SoSceneManager *sm) {} |
| 231 |
METHOD getSceneMgr SoSceneManager * getSceneManager() const {} |
| 232 |
METHOD setOverSceneMgr void setOverlaySceneManager(SoSceneManager *sm) {} |
| 233 |
METHOD getOverSceneMgr SoSceneManager * getOverlaySceneManager() const |
| 234 |
{ |
| 235 |
Sets/gets the normal and overlay plane scene managers. |
| 236 |
\p |
| 237 |
Note: for convenience most of the \cSoSceneManager\. methods have already |
| 238 |
been added to this class. |
| 239 |
} |
| 240 |
|
| 241 |
MISC RESOURCES { |
| 242 |
\b |
| 243 |
*SoXtRenderArea*BackgroundColor: black (color name or hex value) |
| 244 |
\. |
| 245 |
} |
| 246 |
|
| 247 |
ALSO { SoXtGLWidget, SoXtComponent, SoXtViewer, SoSceneManager, |
| 248 |
SoBoxHighlightRenderAction, SoLineHighlightRenderAction } |