aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCasperW2009-11-30 21:52:55 +0100
committerCasperW2009-11-30 21:52:55 +0100
commit2e6dce434f1fd20664a60e464e589798287dcfe3 (patch)
tree278de1777e9b5686002af53ebe73bc3a15615f28
parentConvert multiple lock()s which directly hinder script performance in linksets... (diff)
downloadopensim-SC_OLD-2e6dce434f1fd20664a60e464e589798287dcfe3.zip
opensim-SC_OLD-2e6dce434f1fd20664a60e464e589798287dcfe3.tar.gz
opensim-SC_OLD-2e6dce434f1fd20664a60e464e589798287dcfe3.tar.bz2
opensim-SC_OLD-2e6dce434f1fd20664a60e464e589798287dcfe3.tar.xz
Enforce physical prim max size on single prims.
Also convert a lock() to ReaderWriterLockSlim that i missed in the last commit
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs119
1 files changed, 58 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index fb34ddc..42481ff 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2871,11 +2871,9 @@ namespace OpenSim.Region.Framework.Scenes
2871 scale.Y = m_scene.m_maxNonphys; 2871 scale.Y = m_scene.m_maxNonphys;
2872 if (scale.Z > m_scene.m_maxNonphys) 2872 if (scale.Z > m_scene.m_maxNonphys)
2873 scale.Z = m_scene.m_maxNonphys; 2873 scale.Z = m_scene.m_maxNonphys;
2874
2875 SceneObjectPart part = GetChildPart(localID); 2874 SceneObjectPart part = GetChildPart(localID);
2876 if (part != null) 2875 if (part != null)
2877 { 2876 {
2878 part.Resize(scale);
2879 if (part.PhysActor != null) 2877 if (part.PhysActor != null)
2880 { 2878 {
2881 if (part.PhysActor.IsPhysical) 2879 if (part.PhysActor.IsPhysical)
@@ -2890,7 +2888,7 @@ namespace OpenSim.Region.Framework.Scenes
2890 part.PhysActor.Size = scale; 2888 part.PhysActor.Size = scale;
2891 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 2889 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
2892 } 2890 }
2893 //if (part.UUID != m_rootPart.UUID) 2891 part.Resize(scale);
2894 2892
2895 HasGroupChanged = true; 2893 HasGroupChanged = true;
2896 ScheduleGroupForFullUpdate(); 2894 ScheduleGroupForFullUpdate();
@@ -2931,77 +2929,76 @@ namespace OpenSim.Region.Framework.Scenes
2931 float y = (scale.Y / part.Scale.Y); 2929 float y = (scale.Y / part.Scale.Y);
2932 float z = (scale.Z / part.Scale.Z); 2930 float z = (scale.Z / part.Scale.Z);
2933 2931
2934 lock (m_parts) 2932 lockPartsForRead(true);
2933 if (x > 1.0f || y > 1.0f || z > 1.0f)
2935 { 2934 {
2936 if (x > 1.0f || y > 1.0f || z > 1.0f) 2935 foreach (SceneObjectPart obPart in m_parts.Values)
2937 { 2936 {
2938 foreach (SceneObjectPart obPart in m_parts.Values) 2937 if (obPart.UUID != m_rootPart.UUID)
2939 { 2938 {
2940 if (obPart.UUID != m_rootPart.UUID) 2939 Vector3 oldSize = new Vector3(obPart.Scale);
2941 {
2942 Vector3 oldSize = new Vector3(obPart.Scale);
2943 2940
2944 float f = 1.0f; 2941 float f = 1.0f;
2945 float a = 1.0f; 2942 float a = 1.0f;
2946 2943
2947 if (part.PhysActor != null && part.PhysActor.IsPhysical) 2944 if (part.PhysActor != null && part.PhysActor.IsPhysical)
2945 {
2946 if (oldSize.X*x > m_scene.m_maxPhys)
2948 { 2947 {
2949 if (oldSize.X*x > m_scene.m_maxPhys) 2948 f = m_scene.m_maxPhys / oldSize.X;
2950 { 2949 a = f / x;
2951 f = m_scene.m_maxPhys / oldSize.X; 2950 x *= a;
2952 a = f / x; 2951 y *= a;
2953 x *= a; 2952 z *= a;
2954 y *= a;
2955 z *= a;
2956 }
2957 if (oldSize.Y*y > m_scene.m_maxPhys)
2958 {
2959 f = m_scene.m_maxPhys / oldSize.Y;
2960 a = f / y;
2961 x *= a;
2962 y *= a;
2963 z *= a;
2964 }
2965 if (oldSize.Z*z > m_scene.m_maxPhys)
2966 {
2967 f = m_scene.m_maxPhys / oldSize.Z;
2968 a = f / z;
2969 x *= a;
2970 y *= a;
2971 z *= a;
2972 }
2973 } 2953 }
2974 else 2954 if (oldSize.Y*y > m_scene.m_maxPhys)
2955 {
2956 f = m_scene.m_maxPhys / oldSize.Y;
2957 a = f / y;
2958 x *= a;
2959 y *= a;
2960 z *= a;
2961 }
2962 if (oldSize.Z*z > m_scene.m_maxPhys)
2963 {
2964 f = m_scene.m_maxPhys / oldSize.Z;
2965 a = f / z;
2966 x *= a;
2967 y *= a;
2968 z *= a;
2969 }
2970 }
2971 else
2972 {
2973 if (oldSize.X*x > m_scene.m_maxNonphys)
2975 { 2974 {
2976 if (oldSize.X*x > m_scene.m_maxNonphys) 2975 f = m_scene.m_maxNonphys / oldSize.X;
2977 { 2976 a = f / x;
2978 f = m_scene.m_maxNonphys / oldSize.X; 2977 x *= a;
2979 a = f / x; 2978 y *= a;
2980 x *= a; 2979 z *= a;
2981 y *= a; 2980 }
2982 z *= a; 2981 if (oldSize.Y*y > m_scene.m_maxNonphys)
2983 } 2982 {
2984 if (oldSize.Y*y > m_scene.m_maxNonphys) 2983 f = m_scene.m_maxNonphys / oldSize.Y;
2985 { 2984 a = f / y;
2986 f = m_scene.m_maxNonphys / oldSize.Y; 2985 x *= a;
2987 a = f / y; 2986 y *= a;
2988 x *= a; 2987 z *= a;
2989 y *= a; 2988 }
2990 z *= a; 2989 if (oldSize.Z*z > m_scene.m_maxNonphys)
2991 } 2990 {
2992 if (oldSize.Z*z > m_scene.m_maxNonphys) 2991 f = m_scene.m_maxNonphys / oldSize.Z;
2993 { 2992 a = f / z;
2994 f = m_scene.m_maxNonphys / oldSize.Z; 2993 x *= a;
2995 a = f / z; 2994 y *= a;
2996 x *= a; 2995 z *= a;
2997 y *= a;
2998 z *= a;
2999 }
3000 } 2996 }
3001 } 2997 }
3002 } 2998 }
3003 } 2999 }
3004 } 3000 }
3001 lockPartsForRead(false);
3005 3002
3006 Vector3 prevScale = part.Scale; 3003 Vector3 prevScale = part.Scale;
3007 prevScale.X *= x; 3004 prevScale.X *= x;