aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs89
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)]
200public 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
196public enum ActivationState : uint 215public 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
284public abstract string BulletEngineName { get; } 303public abstract string BulletEngineName { get; }
285public abstract string BulletEngineVersion { get; protected set;} 304public abstract string BulletEngineVersion { get; protected set;}
286 305
287// Initialization and simulation 306// Initialization and simulation
288public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, 307public 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
327public abstract BulletShape CreateGImpactShape(BulletWorld world,
328 int indicesCount, int[] indices,
329 int verticesCount, float[] vertices );
330
308public abstract BulletShape CreateHullShape(BulletWorld world, 331public abstract BulletShape CreateHullShape(BulletWorld world,
309 int hullCount, float[] hulls); 332 int hullCount, float[] hulls);
310 333
311public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape); 334public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms);
335
336public abstract BulletShape BuildConvexHullShapeFromMesh(BulletWorld world, BulletShape meshShape);
337
338public abstract BulletShape CreateConvexHullShape(BulletWorld world,
339 int indicesCount, int[] indices,
340 int verticesCount, float[] vertices );
312 341
313public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); 342public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData);
314 343
@@ -351,7 +380,7 @@ public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
351// ===================================================================================== 380// =====================================================================================
352public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin); 381public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin);
353 382
354public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, 383public 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
368public abstract BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1, 397public 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
372public abstract BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, 401public abstract BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
@@ -414,6 +443,38 @@ public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float e
414 443
415public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); 444public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold);
416 445
446public const int HINGE_NOT_SPECIFIED = -1;
447public abstract bool HingeSetLimits(BulletConstraint constrain, float low, float high, float softness, float bias, float relaxation);
448
449public abstract bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse);
450
451public const int SPRING_NOT_SPECIFIED = -1;
452public abstract bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint);
453
454public abstract bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss);
455
456public abstract bool SpringSetDamping(BulletConstraint constrain, int index, float damping);
457
458public const int SLIDER_LOWER_LIMIT = 0;
459public const int SLIDER_UPPER_LIMIT = 1;
460public const int SLIDER_LINEAR = 2;
461public const int SLIDER_ANGULAR = 3;
462public abstract bool SliderSetLimits(BulletConstraint constrain, int lowerUpper, int linAng, float val);
463
464public const int SLIDER_SET_SOFTNESS = 4;
465public const int SLIDER_SET_RESTITUTION = 5;
466public const int SLIDER_SET_DAMPING = 6;
467public const int SLIDER_SET_DIRECTION = 7;
468public const int SLIDER_SET_LIMIT = 8;
469public const int SLIDER_SET_ORTHO = 9;
470public abstract bool SliderSet(BulletConstraint constrain, int softRestDamp, int dirLimOrtho, int linAng, float val);
471
472public abstract bool SliderMotorEnable(BulletConstraint constrain, int linAng, float numericTrueFalse);
473
474public const int SLIDER_MOTOR_VELOCITY = 10;
475public const int SLIDER_MAX_MOTOR_FORCE = 11;
476public abstract bool SliderMotor(BulletConstraint constrain, int forceVel, int linAng, float val);
477
417public abstract bool CalculateTransforms(BulletConstraint constrain); 478public abstract bool CalculateTransforms(BulletConstraint constrain);
418 479
419public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); 480public 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
438public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); 499public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj);
439 500
501public abstract bool ClearCollisionProxyCache(BulletWorld world, BulletBody obj);
502
440public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); 503public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
441 504
442public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); 505public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain);