Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoWinCollisionViewer Class Reference

VSG extension Class to manage collisions between the camera and the scene. More...

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

Public Types

typedef void SoWinCollisionViewerCB(void *userData, SoWinCollisionViewer *collisionViewer)
 

Public Member Functions

 SoWinCollisionViewer (SoWinViewer *viewer)
 Constructor.
 
 ~SoWinCollisionViewer ()
 Destructor.
 
SoWinViewergetViewer () const
 Gets the original viewer.
 
void setDistance (float distance)
 Sets the distance between the camera and the objects.
 
float getDistance () const
 Gets the distance between the camera and the objects.
 
void setNumSteps (int num_steps)
 Sets the number of steps to be used in the collision computation.
 
int getNumSteps () const
 Gets the number of steps to be used in the collision computation.
 
void setCollisionDetection (SbBool value=TRUE)
 Sets the collision detection active flag.
 
SbBool getCollisionDetection () const
 Gets the collision detection active flag.
 
void setZBufferOptimization (SbBool value=TRUE, SbBool useZBufferOnly=FALSE)
 Sets the Z buffer optimization active flag.
 
SbBool getZBufferOptimistation () const
 Gets the Z buffer optimization active flag.
 
void addCallback (SoWinCollisionViewerCB *f, void *ud=NULL)
 Adds callback.
 
void removeCallback (SoWinCollisionViewerCB *f, void *ud=NULL)
 Removes callback.
 

Detailed Description

VSG extension Class to manage collisions between the camera and the scene.

This class is used to constrain a viewer, preventing the viewer's camera from colliding with the objects in the scene. It overrides the RenderCallback on the viewer that it's attached to.

The programmer can define the maximum distance between the camera and the objects.

When Z-buffer optimization is enabled, the algorithm looks at the Z-buffer to see if there is an object in front of the camera when the user moves forward, and an SoIntersectionDetectionAction when the user moves backward.

NOTE: This class is not a viewer.

SEE ALSO

SoCollisionManager, SoIntersectionDetectionAction

Definition at line 77 of file SoWinCollisionViewer.h.

Member Typedef Documentation

◆ SoWinCollisionViewerCB

typedef void SoWinCollisionViewerCB(void *userData, SoWinCollisionViewer *collisionViewer)

Definition at line 47 of file SoWinCollisionViewer.h.

Constructor & Destructor Documentation

◆ SoWinCollisionViewer()

SoWinCollisionViewer::SoWinCollisionViewer ( SoWinViewer viewer)

Constructor.

◆ ~SoWinCollisionViewer()

SoWinCollisionViewer::~SoWinCollisionViewer ( )

Destructor.

Member Function Documentation

◆ addCallback()

void SoWinCollisionViewer::addCallback ( SoWinCollisionViewerCB f,
void *  ud = NULL 
)

Adds callback.

This callback is called when a collision occurs between the camera and the scene.

◆ getCollisionDetection()

SbBool SoWinCollisionViewer::getCollisionDetection ( ) const

Gets the collision detection active flag.

◆ getDistance()

float SoWinCollisionViewer::getDistance ( ) const

Gets the distance between the camera and the objects.

◆ getNumSteps()

int SoWinCollisionViewer::getNumSteps ( ) const

Gets the number of steps to be used in the collision computation.

◆ getViewer()

SoWinViewer * SoWinCollisionViewer::getViewer ( ) const

Gets the original viewer.

◆ getZBufferOptimistation()

SbBool SoWinCollisionViewer::getZBufferOptimistation ( ) const

Gets the Z buffer optimization active flag.

◆ removeCallback()

void SoWinCollisionViewer::removeCallback ( SoWinCollisionViewerCB f,
void *  ud = NULL 
)

Removes callback.

◆ setCollisionDetection()

void SoWinCollisionViewer::setCollisionDetection ( SbBool  value = TRUE)

Sets the collision detection active flag.

The default value is TRUE.

◆ setDistance()

void SoWinCollisionViewer::setDistance ( float  distance)

Sets the distance between the camera and the objects.

◆ setNumSteps()

void SoWinCollisionViewer::setNumSteps ( int  num_steps)

Sets the number of steps to be used in the collision computation.

The default number of steps is 4. The minimum value is 2.

◆ setZBufferOptimization()

void SoWinCollisionViewer::setZBufferOptimization ( SbBool  value = TRUE,
SbBool  useZBufferOnly = FALSE 
)

Sets the Z buffer optimization active flag.

The default value is TRUE.

Also sets the useZBufferOnly flag. When this flag is TRUE, the geometric collision detection algorithm is never used. Therefore there is no collision check when the camera is moving backward, but this may be desireable for large scenes when this check is too slow.


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