25#ifndef _SO_COLLISION_MANAGER_
26#define _SO_COLLISION_MANAGER_
31#include <Inventor/SbBasic.h>
32#include <Inventor/SbLinear.h>
294 void* userData = NULL);
351#ifndef HIDDEN_FROM_DOC
353 struct ShapeBBoxInformationItem {
355 float x_min, y_min, z_min;
356 float x_max, y_max, z_max;
359 struct PairTableItem {
361 float x_min, y_min, z_min;
362 float x_max, y_max, z_max;
373 struct ManagerListItem {
375 ManagerListItem* next;
378 class SceneInformationItem {
380 ~SceneInformationItem();
385 SbBool one_object_has_changed;
388 ManagerListItem* manager_list;
389 int active_manager_count;
392 int shape_bbox_information_reserved_size;
393 ShapeBBoxInformationItem* shape_bbox_information;
395 int pair_table_reserved_size;
396 PairTableItem* pair_table;
399 int comp_list_reserved_size;
400 CompListItem* comp_list;
403 SceneInformationItem* next;
416 SbBool m_object_bbox_only;
423 void* m_filter_cb_ud;
424 void* m_bbox_cb_list;
425 void* m_collision_cb_list;
426 void invokeBBoxCallbacks (
const SoPath* p1,
const SoPath* p2);
432 SbBool m_object_geometry_has_changed;
433 int m_primitive_count;
434 int m_num_primitive_reserved;
436 SoPath* m_current_shape_path;
437 Resp m_upper_response;
440 static SceneInformationItem* m_scene_information_list;
441 SceneInformationItem* m_scene_information;
442 SbBool m_is_a_good_transform;
443 SbBool m_there_is_a_good_transform;
454 PairTableItem* pairTableGetItem (
int shape1,
int shape2);
455 void pairTableCompute (
int (*fct)(
const void*,
const void*),
Axis axis);
456 static int compListXCompare(
const void* v1,
const void* v2);
457 static int compListYCompare(
const void* v1,
const void* v2);
458 static int compListZCompare(
const void* v1,
const void* v2);
460 void addPrimitiveToTable (
SoPath* p,
465 void addPrimitiveToTable (
SoPath* p,
469 { addPrimitiveToTable (p, type, v1, v2,
SbVec3f (0, 0, 0)); }
481 void onObjectTriangleReal (
const SbVec3f v0,
496 static void onSceneChange (
void* ud,
SoSensor* sensor);
497 static void refresh (SceneInformationItem* scene);
498 void lastKnowGoodTransformComputing ();
520 static void onTranslationChangeCB (
void* ud,
SoSensor* sensor)
522 static void onScaleChangeCB (
void* ud,
SoSensor* sensor)
524 static void onRotationChangeCB (
void* ud,
SoSensor* sensor)
526 static void onOrientationChangeCB (
void* ud,
SoSensor* sensor)
528 static void onCenterChangeCB (
void* ud,
SoSensor* sensor)
530 static void onDraggerMotionCB (
void* ud,
SoDragger *)
536 SbVec3f m_dragger_scale_factor;
539 void onDraggerMotion ();
542 void quickSort(
void *array,
int nElm,
int elmSize,
543 int (*compare)(
const void*,
const void*),
Class for representing a rotation.
Performs a generic traversal of a scene graph or path.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class to manage ...
void removeBBoxCollisionCallback(SoBBoxCollisionCB *f, void *userData=NULL)
Removes bounding box collision callback.
@ NEXT_SHAPE
Continue and call again for next colliding shape.
@ NEXT_PRIMITIVE
Continue and call again for next colliding primitive.
void addCollisionCallback(SoCollisionCB *f, void *userData=NULL)
Adds collision callback.
void setFilterCallback(SoFilterCollisionCB *f, void *userData=NULL)
Sets the callback function called when an object shape collides with a scene shape.
void setObject(SoPath *object)
Sets the object that will be transformed.
SoGroup * getScene() const
Returns the scene the object is interacting with.
SoPath * getObject() const
Returns the object that will be transformed.
Resp SoCollisionCB(void *userData, const SoCollidingPrimitive *object, const SoCollidingPrimitive *scene)
void setScene(SoGroup *scene)
Sets the scene the object is interacting with.
void SoBBoxCollisionCB(void *userData, const SoPath *p1, const SoPath *p2)
TransformChangeType
Transform change type.
@ TRANSLATION
Translation.
@ ORIENTATION
Orientation.
SbBool SoFilterCollisionCB(void *userData, const SoPath *p1, const SoPath *p2)
void setObjectBBoxOnly(SbBool flag=TRUE)
Sets a flag indicating whether to use the object's bounding box instead of the actual primitives when...
void activate(SbBool flag=TRUE)
Sets a flag to activate the collision manager, for instance, to tell it to watch the transformation a...
void setGluingLevel(unsigned int level)
Sets the gluing level.
void removeCollisionCallback(SoCollisionCB *f, void *userData=NULL)
Removes collision callback.
~SoCollisionManager()
Destructor.
SoCollisionManager(SoPath *object, SoGroup *scene, SoTransform *transform)
Constructor.
SbBool isGluing() const
Returns a flag indicating whether the collision manager should place the object at the position just ...
void setSceneBBoxOnly(SbBool flag=TRUE)
Sets a flag indicating whether to use the bounding boxes of objects in the scene instead of the actua...
void setGluing(SbBool flag=TRUE)
Sets a flag indicating that the collision manager should place the object at the position just before...
SbBool isSceneBBoxOnly() const
Returns a flag indicating whether to use the bounding boxes of objects in the scene instead of the ac...
SbBool isObjectBBoxOnly() const
Returns a flag indicating whether to use the object's bounding box instead of the actual primitives w...
SoTransform * getTransform() const
Returns the transformation that will be watched.
unsigned int getGluingLevel() const
Returns the gluing level.
void addBBoxCollisionCallback(SoBBoxCollisionCB *f, void *userData=NULL)
Adds bounding box collision callback.
SbBool isActivated() const
Returns a flag indicating whether the collision manager is activated.
void setTransform(SoTransform *transform)
Sets the transformation that will be watched.
Base class for nodekits that move in response to click-drag-release mouse events.
Sensor class that can be attached to Open Inventor fields.
Base class for all group nodes.
Abstract base class for all database nodes.
Sensor class that can be attached to Open Inventor nodes.
Path that points to a list of hierarchical nodes.
Represents a vertex of a generated primitive.
Abstract base class for Open Inventor sensors.
PrimitiveType type
Type of primitive.
SbVec3f vertex[3]
Vertex of the primitive.
SoPath * path
Path of the shape.
PrimitiveType
Primitive type.
@ LINE_SEGMENT
Line segment.