Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoGuiAlgoViewers Class Reference

VSG extension Common algorithms for all viewers. More...

#include <Inventor/Gui/viewers/SoGuiAlgoViewers.h>

+ Inheritance diagram for SoGuiAlgoViewers:

Public Types

enum  ViewerTypes {
  EXAMINER ,
  PLANE ,
  FLY ,
  WALK ,
  UNKNOWN
}
 Viewer type flags. 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
}
 List of possible drawing types. More...
 
enum  BufferType {
  BUFFER_SINGLE ,
  BUFFER_DOUBLE ,
  BUFFER_INTERACTIVE
}
 List of different buffering types. More...
 
enum  ProjectorsType {
  SPHERICAL ,
  CYLINDRICAL
}
 List of possible projection modes for the virtual trackball. More...
 
enum  ZoomingType {
  AUTOCENTER ,
  GIVENPOSITION
}
 List of possible zooming modes. More...
 
enum  WalkViewerMode {
  WALK_MODE ,
  PAN_MODE
}
 Walk viewer mode flags. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoGuiAlgoViewers ()
 Constructor.
 
void setConstrained (SbBool constrained)
 Specifies whether algorithms for constrained viewers should be used.
 
SbBool isConstrained () const
 Returns TRUE if algorithms for constrained viewers are used.
 
void setViewerType (ViewerTypes vType)
 Sets the type of viewer used for the algorithms.
 
SoGuiAlgoViewers::ViewerTypes getViewerType () const
 Returns the current viewer type.
 
void resetRenderAction ()
 This method resets the render action cache.
 
void setSheetProjectionType (const ProjectorsType &projType)
 Specifies the sheet projection to use for rotations.
 
ProjectorsType getSheetProjectionType () const
 Returns the sheet projection used for rotations.
 
void setMouseAngularSpeed (double speedFactor)
 Specifies the factor used to scale the rotation speed while interactively rotating the camera.
 
double getMouseAngularSpeed ()
 Returns the factor used to scale the rotation speed while interactively rotating the camera.
 
void setZoomingType (const ZoomingType &zoomType)
 Specifies the zooming algorithm to use.
 
ZoomingType getZoomingType () const
 Returns the zooming algorithm.
 
virtual void setRotationTargetPosition (const SbVec3f &targetPos)
 Sets the camera target position for rotations.
 
virtual void resetRotationTargetPosition ()
 Reset target position to default rotation around "focal point".
 
virtual bool getRotationTargetPosition (SbVec3f &targetPos)
 Query the camera target position for rotations.
 
virtual void getDefaultRotationTargetPosition (SbVec3f &targetPos)
 Gets the default camera target position for rotations.
 
virtual void setSceneGraph (SoNode *newScene)
 Sets the scene graph to render.
 
virtual SoNodegetSceneGraph ()
 Returns the scene graph to render.
 
void enableShadows (bool onOrOff)
 Adds an SoShadowGroup after the headlight and enables it if true.
 
virtual void setCamera (SoCamera *newCamera)
 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 toggleCameraType ()
 This routine will toggle the current camera from perspective to orthographic, and from orthographic back to perspective.
 
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
 Queries whether the SoPerspectiveCamera's heightAngle is preserved if the camera is changed to an SoOrthographicCamera and then toggled back to an SoPerspectiveCamera.
 
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.
 
virtual void setHeadlight (SbBool insertFlag)
 Turns the headlight on/off (default on).
 
SbBool isHeadlight ()
 Returns TRUE if the headlight is on.
 
SoDirectionalLightgetHeadlight ()
 Returns the headlight node.
 
virtual void setDrawStyle (DrawType type, DrawStyle style)
 Sets the current drawing style in the main view.
 
DrawStyle getDrawStyle (DrawType type)
 Returns the current drawing style in the main view.
 
virtual void setBufferingType (BufferType type)
 Sets the current buffering type in the main view (default BUFFER_DOUBLE).
 
BufferType getBufferingType ()
 Returns the current buffering type in the main view.
 
virtual void setViewing (SbBool flag)
 Sets whether the viewer is turned on or off.
 
SbBool isViewing () const
 Returns TRUE if the viewer is in viewing mode.
 
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.
 
virtual void setSeekMode (SbBool onOrOff)
 Set the viewer into/out of seek mode (default OFF).
 
SbBool isSeekMode ()
 Returns TRUE if viewer is in seek mode.
 
virtual void adjustCameraClippingPlanes ()
 Auto clipping routine.
 
void setBoxSelectionMode (SbBool on)
 Sets box selection mode.
 
SbBool isBoxSelection () const
 Returns TRUE if box selection mode is enabled.
 
void setBoxDrawingMode (SbBool on)
 Sets box drawing mode.
 
SbBool isBoxDrawing () const
 Returns TRUE if box drawing mode is enabled.
 
void doBoxZoom (int x1, int y1, int x2, int y2)
 Zooms to the region delimited by the box.
 
virtual void rollCamera (const SbVec2s &newLocator)
 Rolls the camera based on cursor motion.
 
virtual void dollyCamera (const SbVec2s &newLocator)
 Moves the camera on the z axis based on cursor motion.
 
virtual void dollyCamera (float dist)
 Moves the camera forward by the given amount.
 
virtual void reverseDollyCamera (const SbVec2s &newLocator)
 Same as dollyCamera but reversed.
 
virtual void panCamera (const SbVec2f &newLocator)
 Pans the camera based on cursor motion.
 
void doCameraAnimation ()
 Does camera animation for constrained viewers.
 
virtual void rightWheelStart ()
 Initializes right thumb wheel.
 
virtual void bottomWheelStart ()
 Initializes bottom thumb wheel.
 
virtual void leftWheelStart ()
 Initializes left thumb wheel.
 
virtual void bottomWheelMotion (float newVal)
 Examiner and constrained viewers: Rotates the camera based on bottom wheel motion.
 
virtual void leftWheelMotion (float newVal)
 Examiner and constrained viewers: Rotates the camera based on left wheel motion.
 
virtual void rightWheelMotion (float newVal)
 Makes the camera to zoom based on right wheel motion.
 
virtual void mouseWheelMotion (float newVal)
 Makes the camera to zoom based on mouse wheel motion.
 
void activatePanning ()
 Updates camera position when panning is actived.
 
void setStartMousePositionLocator (const SbVec2s &mousePosition)
 Sets the mouse start position.
 
SbVec2s getStartMousePositionLocator () const
 Returns the mouse start position in pixels.
 
void setCurrentMousePositionLocator (const SbVec2s &mousePosition)
 Sets the current mouse position.
 
SbVec2s getCurrentMousePositionLocator () const
 Returns the current mouse position in pixels.
 
void setPreviousMousePositionLocator (const SbVec2s &mousePosition)
 Sets the previous mouse position.
 
SbVec2s getPreviousMousePositionLocator () const
 Returns the previous mouse position in pixels.
 
void setCameraPositionLocator (const SbVec3f &camPosition)
 Sets the camera position.
 
SbVec3f getCameraPositionLocator () const
 Returns the camera position.
 
void setCameraFocalPlane (const SbPlane &focalPlane)
 Sets the camera focal plane.
 
SbPlane getCameraFocalPlane () const
 Returns the camera focal position.
 
void interactiveCountInc ()
 Invokes the start viewing callbacks.
 
void interactiveCountDec ()
 Invokes the finish viewing callbacks.
 
void setPrevAnimTime (SbTime previous)
 Sets the previous animation time.
 
SbTime getPrevAnimTime () const
 Returns the previous animation time.
 
virtual void computeSeekFinalOrientation ()
 Keeps the same camera rotation when seeking.
 
virtual void setMPEGRecorder (SoMPEGRenderer *recorder)
 Sets the recorder used for MPEG encoding.
 
virtual SoMPEGRenderergetMPEGRecorder () const
 Returns the recorder used for MPEG encoding.
 
void viewX (bool reverse=false)
 Selects axial view.
 
void viewY (bool reverse=false)
 Selects frontal view.
 
void viewZ (bool reverse=false)
 Selects sagittal view.
 
SoNodegetSceneRoot ()
 Returns the scene root of the viewer (drawstyle, camera and headlight + user scene graph) or the user scene graph if there's no scene root.
 
virtual void spinCamera (const SbVec2f &newLocator)
 Spins the camera based on cursor motion.
 
virtual void spinConstrainedCamera (const SbVec2f &newLocator, int axisIndex)
 Spin the camera based on cursor motion but constrained to rotation around one axis.
 
void startSpinAnimation ()
 Starts the spin animation.
 
void stopSpinAnimation ()
 Stops the spin animation.
 
virtual void doSpinAnimation ()
 Rotate the camera for spin animation.
 
SbProjectorgetSheetProjector () const
 Returns the sheet projector.
 
SbSphereSheetProjectorgetSphereSheetProjector () const
 Returns the sphere sheet projector and NULL if the current projection is not spherical.
 
void activateSpinning ()
 Set sphere sheet starting point and resets the animation queue.
 
void rotateCamera (const SbRotation &rot)
 Rotates the camera around focal point by given incremental rotation (Given rotation is concatenated onto the current camera rotation).
 
void constrainCameraRotation (bool x=false, bool y=false, bool z=false)
 Constrains the camera to spin around the specified axis.
 
void setPlane (const SbVec3f &newNormal, const SbVec3f &newRight)
 Moves the camera to be aligned with the given plane.
 
void calculateMaxSpeed ()
 Calculates the maximum speed of the animation.
 
void changeMaxStraightSpeed (SbBool increase)
 Computes the maximum straight speed.
 
void setMinSpeed (float speed)
 Sets the minimum speed.
 
float getMinSpeed () const
 Returns the minimum speed.
 
void setMaxSpeed (float speed)
 Sets the maximum speed.
 
float getMaxSpeed () const
 Returns the maximum speed.
 
void setSpeedLimit (float limit)
 Sets the speed limit.
 
float getSpeedLimit () const
 Returns the speed limit.
 
void setCurrentSpeed (float speed)
 Sets the current speed.
 
float getCurrentSpeed () const
 Returns the current speed.
 
void setMaxStraightSpeed (float speed)
 Sets the maximum straight speed.
 
float getMaxStraightSpeed () const
 Returns the maximum straight speed.
 
void setMaxSpeedInc (float increment)
 Sets maximum speed multiplier.
 
float getMaxSpeedInc () const
 Returns maximum speed multiplier.
 
void startFlyAnimation ()
 Starts the walk animation.
 
void stopFlyAnimation ()
 Stops the walk animation.
 
void activateFlying ()
 Initializes flying animation.
 
void updateCameraFocalPoint ()
 Updates focal distance.
 
void setWalkViewerAnimMode (WalkViewerMode mode)
 Sets the camera animation for walk viewers regarding the mode.
 
SoGuiAlgoViewers::WalkViewerMode getWalkViewerAnimMode () const
 Returns the current mode for the walk viewer camera animation.
 
void startWalkAnimation ()
 Starts the walk animation.
 
void stopWalkAnimation ()
 Stops the walk animation.
 
void rotateCamera ()
 Rotates the camera around focal point by given incremental rotation (Given rotation is concatenated onto the current camera rotation).
 
- Public Member Functions inherited from SoStereoViewer
virtual ~SoStereoViewer ()
 Destructor.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

VSG extension Common algorithms for all viewers.

This class provides common viewer algorithms in order to more easily create a viewer class from scratch. The algorithms provided deal with animations, camera management, etc. This class regroups algorithms from all the viewer types (examiner, plane, fly and walk).

There are two ways to use this class:
1) Passed as an argument to the RenderArea.

SoXXRenderArea( parent, name, buildInsideParent, getMouseInput, getKeyboardInput, pAlgo );
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Common algorithm...
SoGuiAlgoViewers()
Constructor.

2) Use your own GL widget and call the necessary functions for the interactions and the rendering.
See the demo QtViewer for more information.

There are two projection modes for the "virtual trackball" that translates mouse motion into camera rotation:

  • SPHERICAL: Spherical rotation (the classic Open Inventor algorithm).
    Uses an SbSphereSheetProjector to determine rotation angle and rotation axis used to rotate the camera.
  • CYLINDRICAL: Cylindrical rotation.
    Uses an SbCylinderSheetProjector. The axis is the direction normal to the movement of the cursor on the screen and the angle is proportional to the mouse movement. The coefficient can be set using the setMouseAngularSpeed() method.

The viewer can use two zooming modes:

Definition at line 88 of file SoGuiAlgoViewers.h.

Member Enumeration Documentation

◆ 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 180 of file SoGuiAlgoViewers.h.

◆ DrawStyle

List of possible drawing 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 122 of file SoGuiAlgoViewers.h.

◆ DrawType

List of possible drawing types.

Enumerator
STILL 

Applies to static rendering.

INTERACTIVE 

Applies to rendering while interactive viewing.

Definition at line 167 of file SoGuiAlgoViewers.h.

◆ ProjectorsType

List of possible projection modes for the virtual trackball.

Enumerator
SPHERICAL 

Spherical rotation (the classic Open Inventor algorithm).


Uses an SbSphereSheetProjector to determine rotation angle and rotation axis used to rotate the camera.

CYLINDRICAL 

Cylindrical rotation.


Uses an SbCylinderSheetProjector. The axis is the direction normal to the movement of the cursor on the screen and the angle is proportional to the mouse movement. The coefficient can be set using the setMouseAngularSpeed() method.

Definition at line 199 of file SoGuiAlgoViewers.h.

◆ ViewerTypes

Viewer type flags.

This specifies what kind of viewer will be used for some algorithms.

Enumerator
EXAMINER 

Algorithms for examiner viewer.

PLANE 

Algorithms for plane viewer.

FLY 

Algorithms for fly viewer.

WALK 

Algorithms for walk viewer.

UNKNOWN 

Unknown: default value.

Definition at line 97 of file SoGuiAlgoViewers.h.

◆ WalkViewerMode

Walk viewer mode flags.

This specifies what mode will be used for the walk viewer camera animation.

Enumerator
WALK_MODE 

Walking mode (default).

PAN_MODE 

Panning mode.

Definition at line 978 of file SoGuiAlgoViewers.h.

◆ ZoomingType

List of possible zooming modes.

Enumerator
AUTOCENTER 

Around the viewport center.

GIVENPOSITION 

Uses as the zooming center a point provided by the application through the setCurrentMousePositionLocator() method before calling mouseWheelMotion().

Definition at line 218 of file SoGuiAlgoViewers.h.

Constructor & Destructor Documentation

◆ SoGuiAlgoViewers()

SoGuiAlgoViewers::SoGuiAlgoViewers ( )

Constructor.

Member Function Documentation

◆ activateFlying()

void SoGuiAlgoViewers::activateFlying ( )

Initializes flying animation.

◆ activatePanning()

void SoGuiAlgoViewers::activatePanning ( )

Updates camera position when panning is actived.

For Examiner and Plane viewers only.

◆ activateSpinning()

void SoGuiAlgoViewers::activateSpinning ( )

Set sphere sheet starting point and resets the animation queue.

◆ adjustCameraClippingPlanes()

virtual void SoGuiAlgoViewers::adjustCameraClippingPlanes ( )
virtual

Auto clipping routine.

Reimplemented from SoGuiViewer.

◆ bottomWheelMotion()

virtual void SoGuiAlgoViewers::bottomWheelMotion ( float  newVal)
virtual

Examiner and constrained viewers: Rotates the camera based on bottom wheel motion.

Plane viewer: Translates the camera based on bottom wheel motion.

Reimplemented from SoGuiConstrainedViewer.

◆ bottomWheelStart()

virtual void SoGuiAlgoViewers::bottomWheelStart ( )
virtual

Initializes bottom thumb wheel.

Reimplemented from SoGuiFullViewer.

◆ calculateMaxSpeed()

void SoGuiAlgoViewers::calculateMaxSpeed ( )

Calculates the maximum speed of the animation.

◆ changeMaxStraightSpeed()

void SoGuiAlgoViewers::changeMaxStraightSpeed ( SbBool  increase)

Computes the maximum straight speed.

◆ computeSeekFinalOrientation()

virtual void SoGuiAlgoViewers::computeSeekFinalOrientation ( )
virtual

Keeps the same camera rotation when seeking.

Reimplemented from SoGuiConstrainedViewer.

◆ constrainCameraRotation()

void SoGuiAlgoViewers::constrainCameraRotation ( bool  x = false,
bool  y = false,
bool  z = false 
)

Constrains the camera to spin around the specified axis.


For instance giving true, true, false will prevent the camera from rotating around the Z axis. Default is free rotation.

Parameters
xIf false, rotation around x axis is allowed.
yIf false, rotation around y axis is allowed.
zIf false, rotation around z axis is allowed.

◆ doBoxZoom()

void SoGuiAlgoViewers::doBoxZoom ( int  x1,
int  y1,
int  x2,
int  y2 
)

Zooms to the region delimited by the box.


(x1, y1) is the top left corner and (x2, y2) is the bottom right corner of the box in pixel coordinates.

◆ doCameraAnimation()

void SoGuiAlgoViewers::doCameraAnimation ( )

Does camera animation for constrained viewers.

◆ dollyCamera() [1/2]

virtual void SoGuiAlgoViewers::dollyCamera ( const SbVec2s newLocator)
virtual

Moves the camera on the z axis based on cursor motion.

Only for Examiner and Plane viewers.

Parameters
newLocatorThe new cursor position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.

◆ dollyCamera() [2/2]

virtual void SoGuiAlgoViewers::dollyCamera ( float  dist)
virtual

Moves the camera forward by the given amount.

Only for Walk and Fly viewers.

Parameters
distDistance the camera will be moved.

Reimplemented from SoGuiConstrainedViewer.

◆ doSpinAnimation()

virtual void SoGuiAlgoViewers::doSpinAnimation ( )
virtual

Rotate the camera for spin animation.

◆ enableShadows()

void SoGuiAlgoViewers::enableShadows ( bool  onOrOff)

Adds an SoShadowGroup after the headlight and enables it if true.

The shadow group's method field is set to VARIANCE_SHADOW_MAP.

◆ getBufferingType()

BufferType SoGuiAlgoViewers::getBufferingType ( )

Returns the current buffering type in the main view.

◆ getCamera()

SoCamera * SoGuiAlgoViewers::getCamera ( )

Gets the edited camera.

◆ getCameraFocalPlane()

SbPlane SoGuiAlgoViewers::getCameraFocalPlane ( ) const

Returns the camera focal position.

◆ getCameraPositionLocator()

SbVec3f SoGuiAlgoViewers::getCameraPositionLocator ( ) const

Returns the camera position.

◆ getCameraType()

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

◆ getClassTypeId()

static SoType SoGuiAlgoViewers::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getCurrentMousePositionLocator()

SbVec2s SoGuiAlgoViewers::getCurrentMousePositionLocator ( ) const

Returns the current mouse position in pixels.

◆ getCurrentSpeed()

float SoGuiAlgoViewers::getCurrentSpeed ( ) const

Returns the current speed.

◆ getDefaultRotationTargetPosition()

virtual void SoGuiAlgoViewers::getDefaultRotationTargetPosition ( SbVec3f targetPos)
virtual

Gets the default camera target position for rotations.

A camera must have been defined so that a rotation target is implicitly defined

◆ getDrawStyle()

DrawStyle SoGuiAlgoViewers::getDrawStyle ( DrawType  type)

Returns the current drawing style in the main view.

◆ getHeadlight()

SoDirectionalLight * SoGuiAlgoViewers::getHeadlight ( )

Returns the headlight node.

◆ getMaxSpeed()

float SoGuiAlgoViewers::getMaxSpeed ( ) const

Returns the maximum speed.

◆ getMaxSpeedInc()

float SoGuiAlgoViewers::getMaxSpeedInc ( ) const

Returns maximum speed multiplier.

◆ getMaxStraightSpeed()

float SoGuiAlgoViewers::getMaxStraightSpeed ( ) const

Returns the maximum straight speed.

◆ getMinSpeed()

float SoGuiAlgoViewers::getMinSpeed ( ) const

Returns the minimum speed.

◆ getMouseAngularSpeed()

double SoGuiAlgoViewers::getMouseAngularSpeed ( )
inline

Returns the factor used to scale the rotation speed while interactively rotating the camera.

Definition at line 283 of file SoGuiAlgoViewers.h.

◆ getMPEGRecorder()

virtual SoMPEGRenderer * SoGuiAlgoViewers::getMPEGRecorder ( ) const
virtual

Returns the recorder used for MPEG encoding.

Reimplemented from SoGuiRenderArea.

◆ getPrevAnimTime()

SbTime SoGuiAlgoViewers::getPrevAnimTime ( ) const

Returns the previous animation time.

◆ getPreviousMousePositionLocator()

SbVec2s SoGuiAlgoViewers::getPreviousMousePositionLocator ( ) const

Returns the previous mouse position in pixels.

◆ getRotationTargetPosition()

virtual bool SoGuiAlgoViewers::getRotationTargetPosition ( SbVec3f targetPos)
virtual

Query the camera target position for rotations.

Returns true if a targetPos has been set explicitly by the application or if a camera has been defined so that a rotation target is implicitly defined.

◆ getSceneGraph()

virtual SoNode * SoGuiAlgoViewers::getSceneGraph ( )
virtual

Returns the scene graph to render.

Reimplemented from SoGuiViewer.

◆ getSceneRoot()

SoNode * SoGuiAlgoViewers::getSceneRoot ( )

Returns the scene root of the viewer (drawstyle, camera and headlight + user scene graph) or the user scene graph if there's no scene root.

◆ getSheetProjectionType()

ProjectorsType SoGuiAlgoViewers::getSheetProjectionType ( ) const

Returns the sheet projection used for rotations.

◆ getSheetProjector()

SbProjector * SoGuiAlgoViewers::getSheetProjector ( ) const

Returns the sheet projector.

The sheet projector is used to translate mouse motion into camera motion. The returned object will be one of the specific subclasses of SbProjector, for example SbSphereSheetProjector (default "virtual trackball" motion) or SbCylinderSheetProjector. See setSheetProjectionType().

◆ getSpeedLimit()

float SoGuiAlgoViewers::getSpeedLimit ( ) const

Returns the speed limit.

◆ getSphereSheetProjector()

SbSphereSheetProjector * SoGuiAlgoViewers::getSphereSheetProjector ( ) const

Returns the sphere sheet projector and NULL if the current projection is not spherical.

See getSheetProjector() and setSheetProjectionType().

◆ getStartMousePositionLocator()

SbVec2s SoGuiAlgoViewers::getStartMousePositionLocator ( ) const

Returns the mouse start position in pixels.

◆ getTypeId()

virtual SoType SoGuiAlgoViewers::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

◆ getViewerType()

SoGuiAlgoViewers::ViewerTypes SoGuiAlgoViewers::getViewerType ( ) const

Returns the current viewer type.

◆ getWalkViewerAnimMode()

SoGuiAlgoViewers::WalkViewerMode SoGuiAlgoViewers::getWalkViewerAnimMode ( ) const

Returns the current mode for the walk viewer camera animation.

◆ getZoomingType()

ZoomingType SoGuiAlgoViewers::getZoomingType ( ) const

Returns the zooming algorithm.

If GIVENCENTER is used then setCurrentMousePositionLocator() must be called before any mouseWheelMotion() call.

◆ interactiveCountDec()

void SoGuiAlgoViewers::interactiveCountDec ( )

Invokes the finish viewing callbacks.

This must be called to finish doing interactive viewing operations.

◆ interactiveCountInc()

void SoGuiAlgoViewers::interactiveCountInc ( )

Invokes the start viewing callbacks.

This must be called to start doing interactive viewing operations so that correct interactive drawing style and buffering types, as well as application callbacks, gets set and called properly.

◆ isBoxDrawing()

SbBool SoGuiAlgoViewers::isBoxDrawing ( ) const

Returns TRUE if box drawing mode is enabled.

◆ isBoxSelection()

SbBool SoGuiAlgoViewers::isBoxSelection ( ) const

Returns TRUE if box selection mode is enabled.

◆ isCameraHeightAnglePreserved()

virtual SbBool SoGuiAlgoViewers::isCameraHeightAnglePreserved ( ) const
virtual

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

Reimplemented from SoGuiViewer.

◆ isConstrained()

SbBool SoGuiAlgoViewers::isConstrained ( ) const

Returns TRUE if algorithms for constrained viewers are used.

◆ isHeadlight()

SbBool SoGuiAlgoViewers::isHeadlight ( )

Returns TRUE if the headlight is on.

◆ isSeekMode()

SbBool SoGuiAlgoViewers::isSeekMode ( )

Returns TRUE if viewer is in seek mode.

◆ isViewing()

SbBool SoGuiAlgoViewers::isViewing ( ) const

Returns TRUE if the viewer is in viewing mode.

See setViewing() for details.

◆ leftWheelMotion()

virtual void SoGuiAlgoViewers::leftWheelMotion ( float  newVal)
virtual

Examiner and constrained viewers: Rotates the camera based on left wheel motion.

Plane viewer: Translates the camera based on left wheel motion.

Reimplemented from SoGuiConstrainedViewer.

◆ leftWheelStart()

virtual void SoGuiAlgoViewers::leftWheelStart ( )
virtual

Initializes left thumb wheel.

Reimplemented from SoGuiFullViewer.

◆ mouseWheelMotion()

virtual void SoGuiAlgoViewers::mouseWheelMotion ( float  newVal)
virtual

Makes the camera to zoom based on mouse wheel motion.

Reimplemented from SoGuiConstrainedViewer.

◆ panCamera()

virtual void SoGuiAlgoViewers::panCamera ( const SbVec2f newLocator)
virtual

Pans the camera based on cursor motion.

Only for Examiner and Plane viewers.

Parameters
newLocatorThe new cursor position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.

◆ recomputeSceneSize()

virtual void SoGuiAlgoViewers::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 from SoGuiConstrainedViewer.

◆ resetRenderAction()

void SoGuiAlgoViewers::resetRenderAction ( )

This method resets the render action cache.

It is useful to reset cache when the device context used for the rendering is modified (new anti-aliasing mode, pixel format...)

◆ resetRotationTargetPosition()

virtual void SoGuiAlgoViewers::resetRotationTargetPosition ( )
virtual

Reset target position to default rotation around "focal point".

◆ resetToHomePosition()

virtual void SoGuiAlgoViewers::resetToHomePosition ( )
virtual

Restores the camera values.

Reimplemented from SoGuiConstrainedViewer.

◆ reverseDollyCamera()

virtual void SoGuiAlgoViewers::reverseDollyCamera ( const SbVec2s newLocator)
virtual

Same as dollyCamera but reversed.

Only for Examiner and Plane viewers.

Parameters
newLocatorThe new cursor position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.

◆ rightWheelMotion()

virtual void SoGuiAlgoViewers::rightWheelMotion ( float  newVal)
virtual

Makes the camera to zoom based on right wheel motion.

Reimplemented from SoGuiConstrainedViewer.

◆ rightWheelStart()

virtual void SoGuiAlgoViewers::rightWheelStart ( )
virtual

Initializes right thumb wheel.

Reimplemented from SoGuiFullViewer.

◆ rollCamera()

virtual void SoGuiAlgoViewers::rollCamera ( const SbVec2s newLocator)
virtual

Rolls the camera based on cursor motion.

Parameters
newLocatorThe new cursor position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.

◆ rotateCamera() [1/2]

void SoGuiAlgoViewers::rotateCamera ( )

Rotates the camera around focal point by given incremental rotation (Given rotation is concatenated onto the current camera rotation).

◆ rotateCamera() [2/2]

void SoGuiAlgoViewers::rotateCamera ( const SbRotation rot)

Rotates the camera around focal point by given incremental rotation (Given rotation is concatenated onto the current camera rotation).

◆ saveHomePosition()

virtual void SoGuiAlgoViewers::saveHomePosition ( )
virtual

Saves the camera values.

Reimplemented from SoGuiConstrainedViewer.

◆ setBoxDrawingMode()

void SoGuiAlgoViewers::setBoxDrawingMode ( SbBool  on)

Sets box drawing mode.

◆ setBoxSelectionMode()

void SoGuiAlgoViewers::setBoxSelectionMode ( SbBool  on)

Sets box selection mode.

◆ setBufferingType()

virtual void SoGuiAlgoViewers::setBufferingType ( BufferType  type)
virtual

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

◆ setCamera()

virtual void SoGuiAlgoViewers::setCamera ( SoCamera newCamera)
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 from SoGuiConstrainedViewer.

◆ setCameraFocalPlane()

void SoGuiAlgoViewers::setCameraFocalPlane ( const SbPlane focalPlane)

Sets the camera focal plane.

◆ setCameraPositionLocator()

void SoGuiAlgoViewers::setCameraPositionLocator ( const SbVec3f camPosition)

Sets the camera position.

◆ setCameraType()

virtual void SoGuiAlgoViewers::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). Moreover with fly or walk viewers orthographic cameras don't make sense and are not supported.

Reimplemented from SoGuiViewer.

◆ setConstrained()

void SoGuiAlgoViewers::setConstrained ( SbBool  constrained)

Specifies whether algorithms for constrained viewers should be used.

◆ setCurrentMousePositionLocator()

void SoGuiAlgoViewers::setCurrentMousePositionLocator ( const SbVec2s mousePosition)

Sets the current mouse position.

Parameters
mousePositionThe new mouse position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.

◆ setCurrentSpeed()

void SoGuiAlgoViewers::setCurrentSpeed ( float  speed)

Sets the current speed.

◆ setDrawStyle()

virtual void SoGuiAlgoViewers::setDrawStyle ( DrawType  type,
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.

◆ setHeadlight()

virtual void SoGuiAlgoViewers::setHeadlight ( SbBool  insertFlag)
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 from SoGuiViewer.

◆ setMaxSpeed()

void SoGuiAlgoViewers::setMaxSpeed ( float  speed)

Sets the maximum speed.

◆ setMaxSpeedInc()

void SoGuiAlgoViewers::setMaxSpeedInc ( float  increment)

Sets maximum speed multiplier.

◆ setMaxStraightSpeed()

void SoGuiAlgoViewers::setMaxStraightSpeed ( float  speed)

Sets the maximum straight speed.

◆ setMinSpeed()

void SoGuiAlgoViewers::setMinSpeed ( float  speed)

Sets the minimum speed.

◆ setMouseAngularSpeed()

void SoGuiAlgoViewers::setMouseAngularSpeed ( double  speedFactor)
inline

Specifies the factor used to scale the rotation speed while interactively rotating the camera.

Default is 1.

Definition at line 278 of file SoGuiAlgoViewers.h.

◆ setMPEGRecorder()

virtual void SoGuiAlgoViewers::setMPEGRecorder ( SoMPEGRenderer recorder)
virtual

Sets the recorder used for MPEG encoding.

Parameters
recorderthe recorder to be used.

Note: The destruction of the recorder is handled by SoGuiAlgoViewers.

Reimplemented from SoGuiRenderArea.

◆ setPlane()

void SoGuiAlgoViewers::setPlane ( const SbVec3f newNormal,
const SbVec3f newRight 
)

Moves the camera to be aligned with the given plane.

For instance: setPlane( SbVec3f(1, 0, 0), SbVec3f(0, 0, -1) ) will align the camera with the X plane.

◆ setPreserveCameraHeightAngle()

virtual void SoGuiAlgoViewers::setPreserveCameraHeightAngle ( SbBool  flag)
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.

Reimplemented from SoGuiViewer.

◆ setPrevAnimTime()

void SoGuiAlgoViewers::setPrevAnimTime ( SbTime  previous)

Sets the previous animation time.

◆ setPreviousMousePositionLocator()

void SoGuiAlgoViewers::setPreviousMousePositionLocator ( const SbVec2s mousePosition)

Sets the previous mouse position.

Parameters
mousePositionThe new mouse position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.

◆ setRotationTargetPosition()

virtual void SoGuiAlgoViewers::setRotationTargetPosition ( const SbVec3f targetPos)
virtual

Sets the camera target position for rotations.

◆ setSceneGraph()

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

◆ setSeekMode()

virtual void SoGuiAlgoViewers::setSeekMode ( SbBool  onOrOff)
virtual

Set the viewer into/out of seek mode (default OFF).

Actual seeking will not happen until the viewer decides to, for example, on a mouse click.

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

Reimplemented from SoGuiViewer.

◆ setSheetProjectionType()

void SoGuiAlgoViewers::setSheetProjectionType ( const ProjectorsType projType)

Specifies the sheet projection to use for rotations.

Use enum ProjectorsType. Default is SPHERICAL.

◆ setSpeedLimit()

void SoGuiAlgoViewers::setSpeedLimit ( float  limit)

Sets the speed limit.

◆ setStartMousePositionLocator()

void SoGuiAlgoViewers::setStartMousePositionLocator ( const SbVec2s mousePosition)

Sets the mouse start position.

Parameters
mousePositionThe new mouse position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.

◆ setViewerType()

void SoGuiAlgoViewers::setViewerType ( ViewerTypes  vType)

Sets the type of viewer used for the algorithms.

◆ setViewing()

virtual void SoGuiAlgoViewers::setViewing ( SbBool  flag)
virtual

Sets whether the viewer is turned on or off.

When turned on (commonly called viewing mode), events are consumed by the viewer. When viewing is off (commonly called selection mode), 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 from SoGuiViewer.

◆ setWalkViewerAnimMode()

void SoGuiAlgoViewers::setWalkViewerAnimMode ( WalkViewerMode  mode)

Sets the camera animation for walk viewers regarding the mode.

◆ setZoomingType()

void SoGuiAlgoViewers::setZoomingType ( const ZoomingType zoomType)

Specifies the zooming algorithm to use.

Use enum ZoomingType. Default is AUTOCENTER.

◆ spinCamera()

virtual void SoGuiAlgoViewers::spinCamera ( const SbVec2f newLocator)
virtual

Spins the camera based on cursor motion.

Parameters
newLocatorThe new cursor position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.

◆ spinConstrainedCamera()

virtual void SoGuiAlgoViewers::spinConstrainedCamera ( const SbVec2f newLocator,
int  axisIndex 
)
virtual

Spin the camera based on cursor motion but constrained to rotation around one axis.

Parameters
newLocatorThe new cursor position in pixels. The coordinates must be defined with x in the range [0,window width] and y in the range [0,window height] with min y at the bottom and min x on the left.
axisIndexthe axis index:
  • X = 0
  • Y = 1
  • Z = 2

◆ startFlyAnimation()

void SoGuiAlgoViewers::startFlyAnimation ( )

Starts the walk animation.

◆ startSpinAnimation()

void SoGuiAlgoViewers::startSpinAnimation ( )

Starts the spin animation.

◆ startWalkAnimation()

void SoGuiAlgoViewers::startWalkAnimation ( )

Starts the walk animation.

◆ stopFlyAnimation()

void SoGuiAlgoViewers::stopFlyAnimation ( )

Stops the walk animation.

◆ stopSpinAnimation()

void SoGuiAlgoViewers::stopSpinAnimation ( )

Stops the spin animation.

◆ stopWalkAnimation()

void SoGuiAlgoViewers::stopWalkAnimation ( )

Stops the walk animation.

◆ toggleCameraType()

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

Reimplemented from SoGuiViewer.

◆ updateCameraFocalPoint()

void SoGuiAlgoViewers::updateCameraFocalPoint ( )

Updates focal distance.

◆ viewAll()

virtual void SoGuiAlgoViewers::viewAll ( )
virtual

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

Reimplemented from SoGuiViewer.

◆ viewX()

void SoGuiAlgoViewers::viewX ( bool  reverse = false)

Selects axial view.

◆ viewY()

void SoGuiAlgoViewers::viewY ( bool  reverse = false)

Selects frontal view.

◆ viewZ()

void SoGuiAlgoViewers::viewZ ( bool  reverse = false)

Selects sagittal view.


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