Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoXtViewer Class Reference

Viewer component lowest base class. More...

#include <Inventor/Xt/viewers/SoXtViewer.h>

+ Inheritance diagram for SoXtViewer:

Public Types

enum  Type {
  BROWSER ,
  EDITOR
}
 An EDITOR viewer will create a camera under the user supplied scene graph (specified in setSceneGraph()) if it cannot find one in the scene and will leave the camera behind when supplied with a new scene. More...
 
enum  DrawStyle {
  VIEW_AS_IS ,
  VIEW_HIDDEN_LINE ,
  VIEW_NO_TEXTURE ,
  VIEW_LOW_COMPLEXITY ,
  VIEW_LINE ,
  VIEW_POINT ,
  VIEW_BBOX ,
  VIEW_LOW_RES_LINE ,
  VIEW_LOW_RES_POINT ,
  VIEW_SAME_AS_STILL
}
 list of possible drawing styles More...
 
enum  DrawType {
  STILL ,
  INTERACTIVE
}
 DrawType. More...
 
enum  BufferType {
  BUFFER_SINGLE ,
  BUFFER_DOUBLE ,
  BUFFER_INTERACTIVE
}
 list of different buffering types More...
 
enum  DecimationStrategy {
  NORMAL ,
  FIXED_NUM_TRIANGLES ,
  FRAMES_PER_SECOND ,
  FIXED_PERCENTAGE
}
 list of decimation strategies More...
 
enum  CursorStyle {
  CLASSIC ,
  XOR ,
  SHADOW
}
 Classic cursors are all white and tend to disappear over white geometry or white background. More...
 
typedef void SoXtViewerCB(void *userData, SoXtViewer *viewer)
 
typedef void SoXtViewerCameraTypeChangeCB(void *userData, SoCamera *camera, SoXtViewer *viewer)
 
typedef void SoXtViewerFPSCB(float fps, void *userData, SoXtViewer *viewer)
 
typedef void SoXtViewerDecimationPercentageCB(float percentage, void *userData, SoXtViewer *viewer)
 
- Public Types inherited from SoXtRenderArea
typedef SbBool SoXtRenderAreaEventCB(void *userData, XAnyEvent *anyevent)
 
typedef SbBool SoXtRenderAreaRenderCB(void *userData, SoXtRenderArea *rendArea)
 
- Public Types inherited from SoXtGLWidget
enum  FloatColorBufferSize {
  FLOAT_16_COLOR_BUFFER = SoGuiGLWidget::FLOAT_16_COLOR_BUFFER ,
  FLOAT_32_COLOR_BUFFER = SoGuiGLWidget::FLOAT_32_COLOR_BUFFER
}
 FloatColorBufferSize. More...
 
- Public Types inherited from SoXtComponent
typedef void SoXtComponentCB(void *data, SoXtComponent *v)
 

Public Member Functions

virtual void setSceneGraph (SoNode *newScene)
 Sets the scene graph to render.
 
virtual SoNodegetSceneGraph ()
 Gets the scene graph to render.
 
virtual void setCamera (SoCamera *cam)
 Sets the edited camera.
 
SoCameragetCamera ()
 Gets the edited camera.
 
virtual void setCameraType (SoType type)
 Sets the camera type that will be created by the viewer if no cameras are found in the scene graph (see SoPerspectiveCamera and SoOrthographicCamera).
 
SoType getCameraType ()
 Gets the camera type that will be created by the viewer if no cameras are found in the scene graph (see SoPerspectiveCamera and SoOrthographicCamera).
 
virtual void setPreserveCameraHeightAngle (SbBool flag)
 If TRUE, an SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrthographicCamera and then toggled back to an SoPerspectiveCamera.
 
virtual SbBool isCameraHeightAnglePreserved () const
 Query whether the SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrthographicCamera and then toggled back to an SoPerspectiveCamera.
 
virtual void enableSeekWithOrtho (SbBool flag)
 If FALSE, the seek functionality is disabled for an SoOrthographicCamera.
 
virtual SbBool isSeekWithOrthoEnabled () const
 Query whether the seek functionality is enabled for an SoOrthographicCamera.
 
virtual void viewAll ()
 Changes the camera position to view the entire scene (the camera zoom or orientation isn't changed).
 
virtual void saveHomePosition ()
 Saves the camera values.
 
virtual void resetToHomePosition ()
 Restores the camera values.
 
void setCameraTypeChangeCallback (SoXtViewerCameraTypeChangeCB *callback, void *userdata)
 Defines a callback which is called each time the camera type has changed (change from SoPerspectiveCamera to SoOrthographicCamera or vice versa).
 
virtual void setHeadlight (SbBool onOrOff)
 Turns the headlight on/off (default on).
 
SbBool isHeadlight ()
 Queries if the headlight is on.
 
SoDirectionalLightgetHeadlight ()
 Returns the headlight node.
 
virtual void setDrawStyle (SoXtViewer::DrawType type, SoXtViewer::DrawStyle style)
 Sets the current drawing style in the main view.
 
SoXtViewer::DrawStyle getDrawStyle (SoXtViewer::DrawType type)
 Queries the current drawing style in the main view.
 
virtual void setBufferingType (SoXtViewer::BufferType type)
 Sets the current buffering type in the main view (default SoXtViewer::BUFFER_DOUBLE).
 
SoXtViewer::BufferType getBufferingType ()
 Gets the current buffering type in the main view.
 
virtual void setViewing (SbBool onOrOff)
 Sets whether the viewer is turned on or off.
 
SbBool isViewing () const
 Queries whether the viewer is turned on or off.
 
virtual void setCursorEnabled (SbBool onOrOff)
 Sets whether the viewer is allowed to change the cursor over the renderArea window.
 
SbBool isCursorEnabled () const
 Queries whether the viewer is allowed to change the cursor over the renderArea window.
 
void setAutoClipping (SbBool onOrOff)
 Sets the auto clipping plane.
 
SbBool isAutoClipping () const
 Queries if auto clipping is ON.
 
virtual void setStereoViewing (SbBool onOrOff)
 Turns stereo viewing on/off on the viewer (default off).
 
virtual SbBool isStereoViewing ()
 Queries if stereo viewing is on or off on the viewer.
 
void setStereoOffset (float dist)
 Sets the stereo offset.
 
float getStereoOffset ()
 Returns the stereo offset.
 
void setDetailSeek (SbBool onOrOff)
 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.
 
SbBool isDetailSeek ()
 Queries whether the viewer is in seek mode.
 
void setSeekTime (float seconds)
 Sets the time a seek takes to change to the new camera location.
 
float getSeekTime ()
 Queries the seek time.
 
void addStartCallback (SoXtViewerCB *f, void *userData=NULL)
 Adds start callback routine on the viewer.
 
void addFinishCallback (SoXtViewerCB *f, void *userData=NULL)
 Adds finish callback routines on the viewer.
 
void removeStartCallback (SoXtViewerCB *f, void *userData=NULL)
 Removes start callback routine from the viewer.
 
void removeFinishCallback (SoXtViewerCB *f, void *userData=NULL)
 Removes finish callback routine from the viewer.
 
void copyView (Time eventTime)
 Copies the view.
 
void pasteView (Time eventTime)
 Pastes the view.
 
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.
 
void setDecimationStrategy (SoXtViewer::DecimationStrategy strategy)
 Sets strategy to use to decide on decimation value.
 
SoXtViewer::DecimationStrategy getDecimationStrategy ()
 Gets strategy to use to decide on decimation value.
 
void setGoalNumberOfTriangles (int32_t goal)
 Sets goal number of triangles for the viewer to try to render.
 
int32_t getGoalNumberOfTriangles ()
 Gets goal number of triangles for the viewer to try to render.
 
void setGoalFramesPerSecond (float goal)
 Sets goal frames per second for the viewer to try to render.
 
float getGoalFramesPerSecond ()
 Gets goal frames per second for the viewer to try to render.
 
void setFixedPercentage (float percent)
 Sets fixed percentage for the viewer to render (0.0 to 1.0) Default is 1.0.
 
float getFixedPercentage ()
 Gets fixed percentage for the viewer to render (0.0 to 1.0)
 
void enableFullRenderingWhenStill (SbBool onOff)
 If this flag is set, the viewer will render at full resolution when it sits still for a certain period of time.
 
SbBool isFullRenderingWhenStill ()
 Queries if the viewer will render at full resolution when it sits still for a certain period of time.
 
SbBool isStillNow ()
 Returns whether the viewer is currently still.
 
void setFramesPerSecondCallback (SoXtViewerFPSCB *callback, void *userData=NULL)
 Registers frames per second callback.
 
void setNumSamples (int numFrames)
 Sets how many frames should be timed before frames per second callback is called, default is 10.
 
int getNumSamples ()
 Gets how many frames should be timed before frames per second callback is called.
 
void setDecimationPercentageCallback (SoXtViewerDecimationPercentageCB *callback, void *userData=NULL)
 Registers decimation percentage callback.
 
float getCurrentDecimationPercentage ()
 Returns the Decimation Percentage the viewer used in its last render.
 
virtual SoCameragetViewerCamera ()
 Returning the camera allows the SoBaseStereo to manipulate it to achieve the stereo effect.
 
virtual SbBool isViewerDoubleBuffer ()
 Queries if viewer is double buffered.
 
virtual void actualRendering ()
 This method is called automatically when the viewer requests that its SoBaseStereo object perform stereo rendering.
 
virtual const SbVec2sgetSize ()
 Returns the size of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system.
 
virtual const SbVec2sgetTopLeft ()
 Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).
 
virtual const SbVec2sgetBottomRight ()
 Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).
 
void setStereoViewType (SoBaseStereo *stereo)
 If stereoViewType is NULL, the stereo is inactivated (see setStereoActive).
 
SoBaseStereogetStereoViewType ()
 Returns the stereo view type.
 
void reverseStereoView (SbBool reverse)
 Sets reversal of the left and right views.
 
SbBool isStereoViewReversed ()
 Queries reversal of the left and right views.
 
virtual void setStereoAbsoluteAdjustments (SbBool absolute)
 Specifies if stereo adjustments are absolute.
 
virtual SbBool isStereoAbsoluteAdjustments () const
 Queries if the stereo adjustments are absolute.
 
virtual void setStereoBalance (float balance, SbBool nearFrac)
 Sets the stereo balance (the position of the zero parallax plane) and specifies whether the balance value is defined as a fraction of the camera near distance.
 
virtual float getStereoBalance ()
 Queries the stereo balance (the position of the zero parallax plane).
 
virtual SbBool isStereoBalanceNearFrac ()
 Returns TRUE when the stereo balance adjustement is defined as a fraction of the camera near distance.
 
virtual void setStereoActive (SbBool activate)
 Sets stereo activation.
 
virtual SbBool isStereoActive ()
 Queries stereo activation.
 
void setViewport (short left, short bottom, short width, short height)
 Sets viewport region with given origin (lower-left corner) and size, given as pixel coordinates.
 
void getViewport (short &left, short &bottom, short &width, short &height)
 Returns viewport region with origin (lower-left corner) and size, given as pixel coordinates.
 
virtual void setCursorStyle (SoXtViewer::CursorStyle style)
 Sets the cursor style.
 
SoXtViewer::CursorStyle getCursorStyle ()
 Returns the cursor style.
 
SoSeparatorgetSceneRoot ()
 
void setAutoClipTolerance (float tolerance)
 Sets the auto clipping tolerance value.
 
float getAutoClipTolerance () const
 Gets the auto clipping tolerance value.
 
virtual void setCameraSceneGraph (SoNode *cameraSceneGraph)
 Sets the sub-scene graph to be used for viewAll computation.
 
SoNodegetCameraSceneGraph ()
 Gets the sub-scene graph to be viewed.
 
virtual void toggleCameraType ()
 This routine will toggle the current camera from perspective to orthographic, and from orthographic back to perspective.
 
virtual void setSeekMode (SbBool onOrOff)
 Externally set the viewer into/out off seek mode (default OFF).
 
void setPickRadius (float radius)
 Sets the pick radius, in pixels, used by the viewer for picking and seeking actions.
 
float getPickRadius () const
 Returns the current pick radius for picking and seeking actions.
 
SbBool getDepthValue (int x, int y, float &depth)
 Returns the depth value, scaled between 0.0 and 1.0, from the depth buffer at window coordinates x, y.
 
Deprecated
virtual SoDEPRECATED void adjustClippingPlanes ()
 
- Public Member Functions inherited from SoXtRenderArea
 SoXtRenderArea (SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, SbBool getMouseInput=TRUE, SbBool getKeyboardInput=TRUE)
 Constructor which is passed arguments which tell it whether to register the mouse and keyboard devices by default (SoXtMouse and SoXtKeyboard).
 
 ~SoXtRenderArea ()
 Destructor.
 
void registerDevice (SoXtDevice *d)
 Registers interest in devices.
 
void unregisterDevice (SoXtDevice *d)
 Unregisters interest in devices.
 
void setBackgroundColor (const SbColor &c)
 Sets the background color for this window.
 
SbColor getBackgroundColor () const
 Gets the background color for this window.
 
void setBackgroundIndex (int index)
 Sets the window background color when in color index mode.
 
int getBackgroundIndex () const
 Gets the window background color when in color index mode.
 
void setColorMap (int startIndex, int num, const SbColor *colors)
 Sets the colors to use when displaying in color index mode.
 
void setViewportRegion (const SbViewportRegion &newRegion)
 Sets viewport region to use for rendering.
 
const SbViewportRegiongetViewportRegion () const
 Gets current viewport region to use for rendering.
 
void setTransparencyType (SoGLRenderAction::TransparencyType type)
 Sets the algorithm for rendering transparent objects.
 
SoGLRenderAction::TransparencyType getTransparencyType () const
 Gets the algorithm for rendering transparent objects.
 
void setFastEditSavePolicy (SoGLRenderAction::FastEditSavePolicy policy, SbBool fastEditDelayedObjects=FALSE)
 Sets fast editing save policy to use when rendering.
 
SoGLRenderAction::FastEditSavePolicy getFastEditSavePolicy () const
 Returns fast editing save policy used when rendering.
 
void setInvalidateCacheMode (SoGLRenderAction::InvalidateCacheMode icm)
 Enables or disables the invalidation of render caches.
 
SoGLRenderAction::InvalidateCacheMode getInvalidateCacheMode ()
 Returns the current cache invalidation mode.
 
void setClearBeforeRender (SbBool trueOrFalse, SbBool zbTrueOrFalse=TRUE)
 Enables/prevents window clearing from happening before a rendering starts (default is clear TRUE).
 
SbBool isClearBeforeRender () const
 Queries whether the window will be cleared before rendering starts.
 
SbBool isClearZBufferBeforeRender () const
 Queries whether the depth buffer (sometimes called the Z buffer) will be cleared before rendering starts.
 
void setAutoRedraw (SbBool trueOrFalse)
 The render area will automatically redraw whenever something in the scene graph changes.
 
SbBool isAutoRedraw () const
 Queries whether the render area will automatically redraw whenever something in the scene graph changes.
 
void setRedrawPriority (uint32_t priority)
 Sets the priority of the redraw sensor.
 
uint32_t getRedrawPriority () const
 Gets the priority of the redraw sensor.
 
void render ()
 Calling this forces the render area to be redrawn now.
 
void scheduleRedraw ()
 Schedules a redraw to happen sometime soon (as opposed to immediately).
 
void redrawOnSelectionChange (SoSelection *s)
 Call this convenience method to have this render area redraw whenever the selection list changes in the passed node.
 
void setEventCallback (SoXtRenderAreaEventCB *fcn, void *userData=NULL)
 X events which occur in the render area window are either directly handled by the viewer (when this is really a viewer) or automatically translated to SoEvents, then passed into the scene graph (via the SoHandleEventAction) so that live scene graph objects can handle the event (when viewers are not in viewing mode).
 
void setSceneManager (SoSceneManager *sm)
 Sets the normal scene manager.
 
SoSceneManagergetSceneManager () const
 Gets the normal scene manager.
 
void setGLRenderAction (SoGLRenderAction *ra)
 Sets the GL render action to use.
 
SoGLRenderActiongetGLRenderAction () const
 Gets the current GL render action.
 
const SbGLShareContext getShareContext ()
 Returns the information needed to make OpenGL render contexts share OpenGL objects, for example, display lists and texture objects.
 
void setPostRenderCallback (SoXtRenderAreaRenderCB *fcn, void *userData=NULL)
 Specifies a function to be called after the Open Inventor render traversal and immediately before the OpenGL buffer swap.
 
SoXtRenderAreaRenderCB * getPostRenderCallback (const void *&userData) const
 Gets the post-render callback function and data.
 
void setFloatingColorBuffer (SbBool enable, FloatColorBufferSize size=FLOAT_16_COLOR_BUFFER)
 Enables/disables floating point rendering using 16- or 32-bit components.
 
void getFloatingColorBuffer (SbBool &enable, FloatColorBufferSize &size)
 Returns TRUE if floating point rendering is used and its precision.
 
void sendEvent (XAnyEvent *anEvent)
 Sends the event to be processed by the renderArea.
 
virtual void setMPEGRecorder (SoMPEGRenderer *recorder)
 Sets the recorder used for MPEG encoding.
 
virtual SoMPEGRenderergetMPEGRecorder () const
 Returns the recorder used for the MPEG encoding.
 
SoDEPRECATED void setAntialiasing (SbBool smoothing, int numPasses)
 Enables smoothing and/or multi-pass antialiasing for rendering.
 
SoDEPRECATED void getAntialiasing (SbBool &smoothing, int &numPasses) const
 Gets the antialiasing used for rendering.
 
void setAntialiasing (const float quality, const SoSceneManager::AntialiasingMode mode=SoSceneManager::AUTO)
 Enable (or disable) antialiasing with specified quality and mode.
 
void setAntialiasing (SoAntialiasingParameters *advancedParameters)
 Enable (or disable) antialiasing with specific parameters.
 
- Public Member Functions inherited from SoXtGLWidget
int getColorMapSize ()
 Returns the color map size.
 
virtual Window getNormalWindow ()
 Gets the current normal GL window, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes.
 
SbGlContextHelper::GLContext getNormalContext () const
 Gets the current normal context, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes.
 
SoGLContextgetNormalSoContext () const
 
SoWidget getNormalWidget () const
 Gets the current normal widget, which is needed as an argument to glXMakeCurrent() when drawing in the normal planes.
 
XVisualInfo * getNormalVisual ()
 Returns the visual for the normal window.
 
virtual void setDoubleBuffer (SbBool onOrOff)
 Routine that dynamically changes between single and double buffering.
 
SbBool isDoubleBuffer ()
 Returns whether double buffering is on or off.
 
void setAntialiasing (const float quality, const SoSceneManager::AntialiasingMode mode=SoSceneManager::AUTO)
 Enable (or disable) antialiasing with specified quality and mode.
 
void setAntialiasing (SoAntialiasingParameters *advancedParameters)
 Enable (or disable) antialiasing with specific parameters.
 
float getAntialiasingQuality () const
 Returns the antialiasing quality set using the setAntialiasing(float,AntialiasingMode) method.
 
SoSceneManager::AntialiasingMode getAntialiasingMode () const
 Returns the antialiasing mode set using the setAntialiasing(float,AntialiasingMode) method.
 
SoAntialiasingParametersgetAntialiasingParameters () const
 Returns the antialiasing parameters set using the setAntialiasing(SoAntialiasingParameters*) method.
 
void setBorder (SbBool onOrOff)
 Shows/hides a border of thickness 3 around the glX widgets.
 
SbBool isBorder () const
 Returns whether the border is on or off.
 
void setDrawToFrontBufferEnable (SbBool enableFlag)
 Sets drawing to the front buffer.
 
SbBool isDrawToFrontBufferEnable () const
 Queries drawing to the front buffer.
 
virtual SbBool bindNormalContext ()
 Makes the normal rendering context the current context.
 
virtual SbBool unbindNormalContext ()
 unbind the current context (previously bind with bindNormalContext );
 
virtual SbBool swapNormalBuffers ()
 Swaps the normal front and back buffers.
 
SoGLGraphicConfigTemplategetGraphicConfigTemplate ()
 Gets the current graphics configuration template.
 
void setGraphicConfigTemplate (SoGLGraphicConfigTemplate *gTemplate)
 Sets a new graphics configuration template.
 
void setFloatingColorBuffer (SbBool enable, FloatColorBufferSize size=FLOAT_16_COLOR_BUFFER)
 Enables/disables floating point rendering using 16- or 32-bit components.
 
void getFloatingColorBuffer (SbBool &enable, FloatColorBufferSize &size)
 Returns TRUE if floating point rendering is used and its precision.
 
bool saveSnapshot (const SbString &filename, bool overwrite=true)
 Save a snapshot of the current image displayed in the viewer.
 
- Public Member Functions inherited from SoXtComponent
virtual void show ()
 This shows the component.
 
virtual void hide ()
 This hides the component.
 
SbBool isVisible ()
 Returns TRUE if this component is mapped onto the screen.
 
SoWidget getWidget () const
 This returns the base widget for this component.
 
SbBool isTopLevelShell () const
 Returns TRUE if this component is a top level shell component (has its own window).
 
SoWidget getShellWidget () const
 Returns the shell widget (NULL if the shell hasn't been created by this component).
 
SoWidget getParentWidget () const
 Returns the parent widget, be it a shell or not.
 
void setSize (const SbVec2s &size)
 Convenience routine on the widget.
 
SbVec2s getSize ()
 Convenience routine on the widget.
 
SbBool setFullScreen (const SbBool enable)
 Switches the viewer into (or out of) fullscreen mode.
 
SbBool isFullScreen (void) const
 Queries if the viewer is in fullscreen mode.
 
void setFullScreenEnable (const SbBool enable)
 Enables/disables fullscreen mode.
 
SbBool isFullScreenEnable () const
 Queries if it is possible to put the viewer in fullscreen mode.
 
Display * getDisplay ()
 Returns the X display associated with this components widget.
 
SoNONUNICODE void setTitle (const char *newTitle)
 Sets window title.
 
void setTitle (const SbString &newTitle)
 Sets window title.
 
SbString getTitle () const
 Gets window title.
 
SoNONUNICODE void setIconTitle (const char *newIconTitle)
 Sets icon title.
 
void setIconTitle (const SbString &newIconTitle)
 Sets icon title.
 
SbString getIconTitle () const
 Gets icon title.
 
void setWindowCloseCallback (SoXtComponentCB *func, void *data=NULL)
 Sets which callback to call when the user closes this component (double click in the upper left corner) - by default hide() is called on this component, unless a callback is set to something other than NULL.
 
SbString getWidgetName () const
 Returns the widget name.
 
SbString getClassName () const
 Returns the class name.
 
- Public Member Functions inherited from SoStereoViewer
virtual ~SoStereoViewer ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from SoXtRenderArea
static uint32_t getDefaultRedrawPriority ()
 Gets the default priority number of the redraw sensor.
 
- Static Public Member Functions inherited from SoXtComponent
static void displayHelp (const char *filename, UINT contextID)
 Static method to display the specified topic of the specified help file.
 
static SoXtComponentgetComponent (SoWidget w)
 This returns the SoXtComponent for this widget.
 

Detailed Description

Viewer component lowest base class.

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 setSceneGraph(), 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 SoXtViewer::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 SoXtViewer::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), and enables the user to change drawing styles (like wireframe or move wireframe), and buffering types. When the headlight is enabled, a group node is added immediately following the edited camera. This group contains a directional light node.

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 setEventCallback() 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.

Depending on the DecimationStrategy, a viewer can control the complexity of a scene by adjusting the Decimation elements to reach certain goals. The viewer can attempt to keep a constant frame rate or a constant number of triangles rendered. The viewer can be set to switch to full detail when the scene is not moving.

In order to set the frame rate, the viewer times each render action traversal, and then adjusts the Decimation percentage to keep the time within a range depending on the goal frames per second. To fix the number of triangles, the viewer applies a GetPrimitiveCountAction before each traversal and sets the DecimationPercentage to the desired percentage of the resulting count.

If the DecimationStrategy is NORMAL (the default) then nothing special is done. If the strategy is FIXED_PERCENTAGE, then the same percentage is used for every render. Also note that FIXED_PERCENTAGE sets the DecimationType to be PERCENTAGE (all others use AUTOMATIC), which means that instances of SoLOD will not use the camera position in their calculations, and can therefore be cached.

The application can add callbacks from the viewer to get the current decimation level, the current primitive count and the current frames per second. The decimation level and primitive count callbacks are called every frame. The frames per second callback is called after a certain number of samples have been averaged together.

SEE ALSO

SoXtComponent, SoXtRenderArea, SoXtExaminerViewer, SoXtWalkViewer, SoXtFlyViewer, SoXtPlaneViewer

Definition at line 188 of file SoXtViewer.h.

Member Typedef Documentation

◆ SoXtViewerCameraTypeChangeCB

typedef void SoXtViewerCameraTypeChangeCB(void *userData, SoCamera *camera, SoXtViewer *viewer)

Definition at line 99 of file SoXtViewer.h.

◆ SoXtViewerCB

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

Definition at line 97 of file SoXtViewer.h.

◆ SoXtViewerDecimationPercentageCB

typedef void SoXtViewerDecimationPercentageCB(float percentage, void *userData, SoXtViewer *viewer)

Definition at line 106 of file SoXtViewer.h.

◆ SoXtViewerFPSCB

typedef void SoXtViewerFPSCB(float fps, void *userData, SoXtViewer *viewer)

Definition at line 104 of file SoXtViewer.h.

Member Enumeration Documentation

◆ BufferType

enum SoXtViewer::BufferType

list of different buffering types

Enumerator
BUFFER_SINGLE 

Single buffer.

BUFFER_DOUBLE 

Double buffer.

BUFFER_INTERACTIVE 

Double buffer while interactive viewing.

Definition at line 277 of file SoXtViewer.h.

◆ CursorStyle

enum SoXtViewer::CursorStyle

Classic cursors are all white and tend to disappear over white geometry or white background.

New styles avoid that problem (but have quirks of their own of course :-). Added for v2.6

Enumerator
CLASSIC 

Standard Open Inventor cursors.

XOR 

Improved cursors using XOR.

SHADOW 

Improved cursors using "shadow".

Definition at line 319 of file SoXtViewer.h.

◆ DecimationStrategy

enum SoXtViewer::DecimationStrategy

list of decimation strategies

Enumerator
NORMAL 

Decimation is not changed.

FIXED_NUM_TRIANGLES 

Try to fix number of triangles drawn.

FRAMES_PER_SECOND 

Try to fix frames per second.

FIXED_PERCENTAGE 

Use given decimation percentage.

Definition at line 294 of file SoXtViewer.h.

◆ DrawStyle

enum SoXtViewer::DrawStyle

list of possible drawing styles

Note: Refer to the SoXtViewer man pages for a complete description of those draw styles.

Enumerator
VIEW_AS_IS 

Unchanged.

VIEW_HIDDEN_LINE 

Render only the frontmost lines.

VIEW_NO_TEXTURE 

Render without textures.

VIEW_LOW_COMPLEXITY 

Render low complexity and no texture.

VIEW_LINE 

Wireframe draw style.

VIEW_POINT 

Point draw style.

VIEW_BBOX 

Bounding box draw style.

VIEW_LOW_RES_LINE 

Low complexity wireframe + no depth clearing.

VIEW_LOW_RES_POINT 

Low complexity point + no depth clearing.

VIEW_SAME_AS_STILL 

Forces the INTERACTIVE draw style to match STILL.

Definition at line 219 of file SoXtViewer.h.

◆ DrawType

enum SoXtViewer::DrawType

DrawType.

Enumerator
STILL 

Applies to static rendering.

INTERACTIVE 

Applies to rendering while interactive viewing.

Definition at line 264 of file SoXtViewer.h.

◆ Type

enum SoXtViewer::Type

An EDITOR viewer will create a camera under the user supplied scene graph (specified in setSceneGraph()) if it cannot find one in the scene and will leave the camera behind when supplied with a new scene.

A BROWSER viewer will also create a camera if it cannot find one in the scene, but will place it above the scene graph node (camera will not appear in the user supplied scene graph), and will automatically remove it when another scene is supplied to the viewer.

Enumerator
BROWSER 

Camera views scene, but is not added to scene.

EDITOR 

Camera is added to user's scene.

Definition at line 201 of file SoXtViewer.h.

Member Function Documentation

◆ actualRendering()

virtual void SoXtViewer::actualRendering ( )
virtual

This method is called automatically when the viewer requests that its SoBaseStereo object perform stereo rendering.

actualRendering() may then be called twice (once for each eye view) and therefore must not take into account any stereo-specific settings. It should behave as if it were a rendering method for a monoscopic view.

Implements SoStereoViewer.

◆ addFinishCallback()

void SoXtViewer::addFinishCallback ( SoXtViewerCB f,
void *  userData = NULL 
)
inline

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

Definition at line 658 of file SoXtViewer.h.

◆ addStartCallback()

void SoXtViewer::addStartCallback ( SoXtViewerCB f,
void *  userData = NULL 
)
inline

Adds start callback routine 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.

Definition at line 647 of file SoXtViewer.h.

◆ adjustClippingPlanes()

virtual SoDEPRECATED void SoXtViewer::adjustClippingPlanes ( )
virtual

◆ copyView()

void SoXtViewer::copyView ( Time  eventTime)

Copies the view.

eventTime should be the time of the X event which initiated the copy (e.g. if copy is initiated from a keystroke, eventTime should be the time in the key down message.)

◆ enableFullRenderingWhenStill()

void SoXtViewer::enableFullRenderingWhenStill ( SbBool  onOff)

If this flag is set, the viewer will render at full resolution when it sits still for a certain period of time.

Default is false.

The default value can be set using the environment variable OIV_FULL_RENDER_WHEN_STILL (0 = FALSE, 1 = TRUE).

◆ enableSeekWithOrtho()

virtual void SoXtViewer::enableSeekWithOrtho ( SbBool  flag)
inlinevirtual

If FALSE, the seek functionality is disabled for an SoOrthographicCamera.

Default is TRUE.

Definition at line 398 of file SoXtViewer.h.

◆ getAutoClipTolerance()

float SoXtViewer::getAutoClipTolerance ( ) const
inline

Gets the auto clipping tolerance value.

Definition at line 865 of file SoXtViewer.h.

◆ getBottomRight()

virtual const SbVec2s & SoXtViewer::getBottomRight ( )
virtual

Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).

Returns "Bottom" in the first value of the vector and "Right" in the second value (reverse of the usual X,Y ordering).

Implements SoStereoViewer.

◆ getBufferingType()

SoXtViewer::BufferType SoXtViewer::getBufferingType ( )
inline

Gets the current buffering type in the main view.

Definition at line 524 of file SoXtViewer.h.

◆ getCamera()

SoCamera * SoXtViewer::getCamera ( )
inline

Gets the edited camera.

Definition at line 361 of file SoXtViewer.h.

◆ getCameraSceneGraph()

SoNode * SoXtViewer::getCameraSceneGraph ( )

Gets the sub-scene graph to be viewed.

See setCameraSceneGraph().

◆ getCameraType()

SoType SoXtViewer::getCameraType ( )
inline

Gets the camera type that will be created by the viewer if no cameras are found in the scene graph (see SoPerspectiveCamera and SoOrthographicCamera).

Definition at line 377 of file SoXtViewer.h.

◆ getCurrentDecimationPercentage()

float SoXtViewer::getCurrentDecimationPercentage ( )

Returns the Decimation Percentage the viewer used in its last render.

◆ getCursorStyle()

SoXtViewer::CursorStyle SoXtViewer::getCursorStyle ( )
inline

Returns the cursor style.

Definition at line 845 of file SoXtViewer.h.

◆ getDecimationStrategy()

SoXtViewer::DecimationStrategy SoXtViewer::getDecimationStrategy ( )
inline

Gets strategy to use to decide on decimation value.

Definition at line 711 of file SoXtViewer.h.

◆ getDepthValue()

SbBool SoXtViewer::getDepthValue ( int  x,
int  y,
float &  depth 
)
inline

Returns the depth value, scaled between 0.0 and 1.0, from the depth buffer at window coordinates x, y.

This is only valid after a traversal of the scene graph e.g., in a post render callback (see setPostRenderCallback()).

Definition at line 946 of file SoXtViewer.h.

◆ getDrawStyle()

SoXtViewer::DrawStyle SoXtViewer::getDrawStyle ( SoXtViewer::DrawType  type)

Queries the current drawing style in the main view.

◆ getFixedPercentage()

float SoXtViewer::getFixedPercentage ( )
inline

Gets fixed percentage for the viewer to render (0.0 to 1.0)

Definition at line 754 of file SoXtViewer.h.

◆ getGoalFramesPerSecond()

float SoXtViewer::getGoalFramesPerSecond ( )
inline

Gets goal frames per second for the viewer to try to render.

Definition at line 740 of file SoXtViewer.h.

◆ getGoalNumberOfTriangles()

int32_t SoXtViewer::getGoalNumberOfTriangles ( )
inline

Gets goal number of triangles for the viewer to try to render.

Definition at line 726 of file SoXtViewer.h.

◆ getHeadlight()

SoDirectionalLight * SoXtViewer::getHeadlight ( )
inline

Returns the headlight node.

Definition at line 458 of file SoXtViewer.h.

◆ getNumSamples()

int SoXtViewer::getNumSamples ( )
inline

Gets how many frames should be timed before frames per second callback is called.

Definition at line 791 of file SoXtViewer.h.

◆ getPickRadius()

float SoXtViewer::getPickRadius ( ) const

Returns the current pick radius for picking and seeking actions.

◆ getSceneGraph()

virtual SoNode * SoXtViewer::getSceneGraph ( )
virtual

Gets the scene graph to render.

Reimplemented from SoXtRenderArea.

◆ getSceneRoot()

SoSeparator * SoXtViewer::getSceneRoot ( )
inline

Definition at line 849 of file SoXtViewer.h.

◆ getSeekTime()

float SoXtViewer::getSeekTime ( )
inline

Queries the seek time.

Definition at line 637 of file SoXtViewer.h.

◆ getSize()

virtual const SbVec2s & SoXtViewer::getSize ( )
virtual

Returns the size of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system.

Implements SoStereoViewer.

◆ getStereoBalance()

virtual float SoXtViewer::getStereoBalance ( )
virtual

Queries the stereo balance (the position of the zero parallax plane).

Implements SoStereoViewer.

◆ getStereoOffset()

float SoXtViewer::getStereoOffset ( )
virtual

Returns the stereo offset.

See setStereoViewing() for additional info.

Implements SoStereoViewer.

◆ getStereoViewType()

SoBaseStereo * SoXtViewer::getStereoViewType ( )
virtual

Returns the stereo view type.

Implements SoStereoViewer.

◆ getTopLeft()

virtual const SbVec2s & SoXtViewer::getTopLeft ( )
virtual

Returns the position of the OpenGL drawing window in absolute screen coordinates (not relative to parent window) of the native window system (typically Y increasing downward).

Returns "Top" in the first value of the vector and "Left" in the second value (reverse of the usual X,Y ordering).

Implements SoStereoViewer.

◆ getViewerCamera()

virtual SoCamera * SoXtViewer::getViewerCamera ( )
virtual

Returning the camera allows the SoBaseStereo to manipulate it to achieve the stereo effect.

Implements SoStereoViewer.

◆ getViewport()

void SoXtViewer::getViewport ( short &  left,
short &  bottom,
short &  width,
short &  height 
)
virtual

Returns viewport region with origin (lower-left corner) and size, given as pixel coordinates.

Implements SoStereoViewer.

◆ isAutoClipping()

SbBool SoXtViewer::isAutoClipping ( ) const
inline

Queries if auto clipping is ON.

Definition at line 579 of file SoXtViewer.h.

◆ isCameraHeightAnglePreserved()

virtual SbBool SoXtViewer::isCameraHeightAnglePreserved ( ) const
inlinevirtual

Query whether the SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrthographicCamera and then toggled back to an SoPerspectiveCamera.

Definition at line 392 of file SoXtViewer.h.

◆ isCursorEnabled()

SbBool SoXtViewer::isCursorEnabled ( ) const
inline

Queries whether the viewer is allowed to change the cursor over the renderArea window.

Definition at line 562 of file SoXtViewer.h.

◆ isDetailSeek()

SbBool SoXtViewer::isDetailSeek ( )
inline

Queries whether the viewer is in seek mode.

Definition at line 618 of file SoXtViewer.h.

◆ isFullRenderingWhenStill()

SbBool SoXtViewer::isFullRenderingWhenStill ( )
inline

Queries if the viewer will render at full resolution when it sits still for a certain period of time.

Definition at line 770 of file SoXtViewer.h.

◆ isHeadlight()

SbBool SoXtViewer::isHeadlight ( )
inline

Queries if the headlight is on.

Definition at line 453 of file SoXtViewer.h.

◆ isSeekWithOrthoEnabled()

virtual SbBool SoXtViewer::isSeekWithOrthoEnabled ( ) const
inlinevirtual

Query whether the seek functionality is enabled for an SoOrthographicCamera.

Definition at line 404 of file SoXtViewer.h.

◆ isStereoAbsoluteAdjustments()

virtual SbBool SoXtViewer::isStereoAbsoluteAdjustments ( ) const
inlinevirtual

Queries if the stereo adjustments are absolute.

Not virtual pure for compatibity reasons.

Reimplemented from SoStereoViewer.

Definition at line 816 of file SoXtViewer.h.

◆ isStereoActive()

virtual SbBool SoXtViewer::isStereoActive ( )
virtual

Queries stereo activation.

Implements SoStereoViewer.

◆ isStereoBalanceNearFrac()

virtual SbBool SoXtViewer::isStereoBalanceNearFrac ( )
virtual

Returns TRUE when the stereo balance adjustement is defined as a fraction of the camera near distance.

Implements SoStereoViewer.

◆ isStereoViewing()

virtual SbBool SoXtViewer::isStereoViewing ( )
virtual

Queries if stereo viewing is on or off on the viewer.

See setStereoViewing() for additional info.

◆ isStereoViewReversed()

SbBool SoXtViewer::isStereoViewReversed ( )
virtual

Queries reversal of the left and right views.

Implements SoStereoViewer.

◆ isStillNow()

SbBool SoXtViewer::isStillNow ( )
inline

Returns whether the viewer is currently still.

Definition at line 775 of file SoXtViewer.h.

◆ isViewerDoubleBuffer()

virtual SbBool SoXtViewer::isViewerDoubleBuffer ( )
virtual

Queries if viewer is double buffered.

Implements SoStereoViewer.

◆ isViewing()

SbBool SoXtViewer::isViewing ( ) const
inline

Queries whether the viewer is turned on or off.

See setViewing() for details.

Definition at line 544 of file SoXtViewer.h.

◆ pasteView()

void SoXtViewer::pasteView ( Time  eventTime)

Pastes the view.

eventTime should be the time of the X event which initiated the paste (e.g. if paste is initiated from a keystroke, eventTime should be the time in the key down message.)

◆ recomputeSceneSize()

virtual void SoXtViewer::recomputeSceneSize ( )
virtual

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 setSceneGraph() is called.

Reimplemented in SoXtConstrainedViewer.

◆ removeFinishCallback()

void SoXtViewer::removeFinishCallback ( SoXtViewerCB f,
void *  userData = NULL 
)
inline

Removes finish callback routine from the viewer.

Note: The viewer "this" pointer is passed as callback data.

Definition at line 674 of file SoXtViewer.h.

◆ removeStartCallback()

void SoXtViewer::removeStartCallback ( SoXtViewerCB f,
void *  userData = NULL 
)
inline

Removes start callback routine from the viewer.

Note: The viewer "this" pointer is passed as callback data.

Definition at line 666 of file SoXtViewer.h.

◆ resetToHomePosition()

virtual void SoXtViewer::resetToHomePosition ( )
virtual

Restores the camera values.

Reimplemented in SoXtConstrainedViewer, SoXtExaminerViewer, and SoXtFlyViewer.

◆ reverseStereoView()

void SoXtViewer::reverseStereoView ( SbBool  reverse)
virtual

Sets reversal of the left and right views.

Implements SoStereoViewer.

◆ saveHomePosition()

virtual void SoXtViewer::saveHomePosition ( )
virtual

Saves the camera values.

Reimplemented in SoXtConstrainedViewer.

◆ setAutoClipping()

void SoXtViewer::setAutoClipping ( SbBool  onOrOff)

Sets 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). Default is ON.

The default value can be set using the environment variable OIV_AUTO_CLIPPING (0 = FALSE, 1 = TRUE).

◆ setAutoClipTolerance()

void SoXtViewer::setAutoClipTolerance ( float  tolerance)
inline

Sets the auto clipping tolerance value.

Auto clipping normally sets the near and far clip planes based on the scene's bounding box. If the camera is inside the scene bounding box, the near plane is moved in front of the camera using tolerance *bbox size. The default is 0.001.

The default value can be set using the environment variable OIV_AUTO_CLIP_TOLERANCE.

Definition at line 860 of file SoXtViewer.h.

◆ setBufferingType()

virtual void SoXtViewer::setBufferingType ( SoXtViewer::BufferType  type)
virtual

Sets the current buffering type in the main view (default SoXtViewer::BUFFER_DOUBLE).

Reimplemented in SoXtFullViewer.

◆ setCamera()

virtual void SoXtViewer::setCamera ( SoCamera cam)
virtual

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

Reimplemented in SoXtExaminerViewer, SoXtFlyViewer, SoXtFullViewer, SoXtPlaneViewer, SoXtWalkViewer, and SoXtConstrainedViewer.

◆ setCameraSceneGraph()

virtual void SoXtViewer::setCameraSceneGraph ( SoNode cameraSceneGraph)
virtual

Sets the sub-scene graph to be used for viewAll computation.


If this sub-scene graph contains a camera, this camera will be used as the viewer camera. Otherwise the first camera of the scene graph will be used. If no camera is found, the viewer will create its own above the root.

When viewAll computes the bounding box that will be used for determining where to position the camera, it will base its computation on this sub-scene graph rather than on the entire scene graph.

It is useful to specify a sub-scene graph when, for instance, you are using a second camera in the scene, followed by annotation. With this method you can exclude the annotation from the viewAll bounding box computation. Note that since Open Inventor 8.0 you can also exclude portions of the scene graph from the bounding box computation using an SoBBox node.

This method can also be useful when using PoView/PoSceneView. As the viewer uses the first camera it finds, it could find the camera of a PoView/PoSceneView. The bounding box would be computed based on the sub-scene graph owned by this PoView/PoSceneView. Thus the global bounding box of the whole scene would be wrong, causing some clipping problems when viewing.

◆ setCameraType()

virtual void SoXtViewer::setCameraType ( SoType  type)
virtual

Sets 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 cameras are found.

Note: The set method will only take effect the next time a scene graph is specified (and if no cameras are found).

Reimplemented in SoXtFlyViewer, and SoXtWalkViewer.

◆ setCameraTypeChangeCallback()

void SoXtViewer::setCameraTypeChangeCallback ( SoXtViewerCameraTypeChangeCB callback,
void *  userdata 
)

Defines a callback which is called each time the camera type has changed (change from SoPerspectiveCamera to SoOrthographicCamera or vice versa).

◆ setCursorEnabled()

virtual void SoXtViewer::setCursorEnabled ( SbBool  onOrOff)
virtual

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

Reimplemented in SoXtExaminerViewer, SoXtFlyViewer, SoXtPlaneViewer, and SoXtWalkViewer.

◆ setCursorStyle()

virtual void SoXtViewer::setCursorStyle ( SoXtViewer::CursorStyle  style)
virtual

Sets the cursor style.

The standard Open Inventor (CLASSIC) cursors use all white pixels, which can be difficult to see over light colored geometry or background. The XOR and SHADOW style cursors are much easier to see. The XOR style cursors that have a "hand" shape differ from the other styles in that the cursor hotspot is at the tip of the index finger. This generally works better for picking.

The cursor can also be specified using environment variable OIV_CURSOR_STYLE, where the values 0, 1, and 2 specify Classic, XOR, and Shadow cursors respectively.

Note: This method only has an effect if setCursorEnabled is set to TRUE.

◆ setDecimationPercentageCallback()

void SoXtViewer::setDecimationPercentageCallback ( SoXtViewerDecimationPercentageCB callback,
void *  userData = NULL 
)

Registers decimation percentage callback.

◆ setDecimationStrategy()

void SoXtViewer::setDecimationStrategy ( SoXtViewer::DecimationStrategy  strategy)

Sets strategy to use to decide on decimation value.

Default is normal.
Valid values are NORMAL, FIXED_NUM_TRIANGLES, FRAMES_PER_SECOND, FIXED_PERCENTAGE.

◆ setDetailSeek()

void SoXtViewer::setDetailSeek ( SbBool  onOrOff)
inline

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.

Definition at line 613 of file SoXtViewer.h.

◆ setDrawStyle()

virtual void SoXtViewer::setDrawStyle ( SoXtViewer::DrawType  type,
SoXtViewer::DrawStyle  style 
)
virtual

Sets 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. Default is VIEW_AS_IS draw style for STILL and VIEW_SAME_AS_STILL for INTERACTIVE.

The default value can be set using the environment variables OIV_STILL_DRAW_STYLE and OIV_INTERACTIVE_DRAW_STYLE. Valid values are VIEW_AS_IS, VIEW_HIDDEN_LINE, VIEW_NO_TEXTURE, VIEW_LOW_COMPLEXITY, VIEW_LINE, VIEW_POINT, VIEW_BBOX, VIEW_LOW_RES_LINE, VIEW_LOW_RES_POINT for OIV_STILL_DRAW_STYLE and the same plus VIEW_SAME_AS_STILL for OIV_INTERACTIVE_DRAW_STYLE.

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

VIEW_NO_TEXTURE - Renders the objects without any textures. This is done by setting the override flag on an empty SoTexture2 node.

VIEW_LOW_COMPLEXITY - Renders the objects without any textures and with a low complexity. This is done by setting the override flag on an empty SoTexture2 node, and by setting a low complexity value on an SoComplexity node with override set to TRUE.

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

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.

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

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.

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.

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.

Reimplemented in SoXtFullViewer.

◆ setFixedPercentage()

void SoXtViewer::setFixedPercentage ( float  percent)

Sets fixed percentage for the viewer to render (0.0 to 1.0) Default is 1.0.



The default value can be set using the environment variable OIV_DECIMATION_PERCENTAGE (0.0 to 1.0).

◆ setFramesPerSecondCallback()

void SoXtViewer::setFramesPerSecondCallback ( SoXtViewerFPSCB callback,
void *  userData = NULL 
)

Registers frames per second callback.

◆ setGoalFramesPerSecond()

void SoXtViewer::setGoalFramesPerSecond ( float  goal)

Sets goal frames per second for the viewer to try to render.

Default is 8.0.

The default value can be set using the environment variable OIV_DECIMATION_GOAL_FPS.

◆ setGoalNumberOfTriangles()

void SoXtViewer::setGoalNumberOfTriangles ( int32_t  goal)

Sets goal number of triangles for the viewer to try to render.

Default is 10000.

The default value can be set using the environment variable OIV_DECIMATION_GOAL_NUM_OF_TRIANGLES.

◆ setHeadlight()

virtual void SoXtViewer::setHeadlight ( SbBool  onOrOff)
virtual

Turns the headlight on/off (default on).



The default value can be set using the environment variable OIV_USE_HEADLIGHT (0 = FALSE, 1 = TRUE).

Reimplemented in SoXtFullViewer.

◆ setNumSamples()

void SoXtViewer::setNumSamples ( int  numFrames)

Sets how many frames should be timed before frames per second callback is called, default is 10.

◆ setPickRadius()

void SoXtViewer::setPickRadius ( float  radius)

Sets the pick radius, in pixels, used by the viewer for picking and seeking actions.

Effectively calls setRadius on the viewer's internal SoRayPickAction. The default is the SoRayPickAction default (5 pixels).

Specifying a radius of 0 may give better performance. In particular, some shapes like MoMeshSkin implement a fast GPU picking algorithm that can only be used when radius is 0.

◆ setPreserveCameraHeightAngle()

virtual void SoXtViewer::setPreserveCameraHeightAngle ( SbBool  flag)
inlinevirtual

If TRUE, an SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrthographicCamera and then toggled back to an SoPerspectiveCamera.

Default is FALSE.

Definition at line 384 of file SoXtViewer.h.

◆ setSceneGraph()

virtual void SoXtViewer::setSceneGraph ( SoNode newScene)
virtual

Sets the scene graph to render.

Whenever a new scene is supplied the first camera encountered will be by default used as the edited camera, else a new camera will be created. If the scene graph does not contain any light nodes, the viewer inserts a headlight (directional light which is made to follow the camera) immediately after the camera. See the main description of this class for further details.

Reimplemented from SoXtRenderArea.

◆ setSeekMode()

virtual void SoXtViewer::setSeekMode ( SbBool  onOrOff)
virtual

Externally set the viewer into/out off seek mode (default OFF).

Actual seeking will not happen until the viewer decides to (ex: mouse click).

Note: setting the viewer out of seek mode while the camera is being animated will stop the animation to the current location.

Reimplemented in SoXtExaminerViewer, SoXtFlyViewer, SoXtPlaneViewer, and SoXtWalkViewer.

◆ setSeekTime()

void SoXtViewer::setSeekTime ( float  seconds)
inline

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

For historical reasons, setting the seek time to zero causes the viewer to stay in seek mode. If you want the camera to move immediately to its new position and still have the viewer leave seek mode after moving the camera, set the seek time to a very small non-zero value.

The default value can be set using the environment variable OIV_SEEK_TIME.

Definition at line 632 of file SoXtViewer.h.

◆ setStereoAbsoluteAdjustments()

virtual void SoXtViewer::setStereoAbsoluteAdjustments ( SbBool  )
virtual

Specifies if stereo adjustments are absolute.

FALSE by default.

The default non-absolute mode allows the stereo settings to be valid over a range of different view volume settings. If you chose absolute mode, you are responsible for modifying the stereo settings (if necessary) when the view volume changes.

When absolute mode is TRUE, stereo offset and balance are used as follows for the right eye view:

StereoCameraOffset = getStereoAdjustment();
FrustumAsymmetry = getBalanceAdjustment();
glTranslated (-StereoCameraOffset, 0, 0);
glFrustum (FrustumLeft + FrustumAsymmetry, FrustumRight + FrustumAsymmetry,
FrustumBottom, FrustumTop, NearClipDistance, FarClipDistance);

The left eye view is symmetric.

When absolute mode is FALSE, stereo offset and balance are used as follows for the right eye view:

Xrange is right minus left (i.e., first two arguments of glFrustum) and multiply that difference by the ratio of the distance to the desired plane of zero parallax to the near clipping plane distance.

StereoCameraOffset = Xrange * 0.035 * getStereoAdjustment();
FrustumAsymmetry = -StereoCameraOffset * getBalanceAdjustment();
ZeroParallaxDistance = (NearClipDistance + FarClipDistance)/0.5;
FrustumAsymmetry *= NearClipDistance / ZeroParallaxDistance;
glTranslated (-StereoCameraOffset, 0, 0);
glFrustum (FrustumLeft + FrustumAsymmetry, FrustumRight + FrustumAsymmetry,
FrustumBottom, FrustumTop, NearClipDistance, FarClipDistance);

The left eye view is symmetric.

Not virtual pure for compatiblity reasons.

Reimplemented from SoStereoViewer.

◆ setStereoActive()

virtual void SoXtViewer::setStereoActive ( SbBool  activate)
virtual

Sets stereo activation.

Default is FALSE. The default can be set using the OIV_STEREO_ACTIVE environment variable.

Implements SoStereoViewer.

◆ setStereoBalance()

virtual void SoXtViewer::setStereoBalance ( float  balance,
SbBool  nearFrac 
)
virtual

Sets the stereo balance (the position of the zero parallax plane) and specifies whether the balance value is defined as a fraction of the camera near distance.

Note: Since the projection matrix always depends on the camera's near plane, in some cases it may be necessary to detect changes to the camera near plane and adjust by setting a new stereo balance value. Open Inventor will make these adjustments automatically if the nearFrac parameter is set to TRUE.
In this case the stereo balance value is defined as a fraction of the camera near distance.

Default balance is 1.0. The default can be set using the OIV_STEREO_BALANCE environment variable. Default nearFrac is FALSE. The default can be set using the OIV_STEREO_BALANCE_NEAR_FRAC environment variable.

Implements SoStereoViewer.

◆ setStereoOffset()

void SoXtViewer::setStereoOffset ( float  dist)
virtual

Sets the stereo offset.

See setStereoViewing() for additional info.

Implements SoStereoViewer.

◆ setStereoViewing()

virtual void SoXtViewer::setStereoViewing ( SbBool  onOrOff)
virtual

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. Stereo viewing is only possible with a graphics board that has support for stereo.

◆ setStereoViewType()

void SoXtViewer::setStereoViewType ( SoBaseStereo stereoViewType)
virtual

If stereoViewType is NULL, the stereo is inactivated (see setStereoActive).

Default is SoAnaglyphStereo with RED_CYAN color filter. The default can be set using the OIV_STEREO_TYPE environment variable.

Implements SoStereoViewer.

◆ setViewing()

virtual void SoXtViewer::setViewing ( SbBool  onOrOff)
virtual

Sets 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 message, 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).

Reimplemented in SoXtExaminerViewer, SoXtFlyViewer, SoXtFullViewer, SoXtPlaneViewer, and SoXtWalkViewer.

◆ setViewport()

void SoXtViewer::setViewport ( short  left,
short  bottom,
short  width,
short  height 
)
virtual

Sets viewport region with given origin (lower-left corner) and size, given as pixel coordinates.

Implements SoStereoViewer.

◆ toggleCameraType()

virtual void SoXtViewer::toggleCameraType ( )
virtual

This routine will toggle the current camera from perspective to orthographic, and from orthographic back to perspective.


Note: It is not actually possible to "toggle" the type of a camera. In fact the current camera will be replaced by a new camera of the appropriate type. Of course the current camera node will be destroyed in the process unless it has been ref'd elsewhere.

◆ viewAll()

virtual void SoXtViewer::viewAll ( )
virtual

Changes the camera position to view the entire scene (the camera zoom or orientation isn't changed).

The viewer applies an SoGetBoundingBoxAction to the scene graph to get the bounding box of the entire scene. The bounding box will only include shapes that are actually traversed. For example the bounding box will not include shapes under an SoSwitch with whichChild set to SO_SWITCH_NONE. The action does not consider the visibility of shapes that are traversed. In other words the bounding box will include shapes that are invisible (SoDrawStyle), shapes that are clipped (SoClipPlane), etc. Use an SoBBox node to exclude shapes from the bounding box computation. Bounding boxes are automatically cached at SoSeparator nodes, so getting the bounding box is very fast when the scene graph has not been changed.

See all SoCamera::viewAll(). This method allows the application to adjust the camera based on a specific sub-graph or path in the scene graph.

Reimplemented in SoXtExaminerViewer.


The documentation for this class was generated from the following file: