diff options
author | Robert Adams | 2013-04-24 08:05:42 -0700 |
---|---|---|
committer | Robert Adams | 2013-04-24 08:05:42 -0700 |
commit | c22a2ab7d21803050317527476c2e18aa2edb40f (patch) | |
tree | b441277aeebb532bd2576fe3a8e32e7e0c39f215 /OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |
parent | BulletSim: update DLLs and SOs to they have no dependencies on newer (diff) | |
download | opensim-SC_OLD-c22a2ab7d21803050317527476c2e18aa2edb40f.zip opensim-SC_OLD-c22a2ab7d21803050317527476c2e18aa2edb40f.tar.gz opensim-SC_OLD-c22a2ab7d21803050317527476c2e18aa2edb40f.tar.bz2 opensim-SC_OLD-c22a2ab7d21803050317527476c2e18aa2edb40f.tar.xz |
BulletSim: partial addition of BSShape class code preparing for
different physical mesh representations (simplified convex meshes)
and avatar mesh.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 1976c42..bc26460 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -612,7 +612,7 @@ public sealed class BSShapeCollection : IDisposable | |||
612 | 612 | ||
613 | newShape = CreatePhysicalMesh(prim, newMeshKey, prim.BaseShape, prim.Size, lod); | 613 | newShape = CreatePhysicalMesh(prim, newMeshKey, prim.BaseShape, prim.Size, lod); |
614 | // Take evasive action if the mesh was not constructed. | 614 | // Take evasive action if the mesh was not constructed. |
615 | newShape = VerifyMeshCreated(newShape, prim); | 615 | newShape = VerifyMeshCreated(PhysicsScene, newShape, prim); |
616 | 616 | ||
617 | ReferenceShape(newShape); | 617 | ReferenceShape(newShape); |
618 | 618 | ||
@@ -719,7 +719,7 @@ public sealed class BSShapeCollection : IDisposable | |||
719 | 719 | ||
720 | newShape = CreatePhysicalHull(prim, newHullKey, prim.BaseShape, prim.Size, lod); | 720 | newShape = CreatePhysicalHull(prim, newHullKey, prim.BaseShape, prim.Size, lod); |
721 | // It might not have been created if we're waiting for an asset. | 721 | // It might not have been created if we're waiting for an asset. |
722 | newShape = VerifyMeshCreated(newShape, prim); | 722 | newShape = VerifyMeshCreated(PhysicsScene, newShape, prim); |
723 | 723 | ||
724 | ReferenceShape(newShape); | 724 | ReferenceShape(newShape); |
725 | 725 | ||
@@ -923,7 +923,7 @@ public sealed class BSShapeCollection : IDisposable | |||
923 | 923 | ||
924 | // Create a hash of all the shape parameters to be used as a key | 924 | // Create a hash of all the shape parameters to be used as a key |
925 | // for this particular shape. | 925 | // for this particular shape. |
926 | private System.UInt64 ComputeShapeKey(OMV.Vector3 size, PrimitiveBaseShape pbs, out float retLod) | 926 | public static System.UInt64 ComputeShapeKey(OMV.Vector3 size, PrimitiveBaseShape pbs, out float retLod) |
927 | { | 927 | { |
928 | // level of detail based on size and type of the object | 928 | // level of detail based on size and type of the object |
929 | float lod = BSParam.MeshLOD; | 929 | float lod = BSParam.MeshLOD; |
@@ -944,7 +944,7 @@ public sealed class BSShapeCollection : IDisposable | |||
944 | return pbs.GetMeshKey(size, lod); | 944 | return pbs.GetMeshKey(size, lod); |
945 | } | 945 | } |
946 | // For those who don't want the LOD | 946 | // For those who don't want the LOD |
947 | private System.UInt64 ComputeShapeKey(OMV.Vector3 size, PrimitiveBaseShape pbs) | 947 | public static System.UInt64 ComputeShapeKey(OMV.Vector3 size, PrimitiveBaseShape pbs) |
948 | { | 948 | { |
949 | float lod; | 949 | float lod; |
950 | return ComputeShapeKey(size, pbs, out lod); | 950 | return ComputeShapeKey(size, pbs, out lod); |
@@ -957,7 +957,7 @@ public sealed class BSShapeCollection : IDisposable | |||
957 | // us to not loop forever. | 957 | // us to not loop forever. |
958 | // Called after creating a physical mesh or hull. If the physical shape was created, | 958 | // Called after creating a physical mesh or hull. If the physical shape was created, |
959 | // just return. | 959 | // just return. |
960 | private BulletShape VerifyMeshCreated(BulletShape newShape, BSPhysObject prim) | 960 | public static BulletShape VerifyMeshCreated(BSScene physicsScene, BulletShape newShape, BSPhysObject prim) |
961 | { | 961 | { |
962 | // If the shape was successfully created, nothing more to do | 962 | // If the shape was successfully created, nothing more to do |
963 | if (newShape.HasPhysicalShape) | 963 | if (newShape.HasPhysicalShape) |
@@ -969,7 +969,7 @@ public sealed class BSShapeCollection : IDisposable | |||
969 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) | 969 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) |
970 | { | 970 | { |
971 | prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; | 971 | prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; |
972 | PhysicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}", | 972 | physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}", |
973 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); | 973 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); |
974 | } | 974 | } |
975 | else | 975 | else |
@@ -981,14 +981,14 @@ public sealed class BSShapeCollection : IDisposable | |||
981 | && prim.BaseShape.SculptTexture != OMV.UUID.Zero | 981 | && prim.BaseShape.SculptTexture != OMV.UUID.Zero |
982 | ) | 982 | ) |
983 | { | 983 | { |
984 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset", prim.LocalID); | 984 | physicsScene.DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset", prim.LocalID); |
985 | // Multiple requestors will know we're waiting for this asset | 985 | // Multiple requestors will know we're waiting for this asset |
986 | prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting; | 986 | prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting; |
987 | 987 | ||
988 | BSPhysObject xprim = prim; | 988 | BSPhysObject xprim = prim; |
989 | Util.FireAndForget(delegate | 989 | Util.FireAndForget(delegate |
990 | { | 990 | { |
991 | RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; | 991 | RequestAssetDelegate assetProvider = physicsScene.RequestAssetMethod; |
992 | if (assetProvider != null) | 992 | if (assetProvider != null) |
993 | { | 993 | { |
994 | BSPhysObject yprim = xprim; // probably not necessary, but, just in case. | 994 | BSPhysObject yprim = xprim; // probably not necessary, but, just in case. |
@@ -1016,7 +1016,7 @@ public sealed class BSShapeCollection : IDisposable | |||
1016 | yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched; | 1016 | yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched; |
1017 | else | 1017 | else |
1018 | yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; | 1018 | yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; |
1019 | DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}", | 1019 | physicsScene.DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}", |
1020 | yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); | 1020 | yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); |
1021 | 1021 | ||
1022 | }); | 1022 | }); |
@@ -1024,8 +1024,8 @@ public sealed class BSShapeCollection : IDisposable | |||
1024 | else | 1024 | else |
1025 | { | 1025 | { |
1026 | xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; | 1026 | xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; |
1027 | PhysicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", | 1027 | physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", |
1028 | LogHeader, PhysicsScene.Name); | 1028 | LogHeader, physicsScene.Name); |
1029 | } | 1029 | } |
1030 | }); | 1030 | }); |
1031 | } | 1031 | } |
@@ -1033,15 +1033,15 @@ public sealed class BSShapeCollection : IDisposable | |||
1033 | { | 1033 | { |
1034 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) | 1034 | if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed) |
1035 | { | 1035 | { |
1036 | PhysicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}", | 1036 | physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}", |
1037 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); | 1037 | LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); |
1038 | } | 1038 | } |
1039 | } | 1039 | } |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | // While we wait for the mesh defining asset to be loaded, stick in a simple box for the object. | 1042 | // While we wait for the mesh defining asset to be loaded, stick in a simple box for the object. |
1043 | BulletShape fillinShape = BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | 1043 | BulletShape fillinShape = physicsScene.Shapes.BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); |
1044 | DetailLog("{0},BSShapeCollection.VerifyMeshCreated,boxTempShape", prim.LocalID); | 1044 | physicsScene.DetailLog("{0},BSShapeCollection.VerifyMeshCreated,boxTempShape", prim.LocalID); |
1045 | 1045 | ||
1046 | return fillinShape; | 1046 | return fillinShape; |
1047 | } | 1047 | } |