diff options
author | Robert Adams | 2013-05-08 06:02:12 -0700 |
---|---|---|
committer | Robert Adams | 2013-05-08 06:02:12 -0700 |
commit | eb0687f5af127ad6195b95965ce31346f2bc0a24 (patch) | |
tree | 8888b8d4c45874c646da0b475d09bd051b33e1cc /OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | |
parent | Add regression test for inventory item give, reject and subsequent trash fold... (diff) | |
download | opensim-SC_OLD-eb0687f5af127ad6195b95965ce31346f2bc0a24.zip opensim-SC_OLD-eb0687f5af127ad6195b95965ce31346f2bc0a24.tar.gz opensim-SC_OLD-eb0687f5af127ad6195b95965ce31346f2bc0a24.tar.bz2 opensim-SC_OLD-eb0687f5af127ad6195b95965ce31346f2bc0a24.tar.xz |
vh: update BulletSim (OpenSim/Region/Physics/BulletSPlugin
and DLL/SO) to ac6dcd35fb77f118fc6c3d72cb029591306c7e99
(Mon May 6 21:10:02 2013 -0400) on top of 0.7.5-postfixes.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | 167 |
1 files changed, 105 insertions, 62 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs index 8ad78ca..3378c93 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | |||
@@ -6,7 +6,7 @@ | |||
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyrightD | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
@@ -70,6 +70,7 @@ public enum BSPhysicsShapeType | |||
70 | SHAPE_COMPOUND = 22, | 70 | SHAPE_COMPOUND = 22, |
71 | SHAPE_HEIGHTMAP = 23, | 71 | SHAPE_HEIGHTMAP = 23, |
72 | SHAPE_AVATAR = 24, | 72 | SHAPE_AVATAR = 24, |
73 | SHAPE_CONVEXHULL= 25, | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | // The native shapes have predefined shape hash keys | 76 | // The native shapes have predefined shape hash keys |
@@ -87,7 +88,7 @@ public enum FixedShapeKey : ulong | |||
87 | [StructLayout(LayoutKind.Sequential)] | 88 | [StructLayout(LayoutKind.Sequential)] |
88 | public struct ShapeData | 89 | public struct ShapeData |
89 | { | 90 | { |
90 | public uint ID; | 91 | public UInt32 ID; |
91 | public BSPhysicsShapeType Type; | 92 | public BSPhysicsShapeType Type; |
92 | public Vector3 Position; | 93 | public Vector3 Position; |
93 | public Quaternion Rotation; | 94 | public Quaternion Rotation; |
@@ -111,7 +112,7 @@ public struct ShapeData | |||
111 | [StructLayout(LayoutKind.Sequential)] | 112 | [StructLayout(LayoutKind.Sequential)] |
112 | public struct SweepHit | 113 | public struct SweepHit |
113 | { | 114 | { |
114 | public uint ID; | 115 | public UInt32 ID; |
115 | public float Fraction; | 116 | public float Fraction; |
116 | public Vector3 Normal; | 117 | public Vector3 Normal; |
117 | public Vector3 Point; | 118 | public Vector3 Point; |
@@ -119,27 +120,47 @@ public struct SweepHit | |||
119 | [StructLayout(LayoutKind.Sequential)] | 120 | [StructLayout(LayoutKind.Sequential)] |
120 | public struct RaycastHit | 121 | public struct RaycastHit |
121 | { | 122 | { |
122 | public uint ID; | 123 | public UInt32 ID; |
123 | public float Fraction; | 124 | public float Fraction; |
124 | public Vector3 Normal; | 125 | public Vector3 Normal; |
125 | } | 126 | } |
126 | [StructLayout(LayoutKind.Sequential)] | 127 | [StructLayout(LayoutKind.Sequential)] |
127 | public struct CollisionDesc | 128 | public struct CollisionDesc |
128 | { | 129 | { |
129 | public uint aID; | 130 | public UInt32 aID; |
130 | public uint bID; | 131 | public UInt32 bID; |
131 | public Vector3 point; | 132 | public Vector3 point; |
132 | public Vector3 normal; | 133 | public Vector3 normal; |
134 | public float penetration; | ||
133 | } | 135 | } |
134 | [StructLayout(LayoutKind.Sequential)] | 136 | [StructLayout(LayoutKind.Sequential)] |
135 | public struct EntityProperties | 137 | public struct EntityProperties |
136 | { | 138 | { |
137 | public uint ID; | 139 | public UInt32 ID; |
138 | public Vector3 Position; | 140 | public Vector3 Position; |
139 | public Quaternion Rotation; | 141 | public Quaternion Rotation; |
140 | public Vector3 Velocity; | 142 | public Vector3 Velocity; |
141 | public Vector3 Acceleration; | 143 | public Vector3 Acceleration; |
142 | public Vector3 RotationalVelocity; | 144 | public Vector3 RotationalVelocity; |
145 | |||
146 | public override string ToString() | ||
147 | { | ||
148 | StringBuilder buff = new StringBuilder(); | ||
149 | buff.Append("<i="); | ||
150 | buff.Append(ID.ToString()); | ||
151 | buff.Append(",p="); | ||
152 | buff.Append(Position.ToString()); | ||
153 | buff.Append(",r="); | ||
154 | buff.Append(Rotation.ToString()); | ||
155 | buff.Append(",v="); | ||
156 | buff.Append(Velocity.ToString()); | ||
157 | buff.Append(",a="); | ||
158 | buff.Append(Acceleration.ToString()); | ||
159 | buff.Append(",rv="); | ||
160 | buff.Append(RotationalVelocity.ToString()); | ||
161 | buff.Append(">"); | ||
162 | return buff.ToString(); | ||
163 | } | ||
143 | } | 164 | } |
144 | 165 | ||
145 | // Format of this structure must match the definition in the C++ code | 166 | // Format of this structure must match the definition in the C++ code |
@@ -154,32 +175,6 @@ public struct ConfigurationParameters | |||
154 | public float collisionMargin; | 175 | public float collisionMargin; |
155 | public float gravity; | 176 | public float gravity; |
156 | 177 | ||
157 | public float XlinearDamping; | ||
158 | public float XangularDamping; | ||
159 | public float XdeactivationTime; | ||
160 | public float XlinearSleepingThreshold; | ||
161 | public float XangularSleepingThreshold; | ||
162 | public float XccdMotionThreshold; | ||
163 | public float XccdSweptSphereRadius; | ||
164 | public float XcontactProcessingThreshold; | ||
165 | |||
166 | public float XterrainImplementation; | ||
167 | public float XterrainFriction; | ||
168 | public float XterrainHitFraction; | ||
169 | public float XterrainRestitution; | ||
170 | public float XterrainCollisionMargin; | ||
171 | |||
172 | public float XavatarFriction; | ||
173 | public float XavatarStandingFriction; | ||
174 | public float XavatarDensity; | ||
175 | public float XavatarRestitution; | ||
176 | public float XavatarCapsuleWidth; | ||
177 | public float XavatarCapsuleDepth; | ||
178 | public float XavatarCapsuleHeight; | ||
179 | public float XavatarContactProcessingThreshold; | ||
180 | |||
181 | public float XvehicleAngularDamping; | ||
182 | |||
183 | public float maxPersistantManifoldPoolSize; | 178 | public float maxPersistantManifoldPoolSize; |
184 | public float maxCollisionAlgorithmPoolSize; | 179 | public float maxCollisionAlgorithmPoolSize; |
185 | public float shouldDisableContactPoolDynamicAllocation; | 180 | public float shouldDisableContactPoolDynamicAllocation; |
@@ -188,22 +183,30 @@ public struct ConfigurationParameters | |||
188 | public float shouldSplitSimulationIslands; | 183 | public float shouldSplitSimulationIslands; |
189 | public float shouldEnableFrictionCaching; | 184 | public float shouldEnableFrictionCaching; |
190 | public float numberOfSolverIterations; | 185 | public float numberOfSolverIterations; |
186 | public float useSingleSidedMeshes; | ||
187 | public float globalContactBreakingThreshold; | ||
191 | 188 | ||
192 | public float XlinksetImplementation; | 189 | public float physicsLoggingFrames; |
193 | public float XlinkConstraintUseFrameOffset; | ||
194 | public float XlinkConstraintEnableTransMotor; | ||
195 | public float XlinkConstraintTransMotorMaxVel; | ||
196 | public float XlinkConstraintTransMotorMaxForce; | ||
197 | public float XlinkConstraintERP; | ||
198 | public float XlinkConstraintCFM; | ||
199 | public float XlinkConstraintSolverIterations; | ||
200 | |||
201 | public float XphysicsLoggingFrames; | ||
202 | 190 | ||
203 | public const float numericTrue = 1f; | 191 | public const float numericTrue = 1f; |
204 | public const float numericFalse = 0f; | 192 | public const float numericFalse = 0f; |
205 | } | 193 | } |
206 | 194 | ||
195 | // Parameters passed for the conversion of a mesh to a hull using Bullet's HACD library. | ||
196 | [StructLayout(LayoutKind.Sequential)] | ||
197 | public struct HACDParams | ||
198 | { | ||
199 | // usual default values | ||
200 | public float maxVerticesPerHull; // 100 | ||
201 | public float minClusters; // 2 | ||
202 | public float compacityWeight; // 0.1 | ||
203 | public float volumeWeight; // 0.0 | ||
204 | public float concavity; // 100 | ||
205 | public float addExtraDistPoints; // false | ||
206 | public float addNeighboursDistPoints; // false | ||
207 | public float addFacesPoints; // false | ||
208 | public float shouldAdjustCollisionMargin; // false | ||
209 | } | ||
207 | 210 | ||
208 | // The states a bullet collision object can have | 211 | // The states a bullet collision object can have |
209 | public enum ActivationState : uint | 212 | public enum ActivationState : uint |
@@ -238,9 +241,10 @@ public enum CollisionFlags : uint | |||
238 | CF_DISABLE_VISUALIZE_OBJECT = 1 << 5, | 241 | CF_DISABLE_VISUALIZE_OBJECT = 1 << 5, |
239 | CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, | 242 | CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, |
240 | // Following used by BulletSim to control collisions and updates | 243 | // Following used by BulletSim to control collisions and updates |
241 | BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, | 244 | BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, // return collision events from unmanaged to managed |
242 | BS_FLOATS_ON_WATER = 1 << 11, | 245 | BS_FLOATS_ON_WATER = 1 << 11, // the object should float at water level |
243 | BS_VEHICLE_COLLISIONS = 1 << 12, | 246 | BS_VEHICLE_COLLISIONS = 1 << 12, // return collisions for vehicle ground checking |
247 | BS_RETURN_ROOT_COMPOUND_SHAPE = 1 << 13, // return the pos/rot of the root shape in a compound shape | ||
244 | BS_NONE = 0, | 248 | BS_NONE = 0, |
245 | BS_ALL = 0xFFFFFFFF | 249 | BS_ALL = 0xFFFFFFFF |
246 | }; | 250 | }; |
@@ -294,7 +298,7 @@ public abstract class BSAPITemplate | |||
294 | { | 298 | { |
295 | // Returns the name of the underlying Bullet engine | 299 | // Returns the name of the underlying Bullet engine |
296 | public abstract string BulletEngineName { get; } | 300 | public abstract string BulletEngineName { get; } |
297 | public abstract string BulletEngineVersion { get; protected set;} | 301 | public abstract string BulletEngineVersion { get; protected set;} |
298 | 302 | ||
299 | // Initialization and simulation | 303 | // Initialization and simulation |
300 | public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, | 304 | public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms, |
@@ -305,7 +309,7 @@ public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet | |||
305 | public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, | 309 | public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, |
306 | out int updatedEntityCount, out int collidersCount); | 310 | out int updatedEntityCount, out int collidersCount); |
307 | 311 | ||
308 | public abstract bool UpdateParameter(BulletWorld world, uint localID, String parm, float value); | 312 | public abstract bool UpdateParameter(BulletWorld world, UInt32 localID, String parm, float value); |
309 | 313 | ||
310 | public abstract void Shutdown(BulletWorld sim); | 314 | public abstract void Shutdown(BulletWorld sim); |
311 | 315 | ||
@@ -320,7 +324,13 @@ public abstract BulletShape CreateMeshShape(BulletWorld world, | |||
320 | public abstract BulletShape CreateHullShape(BulletWorld world, | 324 | public abstract BulletShape CreateHullShape(BulletWorld world, |
321 | int hullCount, float[] hulls); | 325 | int hullCount, float[] hulls); |
322 | 326 | ||
323 | public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape); | 327 | public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms); |
328 | |||
329 | public abstract BulletShape BuildConvexHullShapeFromMesh(BulletWorld world, BulletShape meshShape); | ||
330 | |||
331 | public abstract BulletShape CreateConvexHullShape(BulletWorld world, | ||
332 | int indicesCount, int[] indices, | ||
333 | int verticesCount, float[] vertices ); | ||
324 | 334 | ||
325 | public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); | 335 | public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); |
326 | 336 | ||
@@ -342,26 +352,28 @@ public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape c | |||
342 | 352 | ||
343 | public abstract void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape); | 353 | public abstract void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape); |
344 | 354 | ||
355 | public abstract void UpdateChildTransform(BulletShape pShape, int childIndex, Vector3 pos, Quaternion rot, bool shouldRecalculateLocalAabb); | ||
356 | |||
345 | public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape); | 357 | public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape); |
346 | 358 | ||
347 | public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id); | 359 | public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, UInt32 id); |
348 | 360 | ||
349 | public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape); | 361 | public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape); |
350 | 362 | ||
351 | public abstract CollisionObjectTypes GetBodyType(BulletBody obj); | 363 | public abstract CollisionObjectTypes GetBodyType(BulletBody obj); |
352 | 364 | ||
353 | public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); | 365 | public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot); |
354 | 366 | ||
355 | public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot); | 367 | public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot); |
356 | 368 | ||
357 | public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); | 369 | public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, UInt32 id, Vector3 pos, Quaternion rot); |
358 | 370 | ||
359 | public abstract void DestroyObject(BulletWorld sim, BulletBody obj); | 371 | public abstract void DestroyObject(BulletWorld sim, BulletBody obj); |
360 | 372 | ||
361 | // ===================================================================================== | 373 | // ===================================================================================== |
362 | public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin); | 374 | public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin); |
363 | 375 | ||
364 | public abstract BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, | 376 | public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap, |
365 | float scaleFactor, float collisionMargin); | 377 | float scaleFactor, float collisionMargin); |
366 | 378 | ||
367 | // ===================================================================================== | 379 | // ===================================================================================== |
@@ -375,11 +387,38 @@ public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world, | |||
375 | Vector3 joinPoint, | 387 | Vector3 joinPoint, |
376 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 388 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
377 | 389 | ||
390 | public abstract BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1, | ||
391 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
392 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies); | ||
393 | |||
394 | public abstract BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
395 | Vector3 frame1loc, Quaternion frame1rot, | ||
396 | Vector3 frame2loc, Quaternion frame2rot, | ||
397 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
398 | |||
378 | public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | 399 | public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, |
379 | Vector3 pivotinA, Vector3 pivotinB, | 400 | Vector3 pivotinA, Vector3 pivotinB, |
380 | Vector3 axisInA, Vector3 axisInB, | 401 | Vector3 axisInA, Vector3 axisInB, |
381 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 402 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
382 | 403 | ||
404 | public abstract BulletConstraint CreateSliderConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
405 | Vector3 frameInAloc, Quaternion frameInArot, | ||
406 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
407 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
408 | |||
409 | public abstract BulletConstraint CreateConeTwistConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
410 | Vector3 frameInAloc, Quaternion frameInArot, | ||
411 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
412 | bool disableCollisionsBetweenLinkedBodies); | ||
413 | |||
414 | public abstract BulletConstraint CreateGearConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
415 | Vector3 axisInA, Vector3 axisInB, | ||
416 | float ratio, bool disableCollisionsBetweenLinkedBodies); | ||
417 | |||
418 | public abstract BulletConstraint CreatePoint2PointConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
419 | Vector3 pivotInA, Vector3 pivotInB, | ||
420 | bool disableCollisionsBetweenLinkedBodies); | ||
421 | |||
383 | public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); | 422 | public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); |
384 | 423 | ||
385 | public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); | 424 | public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); |
@@ -607,7 +646,7 @@ public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index); | |||
607 | 646 | ||
608 | public abstract int GetNumConstraintRefs(BulletBody obj); | 647 | public abstract int GetNumConstraintRefs(BulletBody obj); |
609 | 648 | ||
610 | public abstract bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask); | 649 | public abstract bool SetCollisionGroupMask(BulletBody body, UInt32 filter, UInt32 mask); |
611 | 650 | ||
612 | // ===================================================================================== | 651 | // ===================================================================================== |
613 | // btCollisionShape entries | 652 | // btCollisionShape entries |
@@ -646,17 +685,21 @@ public abstract float GetMargin(BulletShape shape); | |||
646 | 685 | ||
647 | // ===================================================================================== | 686 | // ===================================================================================== |
648 | // Debugging | 687 | // Debugging |
649 | public abstract void DumpRigidBody(BulletWorld sim, BulletBody collisionObject); | 688 | public virtual void DumpRigidBody(BulletWorld sim, BulletBody collisionObject) { } |
689 | |||
690 | public virtual void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape) { } | ||
691 | |||
692 | public virtual void DumpConstraint(BulletWorld sim, BulletConstraint constrain) { } | ||
650 | 693 | ||
651 | public abstract void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape); | 694 | public virtual void DumpActivationInfo(BulletWorld sim) { } |
652 | 695 | ||
653 | public abstract void DumpConstraint(BulletWorld sim, BulletConstraint constrain); | 696 | public virtual void DumpAllInfo(BulletWorld sim) { } |
654 | 697 | ||
655 | public abstract void DumpActivationInfo(BulletWorld sim); | 698 | public virtual void DumpPhysicsStatistics(BulletWorld sim) { } |
656 | 699 | ||
657 | public abstract void DumpAllInfo(BulletWorld sim); | 700 | public virtual void ResetBroadphasePool(BulletWorld sim) { } |
658 | 701 | ||
659 | public abstract void DumpPhysicsStatistics(BulletWorld sim); | 702 | public virtual void ResetConstraintSolver(BulletWorld sim) { } |
660 | 703 | ||
661 | }; | 704 | }; |
662 | } | 705 | } |