diff options
author | Melanie | 2014-01-28 20:47:36 +0000 |
---|---|---|
committer | Melanie | 2014-01-28 20:47:36 +0000 |
commit | 4ccb15290ea9686070311c8a62c0fd9e6b0787d8 (patch) | |
tree | 5c4f69879983e87f567e11c59d8d8b83d0bd7bb4 /OpenSim/Region/Physics | |
parent | Remove the core module extra profile settings support carried in with the latest (diff) | |
parent | Merge branch 'justincc-master' (diff) | |
download | opensim-SC-4ccb15290ea9686070311c8a62c0fd9e6b0787d8.zip opensim-SC-4ccb15290ea9686070311c8a62c0fd9e6b0787d8.tar.gz opensim-SC-4ccb15290ea9686070311c8a62c0fd9e6b0787d8.tar.bz2 opensim-SC-4ccb15290ea9686070311c8a62c0fd9e6b0787d8.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 5a0a14c..fe5ff6c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -71,7 +71,7 @@ public abstract class BSShape | |||
71 | lastReferenced = DateTime.Now; | 71 | lastReferenced = DateTime.Now; |
72 | } | 72 | } |
73 | 73 | ||
74 | // Called when this shape is being used again. | 74 | // Called when this shape is done being used. |
75 | protected virtual void DecrementReference() | 75 | protected virtual void DecrementReference() |
76 | { | 76 | { |
77 | referenceCount--; | 77 | referenceCount--; |
@@ -868,6 +868,8 @@ public class BSShapeHull : BSShape | |||
868 | public class BSShapeCompound : BSShape | 868 | public class BSShapeCompound : BSShape |
869 | { | 869 | { |
870 | private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; | 870 | private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; |
871 | public static Dictionary<string, BSShapeCompound> CompoundShapes = new Dictionary<string, BSShapeCompound>(); | ||
872 | |||
871 | public BSShapeCompound(BulletShape pShape) : base(pShape) | 873 | public BSShapeCompound(BulletShape pShape) : base(pShape) |
872 | { | 874 | { |
873 | } | 875 | } |
@@ -875,7 +877,9 @@ public class BSShapeCompound : BSShape | |||
875 | { | 877 | { |
876 | // Base compound shapes are not shared so this returns a raw shape. | 878 | // Base compound shapes are not shared so this returns a raw shape. |
877 | // A built compound shape can be reused in linksets. | 879 | // A built compound shape can be reused in linksets. |
878 | return new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); | 880 | BSShapeCompound ret = new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene)); |
881 | CompoundShapes.Add(ret.AddrString, ret); | ||
882 | return ret; | ||
879 | } | 883 | } |
880 | public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) | 884 | public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) |
881 | { | 885 | { |
@@ -913,10 +917,21 @@ public class BSShapeCompound : BSShape | |||
913 | BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); | 917 | BulletShape childShape = physicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(physShapeInfo, ii); |
914 | DereferenceAnonCollisionShape(physicsScene, childShape); | 918 | DereferenceAnonCollisionShape(physicsScene, childShape); |
915 | } | 919 | } |
920 | |||
921 | lock (CompoundShapes) | ||
922 | CompoundShapes.Remove(physShapeInfo.AddrString); | ||
916 | physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); | 923 | physicsScene.PE.DeleteCollisionShape(physicsScene.World, physShapeInfo); |
917 | } | 924 | } |
918 | } | 925 | } |
919 | } | 926 | } |
927 | public static bool TryGetCompoundByPtr(BulletShape pShape, out BSShapeCompound outCompound) | ||
928 | { | ||
929 | lock (CompoundShapes) | ||
930 | { | ||
931 | string addr = pShape.AddrString; | ||
932 | return CompoundShapes.TryGetValue(addr, out outCompound); | ||
933 | } | ||
934 | } | ||
920 | private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) | 935 | private static BulletShape CreatePhysicalCompoundShape(BSScene physicsScene) |
921 | { | 936 | { |
922 | BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); | 937 | BulletShape cShape = physicsScene.PE.CreateCompoundShape(physicsScene.World, false); |
@@ -928,10 +943,13 @@ public class BSShapeCompound : BSShape | |||
928 | private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) | 943 | private void DereferenceAnonCollisionShape(BSScene physicsScene, BulletShape pShape) |
929 | { | 944 | { |
930 | // TODO: figure a better way to go through all the shape types and find a possible instance. | 945 | // TODO: figure a better way to go through all the shape types and find a possible instance. |
946 | physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,shape={1}", | ||
947 | BSScene.DetailLogZero, pShape); | ||
931 | BSShapeMesh meshDesc; | 948 | BSShapeMesh meshDesc; |
932 | if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) | 949 | if (BSShapeMesh.TryGetMeshByPtr(pShape, out meshDesc)) |
933 | { | 950 | { |
934 | meshDesc.Dereference(physicsScene); | 951 | meshDesc.Dereference(physicsScene); |
952 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundMesh,shape={1}", BSScene.DetailLogZero, pShape); | ||
935 | } | 953 | } |
936 | else | 954 | else |
937 | { | 955 | { |
@@ -939,13 +957,15 @@ public class BSShapeCompound : BSShape | |||
939 | if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) | 957 | if (BSShapeHull.TryGetHullByPtr(pShape, out hullDesc)) |
940 | { | 958 | { |
941 | hullDesc.Dereference(physicsScene); | 959 | hullDesc.Dereference(physicsScene); |
960 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundHull,shape={1}", BSScene.DetailLogZero, pShape); | ||
942 | } | 961 | } |
943 | else | 962 | else |
944 | { | 963 | { |
945 | BSShapeConvexHull chullDesc; | 964 | BSShapeConvexHull chullDesc; |
946 | if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc)) | 965 | if (BSShapeConvexHull.TryGetConvexHullByPtr(pShape, out chullDesc)) |
947 | { | 966 | { |
948 | chullDesc.Dereference(physicsScene); | 967 | chullDesc.Dereference(physicsScene); |
968 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundConvexHull,shape={1}", BSScene.DetailLogZero, pShape); | ||
949 | } | 969 | } |
950 | else | 970 | else |
951 | { | 971 | { |
@@ -953,20 +973,23 @@ public class BSShapeCompound : BSShape | |||
953 | if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) | 973 | if (BSShapeGImpact.TryGetGImpactByPtr(pShape, out gImpactDesc)) |
954 | { | 974 | { |
955 | gImpactDesc.Dereference(physicsScene); | 975 | gImpactDesc.Dereference(physicsScene); |
976 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,foundgImpact,shape={1}", BSScene.DetailLogZero, pShape); | ||
956 | } | 977 | } |
957 | else | 978 | else |
958 | { | 979 | { |
959 | // Didn't find it in the lists of specific types. It could be compound. | 980 | // Didn't find it in the lists of specific types. It could be compound. |
960 | if (physicsScene.PE.IsCompound(pShape)) | 981 | BSShapeCompound compoundDesc; |
982 | if (BSShapeCompound.TryGetCompoundByPtr(pShape, out compoundDesc)) | ||
961 | { | 983 | { |
962 | BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); | 984 | compoundDesc.Dereference(physicsScene); |
963 | recursiveCompound.Dereference(physicsScene); | 985 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,recursiveCompoundShape,shape={1}", BSScene.DetailLogZero, pShape); |
964 | } | 986 | } |
965 | else | 987 | else |
966 | { | 988 | { |
967 | // If none of the above, maybe it is a simple native shape. | 989 | // If none of the above, maybe it is a simple native shape. |
968 | if (physicsScene.PE.IsNativeShape(pShape)) | 990 | if (physicsScene.PE.IsNativeShape(pShape)) |
969 | { | 991 | { |
992 | // physicsScene.DetailLog("{0},BSShapeCompound.DereferenceAnonCollisionShape,assumingNative,shape={1}", BSScene.DetailLogZero, pShape); | ||
970 | BSShapeNative nativeShape = new BSShapeNative(pShape); | 993 | BSShapeNative nativeShape = new BSShapeNative(pShape); |
971 | nativeShape.Dereference(physicsScene); | 994 | nativeShape.Dereference(physicsScene); |
972 | } | 995 | } |
@@ -1023,6 +1046,8 @@ public class BSShapeConvexHull : BSShape | |||
1023 | convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); | 1046 | convexShape = physicsScene.PE.BuildConvexHullShapeFromMesh(physicsScene.World, baseMesh.physShapeInfo); |
1024 | convexShape.shapeKey = newMeshKey; | 1047 | convexShape.shapeKey = newMeshKey; |
1025 | ConvexHulls.Add(convexShape.shapeKey, retConvexHull); | 1048 | ConvexHulls.Add(convexShape.shapeKey, retConvexHull); |
1049 | physicsScene.DetailLog("{0},BSShapeConvexHull.GetReference,addingNewlyCreatedShape,shape={1}", | ||
1050 | BSScene.DetailLogZero, convexShape); | ||
1026 | } | 1051 | } |
1027 | 1052 | ||
1028 | // Done with the base mesh | 1053 | // Done with the base mesh |
@@ -1051,7 +1076,7 @@ public class BSShapeConvexHull : BSShape | |||
1051 | } | 1076 | } |
1052 | } | 1077 | } |
1053 | // Loop through all the known hulls and return the description based on the physical address. | 1078 | // Loop through all the known hulls and return the description based on the physical address. |
1054 | public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) | 1079 | public static bool TryGetConvexHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull) |
1055 | { | 1080 | { |
1056 | bool ret = false; | 1081 | bool ret = false; |
1057 | BSShapeConvexHull foundDesc = null; | 1082 | BSShapeConvexHull foundDesc = null; |