diff options
author | Robert Adams | 2012-12-08 08:59:53 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-08 09:14:34 -0800 |
commit | 216c121935537f707e6334176e590225fdc988d8 (patch) | |
tree | 4aa9dc1a217f8c969e98cfada702e2f4aa5a8c58 | |
parent | BulletSim: update comments and add more to TODO list. (diff) | |
download | opensim-SC_OLD-216c121935537f707e6334176e590225fdc988d8.zip opensim-SC_OLD-216c121935537f707e6334176e590225fdc988d8.tar.gz opensim-SC_OLD-216c121935537f707e6334176e590225fdc988d8.tar.bz2 opensim-SC_OLD-216c121935537f707e6334176e590225fdc988d8.tar.xz |
BulletSim: fix small problem with setting size/scale of native shapes which caused the native shapes to be rebuilt when not necessary.
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index e77b6ba..933f573 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -415,7 +415,7 @@ public sealed class BSShapeCollection : IDisposable | |||
415 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_CAPSULE) | 415 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_CAPSULE) |
416 | { | 416 | { |
417 | // an avatar capsule is close to a native shape (it is not shared) | 417 | // an avatar capsule is close to a native shape (it is not shared) |
418 | ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_CAPSULE, | 418 | GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_CAPSULE, |
419 | FixedShapeKey.KEY_CAPSULE, shapeCallback); | 419 | FixedShapeKey.KEY_CAPSULE, shapeCallback); |
420 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape); | 420 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape); |
421 | ret = true; | 421 | ret = true; |
@@ -423,7 +423,7 @@ public sealed class BSShapeCollection : IDisposable | |||
423 | } | 423 | } |
424 | 424 | ||
425 | // Compound shapes are handled special as they are rebuilt from scratch. | 425 | // Compound shapes are handled special as they are rebuilt from scratch. |
426 | // This isn't too great a hardship since most of the child shapes will already been created. | 426 | // This isn't too great a hardship since most of the child shapes will have already been created. |
427 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_COMPOUND) | 427 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_COMPOUND) |
428 | { | 428 | { |
429 | ret = GetReferenceToCompoundShape(prim, shapeCallback); | 429 | ret = GetReferenceToCompoundShape(prim, shapeCallback); |
@@ -460,6 +460,9 @@ public sealed class BSShapeCollection : IDisposable | |||
460 | && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 | 460 | && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 |
461 | && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) ) | 461 | && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) ) |
462 | { | 462 | { |
463 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", | ||
464 | prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); | ||
465 | |||
463 | // It doesn't look like Bullet scales spheres so make sure the scales are all equal | 466 | // It doesn't look like Bullet scales spheres so make sure the scales are all equal |
464 | if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) | 467 | if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) |
465 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) | 468 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) |
@@ -538,6 +541,8 @@ public sealed class BSShapeCollection : IDisposable | |||
538 | if (DDetail) DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1},scale={2}", | 541 | if (DDetail) DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1},scale={2}", |
539 | prim.LocalID, newShape, prim.Scale); | 542 | prim.LocalID, newShape, prim.Scale); |
540 | 543 | ||
544 | // native shapes are scaled by Bullet | ||
545 | prim.Scale = prim.Size; | ||
541 | prim.PhysShape = newShape; | 546 | prim.PhysShape = newShape; |
542 | return true; | 547 | return true; |
543 | } | 548 | } |
@@ -550,8 +555,8 @@ public sealed class BSShapeCollection : IDisposable | |||
550 | ShapeData nativeShapeData = new ShapeData(); | 555 | ShapeData nativeShapeData = new ShapeData(); |
551 | nativeShapeData.Type = shapeType; | 556 | nativeShapeData.Type = shapeType; |
552 | nativeShapeData.ID = prim.LocalID; | 557 | nativeShapeData.ID = prim.LocalID; |
553 | nativeShapeData.Scale = prim.Scale; | 558 | nativeShapeData.Scale = prim.Size; |
554 | nativeShapeData.Size = prim.Scale; // unneeded, I think. | 559 | nativeShapeData.Size = prim.Size; // unneeded, I think. |
555 | nativeShapeData.MeshKey = (ulong)shapeKey; | 560 | nativeShapeData.MeshKey = (ulong)shapeKey; |
556 | nativeShapeData.HullKey = (ulong)shapeKey; | 561 | nativeShapeData.HullKey = (ulong)shapeKey; |
557 | 562 | ||
@@ -566,8 +571,6 @@ public sealed class BSShapeCollection : IDisposable | |||
566 | else | 571 | else |
567 | { | 572 | { |
568 | // Native shapes are scaled in Bullet so set the scaling to the size | 573 | // Native shapes are scaled in Bullet so set the scaling to the size |
569 | prim.Scale = prim.Size; | ||
570 | nativeShapeData.Scale = prim.Scale; | ||
571 | newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, nativeShapeData), shapeType); | 574 | newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, nativeShapeData), shapeType); |
572 | } | 575 | } |
573 | if (newShape.ptr == IntPtr.Zero) | 576 | if (newShape.ptr == IntPtr.Zero) |