aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2012-12-29 21:44:13 -0800
committerRobert Adams2012-12-31 19:57:21 -0800
commit9fd0e1b0805ccc97b8e4f19727d98b26fb5fa89d (patch)
treea109719ff00d9a9603e110d6f16112a785bf29d3
parentBulletSim: first round of conversion from direct BulletSimAPI interfacing by ... (diff)
downloadopensim-SC-9fd0e1b0805ccc97b8e4f19727d98b26fb5fa89d.zip
opensim-SC-9fd0e1b0805ccc97b8e4f19727d98b26fb5fa89d.tar.gz
opensim-SC-9fd0e1b0805ccc97b8e4f19727d98b26fb5fa89d.tar.bz2
opensim-SC-9fd0e1b0805ccc97b8e4f19727d98b26fb5fa89d.tar.xz
BulletSim: add the implementation files for the two versions of Bullet:
unmanaged (C++) and managed (C#).
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs1107
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs39
2 files changed, 1146 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
new file mode 100755
index 0000000..bbfc1f8
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
@@ -0,0 +1,1107 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Runtime.InteropServices;
30using System.Security;
31using System.Text;
32
33using OpenMetaverse;
34
35namespace OpenSim.Region.Physics.BulletSPlugin
36{
37public sealed class BSAPIUnman : BulletSimAPITemplate
38{
39 /*
40// Initialization and simulation
41public BulletWorld Initialize(Vector3 maxPosition, IntPtr parms,
42 int maxCollisions, IntPtr collisionArray,
43 int maxUpdates, IntPtr updateArray
44 );
45
46public bool UpdateParameter(BulletWorld world, uint localID, String parm, float value);
47
48public void SetHeightMap(BulletWorld world, float[] heightmap);
49
50public void Shutdown(BulletWorld sim);
51
52public int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
53 out int updatedEntityCount,
54 out IntPtr updatedEntitiesPtr,
55 out int collidersCount,
56 out IntPtr collidersPtr);
57
58public bool PushUpdate(BulletBody obj);
59 */
60
61// =====================================================================================
62// Mesh, hull, shape and body creation helper routines
63public override BulletShape CreateMeshShape(BulletWorld world,
64 int indicesCount, int[] indices,
65 int verticesCount, float[] vertices)
66{
67 return new BulletShape(
68 BSAPI.CreateMeshShape2(world.ptr, indicesCount, indices, verticesCount, vertices),
69 BSPhysicsShapeType.SHAPE_MESH);
70}
71
72public override BulletShape CreateHullShape(BulletWorld world, int hullCount, float[] hulls)
73{
74 return new BulletShape(
75 BSAPI.CreateHullShape2(world.ptr, hullCount, hulls),
76 BSPhysicsShapeType.SHAPE_HULL);
77}
78
79public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape)
80{
81 return new BulletShape(
82 BSAPI.BuildHullShapeFromMesh2(world.ptr, meshShape.ptr),
83 BSPhysicsShapeType.SHAPE_HULL);
84}
85
86public override BulletShape BuildNativeShape( BulletWorld world, ShapeData shapeData)
87{
88 return new BulletShape(
89 BSAPI.BuildNativeShape2(world.ptr, shapeData),
90 shapeData.Type);
91}
92
93public override bool IsNativeShape(BulletShape shape)
94{
95 if (shape.HasPhysicalShape)
96 return BSAPI.IsNativeShape2(shape.ptr);
97 return false;
98}
99
100public override void SetShapeCollisionMargin(BulletShape shape, float margin)
101{
102 if (shape.HasPhysicalShape)
103 BSAPI.SetShapeCollisionMargin2(shape.ptr, margin);
104}
105
106public override BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale)
107{
108 return new BulletShape(
109 BSAPI.BuildCapsuleShape2(world.ptr, radius, height, scale),
110 BSPhysicsShapeType.SHAPE_CAPSULE);
111}
112
113public override BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree)
114{
115 return new BulletShape(
116 BSAPI.CreateCompoundShape2(sim.ptr, enableDynamicAabbTree),
117 BSPhysicsShapeType.SHAPE_COMPOUND);
118
119}
120
121public override int GetNumberOfCompoundChildren(BulletShape shape)
122{
123 if (shape.HasPhysicalShape)
124 return BSAPI.GetNumberOfCompoundChildren2(shape.ptr);
125 return 0;
126}
127
128public override void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot)
129{
130 BSAPI.AddChildShapeToCompoundShape2(cShape.ptr, addShape.ptr, pos, rot);
131}
132
133public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx)
134{
135 return new BulletShape(BSAPI.GetChildShapeFromCompoundShapeIndex2(cShape.ptr, indx));
136}
137
138public override BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx)
139{
140 return new BulletShape(BSAPI.RemoveChildShapeFromCompoundShapeIndex2(cShape.ptr, indx));
141}
142
143public override void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape)
144{
145 BSAPI.RemoveChildShapeFromCompoundShape2(cShape.ptr, removeShape.ptr);
146}
147
148public override void RecalculateCompoundShapeLocalAabb(BulletShape cShape)
149{
150 BSAPI.RecalculateCompoundShapeLocalAabb2(cShape.ptr);
151}
152
153public override BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id)
154{
155 return new BulletShape(BSAPI.DuplicateCollisionShape2(sim.ptr, srcShape.ptr, id), srcShape.type);
156}
157
158public override BulletBody CreateBodyFromShapeAndInfo(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo)
159{
160 return new BulletBody(id, BSAPI.CreateBodyFromShapeAndInfo2(sim.ptr, shape.ptr, id, constructionInfo));
161}
162
163public override bool DeleteCollisionShape(BulletWorld world, BulletShape shape)
164{
165 return BSAPI.DeleteCollisionShape2(world.ptr, shape.ptr);
166}
167
168public override int GetBodyType(BulletBody obj)
169{
170 return BSAPI.GetBodyType2(obj.ptr);
171}
172
173public override BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot)
174{
175 return new BulletBody(id, BSAPI.CreateBodyFromShape2(sim.ptr, shape.ptr, id, pos, rot));
176}
177
178public override BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot)
179{
180 return new BulletBody(id, BSAPI.CreateBodyWithDefaultMotionState2(shape.ptr, id, pos, rot));
181}
182
183public override BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot)
184{
185 return new BulletBody(id, BSAPI.CreateGhostFromShape2(sim.ptr, shape.ptr, id, pos, rot));
186}
187
188public override IntPtr AllocateBodyInfo(BulletBody obj)
189{
190 return BSAPI.AllocateBodyInfo2(obj.ptr);
191}
192
193public override void ReleaseBodyInfo(IntPtr obj)
194{
195 BSAPI.ReleaseBodyInfo2(obj);
196}
197
198public override void DestroyObject(BulletWorld sim, BulletBody obj)
199{
200 BSAPI.DestroyObject2(sim.ptr, obj.ptr);
201}
202
203 /*
204// =====================================================================================
205// Terrain creation and helper routines
206public override IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
207 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
208
209public override IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
210 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
211
212public override bool ReleaseHeightMapInfo(IntPtr heightMapInfo);
213
214public override BulletBody CreateGroundPlaneShape(uint id, float height, float collisionMargin);
215
216public override BulletBody CreateTerrainShape(IntPtr mapInfo);
217
218// =====================================================================================
219// Constraint creation and helper routines
220public override BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
221 Vector3 frame1loc, Quaternion frame1rot,
222 Vector3 frame2loc, Quaternion frame2rot,
223 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
224
225public override BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2,
226 Vector3 joinPoint,
227 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
228
229public override BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
230 Vector3 pivotinA, Vector3 pivotinB,
231 Vector3 axisInA, Vector3 axisInB,
232 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
233
234public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse);
235
236public override void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations);
237
238public override bool SetFrames(BulletConstraint constrain,
239 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
240
241public override bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi);
242
243public override bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi);
244
245public override bool UseFrameOffset(BulletConstraint constrain, float enable);
246
247public override bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce);
248
249public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold);
250
251public override bool CalculateTransforms(BulletConstraint constrain);
252
253public override bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
254
255public override bool DestroyConstraint(BulletWorld world, BulletConstraint constrain);
256
257// =====================================================================================
258// btCollisionWorld entries
259public override void UpdateSingleAabb(BulletWorld world, BulletBody obj);
260
261public override void UpdateAabbs(BulletWorld world);
262
263public override bool GetForceUpdateAllAabbs(BulletWorld world);
264
265public override void SetForceUpdateAllAabbs(BulletWorld world, bool force);
266
267// =====================================================================================
268// btDynamicsWorld entries
269public override bool AddObjectToWorld(BulletWorld world, BulletBody obj);
270
271public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj);
272
273public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects);
274
275public override bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain);
276// =====================================================================================
277// btCollisionObject entries
278public override Vector3 GetAnisotripicFriction(BulletConstraint constrain);
279
280public override Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict);
281
282public override bool HasAnisotripicFriction(BulletConstraint constrain);
283
284public override void SetContactProcessingThreshold(BulletBody obj, float val);
285
286public override float GetContactProcessingThreshold(BulletBody obj);
287
288public override bool IsStaticObject(BulletBody obj);
289
290public override bool IsKinematicObject(BulletBody obj);
291
292public override bool IsStaticOrKinematicObject(BulletBody obj);
293
294public override bool HasContactResponse(BulletBody obj);
295
296public override void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletBody shape);
297
298public override BulletShape GetCollisionShape(BulletBody obj);
299
300public override int GetActivationState(BulletBody obj);
301
302public override void SetActivationState(BulletBody obj, int state);
303
304public override void SetDeactivationTime(BulletBody obj, float dtime);
305
306public override float GetDeactivationTime(BulletBody obj);
307
308public override void ForceActivationState(BulletBody obj, ActivationState state);
309
310public override void Activate(BulletBody obj, bool forceActivation);
311
312public override bool IsActive(BulletBody obj);
313
314public override void SetRestitution(BulletBody obj, float val);
315
316public override float GetRestitution(BulletBody obj);
317
318public override void SetFriction(BulletBody obj, float val);
319
320public override float GetFriction(BulletBody obj);
321
322public override Vector3 GetPosition(BulletBody obj);
323
324public override Quaternion GetOrientation(BulletBody obj);
325
326public override void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation);
327
328public override IntPtr GetBroadphaseHandle(BulletBody obj);
329
330public override void SetBroadphaseHandle(BulletBody obj, IntPtr handle);
331
332public override void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel);
333
334public override void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel);
335
336public override void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel);
337
338public override float GetHitFraction(BulletBody obj);
339
340public override void SetHitFraction(BulletBody obj, float val);
341
342public override CollisionFlags GetCollisionFlags(BulletBody obj);
343
344public override CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags);
345
346public override CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags);
347
348public override CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags);
349
350public override float GetCcdMotionThreshold(BulletBody obj);
351
352public override void SetCcdMotionThreshold(BulletBody obj, float val);
353
354public override float GetCcdSweptSphereRadius(BulletBody obj);
355
356public override void SetCcdSweptSphereRadius(BulletBody obj, float val);
357
358public override IntPtr GetUserPointer(BulletBody obj);
359
360public override void SetUserPointer(BulletBody obj, IntPtr val);
361
362// =====================================================================================
363// btRigidBody entries
364public override void ApplyGravity(BulletBody obj);
365
366public override void SetGravity(BulletBody obj, Vector3 val);
367
368public override Vector3 GetGravity(BulletBody obj);
369
370public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping);
371
372public override void SetLinearDamping(BulletBody obj, float lin_damping);
373
374public override void SetAngularDamping(BulletBody obj, float ang_damping);
375
376public override float GetLinearDamping(BulletBody obj);
377
378public override float GetAngularDamping(BulletBody obj);
379
380public override float GetLinearSleepingThreshold(BulletBody obj);
381
382
383public override void ApplyDamping(BulletBody obj, float timeStep);
384
385public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia);
386
387public override Vector3 GetLinearFactor(BulletBody obj);
388
389public override void SetLinearFactor(BulletBody obj, Vector3 factor);
390
391public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot);
392
393// Add a force to the object as if its mass is one.
394public override void ApplyCentralForce(BulletBody obj, Vector3 force);
395
396// Set the force being applied to the object as if its mass is one.
397public override void SetObjectForce(BulletBody obj, Vector3 force);
398
399public override Vector3 GetTotalForce(BulletBody obj);
400
401public override Vector3 GetTotalTorque(BulletBody obj);
402
403public override Vector3 GetInvInertiaDiagLocal(BulletBody obj);
404
405public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert);
406
407public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold);
408
409public override void ApplyTorque(BulletBody obj, Vector3 torque);
410
411// Apply force at the given point. Will add torque to the object.
412public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos);
413
414// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
415public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp);
416
417// Apply impulse to the object's torque. Force is scaled by object's mass.
418public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp);
419
420// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
421public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos);
422
423public override void ClearForces(BulletBody obj);
424
425public override void ClearAllForces(BulletBody obj);
426
427public override void UpdateInertiaTensor(BulletBody obj);
428
429public override Vector3 GetLinearVelocity(BulletBody obj);
430
431public override Vector3 GetAngularVelocity(BulletBody obj);
432
433public override void SetLinearVelocity(BulletBody obj, Vector3 val);
434
435public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity);
436
437public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos);
438
439public override void Translate(BulletBody obj, Vector3 trans);
440
441public override void UpdateDeactivation(BulletBody obj, float timeStep);
442
443public override bool WantsSleeping(BulletBody obj);
444
445public override void SetAngularFactor(BulletBody obj, float factor);
446
447public override void SetAngularFactorV(BulletBody obj, Vector3 factor);
448
449public override Vector3 GetAngularFactor(BulletBody obj);
450
451public override bool IsInWorld(BulletBody obj);
452
453public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain);
454
455public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain);
456
457public override BulletConstraint GetConstraintRef(BulletBody obj, int index);
458
459public override int GetNumConstraintRefs(BulletBody obj);
460
461public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask);
462
463// =====================================================================================
464// btCollisionShape entries
465
466public override float GetAngularMotionDisc(BulletShape shape);
467
468public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor);
469
470public override bool IsPolyhedral(BulletShape shape);
471
472public override bool IsConvex2d(BulletShape shape);
473
474public override bool IsConvex(BulletShape shape);
475
476public override bool IsNonMoving(BulletShape shape);
477
478public override bool IsConcave(BulletShape shape);
479
480public override bool IsCompound(BulletShape shape);
481
482public override bool IsSoftBody(BulletShape shape);
483
484public override bool IsInfinite(BulletShape shape);
485
486public override void SetLocalScaling(BulletShape shape, Vector3 scale);
487
488public override Vector3 GetLocalScaling(BulletShape shape);
489
490public override Vector3 CalculateLocalInertia(BulletShape shape, float mass);
491
492public override int GetShapeType(BulletShape shape);
493
494public override void SetMargin(BulletShape shape, float val);
495
496public override float GetMargin(BulletShape shape);
497 */
498
499static class BSAPI
500{
501// =====================================================================================
502// Mesh, hull, shape and body creation helper routines
503[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
504public static extern IntPtr CreateMeshShape2(IntPtr world,
505 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
506 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
507
508[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
509public static extern IntPtr CreateHullShape2(IntPtr world,
510 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
511
512[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
513public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
514
515[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
516public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);
517
518[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
519public static extern bool IsNativeShape2(IntPtr shape);
520
521[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
522public static extern void SetShapeCollisionMargin2(IntPtr shape, float margin);
523
524[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
525public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale);
526
527[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
528public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree);
529
530[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
531public static extern int GetNumberOfCompoundChildren2(IntPtr cShape);
532
533[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
534public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot);
535
536[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
537public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
538
539[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
540public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
541
542[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
543public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape);
544
545[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
546public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape);
547
548[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
549public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id);
550
551[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
552public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo);
553
554[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
555public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
556
557[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
558public static extern int GetBodyType2(IntPtr obj);
559
560[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
561public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
562
563[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
564public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot);
565
566[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
567public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
568
569[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
570public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
571
572[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
573public static extern void ReleaseBodyInfo2(IntPtr obj);
574
575[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
576public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
577
578}
579}
580
581// ===============================================================================
582// ===============================================================================
583// ===============================================================================
584// ===============================================================================
585// ===============================================================================
586// ===============================================================================
587// ===============================================================================
588// ===============================================================================
589// ===============================================================================
590// ===============================================================================
591// ===============================================================================
592// ===============================================================================
593// ===============================================================================
594static class BulletSimAPI {
595// ===============================================================================
596// Link back to the managed code for outputting log messages
597[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
598public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);
599
600// ===============================================================================
601// Initialization and simulation
602[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
603public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
604 int maxCollisions, IntPtr collisionArray,
605 int maxUpdates, IntPtr updateArray,
606 DebugLogCallback logRoutine);
607
608[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
609public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value);
610
611[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
612public static extern void SetHeightMap2(IntPtr world, float[] heightmap);
613
614[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
615public static extern void Shutdown2(IntPtr sim);
616
617[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
618public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
619 out int updatedEntityCount,
620 out IntPtr updatedEntitiesPtr,
621 out int collidersCount,
622 out IntPtr collidersPtr);
623
624[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
625public static extern bool PushUpdate2(IntPtr obj);
626
627// =====================================================================================
628// Terrain creation and helper routines
629[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
630public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
631 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
632
633[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
634public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
635 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
636
637[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
638public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
639
640[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
641public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
642
643[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
644public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
645
646// =====================================================================================
647// Constraint creation and helper routines
648[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
649public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
650 Vector3 frame1loc, Quaternion frame1rot,
651 Vector3 frame2loc, Quaternion frame2rot,
652 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
653
654[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
655public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2,
656 Vector3 joinPoint,
657 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
658
659[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
660public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
661 Vector3 pivotinA, Vector3 pivotinB,
662 Vector3 axisInA, Vector3 axisInB,
663 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
664
665[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
666public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse);
667
668[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
669public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations);
670
671[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
672public static extern bool SetFrames2(IntPtr constrain,
673 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
674
675[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
676public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
677
678[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
679public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
680
681[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
682public static extern bool UseFrameOffset2(IntPtr constrain, float enable);
683
684[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
685public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce);
686
687[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
688public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold);
689
690[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
691public static extern bool CalculateTransforms2(IntPtr constrain);
692
693[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
694public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
695
696[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
697public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain);
698
699// =====================================================================================
700// btCollisionWorld entries
701[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
702public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj);
703
704[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
705public static extern void UpdateAabbs2(IntPtr world);
706
707[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
708public static extern bool GetForceUpdateAllAabbs2(IntPtr world);
709
710[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
711public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force);
712
713// =====================================================================================
714// btDynamicsWorld entries
715[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
716public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
717
718[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
719public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
720
721[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
722public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects);
723
724[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
725public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain);
726// =====================================================================================
727// btCollisionObject entries
728[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
729public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain);
730
731[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
732public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict);
733
734[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
735public static extern bool HasAnisotripicFriction2(IntPtr constrain);
736
737[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
738public static extern void SetContactProcessingThreshold2(IntPtr obj, float val);
739
740[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
741public static extern float GetContactProcessingThreshold2(IntPtr obj);
742
743[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
744public static extern bool IsStaticObject2(IntPtr obj);
745
746[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
747public static extern bool IsKinematicObject2(IntPtr obj);
748
749[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
750public static extern bool IsStaticOrKinematicObject2(IntPtr obj);
751
752[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
753public static extern bool HasContactResponse2(IntPtr obj);
754
755[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
756public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape);
757
758[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
759public static extern IntPtr GetCollisionShape2(IntPtr obj);
760
761[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
762public static extern int GetActivationState2(IntPtr obj);
763
764[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
765public static extern void SetActivationState2(IntPtr obj, int state);
766
767[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
768public static extern void SetDeactivationTime2(IntPtr obj, float dtime);
769
770[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
771public static extern float GetDeactivationTime2(IntPtr obj);
772
773[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
774public static extern void ForceActivationState2(IntPtr obj, ActivationState state);
775
776[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
777public static extern void Activate2(IntPtr obj, bool forceActivation);
778
779[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
780public static extern bool IsActive2(IntPtr obj);
781
782[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
783public static extern void SetRestitution2(IntPtr obj, float val);
784
785[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
786public static extern float GetRestitution2(IntPtr obj);
787
788[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
789public static extern void SetFriction2(IntPtr obj, float val);
790
791[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
792public static extern float GetFriction2(IntPtr obj);
793
794 /* Haven't defined the type 'Transform'
795[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
796public static extern Transform GetWorldTransform2(IntPtr obj);
797
798[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
799public static extern void setWorldTransform2(IntPtr obj, Transform trans);
800 */
801
802[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
803public static extern Vector3 GetPosition2(IntPtr obj);
804
805[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
806public static extern Quaternion GetOrientation2(IntPtr obj);
807
808[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
809public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
810
811[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
812public static extern IntPtr GetBroadphaseHandle2(IntPtr obj);
813
814[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
815public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle);
816
817 /*
818[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
819public static extern Transform GetInterpolationWorldTransform2(IntPtr obj);
820
821[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
822public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
823 */
824
825[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
826public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel);
827
828[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
829public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel);
830
831[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
832public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel);
833
834[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
835public static extern float GetHitFraction2(IntPtr obj);
836
837[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
838public static extern void SetHitFraction2(IntPtr obj, float val);
839
840[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
841public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
842
843[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
844public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags);
845
846[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
847public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags);
848
849[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
850public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
851
852[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
853public static extern float GetCcdMotionThreshold2(IntPtr obj);
854
855[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
856public static extern void SetCcdMotionThreshold2(IntPtr obj, float val);
857
858[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
859public static extern float GetCcdSweptSphereRadius2(IntPtr obj);
860
861[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
862public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val);
863
864[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
865public static extern IntPtr GetUserPointer2(IntPtr obj);
866
867[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
868public static extern void SetUserPointer2(IntPtr obj, IntPtr val);
869
870// =====================================================================================
871// btRigidBody entries
872[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
873public static extern void ApplyGravity2(IntPtr obj);
874
875[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
876public static extern void SetGravity2(IntPtr obj, Vector3 val);
877
878[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
879public static extern Vector3 GetGravity2(IntPtr obj);
880
881[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
882public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
883
884[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
885public static extern void SetLinearDamping2(IntPtr obj, float lin_damping);
886
887[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
888public static extern void SetAngularDamping2(IntPtr obj, float ang_damping);
889
890[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
891public static extern float GetLinearDamping2(IntPtr obj);
892
893[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
894public static extern float GetAngularDamping2(IntPtr obj);
895
896[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
897public static extern float GetLinearSleepingThreshold2(IntPtr obj);
898
899[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
900public static extern float GetAngularSleepingThreshold2(IntPtr obj);
901
902[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
903public static extern void ApplyDamping2(IntPtr obj, float timeStep);
904
905[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
906public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
907
908[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
909public static extern Vector3 GetLinearFactor2(IntPtr obj);
910
911[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
912public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor);
913
914 /*
915[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
916public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans);
917 */
918
919[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
920public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot);
921
922// Add a force to the object as if its mass is one.
923[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
924public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force);
925
926// Set the force being applied to the object as if its mass is one.
927[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
928public static extern void SetObjectForce2(IntPtr obj, Vector3 force);
929
930[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
931public static extern Vector3 GetTotalForce2(IntPtr obj);
932
933[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
934public static extern Vector3 GetTotalTorque2(IntPtr obj);
935
936[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
937public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj);
938
939[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
940public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert);
941
942[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
943public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
944
945[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
946public static extern void ApplyTorque2(IntPtr obj, Vector3 torque);
947
948// Apply force at the given point. Will add torque to the object.
949[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
950public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos);
951
952// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
953[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
954public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp);
955
956// Apply impulse to the object's torque. Force is scaled by object's mass.
957[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
958public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp);
959
960// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
961[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
962public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos);
963
964[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
965public static extern void ClearForces2(IntPtr obj);
966
967[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
968public static extern void ClearAllForces2(IntPtr obj);
969
970[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
971public static extern void UpdateInertiaTensor2(IntPtr obj);
972
973[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
974public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj);
975
976 /*
977[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
978public static extern Transform GetCenterOfMassTransform2(IntPtr obj);
979 */
980
981[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
982public static extern Vector3 GetLinearVelocity2(IntPtr obj);
983
984[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
985public static extern Vector3 GetAngularVelocity2(IntPtr obj);
986
987[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
988public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val);
989
990[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
991public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
992
993[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
994public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos);
995
996[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
997public static extern void Translate2(IntPtr obj, Vector3 trans);
998
999[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1000public static extern void UpdateDeactivation2(IntPtr obj, float timeStep);
1001
1002[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1003public static extern bool WantsSleeping2(IntPtr obj);
1004
1005[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1006public static extern void SetAngularFactor2(IntPtr obj, float factor);
1007
1008[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1009public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor);
1010
1011[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1012public static extern Vector3 GetAngularFactor2(IntPtr obj);
1013
1014[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1015public static extern bool IsInWorld2(IntPtr obj);
1016
1017[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1018public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain);
1019
1020[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1021public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain);
1022
1023[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1024public static extern IntPtr GetConstraintRef2(IntPtr obj, int index);
1025
1026[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1027public static extern int GetNumConstraintRefs2(IntPtr obj);
1028
1029[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1030public static extern bool SetCollisionGroupMask2(IntPtr body, uint filter, uint mask);
1031
1032// =====================================================================================
1033// btCollisionShape entries
1034
1035[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1036public static extern float GetAngularMotionDisc2(IntPtr shape);
1037
1038[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1039public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor);
1040
1041[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1042public static extern bool IsPolyhedral2(IntPtr shape);
1043
1044[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1045public static extern bool IsConvex2d2(IntPtr shape);
1046
1047[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1048public static extern bool IsConvex2(IntPtr shape);
1049
1050[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1051public static extern bool IsNonMoving2(IntPtr shape);
1052
1053[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1054public static extern bool IsConcave2(IntPtr shape);
1055
1056[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1057public static extern bool IsCompound2(IntPtr shape);
1058
1059[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1060public static extern bool IsSoftBody2(IntPtr shape);
1061
1062[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1063public static extern bool IsInfinite2(IntPtr shape);
1064
1065[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1066public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale);
1067
1068[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1069public static extern Vector3 GetLocalScaling2(IntPtr shape);
1070
1071[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1072public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass);
1073
1074[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1075public static extern int GetShapeType2(IntPtr shape);
1076
1077[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1078public static extern void SetMargin2(IntPtr shape, float val);
1079
1080[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1081public static extern float GetMargin2(IntPtr shape);
1082
1083// =====================================================================================
1084// Debugging
1085[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1086public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject);
1087
1088[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1089public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape);
1090
1091[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1092public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo);
1093
1094[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1095public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain);
1096
1097[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1098public static extern void DumpActivationInfo2(IntPtr sim);
1099
1100[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1101public static extern void DumpAllInfo2(IntPtr sim);
1102
1103[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1104public static extern void DumpPhysicsStatistics2(IntPtr sim);
1105
1106}
1107}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
new file mode 100755
index 0000000..a56a817
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -0,0 +1,39 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Linq;
30using System.Text;
31
32namespace OpenSim.Region.Physics.BulletSPlugin
33{
34 /*
35public sealed class BSAPIXNA : BulletSimAPITemplate
36{
37}
38 */
39}