diff options
author | Robert Adams | 2012-10-31 14:49:28 -0700 |
---|---|---|
committer | Robert Adams | 2012-11-03 21:15:06 -0700 |
commit | 364a7c308804a3e331199ca60c6dfafa406b5d0d (patch) | |
tree | f9755f07a181265c57542d3df19879c20a924947 /OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |
parent | BulletSim: vehicle tweeking. (diff) | |
download | opensim-SC_OLD-364a7c308804a3e331199ca60c6dfafa406b5d0d.zip opensim-SC_OLD-364a7c308804a3e331199ca60c6dfafa406b5d0d.tar.gz opensim-SC_OLD-364a7c308804a3e331199ca60c6dfafa406b5d0d.tar.bz2 opensim-SC_OLD-364a7c308804a3e331199ca60c6dfafa406b5d0d.tar.xz |
BulletSim: rename BSBody and BSShape to PhysBody and PhysShape. Add skeleton of BSLinksetCompound.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 1219fc0..a38e650 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -106,11 +106,11 @@ public sealed class BSShapeCollection : IDisposable | |||
106 | // rebuild the body around it. | 106 | // rebuild the body around it. |
107 | // Updates prim.BSBody with information/pointers to requested body | 107 | // Updates prim.BSBody with information/pointers to requested body |
108 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, | 108 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, |
109 | prim.BSShape, shapeData, bodyCallback); | 109 | prim.PhysShape, shapeData, bodyCallback); |
110 | ret = newGeom || newBody; | 110 | ret = newGeom || newBody; |
111 | } | 111 | } |
112 | DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}", | 112 | DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}", |
113 | prim.LocalID, forceRebuild, ret, prim.BSBody, prim.BSShape); | 113 | prim.LocalID, forceRebuild, ret, prim.PhysBody, prim.PhysShape); |
114 | 114 | ||
115 | return ret; | 115 | return ret; |
116 | } | 116 | } |
@@ -337,7 +337,7 @@ public sealed class BSShapeCollection : IDisposable | |||
337 | // an avatar capsule is close to a native shape (it is not shared) | 337 | // an avatar capsule is close to a native shape (it is not shared) |
338 | ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR, | 338 | ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR, |
339 | ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); | 339 | ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); |
340 | DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.BSShape); | 340 | DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape); |
341 | ret = true; | 341 | ret = true; |
342 | haveShape = true; | 342 | haveShape = true; |
343 | } | 343 | } |
@@ -360,13 +360,13 @@ public sealed class BSShapeCollection : IDisposable | |||
360 | haveShape = true; | 360 | haveShape = true; |
361 | if (forceRebuild | 361 | if (forceRebuild |
362 | || prim.Scale != shapeData.Size | 362 | || prim.Scale != shapeData.Size |
363 | || prim.BSShape.type != ShapeData.PhysicsShapeType.SHAPE_SPHERE | 363 | || prim.PhysShape.type != ShapeData.PhysicsShapeType.SHAPE_SPHERE |
364 | ) | 364 | ) |
365 | { | 365 | { |
366 | ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_SPHERE, | 366 | ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_SPHERE, |
367 | ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback); | 367 | ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback); |
368 | DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", | 368 | DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", |
369 | prim.LocalID, forceRebuild, prim.BSShape); | 369 | prim.LocalID, forceRebuild, prim.PhysShape); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | if (pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) | 372 | if (pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) |
@@ -374,13 +374,13 @@ public sealed class BSShapeCollection : IDisposable | |||
374 | haveShape = true; | 374 | haveShape = true; |
375 | if (forceRebuild | 375 | if (forceRebuild |
376 | || prim.Scale != shapeData.Size | 376 | || prim.Scale != shapeData.Size |
377 | || prim.BSShape.type != ShapeData.PhysicsShapeType.SHAPE_BOX | 377 | || prim.PhysShape.type != ShapeData.PhysicsShapeType.SHAPE_BOX |
378 | ) | 378 | ) |
379 | { | 379 | { |
380 | ret = GetReferenceToNativeShape( prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_BOX, | 380 | ret = GetReferenceToNativeShape( prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_BOX, |
381 | ShapeData.FixedShapeKey.KEY_BOX, shapeCallback); | 381 | ShapeData.FixedShapeKey.KEY_BOX, shapeCallback); |
382 | DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", | 382 | DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", |
383 | prim.LocalID, forceRebuild, prim.BSShape); | 383 | prim.LocalID, forceRebuild, prim.PhysShape); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | } | 386 | } |
@@ -394,13 +394,13 @@ public sealed class BSShapeCollection : IDisposable | |||
394 | // Update prim.BSShape to reference a hull of this shape. | 394 | // Update prim.BSShape to reference a hull of this shape. |
395 | ret = GetReferenceToHull(prim, shapeData, pbs, shapeCallback); | 395 | ret = GetReferenceToHull(prim, shapeData, pbs, shapeCallback); |
396 | DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1},key={2}", | 396 | DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1},key={2}", |
397 | shapeData.ID, prim.BSShape, prim.BSShape.shapeKey.ToString("X")); | 397 | shapeData.ID, prim.PhysShape, prim.PhysShape.shapeKey.ToString("X")); |
398 | } | 398 | } |
399 | else | 399 | else |
400 | { | 400 | { |
401 | ret = GetReferenceToMesh(prim, shapeData, pbs, shapeCallback); | 401 | ret = GetReferenceToMesh(prim, shapeData, pbs, shapeCallback); |
402 | DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1},key={2}", | 402 | DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1},key={2}", |
403 | shapeData.ID, prim.BSShape, prim.BSShape.shapeKey.ToString("X")); | 403 | shapeData.ID, prim.PhysShape, prim.PhysShape.shapeKey.ToString("X")); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | return ret; | 406 | return ret; |
@@ -413,7 +413,7 @@ public sealed class BSShapeCollection : IDisposable | |||
413 | ShapeDestructionCallback shapeCallback) | 413 | ShapeDestructionCallback shapeCallback) |
414 | { | 414 | { |
415 | // release any previous shape | 415 | // release any previous shape |
416 | DereferenceShape(prim.BSShape, true, shapeCallback); | 416 | DereferenceShape(prim.PhysShape, true, shapeCallback); |
417 | 417 | ||
418 | shapeData.Type = shapeType; | 418 | shapeData.Type = shapeType; |
419 | // Bullet native objects are scaled by the Bullet engine so pass the size in | 419 | // Bullet native objects are scaled by the Bullet engine so pass the size in |
@@ -426,7 +426,7 @@ public sealed class BSShapeCollection : IDisposable | |||
426 | DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1},scale={2}", | 426 | DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1},scale={2}", |
427 | shapeData.ID, newShape, shapeData.Scale); | 427 | shapeData.ID, newShape, shapeData.Scale); |
428 | 428 | ||
429 | prim.BSShape = newShape; | 429 | prim.PhysShape = newShape; |
430 | return true; | 430 | return true; |
431 | } | 431 | } |
432 | 432 | ||
@@ -475,14 +475,14 @@ public sealed class BSShapeCollection : IDisposable | |||
475 | System.UInt64 newMeshKey = ComputeShapeKey(shapeData, pbs, out lod); | 475 | System.UInt64 newMeshKey = ComputeShapeKey(shapeData, pbs, out lod); |
476 | 476 | ||
477 | // if this new shape is the same as last time, don't recreate the mesh | 477 | // if this new shape is the same as last time, don't recreate the mesh |
478 | if (newMeshKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_MESH) | 478 | if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == ShapeData.PhysicsShapeType.SHAPE_MESH) |
479 | return false; | 479 | return false; |
480 | 480 | ||
481 | DetailLog("{0},BSShapeCollection.CreateGeomMesh,create,oldKey={1},newKey={2}", | 481 | DetailLog("{0},BSShapeCollection.CreateGeomMesh,create,oldKey={1},newKey={2}", |
482 | prim.LocalID, prim.BSShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); | 482 | prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); |
483 | 483 | ||
484 | // Since we're recreating new, get rid of the reference to the previous shape | 484 | // Since we're recreating new, get rid of the reference to the previous shape |
485 | DereferenceShape(prim.BSShape, true, shapeCallback); | 485 | DereferenceShape(prim.PhysShape, true, shapeCallback); |
486 | 486 | ||
487 | newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, pbs, shapeData.Size, lod); | 487 | newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, pbs, shapeData.Size, lod); |
488 | // Take evasive action if the mesh was not constructed. | 488 | // Take evasive action if the mesh was not constructed. |
@@ -492,7 +492,7 @@ public sealed class BSShapeCollection : IDisposable | |||
492 | 492 | ||
493 | // meshes are already scaled by the meshmerizer | 493 | // meshes are already scaled by the meshmerizer |
494 | prim.Scale = new OMV.Vector3(1f, 1f, 1f); | 494 | prim.Scale = new OMV.Vector3(1f, 1f, 1f); |
495 | prim.BSShape = newShape; | 495 | prim.PhysShape = newShape; |
496 | 496 | ||
497 | return true; // 'true' means a new shape has been added to this prim | 497 | return true; // 'true' means a new shape has been added to this prim |
498 | } | 498 | } |
@@ -550,14 +550,14 @@ public sealed class BSShapeCollection : IDisposable | |||
550 | System.UInt64 newHullKey = ComputeShapeKey(shapeData, pbs, out lod); | 550 | System.UInt64 newHullKey = ComputeShapeKey(shapeData, pbs, out lod); |
551 | 551 | ||
552 | // if the hull hasn't changed, don't rebuild it | 552 | // if the hull hasn't changed, don't rebuild it |
553 | if (newHullKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL) | 553 | if (newHullKey == prim.PhysShape.shapeKey && prim.PhysShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL) |
554 | return false; | 554 | return false; |
555 | 555 | ||
556 | DetailLog("{0},BSShapeCollection.CreateGeomHull,create,oldKey={1},newKey={2}", | 556 | DetailLog("{0},BSShapeCollection.CreateGeomHull,create,oldKey={1},newKey={2}", |
557 | prim.LocalID, prim.BSShape.shapeKey.ToString("X"), newHullKey.ToString("X")); | 557 | prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newHullKey.ToString("X")); |
558 | 558 | ||
559 | // Remove usage of the previous shape. | 559 | // Remove usage of the previous shape. |
560 | DereferenceShape(prim.BSShape, true, shapeCallback); | 560 | DereferenceShape(prim.PhysShape, true, shapeCallback); |
561 | 561 | ||
562 | newShape = CreatePhysicalHull(prim.PhysObjectName, newHullKey, pbs, shapeData.Size, lod); | 562 | newShape = CreatePhysicalHull(prim.PhysObjectName, newHullKey, pbs, shapeData.Size, lod); |
563 | newShape = VerifyMeshCreated(newShape, prim, shapeData, pbs); | 563 | newShape = VerifyMeshCreated(newShape, prim, shapeData, pbs); |
@@ -566,7 +566,7 @@ public sealed class BSShapeCollection : IDisposable | |||
566 | 566 | ||
567 | // hulls are already scaled by the meshmerizer | 567 | // hulls are already scaled by the meshmerizer |
568 | prim.Scale = new OMV.Vector3(1f, 1f, 1f); | 568 | prim.Scale = new OMV.Vector3(1f, 1f, 1f); |
569 | prim.BSShape = newShape; | 569 | prim.PhysShape = newShape; |
570 | return true; // 'true' means a new shape has been added to this prim | 570 | return true; // 'true' means a new shape has been added to this prim |
571 | } | 571 | } |
572 | 572 | ||
@@ -778,13 +778,13 @@ public sealed class BSShapeCollection : IDisposable | |||
778 | bool ret = false; | 778 | bool ret = false; |
779 | 779 | ||
780 | // the mesh, hull or native shape must have already been created in Bullet | 780 | // the mesh, hull or native shape must have already been created in Bullet |
781 | bool mustRebuild = (prim.BSBody.ptr == IntPtr.Zero); | 781 | bool mustRebuild = (prim.PhysBody.ptr == IntPtr.Zero); |
782 | 782 | ||
783 | // If there is an existing body, verify it's of an acceptable type. | 783 | // If there is an existing body, verify it's of an acceptable type. |
784 | // If not a solid object, body is a GhostObject. Otherwise a RigidBody. | 784 | // If not a solid object, body is a GhostObject. Otherwise a RigidBody. |
785 | if (!mustRebuild) | 785 | if (!mustRebuild) |
786 | { | 786 | { |
787 | CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(prim.BSBody.ptr); | 787 | CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(prim.PhysBody.ptr); |
788 | if (prim.IsSolid && bodyType != CollisionObjectTypes.CO_RIGID_BODY | 788 | if (prim.IsSolid && bodyType != CollisionObjectTypes.CO_RIGID_BODY |
789 | || !prim.IsSolid && bodyType != CollisionObjectTypes.CO_GHOST_OBJECT) | 789 | || !prim.IsSolid && bodyType != CollisionObjectTypes.CO_GHOST_OBJECT) |
790 | { | 790 | { |
@@ -796,7 +796,7 @@ public sealed class BSShapeCollection : IDisposable | |||
796 | if (mustRebuild || forceRebuild) | 796 | if (mustRebuild || forceRebuild) |
797 | { | 797 | { |
798 | // Free any old body | 798 | // Free any old body |
799 | DereferenceBody(prim.BSBody, true, bodyCallback); | 799 | DereferenceBody(prim.PhysBody, true, bodyCallback); |
800 | 800 | ||
801 | BulletBody aBody; | 801 | BulletBody aBody; |
802 | IntPtr bodyPtr = IntPtr.Zero; | 802 | IntPtr bodyPtr = IntPtr.Zero; |
@@ -816,7 +816,7 @@ public sealed class BSShapeCollection : IDisposable | |||
816 | 816 | ||
817 | ReferenceBody(aBody, true); | 817 | ReferenceBody(aBody, true); |
818 | 818 | ||
819 | prim.BSBody = aBody; | 819 | prim.PhysBody = aBody; |
820 | 820 | ||
821 | ret = true; | 821 | ret = true; |
822 | } | 822 | } |