25#ifndef _SO_COLLISION_MANAGER_
26#define _SO_COLLISION_MANAGER_
290 void* userData = NULL);
347#ifndef HIDDEN_FROM_DOC
349 struct ShapeBBoxInformationItem {
351 float x_min, y_min, z_min;
352 float x_max, y_max, z_max;
355 struct PairTableItem {
357 float x_min, y_min, z_min;
358 float x_max, y_max, z_max;
369 struct ManagerListItem {
371 ManagerListItem* next;
374 class SceneInformationItem {
376 ~SceneInformationItem();
381 SbBool one_object_has_changed;
384 ManagerListItem* manager_list;
385 int active_manager_count;
388 int shape_bbox_information_reserved_size;
389 ShapeBBoxInformationItem* shape_bbox_information;
391 int pair_table_reserved_size;
392 PairTableItem* pair_table;
395 int comp_list_reserved_size;
396 CompListItem* comp_list;
399 SceneInformationItem* next;
412 SbBool m_object_bbox_only;
419 void* m_filter_cb_ud;
420 void* m_bbox_cb_list;
421 void* m_collision_cb_list;
422 void invokeBBoxCallbacks (
const SoPath* p1,
const SoPath* p2);
428 SbBool m_object_geometry_has_changed;
429 int m_primitive_count;
430 int m_num_primitive_reserved;
432 SoPath* m_current_shape_path;
433 Resp m_upper_response;
436 static SceneInformationItem* m_scene_information_list;
437 SceneInformationItem* m_scene_information;
438 SbBool m_is_a_good_transform;
439 SbBool m_there_is_a_good_transform;
450 PairTableItem* pairTableGetItem (
int shape1,
int shape2);
451 void pairTableCompute (
int (*fct)(
const void*,
const void*),
Axis axis);
452 static int compListXCompare(
const void* v1,
const void* v2);
453 static int compListYCompare(
const void* v1,
const void* v2);
454 static int compListZCompare(
const void* v1,
const void* v2);
456 void addPrimitiveToTable (
SoPath* p,
461 void addPrimitiveToTable (
SoPath* p,
465 { addPrimitiveToTable (p, type, v1, v2,
SbVec3f (0, 0, 0)); }
477 void onObjectTriangleReal (
const SbVec3f v0,
492 static void onSceneChange (
void* ud,
SoSensor* sensor);
493 static void refresh (SceneInformationItem* scene);
494 void lastKnowGoodTransformComputing ();
516 static void onTranslationChangeCB (
void* ud,
SoSensor* sensor)
518 static void onScaleChangeCB (
void* ud,
SoSensor* sensor)
520 static void onRotationChangeCB (
void* ud,
SoSensor* sensor)
522 static void onOrientationChangeCB (
void* ud,
SoSensor* sensor)
524 static void onCenterChangeCB (
void* ud,
SoSensor* sensor)
526 static void onDraggerMotionCB (
void* ud,
SoDragger *)
532 SbVec3f m_dragger_scale_factor;
535 void onDraggerMotion ();
538 void quickSort(
void *array,
int nElm,
int elmSize,
539 int (*compare)(
const void*,
const void*),
#define TRUE
Possible value of SbBool.
void SoBBoxCollisionCB(void *userData, const SoPath *p1, const SoPath *p2)
SbBool SoFilterCollisionCB(void *userData, const SoPath *p1, const SoPath *p2)
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.
TransformChangeType
Transform change type.
@ TRANSLATION
Translation.
@ ORIENTATION
Orientation.
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.