diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | 89 |
1 files changed, 76 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs index 5765b0d..be6f152 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | |||
@@ -43,7 +43,9 @@ public enum ConstraintType : int | |||
43 | SLIDER_CONSTRAINT_TYPE, | 43 | SLIDER_CONSTRAINT_TYPE, |
44 | CONTACT_CONSTRAINT_TYPE, | 44 | CONTACT_CONSTRAINT_TYPE, |
45 | D6_SPRING_CONSTRAINT_TYPE, | 45 | D6_SPRING_CONSTRAINT_TYPE, |
46 | MAX_CONSTRAINT_TYPE | 46 | MAX_CONSTRAINT_TYPE, // last type defined by Bullet |
47 | // | ||
48 | FIXED_CONSTRAINT_TYPE = 1234 // BulletSim constraint that is fixed and unmoving | ||
47 | } | 49 | } |
48 | 50 | ||
49 | // =============================================================================== | 51 | // =============================================================================== |
@@ -70,6 +72,8 @@ public enum BSPhysicsShapeType | |||
70 | SHAPE_COMPOUND = 22, | 72 | SHAPE_COMPOUND = 22, |
71 | SHAPE_HEIGHTMAP = 23, | 73 | SHAPE_HEIGHTMAP = 23, |
72 | SHAPE_AVATAR = 24, | 74 | SHAPE_AVATAR = 24, |
75 | SHAPE_CONVEXHULL= 25, | ||
76 | SHAPE_GIMPACT = 26, | ||
73 | }; | 77 | }; |
74 | 78 | ||
75 | // The native shapes have predefined shape hash keys | 79 | // The native shapes have predefined shape hash keys |
@@ -191,6 +195,21 @@ public struct ConfigurationParameters | |||
191 | public const float numericFalse = 0f; | 195 | public const float numericFalse = 0f; |
192 | } | 196 | } |
193 | 197 | ||
198 | // Parameters passed for the conversion of a mesh to a hull using Bullet's HACD library. | ||
199 | [StructLayout(LayoutKind.Sequential)] | ||
200 | public struct HACDParams | ||
201 | { | ||
202 | // usual default values | ||
203 | public float maxVerticesPerHull; // 100 | ||
204 | public float minClusters; // 2 | ||
205 | public float compacityWeight; // 0.1 | ||
206 | public float volumeWeight; // 0.0 | ||
207 | public float concavity; // 100 | ||
208 | public float addExtraDistPoints; // false | ||
209 | public float addNeighboursDistPoints; // false | ||
210 | public float addFacesPoints; // false | ||
211 | public float shouldAdjustCollisionMargin; // false | ||
212 | } | ||
194 | 213 | ||
195 | // The states a bullet collision object can have | 214 | // The states a bullet collision object can have |
196 | public enum ActivationState : uint | 215 | public enum ActivationState : uint |
@@ -230,7 +249,7 @@ public enum CollisionFlags : uint | |||
230 | BS_VEHICLE_COLLISIONS = 1 << 12, // return collisions for vehicle ground checking | 249 | BS_VEHICLE_COLLISIONS = 1 << 12, // return collisions for vehicle ground checking |
231 | BS_RETURN_ROOT_COMPOUND_SHAPE = 1 << 13, // return the pos/rot of the root shape in a compound shape | 250 | BS_RETURN_ROOT_COMPOUND_SHAPE = 1 << 13, // return the pos/rot of the root shape in a compound shape |
232 | BS_NONE = 0, | 251 | BS_NONE = 0, |
233 | BS_ALL = 0xFFFFFFFF | 252 | BS_ALL = 0x7FFF // collision flags are a signed short |
234 | }; | 253 | }; |
235 | 254 | ||
236 | // Values f collisions groups and masks | 255 | // Values f collisions groups and masks |
@@ -246,14 +265,14 @@ public enum CollisionFilterGroups : uint | |||
246 | BDebrisGroup = 1 << 3, // 0008 | 265 | BDebrisGroup = 1 << 3, // 0008 |
247 | BSensorTrigger = 1 << 4, // 0010 | 266 | BSensorTrigger = 1 << 4, // 0010 |
248 | BCharacterGroup = 1 << 5, // 0020 | 267 | BCharacterGroup = 1 << 5, // 0020 |
249 | BAllGroup = 0x000FFFFF, | 268 | BAllGroup = 0x0007FFF, // collision flags are a signed short |
250 | // Filter groups defined by BulletSim | 269 | // Filter groups defined by BulletSim |
251 | BGroundPlaneGroup = 1 << 10, // 0400 | 270 | BGroundPlaneGroup = 1 << 8, // 0400 |
252 | BTerrainGroup = 1 << 11, // 0800 | 271 | BTerrainGroup = 1 << 9, // 0800 |
253 | BRaycastGroup = 1 << 12, // 1000 | 272 | BRaycastGroup = 1 << 10, // 1000 |
254 | BSolidGroup = 1 << 13, // 2000 | 273 | BSolidGroup = 1 << 11, // 2000 |
255 | // BLinksetGroup = xx // a linkset proper is either static or dynamic | 274 | // BLinksetGroup = xx // a linkset proper is either static or dynamic |
256 | BLinksetChildGroup = 1 << 14, // 4000 | 275 | BLinksetChildGroup = 1 << 12, // 4000 |
257 | }; | 276 | }; |
258 | 277 | ||
259 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 | 278 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 |
@@ -273,7 +292,7 @@ public enum ConstraintParamAxis : int | |||
273 | AXIS_ANGULAR_X, | 292 | AXIS_ANGULAR_X, |
274 | AXIS_ANGULAR_Y, | 293 | AXIS_ANGULAR_Y, |
275 | AXIS_ANGULAR_Z, | 294 | AXIS_ANGULAR_Z, |
276 | AXIS_LINEAR_ALL = 20, // these last three added by BulletSim so we don't have to do zillions of calls | 295 | AXIS_LINEAR_ALL = 20, // added by BulletSim so we don't have to do zillions of calls |
277 | AXIS_ANGULAR_ALL, | 296 | AXIS_ANGULAR_ALL, |
278 | AXIS_ALL | 297 | AXIS_ALL |
279 | }; | 298 | }; |
@@ -282,7 +301,7 @@ public abstract class BSAPITemplate | |||
282 | { | 301 | { |
283 | // Returns the name of the underlying Bullet engine | 302 | // Returns the name of the underlying Bullet engine |
284 | public abstract string BulletEngineName { get; } | 303 | public abstract string BulletEngineName { get; } |
285 | public abstract string BulletEngineVersion { get; protected set;} | 304 | public abstract string BulletEngineVersion { get; protected set;} |
286 | 305 | ||
287 | // Initialization and simulation | 306 | // Initialization and simulation |
288 | public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, | 307 | public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, |
@@ -305,10 +324,20 @@ public abstract BulletShape CreateMeshShape(BulletWorld world, | |||
305 | int indicesCount, int[] indices, | 324 | int indicesCount, int[] indices, |
306 | int verticesCount, float[] vertices ); | 325 | int verticesCount, float[] vertices ); |
307 | 326 | ||
327 | public abstract BulletShape CreateGImpactShape(BulletWorld world, | ||
328 | int indicesCount, int[] indices, | ||
329 | int verticesCount, float[] vertices ); | ||
330 | |||
308 | public abstract BulletShape CreateHullShape(BulletWorld world, | 331 | public abstract BulletShape CreateHullShape(BulletWorld world, |
309 | int hullCount, float[] hulls); | 332 | int hullCount, float[] hulls); |
310 | 333 | ||
311 | public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape); | 334 | public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms); |
335 | |||
336 | public abstract BulletShape BuildConvexHullShapeFromMesh(BulletWorld world, BulletShape meshShape); | ||
337 | |||
338 | public abstract BulletShape CreateConvexHullShape(BulletWorld world, | ||
339 | int indicesCount, int[] indices, | ||
340 | int verticesCount, float[] vertices ); | ||
312 | 341 | ||
313 | public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); | 342 | public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); |
314 | 343 | ||
@@ -351,7 +380,7 @@ public abstract void DestroyObject(BulletWorld sim, BulletBody obj); | |||
351 | // ===================================================================================== | 380 | // ===================================================================================== |
352 | public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin); | 381 | public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin); |
353 | 382 | ||
354 | public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, | 383 | public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, |
355 | float scaleFactor, float collisionMargin); | 384 | float scaleFactor, float collisionMargin); |
356 | 385 | ||
357 | // ===================================================================================== | 386 | // ===================================================================================== |
@@ -366,7 +395,7 @@ public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world, | |||
366 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 395 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
367 | 396 | ||
368 | public abstract BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1, | 397 | public abstract BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1, |
369 | Vector3 frameInBloc, Quaternion frameInBrot, | 398 | Vector3 frameInBloc, Quaternion frameInBrot, |
370 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies); | 399 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies); |
371 | 400 | ||
372 | public abstract BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | 401 | public abstract BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, |
@@ -414,6 +443,38 @@ public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float e | |||
414 | 443 | ||
415 | public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); | 444 | public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); |
416 | 445 | ||
446 | public const int HINGE_NOT_SPECIFIED = -1; | ||
447 | public abstract bool HingeSetLimits(BulletConstraint constrain, float low, float high, float softness, float bias, float relaxation); | ||
448 | |||
449 | public abstract bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse); | ||
450 | |||
451 | public const int SPRING_NOT_SPECIFIED = -1; | ||
452 | public abstract bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint); | ||
453 | |||
454 | public abstract bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss); | ||
455 | |||
456 | public abstract bool SpringSetDamping(BulletConstraint constrain, int index, float damping); | ||
457 | |||
458 | public const int SLIDER_LOWER_LIMIT = 0; | ||
459 | public const int SLIDER_UPPER_LIMIT = 1; | ||
460 | public const int SLIDER_LINEAR = 2; | ||
461 | public const int SLIDER_ANGULAR = 3; | ||
462 | public abstract bool SliderSetLimits(BulletConstraint constrain, int lowerUpper, int linAng, float val); | ||
463 | |||
464 | public const int SLIDER_SET_SOFTNESS = 4; | ||
465 | public const int SLIDER_SET_RESTITUTION = 5; | ||
466 | public const int SLIDER_SET_DAMPING = 6; | ||
467 | public const int SLIDER_SET_DIRECTION = 7; | ||
468 | public const int SLIDER_SET_LIMIT = 8; | ||
469 | public const int SLIDER_SET_ORTHO = 9; | ||
470 | public abstract bool SliderSet(BulletConstraint constrain, int softRestDamp, int dirLimOrtho, int linAng, float val); | ||
471 | |||
472 | public abstract bool SliderMotorEnable(BulletConstraint constrain, int linAng, float numericTrueFalse); | ||
473 | |||
474 | public const int SLIDER_MOTOR_VELOCITY = 10; | ||
475 | public const int SLIDER_MAX_MOTOR_FORCE = 11; | ||
476 | public abstract bool SliderMotor(BulletConstraint constrain, int forceVel, int linAng, float val); | ||
477 | |||
417 | public abstract bool CalculateTransforms(BulletConstraint constrain); | 478 | public abstract bool CalculateTransforms(BulletConstraint constrain); |
418 | 479 | ||
419 | public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | 480 | public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); |
@@ -437,6 +498,8 @@ public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj); | |||
437 | 498 | ||
438 | public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); | 499 | public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); |
439 | 500 | ||
501 | public abstract bool ClearCollisionProxyCache(BulletWorld world, BulletBody obj); | ||
502 | |||
440 | public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); | 503 | public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); |
441 | 504 | ||
442 | public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); | 505 | public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); |