Class to manage collisions between the camera and the scene. More...
#include <Inventor/Xt/viewers/SoXtCollisionViewer.h>
Public Member Functions | |
SoXtCollisionViewer (SoXtViewer *viewer) | |
Constructor. | |
~SoXtCollisionViewer () | |
Destructor. | |
SoXtViewer * | getViewer () 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 flag. | |
SbBool | getCollisionDetection () const |
Gets the collision detection flag. | |
void | setZBufferOptimization (SbBool value=TRUE, SbBool useZBufferOnly=FALSE) |
Sets the Z buffer optimization flag. | |
SbBool | getZBufferOptimistation () const |
Gets the Z buffer optimization flag. | |
void | addCallback (SoXtCollisionViewerCB *f, void *ud=NULL) |
Adds a callback. | |
void | removeCallback (SoXtCollisionViewerCB *f, void *ud=NULL) |
Removes the callback. | |
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.
SoCollisionManager, SoIntersectionDetectionAction
Definition at line 74 of file SoXtCollisionViewer.h.
SoXtCollisionViewer::SoXtCollisionViewer | ( | SoXtViewer * | viewer | ) |
Constructor.
SoXtCollisionViewer::~SoXtCollisionViewer | ( | ) |
Destructor.
void SoXtCollisionViewer::addCallback | ( | SoXtCollisionViewerCB * | f, |
void * | ud = NULL |
||
) |
Adds a callback.
This callback is called when a collision occurs between the camera and the scene.
SbBool SoXtCollisionViewer::getCollisionDetection | ( | ) | const |
Gets the collision detection flag.
float SoXtCollisionViewer::getDistance | ( | ) | const |
Gets the distance between the camera and the objects.
int SoXtCollisionViewer::getNumSteps | ( | ) | const |
Gets the number of steps to be used in the collision computation.
SoXtViewer * SoXtCollisionViewer::getViewer | ( | ) | const |
Gets the original viewer.
SbBool SoXtCollisionViewer::getZBufferOptimistation | ( | ) | const |
Gets the Z buffer optimization flag.
void SoXtCollisionViewer::removeCallback | ( | SoXtCollisionViewerCB * | f, |
void * | ud = NULL |
||
) |
Removes the callback.
Sets the collision detection flag.
The default value is TRUE.
void SoXtCollisionViewer::setDistance | ( | float | distance | ) |
Sets the distance between the camera and the objects.
void SoXtCollisionViewer::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.
void SoXtCollisionViewer::setZBufferOptimization | ( | SbBool | value = TRUE , |
SbBool | useZBufferOnly = FALSE |
||
) |
Sets the Z buffer optimization 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.