aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2013-05-06 18:05:37 -0700
committerRobert Adams2013-05-06 18:05:37 -0700
commit84118c5735f49bb38ded2ccc72b1bd7d39c09010 (patch)
tree88247789a7e3ea0e2db909c35ec0311c097b4fe2 /OpenSim
parentStep 3: Commit the Avination XEstate estate comms handler (diff)
downloadopensim-SC-84118c5735f49bb38ded2ccc72b1bd7d39c09010.zip
opensim-SC-84118c5735f49bb38ded2ccc72b1bd7d39c09010.tar.gz
opensim-SC-84118c5735f49bb38ded2ccc72b1bd7d39c09010.tar.bz2
opensim-SC-84118c5735f49bb38ded2ccc72b1bd7d39c09010.tar.xz
BulletSim: properly free references to simple convex hull shapes. Didn't
loose memory since shapes are shared but did mess up usage accounting.
Diffstat (limited to 'OpenSim')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapes.cs45
1 files changed, 37 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
index 3e4ee5a..9d47657 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
@@ -117,11 +117,11 @@ public abstract class BSShape
117 StringBuilder buff = new StringBuilder(); 117 StringBuilder buff = new StringBuilder();
118 if (physShapeInfo == null) 118 if (physShapeInfo == null)
119 { 119 {
120 buff.Append(",noPhys"); 120 buff.Append("<noPhys");
121 } 121 }
122 else 122 else
123 { 123 {
124 buff.Append(",phy="); 124 buff.Append("<phy=");
125 buff.Append(physShapeInfo.ToString()); 125 buff.Append(physShapeInfo.ToString());
126 } 126 }
127 buff.Append(",c="); 127 buff.Append(",c=");
@@ -808,17 +808,25 @@ public class BSShapeCompound : BSShape
808 } 808 }
809 else 809 else
810 { 810 {
811 if (physicsScene.PE.IsCompound(pShape)) 811 BSShapeConvexHull chullDesc;
812 if (BSShapeConvexHull.TryGetHullByPtr(pShape, out chullDesc))
812 { 813 {
813 BSShapeCompound recursiveCompound = new BSShapeCompound(pShape); 814 chullDesc.Dereference(physicsScene);
814 recursiveCompound.Dereference(physicsScene);
815 } 815 }
816 else 816 else
817 { 817 {
818 if (physicsScene.PE.IsNativeShape(pShape)) 818 if (physicsScene.PE.IsCompound(pShape))
819 { 819 {
820 BSShapeNative nativeShape = new BSShapeNative(pShape); 820 BSShapeCompound recursiveCompound = new BSShapeCompound(pShape);
821 nativeShape.Dereference(physicsScene); 821 recursiveCompound.Dereference(physicsScene);
822 }
823 else
824 {
825 if (physicsScene.PE.IsNativeShape(pShape))
826 {
827 BSShapeNative nativeShape = new BSShapeNative(pShape);
828 nativeShape.Dereference(physicsScene);
829 }
822 } 830 }
823 } 831 }
824 } 832 }
@@ -898,6 +906,27 @@ public class BSShapeConvexHull : BSShape
898 // TODO: schedule aging and destruction of unused meshes. 906 // TODO: schedule aging and destruction of unused meshes.
899 } 907 }
900 } 908 }
909 // Loop through all the known hulls and return the description based on the physical address.
910 public static bool TryGetHullByPtr(BulletShape pShape, out BSShapeConvexHull outHull)
911 {
912 bool ret = false;
913 BSShapeConvexHull foundDesc = null;
914 lock (ConvexHulls)
915 {
916 foreach (BSShapeConvexHull sh in ConvexHulls.Values)
917 {
918 if (sh.physShapeInfo.ReferenceSame(pShape))
919 {
920 foundDesc = sh;
921 ret = true;
922 break;
923 }
924
925 }
926 }
927 outHull = foundDesc;
928 return ret;
929 }
901} 930}
902 931
903// ============================================================================================================ 932// ============================================================================================================