diff options
author | Robert Adams | 2012-12-30 14:26:57 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-31 19:57:23 -0800 |
commit | c2a7af18b639646b647eb4cdff4168a2b9746ee4 (patch) | |
tree | afe36195792b9990f7defd18bc29791f7527dcff /OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | |
parent | BulletSim: remove all the debug printing of pointer formatting (.ToString(X))... (diff) | |
download | opensim-SC_OLD-c2a7af18b639646b647eb4cdff4168a2b9746ee4.zip opensim-SC_OLD-c2a7af18b639646b647eb4cdff4168a2b9746ee4.tar.gz opensim-SC_OLD-c2a7af18b639646b647eb4cdff4168a2b9746ee4.tar.bz2 opensim-SC_OLD-c2a7af18b639646b647eb4cdff4168a2b9746ee4.tar.xz |
BulletSim: nearly complete in conversion from BulletSimAPI to BSAPITemplate. Only initialization and debug fuctions left.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | 664 |
1 files changed, 664 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs new file mode 100644 index 0000000..fbf362d --- /dev/null +++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | |||
@@ -0,0 +1,664 @@ | |||
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 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Runtime.InteropServices; | ||
30 | using System.Security; | ||
31 | using System.Text; | ||
32 | using OpenMetaverse; | ||
33 | |||
34 | namespace OpenSim.Region.Physics.BulletSPlugin { | ||
35 | |||
36 | // Constraint type values as defined by Bullet | ||
37 | public enum ConstraintType : int | ||
38 | { | ||
39 | POINT2POINT_CONSTRAINT_TYPE = 3, | ||
40 | HINGE_CONSTRAINT_TYPE, | ||
41 | CONETWIST_CONSTRAINT_TYPE, | ||
42 | D6_CONSTRAINT_TYPE, | ||
43 | SLIDER_CONSTRAINT_TYPE, | ||
44 | CONTACT_CONSTRAINT_TYPE, | ||
45 | D6_SPRING_CONSTRAINT_TYPE, | ||
46 | MAX_CONSTRAINT_TYPE | ||
47 | } | ||
48 | |||
49 | // =============================================================================== | ||
50 | [StructLayout(LayoutKind.Sequential)] | ||
51 | public struct ConvexHull | ||
52 | { | ||
53 | Vector3 Offset; | ||
54 | int VertexCount; | ||
55 | Vector3[] Vertices; | ||
56 | } | ||
57 | public enum BSPhysicsShapeType | ||
58 | { | ||
59 | SHAPE_UNKNOWN = 0, | ||
60 | SHAPE_CAPSULE = 1, | ||
61 | SHAPE_BOX = 2, | ||
62 | SHAPE_CONE = 3, | ||
63 | SHAPE_CYLINDER = 4, | ||
64 | SHAPE_SPHERE = 5, | ||
65 | SHAPE_MESH = 6, | ||
66 | SHAPE_HULL = 7, | ||
67 | // following defined by BulletSim | ||
68 | SHAPE_GROUNDPLANE = 20, | ||
69 | SHAPE_TERRAIN = 21, | ||
70 | SHAPE_COMPOUND = 22, | ||
71 | SHAPE_HEIGHTMAP = 23, | ||
72 | SHAPE_AVATAR = 24, | ||
73 | }; | ||
74 | |||
75 | // The native shapes have predefined shape hash keys | ||
76 | public enum FixedShapeKey : ulong | ||
77 | { | ||
78 | KEY_NONE = 0, | ||
79 | KEY_BOX = 1, | ||
80 | KEY_SPHERE = 2, | ||
81 | KEY_CONE = 3, | ||
82 | KEY_CYLINDER = 4, | ||
83 | KEY_CAPSULE = 5, | ||
84 | KEY_AVATAR = 6, | ||
85 | } | ||
86 | |||
87 | [StructLayout(LayoutKind.Sequential)] | ||
88 | public struct ShapeData | ||
89 | { | ||
90 | public uint ID; | ||
91 | public BSPhysicsShapeType Type; | ||
92 | public Vector3 Position; | ||
93 | public Quaternion Rotation; | ||
94 | public Vector3 Velocity; | ||
95 | public Vector3 Scale; | ||
96 | public float Mass; | ||
97 | public float Buoyancy; | ||
98 | public System.UInt64 HullKey; | ||
99 | public System.UInt64 MeshKey; | ||
100 | public float Friction; | ||
101 | public float Restitution; | ||
102 | public float Collidable; // true of things bump into this | ||
103 | public float Static; // true if a static object. Otherwise gravity, etc. | ||
104 | public float Solid; // true if object cannot be passed through | ||
105 | public Vector3 Size; | ||
106 | |||
107 | // note that bools are passed as floats since bool size changes by language and architecture | ||
108 | public const float numericTrue = 1f; | ||
109 | public const float numericFalse = 0f; | ||
110 | } | ||
111 | [StructLayout(LayoutKind.Sequential)] | ||
112 | public struct SweepHit | ||
113 | { | ||
114 | public uint ID; | ||
115 | public float Fraction; | ||
116 | public Vector3 Normal; | ||
117 | public Vector3 Point; | ||
118 | } | ||
119 | [StructLayout(LayoutKind.Sequential)] | ||
120 | public struct RaycastHit | ||
121 | { | ||
122 | public uint ID; | ||
123 | public float Fraction; | ||
124 | public Vector3 Normal; | ||
125 | } | ||
126 | [StructLayout(LayoutKind.Sequential)] | ||
127 | public struct CollisionDesc | ||
128 | { | ||
129 | public uint aID; | ||
130 | public uint bID; | ||
131 | public Vector3 point; | ||
132 | public Vector3 normal; | ||
133 | } | ||
134 | [StructLayout(LayoutKind.Sequential)] | ||
135 | public struct EntityProperties | ||
136 | { | ||
137 | public uint ID; | ||
138 | public Vector3 Position; | ||
139 | public Quaternion Rotation; | ||
140 | public Vector3 Velocity; | ||
141 | public Vector3 Acceleration; | ||
142 | public Vector3 RotationalVelocity; | ||
143 | } | ||
144 | |||
145 | // Format of this structure must match the definition in the C++ code | ||
146 | // NOTE: adding the X causes compile breaks if used. These are unused symbols | ||
147 | // that can be removed from both here and the unmanaged definition of this structure. | ||
148 | [StructLayout(LayoutKind.Sequential)] | ||
149 | public struct ConfigurationParameters | ||
150 | { | ||
151 | public float defaultFriction; | ||
152 | public float defaultDensity; | ||
153 | public float defaultRestitution; | ||
154 | public float collisionMargin; | ||
155 | public float gravity; | ||
156 | |||
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; | ||
184 | public float maxCollisionAlgorithmPoolSize; | ||
185 | public float shouldDisableContactPoolDynamicAllocation; | ||
186 | public float shouldForceUpdateAllAabbs; | ||
187 | public float shouldRandomizeSolverOrder; | ||
188 | public float shouldSplitSimulationIslands; | ||
189 | public float shouldEnableFrictionCaching; | ||
190 | public float numberOfSolverIterations; | ||
191 | |||
192 | public float XlinksetImplementation; | ||
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 physicsLoggingFrames; | ||
202 | |||
203 | public const float numericTrue = 1f; | ||
204 | public const float numericFalse = 0f; | ||
205 | } | ||
206 | |||
207 | |||
208 | // The states a bullet collision object can have | ||
209 | public enum ActivationState : uint | ||
210 | { | ||
211 | ACTIVE_TAG = 1, | ||
212 | ISLAND_SLEEPING, | ||
213 | WANTS_DEACTIVATION, | ||
214 | DISABLE_DEACTIVATION, | ||
215 | DISABLE_SIMULATION, | ||
216 | } | ||
217 | |||
218 | public enum CollisionObjectTypes : int | ||
219 | { | ||
220 | CO_COLLISION_OBJECT = 1 << 0, | ||
221 | CO_RIGID_BODY = 1 << 1, | ||
222 | CO_GHOST_OBJECT = 1 << 2, | ||
223 | CO_SOFT_BODY = 1 << 3, | ||
224 | CO_HF_FLUID = 1 << 4, | ||
225 | CO_USER_TYPE = 1 << 5, | ||
226 | } | ||
227 | |||
228 | // Values used by Bullet and BulletSim to control object properties. | ||
229 | // Bullet's "CollisionFlags" has more to do with operations on the | ||
230 | // object (if collisions happen, if gravity effects it, ...). | ||
231 | public enum CollisionFlags : uint | ||
232 | { | ||
233 | CF_STATIC_OBJECT = 1 << 0, | ||
234 | CF_KINEMATIC_OBJECT = 1 << 1, | ||
235 | CF_NO_CONTACT_RESPONSE = 1 << 2, | ||
236 | CF_CUSTOM_MATERIAL_CALLBACK = 1 << 3, | ||
237 | CF_CHARACTER_OBJECT = 1 << 4, | ||
238 | CF_DISABLE_VISUALIZE_OBJECT = 1 << 5, | ||
239 | CF_DISABLE_SPU_COLLISION_PROCESS = 1 << 6, | ||
240 | // Following used by BulletSim to control collisions and updates | ||
241 | BS_SUBSCRIBE_COLLISION_EVENTS = 1 << 10, | ||
242 | BS_FLOATS_ON_WATER = 1 << 11, | ||
243 | BS_VEHICLE_COLLISIONS = 1 << 12, | ||
244 | BS_NONE = 0, | ||
245 | BS_ALL = 0xFFFFFFFF | ||
246 | }; | ||
247 | |||
248 | // Values f collisions groups and masks | ||
249 | public enum CollisionFilterGroups : uint | ||
250 | { | ||
251 | // Don't use the bit definitions!! Define the use in a | ||
252 | // filter/mask definition below. This way collision interactions | ||
253 | // are more easily found and debugged. | ||
254 | BNoneGroup = 0, | ||
255 | BDefaultGroup = 1 << 0, // 0001 | ||
256 | BStaticGroup = 1 << 1, // 0002 | ||
257 | BKinematicGroup = 1 << 2, // 0004 | ||
258 | BDebrisGroup = 1 << 3, // 0008 | ||
259 | BSensorTrigger = 1 << 4, // 0010 | ||
260 | BCharacterGroup = 1 << 5, // 0020 | ||
261 | BAllGroup = 0x000FFFFF, | ||
262 | // Filter groups defined by BulletSim | ||
263 | BGroundPlaneGroup = 1 << 10, // 0400 | ||
264 | BTerrainGroup = 1 << 11, // 0800 | ||
265 | BRaycastGroup = 1 << 12, // 1000 | ||
266 | BSolidGroup = 1 << 13, // 2000 | ||
267 | // BLinksetGroup = xx // a linkset proper is either static or dynamic | ||
268 | BLinksetChildGroup = 1 << 14, // 4000 | ||
269 | }; | ||
270 | |||
271 | // CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 | ||
272 | // ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2. | ||
273 | public enum ConstraintParams : int | ||
274 | { | ||
275 | BT_CONSTRAINT_ERP = 1, // this one is not used in Bullet as of 20120730 | ||
276 | BT_CONSTRAINT_STOP_ERP, | ||
277 | BT_CONSTRAINT_CFM, | ||
278 | BT_CONSTRAINT_STOP_CFM, | ||
279 | }; | ||
280 | public enum ConstraintParamAxis : int | ||
281 | { | ||
282 | AXIS_LINEAR_X = 0, | ||
283 | AXIS_LINEAR_Y, | ||
284 | AXIS_LINEAR_Z, | ||
285 | AXIS_ANGULAR_X, | ||
286 | AXIS_ANGULAR_Y, | ||
287 | AXIS_ANGULAR_Z, | ||
288 | AXIS_LINEAR_ALL = 20, // these last three added by BulletSim so we don't have to do zillions of calls | ||
289 | AXIS_ANGULAR_ALL, | ||
290 | AXIS_ALL | ||
291 | }; | ||
292 | |||
293 | public abstract class BSAPITemplate | ||
294 | { | ||
295 | /* | ||
296 | // Initialization and simulation | ||
297 | public abstract BulletWorld Initialize(Vector3 maxPosition, IntPtr parms, | ||
298 | int maxCollisions, IntPtr collisionArray, | ||
299 | int maxUpdates, IntPtr updateArray | ||
300 | ); | ||
301 | |||
302 | public abstract bool UpdateParameter(BulletWorld world, uint localID, String parm, float value); | ||
303 | |||
304 | public abstract void SetHeightMap(BulletWorld world, float[] heightmap); | ||
305 | |||
306 | public abstract void Shutdown(BulletWorld sim); | ||
307 | |||
308 | public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, | ||
309 | out int updatedEntityCount, | ||
310 | out IntPtr updatedEntitiesPtr, | ||
311 | out int collidersCount, | ||
312 | out IntPtr collidersPtr); | ||
313 | |||
314 | */ | ||
315 | public abstract bool PushUpdate(BulletBody obj); | ||
316 | |||
317 | // ===================================================================================== | ||
318 | // Mesh, hull, shape and body creation helper routines | ||
319 | public abstract BulletShape CreateMeshShape(BulletWorld world, | ||
320 | int indicesCount, int[] indices, | ||
321 | int verticesCount, float[] vertices ); | ||
322 | |||
323 | public abstract BulletShape CreateHullShape(BulletWorld world, | ||
324 | int hullCount, float[] hulls); | ||
325 | |||
326 | public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape); | ||
327 | |||
328 | public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData); | ||
329 | |||
330 | public abstract bool IsNativeShape(BulletShape shape); | ||
331 | |||
332 | public abstract void SetShapeCollisionMargin(BulletShape shape, float margin); | ||
333 | |||
334 | public abstract BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale); | ||
335 | |||
336 | public abstract BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree); | ||
337 | |||
338 | public abstract int GetNumberOfCompoundChildren(BulletShape cShape); | ||
339 | |||
340 | public abstract void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot); | ||
341 | |||
342 | public abstract BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx); | ||
343 | |||
344 | public abstract BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx); | ||
345 | |||
346 | public abstract void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape); | ||
347 | |||
348 | public abstract void RecalculateCompoundShapeLocalAabb(BulletShape cShape); | ||
349 | |||
350 | public abstract BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id); | ||
351 | |||
352 | public abstract BulletBody CreateBodyFromShapeAndInfo(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo); | ||
353 | |||
354 | public abstract bool DeleteCollisionShape(BulletWorld world, BulletShape shape); | ||
355 | |||
356 | public abstract int GetBodyType(BulletBody obj); | ||
357 | |||
358 | public abstract BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); | ||
359 | |||
360 | public abstract BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot); | ||
361 | |||
362 | public abstract BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot); | ||
363 | |||
364 | public abstract IntPtr AllocateBodyInfo(BulletBody obj); | ||
365 | |||
366 | public abstract void ReleaseBodyInfo(IntPtr obj); | ||
367 | |||
368 | public abstract void DestroyObject(BulletWorld sim, BulletBody obj); | ||
369 | |||
370 | // ===================================================================================== | ||
371 | // Terrain creation and helper routines | ||
372 | public abstract IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords, | ||
373 | float[] heightMap, float collisionMargin); | ||
374 | |||
375 | public abstract IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, | ||
376 | float[] heightMap, float collisionMargin); | ||
377 | |||
378 | public abstract bool ReleaseHeightMapInfo(IntPtr heightMapInfo); | ||
379 | |||
380 | public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin); | ||
381 | |||
382 | public abstract BulletShape CreateTerrainShape(IntPtr mapInfo); | ||
383 | |||
384 | // ===================================================================================== | ||
385 | // Constraint creation and helper routines | ||
386 | public abstract BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
387 | Vector3 frame1loc, Quaternion frame1rot, | ||
388 | Vector3 frame2loc, Quaternion frame2rot, | ||
389 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
390 | |||
391 | public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
392 | Vector3 joinPoint, | ||
393 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
394 | |||
395 | public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
396 | Vector3 pivotinA, Vector3 pivotinB, | ||
397 | Vector3 axisInA, Vector3 axisInB, | ||
398 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
399 | |||
400 | public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); | ||
401 | |||
402 | public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); | ||
403 | |||
404 | public abstract bool SetFrames(BulletConstraint constrain, | ||
405 | Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); | ||
406 | |||
407 | public abstract bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi); | ||
408 | |||
409 | public abstract bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi); | ||
410 | |||
411 | public abstract bool UseFrameOffset(BulletConstraint constrain, float enable); | ||
412 | |||
413 | public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce); | ||
414 | |||
415 | public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); | ||
416 | |||
417 | public abstract bool CalculateTransforms(BulletConstraint constrain); | ||
418 | |||
419 | public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | ||
420 | |||
421 | public abstract bool DestroyConstraint(BulletWorld world, BulletConstraint constrain); | ||
422 | |||
423 | // ===================================================================================== | ||
424 | // btCollisionWorld entries | ||
425 | public abstract void UpdateSingleAabb(BulletWorld world, BulletBody obj); | ||
426 | |||
427 | public abstract void UpdateAabbs(BulletWorld world); | ||
428 | |||
429 | public abstract bool GetForceUpdateAllAabbs(BulletWorld world); | ||
430 | |||
431 | public abstract void SetForceUpdateAllAabbs(BulletWorld world, bool force); | ||
432 | |||
433 | // ===================================================================================== | ||
434 | // btDynamicsWorld entries | ||
435 | public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj); | ||
436 | |||
437 | public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); | ||
438 | |||
439 | public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); | ||
440 | |||
441 | public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); | ||
442 | // ===================================================================================== | ||
443 | // btCollisionObject entries | ||
444 | public abstract Vector3 GetAnisotripicFriction(BulletConstraint constrain); | ||
445 | |||
446 | public abstract Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict); | ||
447 | |||
448 | public abstract bool HasAnisotripicFriction(BulletConstraint constrain); | ||
449 | |||
450 | public abstract void SetContactProcessingThreshold(BulletBody obj, float val); | ||
451 | |||
452 | public abstract float GetContactProcessingThreshold(BulletBody obj); | ||
453 | |||
454 | public abstract bool IsStaticObject(BulletBody obj); | ||
455 | |||
456 | public abstract bool IsKinematicObject(BulletBody obj); | ||
457 | |||
458 | public abstract bool IsStaticOrKinematicObject(BulletBody obj); | ||
459 | |||
460 | public abstract bool HasContactResponse(BulletBody obj); | ||
461 | |||
462 | public abstract void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletShape shape); | ||
463 | |||
464 | public abstract BulletShape GetCollisionShape(BulletBody obj); | ||
465 | |||
466 | public abstract int GetActivationState(BulletBody obj); | ||
467 | |||
468 | public abstract void SetActivationState(BulletBody obj, int state); | ||
469 | |||
470 | public abstract void SetDeactivationTime(BulletBody obj, float dtime); | ||
471 | |||
472 | public abstract float GetDeactivationTime(BulletBody obj); | ||
473 | |||
474 | public abstract void ForceActivationState(BulletBody obj, ActivationState state); | ||
475 | |||
476 | public abstract void Activate(BulletBody obj, bool forceActivation); | ||
477 | |||
478 | public abstract bool IsActive(BulletBody obj); | ||
479 | |||
480 | public abstract void SetRestitution(BulletBody obj, float val); | ||
481 | |||
482 | public abstract float GetRestitution(BulletBody obj); | ||
483 | |||
484 | public abstract void SetFriction(BulletBody obj, float val); | ||
485 | |||
486 | public abstract float GetFriction(BulletBody obj); | ||
487 | |||
488 | public abstract Vector3 GetPosition(BulletBody obj); | ||
489 | |||
490 | public abstract Quaternion GetOrientation(BulletBody obj); | ||
491 | |||
492 | public abstract void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation); | ||
493 | |||
494 | public abstract IntPtr GetBroadphaseHandle(BulletBody obj); | ||
495 | |||
496 | public abstract void SetBroadphaseHandle(BulletBody obj, IntPtr handle); | ||
497 | |||
498 | public abstract void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel); | ||
499 | |||
500 | public abstract void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel); | ||
501 | |||
502 | public abstract void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel); | ||
503 | |||
504 | public abstract float GetHitFraction(BulletBody obj); | ||
505 | |||
506 | public abstract void SetHitFraction(BulletBody obj, float val); | ||
507 | |||
508 | public abstract CollisionFlags GetCollisionFlags(BulletBody obj); | ||
509 | |||
510 | public abstract CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags); | ||
511 | |||
512 | public abstract CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags); | ||
513 | |||
514 | public abstract CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags); | ||
515 | |||
516 | public abstract float GetCcdMotionThreshold(BulletBody obj); | ||
517 | |||
518 | public abstract void SetCcdMotionThreshold(BulletBody obj, float val); | ||
519 | |||
520 | public abstract float GetCcdSweptSphereRadius(BulletBody obj); | ||
521 | |||
522 | public abstract void SetCcdSweptSphereRadius(BulletBody obj, float val); | ||
523 | |||
524 | public abstract IntPtr GetUserPointer(BulletBody obj); | ||
525 | |||
526 | public abstract void SetUserPointer(BulletBody obj, IntPtr val); | ||
527 | |||
528 | // ===================================================================================== | ||
529 | // btRigidBody entries | ||
530 | public abstract void ApplyGravity(BulletBody obj); | ||
531 | |||
532 | public abstract void SetGravity(BulletBody obj, Vector3 val); | ||
533 | |||
534 | public abstract Vector3 GetGravity(BulletBody obj); | ||
535 | |||
536 | public abstract void SetDamping(BulletBody obj, float lin_damping, float ang_damping); | ||
537 | |||
538 | public abstract void SetLinearDamping(BulletBody obj, float lin_damping); | ||
539 | |||
540 | public abstract void SetAngularDamping(BulletBody obj, float ang_damping); | ||
541 | |||
542 | public abstract float GetLinearDamping(BulletBody obj); | ||
543 | |||
544 | public abstract float GetAngularDamping(BulletBody obj); | ||
545 | |||
546 | public abstract float GetLinearSleepingThreshold(BulletBody obj); | ||
547 | |||
548 | public abstract void ApplyDamping(BulletBody obj, float timeStep); | ||
549 | |||
550 | public abstract void SetMassProps(BulletBody obj, float mass, Vector3 inertia); | ||
551 | |||
552 | public abstract Vector3 GetLinearFactor(BulletBody obj); | ||
553 | |||
554 | public abstract void SetLinearFactor(BulletBody obj, Vector3 factor); | ||
555 | |||
556 | public abstract void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot); | ||
557 | |||
558 | // Add a force to the object as if its mass is one. | ||
559 | public abstract void ApplyCentralForce(BulletBody obj, Vector3 force); | ||
560 | |||
561 | // Set the force being applied to the object as if its mass is one. | ||
562 | public abstract void SetObjectForce(BulletBody obj, Vector3 force); | ||
563 | |||
564 | public abstract Vector3 GetTotalForce(BulletBody obj); | ||
565 | |||
566 | public abstract Vector3 GetTotalTorque(BulletBody obj); | ||
567 | |||
568 | public abstract Vector3 GetInvInertiaDiagLocal(BulletBody obj); | ||
569 | |||
570 | public abstract void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert); | ||
571 | |||
572 | public abstract void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold); | ||
573 | |||
574 | public abstract void ApplyTorque(BulletBody obj, Vector3 torque); | ||
575 | |||
576 | // Apply force at the given point. Will add torque to the object. | ||
577 | public abstract void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos); | ||
578 | |||
579 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | ||
580 | public abstract void ApplyCentralImpulse(BulletBody obj, Vector3 imp); | ||
581 | |||
582 | // Apply impulse to the object's torque. Force is scaled by object's mass. | ||
583 | public abstract void ApplyTorqueImpulse(BulletBody obj, Vector3 imp); | ||
584 | |||
585 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | ||
586 | public abstract void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos); | ||
587 | |||
588 | public abstract void ClearForces(BulletBody obj); | ||
589 | |||
590 | public abstract void ClearAllForces(BulletBody obj); | ||
591 | |||
592 | public abstract void UpdateInertiaTensor(BulletBody obj); | ||
593 | |||
594 | public abstract Vector3 GetLinearVelocity(BulletBody obj); | ||
595 | |||
596 | public abstract Vector3 GetAngularVelocity(BulletBody obj); | ||
597 | |||
598 | public abstract void SetLinearVelocity(BulletBody obj, Vector3 val); | ||
599 | |||
600 | public abstract void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity); | ||
601 | |||
602 | public abstract Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos); | ||
603 | |||
604 | public abstract void Translate(BulletBody obj, Vector3 trans); | ||
605 | |||
606 | public abstract void UpdateDeactivation(BulletBody obj, float timeStep); | ||
607 | |||
608 | public abstract bool WantsSleeping(BulletBody obj); | ||
609 | |||
610 | public abstract void SetAngularFactor(BulletBody obj, float factor); | ||
611 | |||
612 | public abstract void SetAngularFactorV(BulletBody obj, Vector3 factor); | ||
613 | |||
614 | public abstract Vector3 GetAngularFactor(BulletBody obj); | ||
615 | |||
616 | public abstract bool IsInWorld(BulletBody obj); | ||
617 | |||
618 | public abstract void AddConstraintRef(BulletBody obj, BulletConstraint constrain); | ||
619 | |||
620 | public abstract void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain); | ||
621 | |||
622 | public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index); | ||
623 | |||
624 | public abstract int GetNumConstraintRefs(BulletBody obj); | ||
625 | |||
626 | public abstract bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask); | ||
627 | |||
628 | // ===================================================================================== | ||
629 | // btCollisionShape entries | ||
630 | |||
631 | public abstract float GetAngularMotionDisc(BulletShape shape); | ||
632 | |||
633 | public abstract float GetContactBreakingThreshold(BulletShape shape, float defaultFactor); | ||
634 | |||
635 | public abstract bool IsPolyhedral(BulletShape shape); | ||
636 | |||
637 | public abstract bool IsConvex2d(BulletShape shape); | ||
638 | |||
639 | public abstract bool IsConvex(BulletShape shape); | ||
640 | |||
641 | public abstract bool IsNonMoving(BulletShape shape); | ||
642 | |||
643 | public abstract bool IsConcave(BulletShape shape); | ||
644 | |||
645 | public abstract bool IsCompound(BulletShape shape); | ||
646 | |||
647 | public abstract bool IsSoftBody(BulletShape shape); | ||
648 | |||
649 | public abstract bool IsInfinite(BulletShape shape); | ||
650 | |||
651 | public abstract void SetLocalScaling(BulletShape shape, Vector3 scale); | ||
652 | |||
653 | public abstract Vector3 GetLocalScaling(BulletShape shape); | ||
654 | |||
655 | public abstract Vector3 CalculateLocalInertia(BulletShape shape, float mass); | ||
656 | |||
657 | public abstract int GetShapeType(BulletShape shape); | ||
658 | |||
659 | public abstract void SetMargin(BulletShape shape, float val); | ||
660 | |||
661 | public abstract float GetMargin(BulletShape shape); | ||
662 | |||
663 | }; | ||
664 | } | ||