00001 #ifndef IPSA_SOCOLLISIONSHAPE_H
00002 #define IPSA_SOCOLLISIONSHAPE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #include "IPSA.h"
00028
00029 #include <Inventor/actions/SoCallbackAction.h>
00030 #include <Inventor/nodekits/SoBaseKit.h>
00031 #include <Inventor/fields/SoSFBool.h>
00032 #include <Inventor/fields/SoSFEnum.h>
00033 #include <Inventor/fields/SoSFUInt32.h>
00034 #include <Inventor/fields/SoSFVec3f.h>
00035 #include <Inventor/fields/SoSFTrigger.h>
00036 #include <Inventor/SbString.h>
00037 #include <Inventor/nodes/SoMatrixTransform.h>
00038 #include <Inventor/sensors/SoFieldSensor.h>
00039
00040 #include <ode/ode.h>
00041
00042 class SoSensor;
00043
00044 class IPSA_IMPORT_EXPORT SoCollisionShape : public SoBaseKit {
00045
00046 SO_KIT_HEADER(SoCollisionShape);
00047
00048
00049 SO_KIT_CATALOG_ENTRY_HEADER(separator);
00050 SO_KIT_CATALOG_ENTRY_HEADER(visDrawStyle);
00051 SO_KIT_CATALOG_ENTRY_HEADER(ODETransform);
00052 SO_KIT_CATALOG_ENTRY_HEADER(visualisation);
00053
00054 public:
00055
00056 SoCollisionShape(const SbString& nodeName = "");
00057
00058 virtual ~SoCollisionShape();
00059
00060 virtual SoBaseKit* copy(SbBool copyConnections) const;
00061 SbBool setUpConnections(SbBool onOff, SbBool doItAlways =FALSE);
00062 static void initClass();
00063 static SoCallbackAction::Response InitCollisionShapesCB(void* userdata, SoCallbackAction* action, const SoNode* node);
00064
00065 dGeomID getGeom();
00066 dGeomID createGeom(const SbMatrix& mm);
00067 void setSpace(dSpaceID spaceID);
00068 dSpaceID getSpace() {return space;}
00069
00070 SbBool getVisualisationStatus();
00071 void setVisualisationStatus(SbBool onOff);
00072
00073 void getCOG(SbVec3f& cog);
00074 virtual void updateGeomPosition(const SbMatrix& mm);
00075 void updateOIPosition();
00076
00077 enum eAlignment
00078 {
00079 STANDARD,
00080 CENTERED
00081 };
00082
00083 SoSFEnum alignment;
00084
00085 enum eSurfaceMaterial
00086 {
00087 CLEAN,
00088 GREASY,
00089 WOOD,
00090 GLASS,
00091 STEEL,
00092 RUBBER,
00093 NO_OF_SURFACEMATERIALS
00094 };
00095
00096 SoSFEnum surfaceMaterial;
00097
00098 SoSFUInt32 category;
00099 SoSFUInt32 collisionmask;
00100 SoSFBool autoinitialise;
00101
00102 protected:
00103 virtual dGeomID cGeom(const SbMatrix& mm);
00104 virtual void updateVisualisationAndOdeProperties();
00105
00106 SoSFTrigger updateOdePropertiesTrigger;
00107 SoFieldSensor updateOdePropertiesSensor;
00108 SoMatrixTransform* transform;
00109 SbMatrix CoinRefTransform;
00110 dSpaceID space;
00111 dGeomID geometry;
00112 SbVec3f COG;
00113
00114 private:
00115 static void UpdateVisualisationAndOdePropertiesCB(void* data, SoSensor* sensor);
00116 };
00117
00118 #endif