diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 838c845..473ef10 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -442,7 +442,8 @@ public sealed class BSShapeCollection : IDisposable | |||
442 | return ret; | 442 | return ret; |
443 | } | 443 | } |
444 | 444 | ||
445 | // Create a mesh/hull shape or a native shape if 'nativeShapePossible' is 'true'. | 445 | // Create a mesh, hull or native shape. |
446 | // Return 'true' if the prim's shape was changed. | ||
446 | public bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) | 447 | public bool CreateGeomNonSpecial(bool forceRebuild, BSPhysObject prim, ShapeDestructionCallback shapeCallback) |
447 | { | 448 | { |
448 | bool ret = false; | 449 | bool ret = false; |
@@ -472,7 +473,7 @@ public sealed class BSShapeCollection : IDisposable | |||
472 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", | 473 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", |
473 | prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); | 474 | prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); |
474 | 475 | ||
475 | // It doesn't look like Bullet scales spheres so make sure the scales are all equal | 476 | // It doesn't look like Bullet scales native spheres so make sure the scales are all equal |
476 | if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) | 477 | if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) |
477 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) | 478 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) |
478 | { | 479 | { |
@@ -484,9 +485,9 @@ public sealed class BSShapeCollection : IDisposable | |||
484 | { | 485 | { |
485 | ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_SPHERE, | 486 | ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_SPHERE, |
486 | FixedShapeKey.KEY_SPHERE, shapeCallback); | 487 | FixedShapeKey.KEY_SPHERE, shapeCallback); |
487 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", | ||
488 | prim.LocalID, forceRebuild, prim.PhysShape); | ||
489 | } | 488 | } |
489 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},rebuilt={2},shape={3}", | ||
490 | prim.LocalID, forceRebuild, ret, prim.PhysShape); | ||
490 | } | 491 | } |
491 | if (!haveShape && pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) | 492 | if (!haveShape && pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) |
492 | { | 493 | { |
@@ -498,9 +499,9 @@ public sealed class BSShapeCollection : IDisposable | |||
498 | { | 499 | { |
499 | ret = GetReferenceToNativeShape( prim, BSPhysicsShapeType.SHAPE_BOX, | 500 | ret = GetReferenceToNativeShape( prim, BSPhysicsShapeType.SHAPE_BOX, |
500 | FixedShapeKey.KEY_BOX, shapeCallback); | 501 | FixedShapeKey.KEY_BOX, shapeCallback); |
501 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", | ||
502 | prim.LocalID, forceRebuild, prim.PhysShape); | ||
503 | } | 502 | } |
503 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},rebuilt={2},shape={3}", | ||
504 | prim.LocalID, forceRebuild, ret, prim.PhysShape); | ||
504 | } | 505 | } |
505 | } | 506 | } |
506 | 507 | ||
@@ -513,6 +514,7 @@ public sealed class BSShapeCollection : IDisposable | |||
513 | return ret; | 514 | return ret; |
514 | } | 515 | } |
515 | 516 | ||
517 | // return 'true' if the prim's shape was changed. | ||
516 | public bool CreateGeomMeshOrHull(BSPhysObject prim, ShapeDestructionCallback shapeCallback) | 518 | public bool CreateGeomMeshOrHull(BSPhysObject prim, ShapeDestructionCallback shapeCallback) |
517 | { | 519 | { |
518 | 520 | ||
@@ -872,8 +874,7 @@ public sealed class BSShapeCollection : IDisposable | |||
872 | { | 874 | { |
873 | prim.LastAssetBuildFailed = true; | 875 | prim.LastAssetBuildFailed = true; |
874 | BSPhysObject xprim = prim; | 876 | BSPhysObject xprim = prim; |
875 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lID={1},lastFailed={2}", | 877 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed); |
876 | LogHeader, prim.LocalID, prim.LastAssetBuildFailed); | ||
877 | Util.FireAndForget(delegate | 878 | Util.FireAndForget(delegate |
878 | { | 879 | { |
879 | RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; | 880 | RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; |
@@ -882,19 +883,34 @@ public sealed class BSShapeCollection : IDisposable | |||
882 | BSPhysObject yprim = xprim; // probably not necessary, but, just in case. | 883 | BSPhysObject yprim = xprim; // probably not necessary, but, just in case. |
883 | assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset) | 884 | assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset) |
884 | { | 885 | { |
885 | if (!yprim.BaseShape.SculptEntry) | 886 | bool assetFound = false; // DEBUG DEBUG |
886 | return; | 887 | string mismatchIDs = String.Empty; // DEBUG DEBUG |
887 | if (yprim.BaseShape.SculptTexture.ToString() != asset.ID) | 888 | if (yprim.BaseShape.SculptEntry) |
888 | return; | 889 | { |
889 | 890 | if (yprim.BaseShape.SculptTexture.ToString() == asset.ID) | |
890 | yprim.BaseShape.SculptData = asset.Data; | 891 | { |
891 | // This will cause the prim to see that the filler shape is not the right | 892 | yprim.BaseShape.SculptData = asset.Data; |
892 | // one and try again to build the object. | 893 | // This will cause the prim to see that the filler shape is not the right |
893 | // No race condition with the normal shape setting since the rebuild is at taint time. | 894 | // one and try again to build the object. |
894 | yprim.ForceBodyShapeRebuild(false); | 895 | // No race condition with the normal shape setting since the rebuild is at taint time. |
896 | yprim.ForceBodyShapeRebuild(false /* inTaintTime */); | ||
897 | assetFound = true; | ||
898 | } | ||
899 | else | ||
900 | { | ||
901 | mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID; | ||
902 | } | ||
903 | } | ||
904 | DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}", | ||
905 | yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); | ||
895 | 906 | ||
896 | }); | 907 | }); |
897 | } | 908 | } |
909 | else | ||
910 | { | ||
911 | PhysicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", | ||
912 | LogHeader, PhysicsScene.Name); | ||
913 | } | ||
898 | }); | 914 | }); |
899 | } | 915 | } |
900 | else | 916 | else |
@@ -906,9 +922,9 @@ public sealed class BSShapeCollection : IDisposable | |||
906 | } | 922 | } |
907 | } | 923 | } |
908 | 924 | ||
909 | // While we figure out the real problem, stick in a simple box for the object. | 925 | // While we wait for the mesh defining asset to be loaded, stick in a simple box for the object. |
910 | BulletShape fillinShape = | 926 | BulletShape fillinShape = BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); |
911 | BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | 927 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,boxTempShape", prim.LocalID); |
912 | 928 | ||
913 | return fillinShape; | 929 | return fillinShape; |
914 | } | 930 | } |