aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs51
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs52
4 files changed, 46 insertions, 76 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 7bbe045..287d8d9 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
63 public delegate void OnNewClientDelegate(IClientAPI client); 63 public delegate void OnNewClientDelegate(IClientAPI client);
64 64
65 /// <summary> 65 /// <summary>
66 /// Depreciated in favour of OnClientConnect. 66 /// Deprecated in favour of OnClientConnect.
67 /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces. 67 /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
68 /// </summary> 68 /// </summary>
69 public event OnNewClientDelegate OnNewClient; 69 public event OnNewClientDelegate OnNewClient;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 0e0999a..7771831 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -928,25 +928,22 @@ namespace OpenSim.Region.Framework.Scenes
928 { 928 {
929 // Primitive Ray Tracing 929 // Primitive Ray Tracing
930 float closestDistance = 280f; 930 float closestDistance = 280f;
931 EntityIntersection returnResult = new EntityIntersection(); 931 EntityIntersection result = new EntityIntersection();
932 List<EntityBase> EntityList = GetEntities(); 932 List<EntityBase> EntityList = GetEntities();
933 foreach (EntityBase ent in EntityList) 933 foreach (EntityBase ent in EntityList)
934 { 934 {
935 if (ent is SceneObjectGroup) 935 if (ent is SceneObjectGroup)
936 { 936 {
937 SceneObjectGroup reportingG = (SceneObjectGroup)ent; 937 SceneObjectGroup reportingG = (SceneObjectGroup)ent;
938 EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); 938 EntityIntersection inter = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters);
939 if (result.HitTF) 939 if (inter.HitTF && inter.distance < closestDistance)
940 { 940 {
941 if (result.distance < closestDistance) 941 closestDistance = inter.distance;
942 { 942 result = inter;
943 closestDistance = result.distance;
944 returnResult = result;
945 }
946 } 943 }
947 } 944 }
948 } 945 }
949 return returnResult; 946 return result;
950 } 947 }
951 948
952 /// <summary> 949 /// <summary>
@@ -979,7 +976,7 @@ namespace OpenSim.Region.Framework.Scenes
979 { 976 {
980 foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) 977 foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts())
981 { 978 {
982 if (p.Name==name) 979 if (p.Name == name)
983 { 980 {
984 return p; 981 return p;
985 } 982 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index c86e4a1..bc3d5c0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -555,7 +555,7 @@ namespace OpenSim.Region.Framework.Scenes
555 // If we get a result, we're going to find the closest result to the origin of the ray 555 // If we get a result, we're going to find the closest result to the origin of the ray
556 // and send back the intersection information back to the innerscene. 556 // and send back the intersection information back to the innerscene.
557 557
558 EntityIntersection returnresult = new EntityIntersection(); 558 EntityIntersection result = new EntityIntersection();
559 559
560 lock (m_parts) 560 lock (m_parts)
561 { 561 {
@@ -576,26 +576,23 @@ namespace OpenSim.Region.Framework.Scenes
576 // when the camera crosses the border. 576 // when the camera crosses the border.
577 float idist = Constants.RegionSize; 577 float idist = Constants.RegionSize;
578 578
579
580 if (inter.HitTF) 579 if (inter.HitTF)
581 { 580 {
582 // We need to find the closest prim to return to the testcaller along the ray 581 // We need to find the closest prim to return to the testcaller along the ray
583 if (inter.distance < idist) 582 if (inter.distance < idist)
584 { 583 {
585 returnresult.HitTF = true; 584 result.HitTF = true;
586 returnresult.ipoint = inter.ipoint; 585 result.ipoint = inter.ipoint;
587 returnresult.obj = part; 586 result.obj = part;
588 returnresult.normal = inter.normal; 587 result.normal = inter.normal;
589 returnresult.distance = inter.distance; 588 result.distance = inter.distance;
590 } 589 }
591 } 590 }
592 } 591 }
593 } 592 }
594 return returnresult; 593 return result;
595 } 594 }
596 595
597
598
599 /// <summary> 596 /// <summary>
600 /// Gets a vector representing the size of the bounding box containing all the prims in the group 597 /// Gets a vector representing the size of the bounding box containing all the prims in the group
601 /// Treats all prims as rectangular, so no shape (cut etc) is taken into account 598 /// Treats all prims as rectangular, so no shape (cut etc) is taken into account
@@ -652,7 +649,6 @@ namespace OpenSim.Region.Framework.Scenes
652 frontBottomRight.Y = orig.Y + (part.Scale.Y / 2); 649 frontBottomRight.Y = orig.Y + (part.Scale.Y / 2);
653 frontBottomRight.Z = orig.Z - (part.Scale.Z / 2); 650 frontBottomRight.Z = orig.Z - (part.Scale.Z / 2);
654 651
655
656 backTopLeft.X = orig.X + (part.Scale.X / 2); 652 backTopLeft.X = orig.X + (part.Scale.X / 2);
657 backTopLeft.Y = orig.Y - (part.Scale.Y / 2); 653 backTopLeft.Y = orig.Y - (part.Scale.Y / 2);
658 backTopLeft.Z = orig.Z + (part.Scale.Z / 2); 654 backTopLeft.Z = orig.Z + (part.Scale.Z / 2);
@@ -839,7 +835,6 @@ namespace OpenSim.Region.Framework.Scenes
839 if (backBottomLeft.Z < minZ) 835 if (backBottomLeft.Z < minZ)
840 minZ = backBottomLeft.Z; 836 minZ = backBottomLeft.Z;
841 } 837 }
842
843 } 838 }
844 839
845 Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); 840 Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ);
@@ -860,6 +855,7 @@ namespace OpenSim.Region.Framework.Scenes
860 // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); 855 // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z);
861 return boundingBox; 856 return boundingBox;
862 } 857 }
858
863 #endregion 859 #endregion
864 860
865 public void SaveScriptedState(XmlTextWriter writer) 861 public void SaveScriptedState(XmlTextWriter writer)
@@ -1029,8 +1025,8 @@ namespace OpenSim.Region.Framework.Scenes
1029 //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); 1025 //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
1030 //AttachToBackup(); 1026 //AttachToBackup();
1031 //m_rootPart.ScheduleFullUpdate(); 1027 //m_rootPart.ScheduleFullUpdate();
1032
1033 } 1028 }
1029
1034 /// <summary> 1030 /// <summary>
1035 /// 1031 ///
1036 /// </summary> 1032 /// </summary>
@@ -1130,6 +1126,7 @@ namespace OpenSim.Region.Framework.Scenes
1130 } 1126 }
1131 } 1127 }
1132 } 1128 }
1129
1133 // helper provided for parts. 1130 // helper provided for parts.
1134 public int GetSceneMaxUndo() 1131 public int GetSceneMaxUndo()
1135 { 1132 {
@@ -1183,7 +1180,6 @@ namespace OpenSim.Region.Framework.Scenes
1183 { 1180 {
1184 SceneObjectPart part = GetChildPart(localId); 1181 SceneObjectPart part = GetChildPart(localId);
1185 OnGrabPart(part, offsetPos, remoteClient); 1182 OnGrabPart(part, offsetPos, remoteClient);
1186
1187 } 1183 }
1188 } 1184 }
1189 1185
@@ -1267,28 +1263,10 @@ namespace OpenSim.Region.Framework.Scenes
1267 } 1263 }
1268 } 1264 }
1269 1265
1270 if ((aggregateScriptEvents & scriptEvents.at_target) != 0) 1266 m_scriptListens_atTarget = ((aggregateScriptEvents & scriptEvents.at_target) != 0);
1271 { 1267 m_scriptListens_notAtTarget = ((aggregateScriptEvents & scriptEvents.not_at_target) != 0);
1272 m_scriptListens_atTarget = true;
1273 }
1274 else
1275 {
1276 m_scriptListens_atTarget = false;
1277 }
1278
1279 if ((aggregateScriptEvents & scriptEvents.not_at_target) != 0)
1280 {
1281 m_scriptListens_notAtTarget = true;
1282 }
1283 else
1284 {
1285 m_scriptListens_notAtTarget = false;
1286 }
1287 1268
1288 if (m_scriptListens_atTarget || m_scriptListens_notAtTarget) 1269 if (!m_scriptListens_atTarget && !m_scriptListens_notAtTarget)
1289 {
1290 }
1291 else
1292 { 1270 {
1293 lock (m_targets) 1271 lock (m_targets)
1294 m_targets.Clear(); 1272 m_targets.Clear();
@@ -1787,9 +1765,6 @@ namespace OpenSim.Region.Framework.Scenes
1787 } 1765 }
1788 } 1766 }
1789 1767
1790
1791
1792
1793 /// <summary> 1768 /// <summary>
1794 /// Set the owner of the root part. 1769 /// Set the owner of the root part.
1795 /// </summary> 1770 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3646811..5a74bad 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2710,11 +2710,10 @@ if (m_shape != null) {
2710 2710
2711 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) 2711 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot)
2712 { 2712 {
2713 // In this case we're using a sphere with a radius of the largest dimention of the prim 2713 // In this case we're using a sphere with a radius of the largest dimension of the prim
2714 // TODO: Change to take shape into account 2714 // TODO: Change to take shape into account
2715 2715
2716 2716 EntityIntersection result = new EntityIntersection();
2717 EntityIntersection returnresult = new EntityIntersection();
2718 Vector3 vAbsolutePosition = AbsolutePosition; 2717 Vector3 vAbsolutePosition = AbsolutePosition;
2719 Vector3 vScale = Scale; 2718 Vector3 vScale = Scale;
2720 Vector3 rOrigin = iray.Origin; 2719 Vector3 rOrigin = iray.Origin;
@@ -2738,8 +2737,7 @@ if (m_shape != null) {
2738 2737
2739 Vector3 tmVal6 = vAbsolutePosition*rOrigin; 2738 Vector3 tmVal6 = vAbsolutePosition*rOrigin;
2740 2739
2741 2740 // Set Radius to the largest dimension of the prim
2742 // Set Radius to the largest dimention of the prim
2743 float radius = 0f; 2741 float radius = 0f;
2744 if (vScale.X > radius) 2742 if (vScale.X > radius)
2745 radius = vScale.X; 2743 radius = vScale.X;
@@ -2765,7 +2763,7 @@ if (m_shape != null) {
2765 if (rootsqr < 0.0f) 2763 if (rootsqr < 0.0f)
2766 { 2764 {
2767 // No intersection 2765 // No intersection
2768 return returnresult; 2766 return result;
2769 } 2767 }
2770 float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); 2768 float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
2771 2769
@@ -2778,7 +2776,7 @@ if (m_shape != null) {
2778 if (root < 0.0f) 2776 if (root < 0.0f)
2779 { 2777 {
2780 // nope, no intersection 2778 // nope, no intersection
2781 return returnresult; 2779 return result;
2782 } 2780 }
2783 } 2781 }
2784 2782
@@ -2788,12 +2786,12 @@ if (m_shape != null) {
2788 new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root), 2786 new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root),
2789 iray.Origin.Z + (iray.Direction.Z*root)); 2787 iray.Origin.Z + (iray.Direction.Z*root));
2790 2788
2791 returnresult.HitTF = true; 2789 result.HitTF = true;
2792 returnresult.ipoint = ipoint; 2790 result.ipoint = ipoint;
2793 2791
2794 // Normal is calculated by the difference and then normalizing the result 2792 // Normal is calculated by the difference and then normalizing the result
2795 Vector3 normalpart = ipoint - vAbsolutePosition; 2793 Vector3 normalpart = ipoint - vAbsolutePosition;
2796 returnresult.normal = normalpart / normalpart.Length(); 2794 result.normal = normalpart / normalpart.Length();
2797 2795
2798 // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't. 2796 // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't.
2799 // I can write a function to do it.. but I like the fact that this one is Static. 2797 // I can write a function to do it.. but I like the fact that this one is Static.
@@ -2802,9 +2800,9 @@ if (m_shape != null) {
2802 Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z); 2800 Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z);
2803 float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2); 2801 float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2);
2804 2802
2805 returnresult.distance = distance; 2803 result.distance = distance;
2806 2804
2807 return returnresult; 2805 return result;
2808 } 2806 }
2809 2807
2810 public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) 2808 public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters)
@@ -3008,9 +3006,9 @@ if (m_shape != null) {
3008 //distance[i] = (normals[i].X * AmBa.X + normals[i].Y * AmBa.Y + normals[i].Z * AmBa.Z) * -1; 3006 //distance[i] = (normals[i].X * AmBa.X + normals[i].Y * AmBa.Y + normals[i].Z * AmBa.Z) * -1;
3009 } 3007 }
3010 3008
3011 EntityIntersection returnresult = new EntityIntersection(); 3009 EntityIntersection result = new EntityIntersection();
3012 3010
3013 returnresult.distance = 1024; 3011 result.distance = 1024;
3014 float c = 0; 3012 float c = 0;
3015 float a = 0; 3013 float a = 0;
3016 float d = 0; 3014 float d = 0;
@@ -3030,7 +3028,7 @@ if (m_shape != null) {
3030 //{ 3028 //{
3031 //if (iray.Origin.Dot(normals[i]) > d) 3029 //if (iray.Origin.Dot(normals[i]) > d)
3032 //{ 3030 //{
3033 //return returnresult; 3031 //return result;
3034 //} 3032 //}
3035 // else 3033 // else
3036 //{ 3034 //{
@@ -3044,7 +3042,7 @@ if (m_shape != null) {
3044 //{ 3042 //{
3045 //if (a > fmin) 3043 //if (a > fmin)
3046 //{ 3044 //{
3047 //return returnresult; 3045 //return result;
3048 //} 3046 //}
3049 //fmax = a; 3047 //fmax = a;
3050 //} 3048 //}
@@ -3056,7 +3054,7 @@ if (m_shape != null) {
3056 //{ 3054 //{
3057 //if (a < 0 || a < fmax) 3055 //if (a < 0 || a < fmax)
3058 //{ 3056 //{
3059 //return returnresult; 3057 //return result;
3060 //} 3058 //}
3061 //fmin = a; 3059 //fmin = a;
3062 //} 3060 //}
@@ -3112,17 +3110,17 @@ if (m_shape != null) {
3112 // distance2 = (float)GetDistanceTo(q, iray.Origin); 3110 // distance2 = (float)GetDistanceTo(q, iray.Origin);
3113 //} 3111 //}
3114 3112
3115 if (distance2 < returnresult.distance) 3113 if (distance2 < result.distance)
3116 { 3114 {
3117 returnresult.distance = distance2; 3115 result.distance = distance2;
3118 returnresult.HitTF = true; 3116 result.HitTF = true;
3119 returnresult.ipoint = q; 3117 result.ipoint = q;
3120 //m_log.Info("[FACE]:" + i.ToString()); 3118 //m_log.Info("[FACE]:" + i.ToString());
3121 //m_log.Info("[POINT]: " + q.ToString()); 3119 //m_log.Info("[POINT]: " + q.ToString());
3122 //m_log.Info("[DIST]: " + distance2.ToString()); 3120 //m_log.Info("[DIST]: " + distance2.ToString());
3123 if (faceCenters) 3121 if (faceCenters)
3124 { 3122 {
3125 returnresult.normal = AAfacenormals[i] * AXrot; 3123 result.normal = AAfacenormals[i] * AXrot;
3126 3124
3127 Vector3 scaleComponent = AAfacenormals[i]; 3125 Vector3 scaleComponent = AAfacenormals[i];
3128 float ScaleOffset = 0.5f; 3126 float ScaleOffset = 0.5f;
@@ -3130,20 +3128,20 @@ if (m_shape != null) {
3130 if (scaleComponent.Y != 0) ScaleOffset = AXscale.Y; 3128 if (scaleComponent.Y != 0) ScaleOffset = AXscale.Y;
3131 if (scaleComponent.Z != 0) ScaleOffset = AXscale.Z; 3129 if (scaleComponent.Z != 0) ScaleOffset = AXscale.Z;
3132 ScaleOffset = Math.Abs(ScaleOffset); 3130 ScaleOffset = Math.Abs(ScaleOffset);
3133 Vector3 offset = returnresult.normal * ScaleOffset; 3131 Vector3 offset = result.normal * ScaleOffset;
3134 returnresult.ipoint = AXpos + offset; 3132 result.ipoint = AXpos + offset;
3135 3133
3136 ///pos = (intersectionpoint + offset); 3134 ///pos = (intersectionpoint + offset);
3137 } 3135 }
3138 else 3136 else
3139 { 3137 {
3140 returnresult.normal = normals[i]; 3138 result.normal = normals[i];
3141 } 3139 }
3142 returnresult.AAfaceNormal = AAfacenormals[i]; 3140 result.AAfaceNormal = AAfacenormals[i];
3143 } 3141 }
3144 } 3142 }
3145 } 3143 }
3146 return returnresult; 3144 return result;
3147 } 3145 }
3148 3146
3149 /// <summary> 3147 /// <summary>