SOXTVIEWER(3iv)
β¨ NAME β¨
SoXtViewer β viewer component lowest base class π«Ά
okay so hi bestie π this page is for SoXtViewer(3IV), and she is literally the blueprint β the bottom of the whole viewer family tree. everything viewer-y that comes after her? built on her. let's go π
𧬠INHERITS FROM π§¬
SoXtComponent > SoXtGLWidget > SoXtRenderArea > SoXtViewer
so yeah, she's got a whole ancestry situation going on. SoXtViewer is at the very end of that chain β everything listed before her is her parent energy π
π SYNOPSIS π
first thing first, you gotta bring her in:
#include <Inventor/Xt/viewers/SoXtViewer.h>
π the typedef π
typedef void SoXtViewerCB(void *userData, SoXtViewer *viewer)
that's the shape of the callback functions she'll accept later. noted, saved, screenshotted π
π₯ enum Type π₯
enum Type {
SoXtViewer::BROWSER camera views scene, but is not added to scene
SoXtViewer::EDITOR camera is added to user's scene
}
SoXtViewer::BROWSERβ the camera views the scene, but she is not added to it. she's just looking, respectfully πSoXtViewer::EDITORβ the camera is added to your scene. she's officially part of the group chat now.
π enum DrawStyle π
enum DrawStyle {
SoXtViewer::VIEW_AS_IS unchanged
SoXtViewer::VIEW_HIDDEN_LINE render only the front most lines
SoXtViewer::VIEW_NO_TEXTURE render withought textures
SoXtViewer::VIEW_LOW_COMPLEXITY
render low complexity and no texture
SoXtViewer::VIEW_LINE wireframe draw style
SoXtViewer::VIEW_LOW_RES_LINE
low complexity wireframe with no depth
comparison
SoXtViewer::VIEW_POINT point draw style
SoXtViewer::VIEW_LOW_RES_POINT
low complexity point with no depth
comparison
SoXtViewer::VIEW_BBOX bounding box draw style with no depth
comparison
SoXtViewer::VIEW_SAME_AS_STILL
forces the INTERACTIVE draw style to
automatically match STILL
}
SoXtViewer::VIEW_AS_ISβ unchanged. she's not doing anything extra, periodt.SoXtViewer::VIEW_HIDDEN_LINEβ renders only the front-most linesSoXtViewer::VIEW_NO_TEXTUREβ renders without texturesSoXtViewer::VIEW_LOW_COMPLEXITYβ renders at low complexity, and no texture eitherSoXtViewer::VIEW_LINEβ the wireframe draw style, iconicSoXtViewer::VIEW_LOW_RES_LINEβ low complexity wireframe, with no depth comparisonSoXtViewer::VIEW_POINTβ the point draw styleSoXtViewer::VIEW_LOW_RES_POINTβ low complexity point, with no depth comparisonSoXtViewer::VIEW_BBOXβ bounding box draw style, with no depth comparisonSoXtViewer::VIEW_SAME_AS_STILLβ forces theINTERACTIVEdraw style to automatically matchSTILL
π¦ enum DrawType π¦
enum DrawType {
SoXtViewer::STILL applies to static rendering
SoXtViewer::INTERACTIVE applies to rendering while interactive
viewing
}
SoXtViewer::STILLβ this one applies to static renderingSoXtViewer::INTERACTIVEβ this one applies to rendering while you're interactively viewing
π enum BufferType π
enum BufferType {
SoXtViewer::BUFFER_SINGLE single buffer
SoXtViewer::BUFFER_DOUBLE double buffer
SoXtViewer::BUFFER_INTERACTIVE
double buffer while interactive viewing
}
SoXtViewer::BUFFER_SINGLEβ single bufferSoXtViewer::BUFFER_DOUBLEβ double bufferSoXtViewer::BUFFER_INTERACTIVEβ double buffer while interactive viewing
π METHODS π
β¨ Methods from class SoXtViewer β¨
virtual void setCamera(SoCamera *cam)
SoCamera * getCamera()
virtual void setCameraType(SoType type)
SoType getCameraType()
virtual void viewAll()
virtual void saveHomePosition()
virtual void resetToHomePosition()
virtual void setHeadlight(SbBool onOrOff)
SbBool isHeadlight()
SoDirectionalLight * getHeadlight()
virtual void setDrawStyle(SoXtViewer::DrawType type,
SoXtViewer::DrawStyle style)
SoXtViewer::DrawStyle getDrawStyle(SoXtViewer::DrawType type)
virtual void setBufferingType(SoXtViewer::BufferType type)
SoXtViewer::BufferType getBufferingType()
virtual void setViewing(SbBool onOrOff)
SbBool isViewing() const
virtual void setCursorEnabled(SbBool onOrOff)
SbBool isCursorEnabled() const
void setAutoClipping(SbBool onOrOff)
SbBool isAutoClipping() const
virtual void setStereoViewing(SbBool onOrOff)
virtual SbBool isStereoViewing()
void setStereoOffset(float dist)
float getStereoOffset()
void setDetailSeek(SbBool onOrOff)
SbBool isDetailSeek()
void setSeekTime(float seconds)
float getSeekTime()
void addStartCallback(SoXtViewerCB *f, void *userData =
NULL)
void addFinishCallback(SoXtViewerCB *f, void *userData
= NULL)
void removeStartCallback(SoXtViewerCB *f, void
*userData = NULL)
void removeFinishCallback(SoXtViewerCB *f, void
*userData = NULL)
void copyView(Time eventTime)
void pasteView(Time eventTime)
virtual void recomputeSceneSize()
look at her. that's the whole roster of things SoXtViewer herself brings to the table β cameras, headlights, draw styles, buffering, viewing, cursors, clipping, stereo, seeking, callbacks, copy/paste view, scene size. she does a LOT. π
π§ Methods from class SoXtRenderArea π§
virtual void setSceneGraph(SoNode *newScene)
virtual SoNode * getSceneGraph()
void setOverlaySceneGraph(SoNode *newScene)
SoNode * getOverlaySceneGraph()
void registerDevice(SoXtDevice *)
void unregisterDevice(SoXtDevice *)
void setBackgroundColor(const SbColor &c)
const SbColor & getBackgroundColor() const
void setBackgroundIndex(int index)
int getBackgroundIndex() const
void setOverlayBackgroundIndex(int index)
int getOverlayBackgroundIndex() const
void setColorMap(int startIndex, int num, const
SbColor *colors)
void setOverlayColorMap(int startIndex, int num,
const SbColor *colors)
void setViewportRegion(const SbViewportRegion
&newRegion)
const SbViewportRegion & getViewportRegion() const
void setTransparencyType(SoGLRenderAction::TransparencyType
type)
SoGLRenderAction::TransparencyType
getTransparencyType() const
void setAntialiasing(SbBool smoothing, int numPasses)
void getAntialiasing(SbBool &smoothing, int
&numPasses) const
void setClearBeforeRender(SbBool trueOrFalse)
SbBool isClearBeforeRender() const
void setClearBeforeOverlayRender(SbBool trueOrFalse)
SbBool isClearBeforeOverlayRender() const
void setAutoRedraw(SbBool trueOrFalse)
SbBool isAutoRedraw() const
void setRedrawPriority(uint32_t priority)
uint32_t getRedrawPriority() const
static uint32_t getDefaultRedrawPriority()
void render()
void renderOverlay()
void scheduleRedraw()
void scheduleOverlayRedraw()
void redrawOnSelectionChange(SoSelection *s)
void redrawOverlayOnSelectionChange(SoSelection *s)
void setEventCallback(SoXtRenderAreaEventCB *fcn,
void *userData = NULL)
void setGLRenderAction(SoGLRenderAction *ra)
SoGLRenderAction * getGLRenderAction() const
void setOverlayGLRenderAction(SoGLRenderAction *ra)
SoGLRenderAction * getOverlayGLRenderAction() const
void setSceneManager(SoSceneManager *sm)
SoSceneManager * getSceneManager() const
void setOverlaySceneManager(SoSceneManager *sm)
SoSceneManager * getOverlaySceneManager() const
she inherits ALL of this from SoXtRenderArea β scenes, overlays, devices, backgrounds, color maps, viewports, transparency, antialiasing, clearing, auto redraw, priorities, rendering, scheduling, selections, event callbacks, GL render actions, scene managers. so much. π«Ά
πΈ Methods from class SoXtGLWidget πΈ
void setBorder(SbBool onOrOff)
SbBool isBorder() const
virtual void setDoubleBuffer(SbBool onOrOff)
SbBool isDoubleBuffer()
Window getNormalWindow()
Window getOverlayWindow()
GLXContext getNormalContext()
GLXContext getOverlayContext()
Widget getNormalWidget()
Widget getOverlayWidget()
virtual void setNormalVisual(XVisualInfo *vis)
XVisualInfo * getNormalVisual()
virtual void setOverlayVisual(XVisualInfo *vis)
XVisualInfo * getOverlayVisual()
void setDrawToFrontBufferEnable(SbBool enableFlag)
SbBool isDrawToFrontBufferEnable() const
borders, double buffering, windows, contexts, widgets, visuals, front-buffer drawing β all handed down from SoXtGLWidget π
β Methods from class SoXtComponent β
virtual void show()
virtual void hide()
SbBool isVisible()
Widget getWidget() const
SbBool isTopLevelShell() const
Widget getShellWidget() const
Widget getParentWidget() const
void setSize(const SbVec2s &size)
SbVec2s getSize()
Display * getDisplay()
void setTitle(const char *newTitle)
const char * getTitle() const
void setIconTitle(const char *newIconTitle)
const char * getIconTitle() const
void setWindowCloseCallback(SoXtComponentCB *func, void
*data = NULL)
static SoXtComponent * getComponent(Widget w)
const char * getWidgetName() const
const char * getClassName() const
and finally the SoXtComponent goodies β showing, hiding, visibility, widgets, sizes, displays, titles, icon titles, close callbacks, and the static lookup + name getters. the whole bloodline, accounted for π§¬
π DESCRIPTION π
okay so real talk. this is the lowest base class for viewer components. what she adds to SoXtRenderArea is the whole concept of a camera. like, that's her thing.
whenever a new scene gets specified with setSceneGraph(), the first camera encountered will, by default, be used as the edited camera. and if there's no camera anywhere in the scene? she just makes one herself. no big deal. π
and here's where the Type enum comes back around:
- if the viewer type is
SoXtViewer::BROWSER, 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, the camera is added beneath the supplied scene graph root
bestie she is literally doing it all. π
beyond the whole auto-creating-a-camera-when-needed situation, this base class also:
- creates a headlight β that's a directional light which is made to follow the camera π¨
- lets the user change drawing styles (like wireframe, or move wireframe) and buffering types
- gives you a super convenient way to have the camera's near and far clipping planes automatically adjusted, so that clipping of objects in the scene gets minimized. so thoughtful of her.
one more thing, and it's lowkey the most interesting part: viewers let the application 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. BUT β and this is the plot twist β unlike the render area, the viewer ignores the return value of this callback, and processes the event as usual.
so what's the point? this lets the application expand viewing capabilities without breaking the viewing paradigm. it's an easy way to hook up other devices β like the spaceball β to an existing viewer. slay. π₯
β¨ METHODS β¨
virtual void setCamera(SoCamera *cam)/SoCamera * getCamera()Set and get the camera being edited. 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. πvirtual void setCameraType(SoType type)/SoType getCameraType()Set and get the camera type that will be created by the viewer if no cameras are found in the scene graph (seeSoPerspectiveCameraandSoOrthographicCamera). By default anSoPerspectiveCamerawill 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).
virtual void viewAll()Changes the camera position to view the entire scene (the camera zoom or orientation isn't changed). πvirtual void saveHomePosition()/virtual void resetToHomePosition()Saves and restores the camera values. πvirtual void setHeadlight(SbBool onOrOff)/SbBool isHeadlight()/SoDirectionalLight * getHeadlight()Turns the headlight on/off (default on) and returns the headlight node. β¨virtual void setDrawStyle(SoXtViewer::DrawType type, SoXtViewer::DrawStyle style)/SoXtViewer::DrawStyle 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 toVIEW_AS_IS. INTERACTIVE defaults toVIEW_NO_TEXTUREon machines that do not support fast texturing,VIEW_SAME_AS_STILLotherwise. Possible draw styles are:VIEW_AS_ISβ Leaves the objects unchanged. π¦VIEW_HIDDEN_LINEβ Renders the object as wireframe, but only shows the object front faces. This is accomplished using a two pass rendering. In the first pass, the objects are rendered as FILLED using the backgroundBASE_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 without any textures. This is done by setting the override flag on anSoComplexitynode withtextureQuality = 0.VIEW_LOW_COMPLEXITYβ Renders the objects without any textures and with a low complexity. This is done by setting the override flag on anSoComplexitynode withtextureQuality = 0andcomplexity value = 0.15.VIEW_LINEβ Renders the objects as LINES (no texture) with lighting model set toBASE_COLOR.VIEW_LOW_RES_LINEβ Renders the objects as LINES (no texture) using a low complexity, with lighting model set toBASE_COLORand no depth comparison.VIEW_POINTβ Renders the objects as POINTS (no texture) with lighting model set toBASE_COLOR.VIEW_LOW_RES_POINTβ Renders the objects as POINTS (no texture) using a low complexity, with lighting model set toBASE_COLORand no depth comparison.VIEW_BBOXβ Renders the objects with complexityBOUNDING_BOX, lighting model set toBASE_COLORand 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 without having to set it explicitly.
virtual void setBufferingType(SoXtViewer::BufferType type)/SoXtViewer::BufferType getBufferingType()Sets/gets the current buffering type in the main view (defaultSoXtViewer::BUFFER_DOUBLE). πvirtual void setViewing(SbBool onOrOff)/SbBool isViewing() constSet/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 viewer's 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). π₯virtual void setCursorEnabled(SbBool onOrOff)/SbBool isCursorEnabled() constSet/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 appropriate glyph. The base class routine only sets the flag. π±οΈ
void setAutoClipping(SbBool onOrOff)/SbBool isAutoClipping() constSet 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). βοΈvirtual void setStereoViewing(SbBool onOrOff)/virtual SbBool isStereoViewing()/void setStereoOffset(float dist)/float 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/setmonneeds 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 setDetailSeek(SbBool onOrOff)/SbBool 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. πvoid setSeekTime(float seconds)/float 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. β±οΈvoid addStartCallback(SoXtViewerCB *f, void *userData = NULL)void addFinishCallback(SoXtViewerCB *f, void *userData = NULL)void removeStartCallback(SoXtViewerCB *f, void *userData = NULL)void 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.
void copyView(Time eventTime)/void pasteView(Time eventTime)Copy/paste the view.eventTimeshould be the time of the X event which initiated the copy or paste (e.g. if copy/paste is initiated from a keystroke,eventTimeshould be the time in the XKeyPressevent). πvirtual void 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 wheneversetSceneGraph()is called. π
π SEE ALSO π
SoXtComponent, SoXtRenderArea, SoXtExaminerViewer, SoXtWalkViewer, SoXtFlyViewer, SoXtPlaneViewer π
and that's the whole vibe, bestie. the footer says SoXtViewer(3IV)() β that's the source/version and the date slot, iconic. stay slaying. πβ¨
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms