SoWinViewer Class Reference
[Win]

VSG extension Viewer component lowest base class. More...

#include <Inventor/Win/viewers/SoWinViewer.h>

Inheritance diagram for SoWinViewer:
SoWinRenderArea SoStereoViewer SoWinGLWidget SoWinComponent SoWinFullViewer SoWinConstrainedViewer SoWinExaminerViewer SoWinPlaneViewer SoWinFlyViewer SoWinWalkViewer

List of all members.

Public Types

enum  Type {
  BROWSER,
  EDITOR
}
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
}
enum  DrawType {
  STILL,
  INTERACTIVE
}
enum  BufferType {
  BUFFER_SINGLE,
  BUFFER_DOUBLE,
  BUFFER_INTERACTIVE
}
enum  DecimationStrategy {
  NORMAL,
  FIXED_NUM_TRIANGLES,
  FRAMES_PER_SECOND,
  FIXED_PERCENTAGE
}
enum  CursorStyle {
  CLASSIC,
  XOR,
  SHADOW
}

Public Member Functions

virtual void setSceneGraph (SoNode *newScene)
virtual SoNodegetSceneGraph ()
virtual void setCamera (SoCamera *cam)
SoCameragetCamera ()
virtual void setCameraType (SoType type)
SoType getCameraType ()
virtual void setPreserveCameraHeightAngle (SbBool flag)
virtual SbBool isCameraHeightAnglePreserved () const
virtual void enableSeekWithOrtho (SbBool flag)
virtual SbBool isSeekWithOrthoEnabled () const
virtual void viewAll ()
virtual void saveHomePosition ()
virtual void resetToHomePosition ()
void setCameraTypeChangeCallback (SoWinViewerCameraTypeChangeCB *callback, void *userdata)
void setHeadlight (SbBool onOrOff)
SbBool isHeadlight ()
SoDirectionalLightgetHeadlight ()
void setDrawStyle (SoWinViewer::DrawType type, SoWinViewer::DrawStyle style)
SoWinViewer::DrawStyle getDrawStyle (SoWinViewer::DrawType type)
void setBufferingType (SoWinViewer::BufferType type)
SoWinViewer::BufferType getBufferingType ()
virtual void setDoubleBuffer (SbBool onOrOff)
virtual void setViewing (SbBool onOrOff)
virtual void enableDirectViz (SbBool onOrOff)
virtual void showDirectVizDialog (SbBool show)
SbBool isViewing () const
SbBool isDirectVizEnabled () const
virtual void setSeekMode (SbBool onOrOff)
SbBool isSeekMode ()
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 (SoWinViewerCB *f, void *userData=NULL)
void addFinishCallback (SoWinViewerCB *f, void *userData=NULL)
void removeStartCallback (SoWinViewerCB *f, void *userData=NULL)
void removeFinishCallback (SoWinViewerCB *f, void *userData=NULL)
void copyView (Time eventTime)
void pasteView (Time eventTime)
virtual void setNormalVisual (XVisualInfo *i)
virtual void recomputeSceneSize ()
void setDecimationStrategy (SoWinViewer::DecimationStrategy strategy)
SoWinViewer::DecimationStrategy getDecimationStrategy ()
void setGoalNumberOfTriangles (int32_t goal)
int32_t getGoalNumberOfTriangles ()
void setGoalFramesPerSecond (float goal)
float getGoalFramesPerSecond ()
void setFixedPercentage (float percent)
float getFixedPercentage ()
void enableFullRenderingWhenStill (SbBool onOff)
SbBool isFullRenderingWhenStill ()
SbBool isStillNow ()
void setFramesPerSecondCallback (SoWinViewerFPSCB *callback, void *userData=NULL)
void setNumSamples (int numFrames)
int getNumSamples ()
void setDecimationPercentageCallback (SoWinViewerDecimationPercentageCB *callback, void *userData=NULL)
float getCurrentDecimationPercentage ()
void enableMouseWheelDolly (SbBool onOff)
void setPickRadius (float radius)
float getPickRadius () const
virtual SoCameragetViewerCamera ()
virtual SbBool isViewerDoubleBuffer ()
virtual void actualRendering ()
virtual const SbVec2sgetSize ()
virtual const SbVec2sgetTopLeft ()
virtual const SbVec2sgetBottomRight ()
void setStereoViewType (SoBaseStereo *stereo)
SoBaseStereogetStereoViewType ()
void reverseStereoView (SbBool reverse)
SbBool isStereoViewReversed ()
virtual void setStereoAbsoluteAdjustments (SbBool absolute)
virtual SbBool isStereoAbsoluteAdjustments () const
virtual void setStereoBalance (float balance, SbBool nearFrac=false)
virtual float getStereoBalance ()
virtual SbBool isStereoBalanceNearFrac ()
virtual void setStereoActive (SbBool activate)
virtual SbBool isStereoActive ()
void setViewport (short left, short bottom, short width, short height)
void getViewport (short &left, short &bottom, short &width, short &height)
virtual void setCursorStyle (SoWinViewer::CursorStyle style)
SoWinViewer::CursorStyle getCursorStyle ()
void setAutoClipTolerance (float tolerance)
float getAutoClipTolerance () const
virtual void setCameraSceneGraph (SoNode *cameraSceneGraph)
SoNodegetCameraSceneGraph ()
virtual void toggleCameraType ()
SbBool getDepthValue (int x, int y, float &depth)

Deprecated



SoDEPRECATED HDC getCurrentDC ()
virtual SoDEPRECATED void adjustClippingPlanes ()

Detailed Description

VSG extension Viewer component lowest base class.

This is the lowest base class for viewer components. This class adds the notion of a camera to the SoWinRenderArea 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. The viewer will use the first SoVRMLViewpoint encountered (if any) to define the parameters of the created camera. If the viewer type is SoWinViewer::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 SoWinViewer::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 message processing. When the application registers a message processing callback by calling setEventCallback() the viewer will invoke this callback for every Windows message it receives. However, unlike the render area, the viewer ignores the return value of this callback, and processes the message 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 SoLODs 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

SoWinComponent, SoWinRenderArea, SoWinExaminerViewer, SoWinWalkViewer, SoWinFlyViewer, SoWinPlaneViewer


Member Enumeration Documentation

list of different buffering types

Enumerator:
BUFFER_SINGLE 

Single buffer.

BUFFER_DOUBLE 

Double buffer.

BUFFER_INTERACTIVE 

Double buffer while interactive viewing.

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

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.

list of possible drawing styles

Note: Refer to the SoWinViewer 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.

DrawType.

Enumerator:
STILL 

Applies to static rendering.

INTERACTIVE 

Applies to rendering while interactive viewing.

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.


Member Function Documentation

virtual void SoWinViewer::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.

void SoWinViewer::addFinishCallback ( SoWinViewerCB f,
void *  userData = NULL 
) [inline]

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

void SoWinViewer::addStartCallback ( SoWinViewerCB 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.

virtual SoDEPRECATED void SoWinViewer::adjustClippingPlanes (  )  [virtual]

Along with the manipulation of the camera, SoBaseStereo needs to set the scene appropriately when changing the camera settings.

Deprecated:

Deprecated since Open Inventor 9000
No longer used.

Implements SoStereoViewer.

void SoWinViewer::copyView ( Time  eventTime  ) 

Copies the view.

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

virtual void SoWinViewer::enableDirectViz ( SbBool  onOrOff  )  [virtual]

Enable or disable DirectViz viewing.

void SoWinViewer::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).

void SoWinViewer::enableMouseWheelDolly ( SbBool  onOff  )  [inline]

Enable/disable moving the camera with the mouse wheel, TRUE by default.

virtual void SoWinViewer::enableSeekWithOrtho ( SbBool  flag  )  [inline, virtual]

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

Default is TRUE.

float SoWinViewer::getAutoClipTolerance (  )  const [inline]

Returns the auto clipping tolerance value.

virtual const SbVec2s& SoWinViewer::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). This is important, for example, for interlaced auto-stereo displays that need the left or right eye view specifically on even or odd pixel row/column.

Implements SoStereoViewer.

SoWinViewer::BufferType SoWinViewer::getBufferingType (  )  [inline]

Gets the current buffering type in the main view.

SoCamera* SoWinViewer::getCamera (  )  [inline]

Gets the edited camera.

SoNode* SoWinViewer::getCameraSceneGraph (  ) 

Gets the sub-scene graph to be viewed.

See setCameraSceneGraph().

SoType SoWinViewer::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).

SoDEPRECATED HDC SoWinViewer::getCurrentDC (  )  [virtual]

Returns the current device context used by this viewer.

Deprecated:

Deprecated since Open Inventor 9000
No longer used.

Implements SoStereoViewer.

float SoWinViewer::getCurrentDecimationPercentage (  ) 

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

SoWinViewer::CursorStyle SoWinViewer::getCursorStyle (  )  [inline]

Returns the cursor style.

SoWinViewer::DecimationStrategy SoWinViewer::getDecimationStrategy (  )  [inline]

Gets strategy to use to decide on decimation value.

SbBool SoWinViewer::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()).

SoWinViewer::DrawStyle SoWinViewer::getDrawStyle ( SoWinViewer::DrawType  type  ) 

Queries the current drawing style in the main view.

float SoWinViewer::getFixedPercentage (  )  [inline]

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

float SoWinViewer::getGoalFramesPerSecond (  )  [inline]

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

int32_t SoWinViewer::getGoalNumberOfTriangles (  )  [inline]

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

SoDirectionalLight* SoWinViewer::getHeadlight (  )  [inline]

Returns the headlight node.

int SoWinViewer::getNumSamples (  )  [inline]

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

float SoWinViewer::getPickRadius (  )  const

Returns the current pick radius for picking and seeking actions.

virtual SoNode* SoWinViewer::getSceneGraph (  )  [virtual]

Gets the scene graph to be rendered in this component's window.

Reimplemented from SoWinRenderArea.

float SoWinViewer::getSeekTime (  )  [inline]

Queries the seek time.

virtual const SbVec2s& SoWinViewer::getSize (  )  [virtual]

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

Implements SoStereoViewer.

virtual float SoWinViewer::getStereoBalance (  )  [virtual]

Returns the current stereo balance.

Implements SoStereoViewer.

float SoWinViewer::getStereoOffset (  )  [virtual]

Returns the stereo offset.

See setStereoViewing() for additional info.

Implements SoStereoViewer.

SoBaseStereo* SoWinViewer::getStereoViewType (  )  [virtual]

Returns the current stereo implementation.

Implements SoStereoViewer.

virtual const SbVec2s& SoWinViewer::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). This is important, for example, for interlaced auto-stereo displays that need the left or right eye view specifically on even or odd pixel row/column.

Implements SoStereoViewer.

virtual SoCamera* SoWinViewer::getViewerCamera (  )  [virtual]

Returns the camera so SoBaseStereo can manipulate it to achieve the stereo effect.

Implements SoStereoViewer.

void SoWinViewer::getViewport ( short &  left,
short &  bottom,
short &  width,
short &  height 
) [virtual]

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

Implements SoStereoViewer.

SbBool SoWinViewer::isAutoClipping (  )  const [inline]

Queries if auto clipping is ON.

virtual SbBool SoWinViewer::isCameraHeightAnglePreserved (  )  const [inline, virtual]

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

SbBool SoWinViewer::isCursorEnabled (  )  const [inline]

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

SbBool SoWinViewer::isDetailSeek (  )  [inline]

Queries whether detail seek is on.

SbBool SoWinViewer::isDirectVizEnabled (  )  const [inline]

Queries whether the viewer is in DirectViz mode.

SbBool SoWinViewer::isFullRenderingWhenStill (  )  [inline]

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

SbBool SoWinViewer::isHeadlight (  )  [inline]

Queries if the headlight is on.

SbBool SoWinViewer::isSeekMode (  )  [inline]

Queries whether the seek mode is active.

See setSeekMode() for details.

virtual SbBool SoWinViewer::isSeekWithOrthoEnabled (  )  const [inline, virtual]

Query whether the seek functionality is enabled for an SoOrthographicCamera.

virtual SbBool SoWinViewer::isStereoAbsoluteAdjustments (  )  const [inline, virtual]

Returns TRUE if stereo absolute adjustments are enabled.

Reimplemented from SoStereoViewer.

virtual SbBool SoWinViewer::isStereoActive (  )  [virtual]

Returns TRUE if stereo is active.

Implements SoStereoViewer.

virtual SbBool SoWinViewer::isStereoBalanceNearFrac (  )  [virtual]

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

Implements SoStereoViewer.

virtual SbBool SoWinViewer::isStereoViewing (  )  [virtual]

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

See setStereoViewing() for additional info.

SbBool SoWinViewer::isStereoViewReversed (  )  [virtual]

Returns TRUE if the left and right eye views are reversed.

Implements SoStereoViewer.

SbBool SoWinViewer::isStillNow (  )  [inline]

Returns whether the viewer is currently still.

virtual SbBool SoWinViewer::isViewerDoubleBuffer (  )  [virtual]

Returns TRUE if viewer is double buffered.

Implements SoStereoViewer.

SbBool SoWinViewer::isViewing (  )  const [inline]

Queries whether the viewer is turned on or off.

See setViewing() for details.

void SoWinViewer::pasteView ( Time  eventTime  ) 

Pastes the view.

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

virtual void SoWinViewer::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 SoWinConstrainedViewer.

void SoWinViewer::removeFinishCallback ( SoWinViewerCB f,
void *  userData = NULL 
) [inline]

Removes finish callback routine from the viewer.

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

void SoWinViewer::removeStartCallback ( SoWinViewerCB f,
void *  userData = NULL 
) [inline]

Removes start callback routine from the viewer.

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

virtual void SoWinViewer::resetToHomePosition (  )  [virtual]

Restores the camera values.

Reimplemented in SoWinConstrainedViewer, SoWinExaminerViewer, and SoWinFlyViewer.

void SoWinViewer::reverseStereoView ( SbBool  reverse  )  [virtual]

If TRUE, reverse the left and right eye views.

Implements SoStereoViewer.

virtual void SoWinViewer::saveHomePosition (  )  [virtual]

Saves the camera values.

Reimplemented in SoWinConstrainedViewer.

void SoWinViewer::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.

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

void SoWinViewer::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.

void SoWinViewer::setBufferingType ( SoWinViewer::BufferType  type  ) 

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

Reimplemented in SoWinFullViewer.

virtual void SoWinViewer::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 SoWinConstrainedViewer, SoWinExaminerViewer, SoWinFlyViewer, SoWinFullViewer, SoWinPlaneViewer, and SoWinWalkViewer.

virtual void SoWinViewer::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.

virtual void SoWinViewer::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 SoWinFlyViewer, and SoWinWalkViewer.

void SoWinViewer::setCameraTypeChangeCallback ( SoWinViewerCameraTypeChangeCB 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 SoWinViewer::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 SoWinExaminerViewer, SoWinFlyViewer, SoWinPlaneViewer, and SoWinWalkViewer.

virtual void SoWinViewer::setCursorStyle ( SoWinViewer::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.

void SoWinViewer::setDecimationPercentageCallback ( SoWinViewerDecimationPercentageCB callback,
void *  userData = NULL 
)

Registers decimation percentage callback.

void SoWinViewer::setDecimationStrategy ( SoWinViewer::DecimationStrategy  strategy  ) 

Sets strategy to use to decide on decimation value.

Default is normal.

The default value can be set using the environment variable OIV_DECIMATION_STRATEGY. Valid values are NORMAL, FIXED_NUM_TRIANGLES, FRAMES_PER_SECOND, FIXED_PERCENTAGE.

void SoWinViewer::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.

virtual void SoWinViewer::setDoubleBuffer ( SbBool  onOrOff  )  [virtual]

Routine that dynamically changes between single and double buffering.

Default is double buffer off. (The SoWinRenderArea subclass makes it double buffer by default.)

Reimplemented from SoWinRenderArea.

void SoWinViewer::setDrawStyle ( SoWinViewer::DrawType  type,
SoWinViewer::DrawStyle  style 
)

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

void SoWinViewer::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).

void SoWinViewer::setFramesPerSecondCallback ( SoWinViewerFPSCB callback,
void *  userData = NULL 
)

Registers frames per second callback.

void SoWinViewer::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.

void SoWinViewer::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.

void SoWinViewer::setHeadlight ( SbBool  onOrOff  ) 

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

virtual void SoWinViewer::setNormalVisual ( XVisualInfo *  vis  )  [virtual]

Specifies the exact pixel format descriptor for the normal window.

This allows the user to create all possible pixel format descriptors supported by OpenGL. The PIXELFORMATDESCRIPTOR structure should be a valid OpenGL pixel format descriptor returned by ChoosePixelFormat(). (The methods for setting the pixel format descriptor are virtual so that derived classes can know when the pixel format descriptor is changing.)

Reimplemented from SoWinGLWidget.

void SoWinViewer::setNumSamples ( int  numFrames  ) 

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

void SoWinViewer::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 and SoIndexedFaceSet implement a fast GPU picking algorithm that can only be used when radius is 0.

virtual void SoWinViewer::setPreserveCameraHeightAngle ( SbBool  flag  )  [inline, virtual]

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.

virtual void SoWinViewer::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 SoWinRenderArea.

virtual void SoWinViewer::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 SoWinExaminerViewer, SoWinFlyViewer, SoWinPlaneViewer, and SoWinWalkViewer.

void SoWinViewer::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.

virtual void SoWinViewer::setStereoAbsoluteAdjustments ( SbBool  absolute  )  [virtual]

If TRUE, use stereo absolute adjustments.

Reimplemented from SoStereoViewer.

virtual void SoWinViewer::setStereoActive ( SbBool  activate  )  [virtual]

If TRUE, stero is activated.

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

Implements SoStereoViewer.

virtual void SoWinViewer::setStereoBalance ( float  balance,
SbBool  nearFrac = false 
) [virtual]

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

Default is 1.0. The default can be set using the OIV_STEREO_BALANCE environment variable.

Implements SoStereoViewer.

void SoWinViewer::setStereoOffset ( float  dist  )  [virtual]

Sets the stereo offset.

See setStereoViewing() for additional info.

Implements SoStereoViewer.

virtual void SoWinViewer::setStereoViewing ( SbBool  onOrOff  )  [virtual]

Turns stereo viewing on/off on the viewer (default off).

To insure backward compatibility with older Open Inventor versions, and specifically with the old stereo model, this method still applies to stereo. Like the current stereo model, the old model makes use of an offset to represent the eye separation. However, instead of adapting the view volume, the cameras were rotated toward the default point of focus, creating the stereo viewing angle.

If no type of stereo (from the current stereo model) is set on the viewer and setStereoViewing() is called, then the old stereo model is in effect. Note that setStereoViewing is the method that actually sets OpenGL in stereo mode. If the old stereo model is in effect, then the offset passed to setStereoOffset() is no longer a factor but the actual value used to separate the cameras. In that case, the default value for the offset is 3.

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 may be needed to see the effect. Old style stereo viewing is only possible with a graphics board that has support for stereo.

See SoStereoViewer for information on the current stereo model.

void SoWinViewer::setStereoViewType ( SoBaseStereo stereo  )  [virtual]

Set an implementation of stereo viewing to use.


If stereo is NULL, 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.

virtual void SoWinViewer::setViewing ( SbBool  onOrOff  )  [virtual]

Sets whether the viewer is turned on or off.

When turned on, messages are consumed by the viewer. When viewing is off, messages are processed by the viewer's render area. This means messages will be sent down to the scene graph for processing (i.e. picking can occur). Note that if the application has registered a message 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 message or not) is ignored when viewing is on. That is, the viewer will process the message even if the callback already did. This is to ensure that the viewing paradigm is not broken (default viewing is on).

Reimplemented in SoWinExaminerViewer, SoWinFlyViewer, SoWinFullViewer, SoWinPlaneViewer, and SoWinWalkViewer.

void SoWinViewer::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.

virtual void SoWinViewer::showDirectVizDialog ( SbBool  show  )  [virtual]

Hide or show DirectViz control dialog.

virtual void SoWinViewer::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.

virtual void SoWinViewer::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 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 SoWinExaminerViewer.


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

Open Inventor Toolkit reference manual, generated on 12 Feb 2024
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/