From a42569d89675430087d32332e168429d4185311c Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 16 Aug 2009 15:06:06 +0900 Subject: Thanks dmiles for a patch that adds PacketType.RequestMultipleObjects Packet Handler - ref mantis #4010 --- .../Framework/Scenes/Scene.PacketHandlers.cs | 23 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 1 + 2 files changed, 24 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 113918d..1a7f8f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -109,6 +109,29 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Invoked when the client requests a prim. + /// + /// + /// + public void RequestPrim(uint primLocalID, IClientAPI remoteClient) + { + PacketType i = PacketType.ObjectUpdate; + List EntityList = GetEntities(); + + foreach (EntityBase ent in EntityList) + { + if (ent is SceneObjectGroup) + { + if (((SceneObjectGroup)ent).LocalId == primLocalID) + { + ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient); + return; + } + } + } + } + + /// /// Invoked when the client selects a prim. /// /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 18d7bad..a2275f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2076,6 +2076,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; client.OnTeleportLocationRequest += RequestTeleportLocation; client.OnTeleportLandmarkRequest += RequestTeleportLandmark; + client.OnObjectRequest += RequestPrim; client.OnObjectSelect += SelectPrim; client.OnObjectDeselect += DeselectPrim; client.OnGrabUpdate += m_sceneGraph.MoveObject; -- cgit v1.1 From 9d9fcac0386ba6adc7a1f6c08f82bd5c0b6cd1d2 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Fri, 14 Aug 2009 17:16:41 +0900 Subject: Misc cleanup. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 17 +++---- .../Region/Framework/Scenes/SceneObjectGroup.cs | 51 ++++++--------------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 52 +++++++++++----------- 4 files changed, 46 insertions(+), 76 deletions(-) (limited to 'OpenSim/Region/Framework') 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 public delegate void OnNewClientDelegate(IClientAPI client); /// - /// Depreciated in favour of OnClientConnect. + /// Deprecated in favour of OnClientConnect. /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces. /// 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 { // Primitive Ray Tracing float closestDistance = 280f; - EntityIntersection returnResult = new EntityIntersection(); + EntityIntersection result = new EntityIntersection(); List EntityList = GetEntities(); foreach (EntityBase ent in EntityList) { if (ent is SceneObjectGroup) { SceneObjectGroup reportingG = (SceneObjectGroup)ent; - EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); - if (result.HitTF) + EntityIntersection inter = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); + if (inter.HitTF && inter.distance < closestDistance) { - if (result.distance < closestDistance) - { - closestDistance = result.distance; - returnResult = result; - } + closestDistance = inter.distance; + result = inter; } } } - return returnResult; + return result; } /// @@ -979,7 +976,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) { - if (p.Name==name) + if (p.Name == name) { return p; } 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 // If we get a result, we're going to find the closest result to the origin of the ray // and send back the intersection information back to the innerscene. - EntityIntersection returnresult = new EntityIntersection(); + EntityIntersection result = new EntityIntersection(); lock (m_parts) { @@ -576,26 +576,23 @@ namespace OpenSim.Region.Framework.Scenes // when the camera crosses the border. float idist = Constants.RegionSize; - if (inter.HitTF) { // We need to find the closest prim to return to the testcaller along the ray if (inter.distance < idist) { - returnresult.HitTF = true; - returnresult.ipoint = inter.ipoint; - returnresult.obj = part; - returnresult.normal = inter.normal; - returnresult.distance = inter.distance; + result.HitTF = true; + result.ipoint = inter.ipoint; + result.obj = part; + result.normal = inter.normal; + result.distance = inter.distance; } } } } - return returnresult; + return result; } - - /// /// Gets a vector representing the size of the bounding box containing all the prims in the group /// Treats all prims as rectangular, so no shape (cut etc) is taken into account @@ -652,7 +649,6 @@ namespace OpenSim.Region.Framework.Scenes frontBottomRight.Y = orig.Y + (part.Scale.Y / 2); frontBottomRight.Z = orig.Z - (part.Scale.Z / 2); - backTopLeft.X = orig.X + (part.Scale.X / 2); backTopLeft.Y = orig.Y - (part.Scale.Y / 2); backTopLeft.Z = orig.Z + (part.Scale.Z / 2); @@ -839,7 +835,6 @@ namespace OpenSim.Region.Framework.Scenes if (backBottomLeft.Z < minZ) minZ = backBottomLeft.Z; } - } Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); @@ -860,6 +855,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); return boundingBox; } + #endregion public void SaveScriptedState(XmlTextWriter writer) @@ -1029,8 +1025,8 @@ namespace OpenSim.Region.Framework.Scenes //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); //AttachToBackup(); //m_rootPart.ScheduleFullUpdate(); - } + /// /// /// @@ -1130,6 +1126,7 @@ namespace OpenSim.Region.Framework.Scenes } } } + // helper provided for parts. public int GetSceneMaxUndo() { @@ -1183,7 +1180,6 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = GetChildPart(localId); OnGrabPart(part, offsetPos, remoteClient); - } } @@ -1267,28 +1263,10 @@ namespace OpenSim.Region.Framework.Scenes } } - if ((aggregateScriptEvents & scriptEvents.at_target) != 0) - { - m_scriptListens_atTarget = true; - } - else - { - m_scriptListens_atTarget = false; - } - - if ((aggregateScriptEvents & scriptEvents.not_at_target) != 0) - { - m_scriptListens_notAtTarget = true; - } - else - { - m_scriptListens_notAtTarget = false; - } + m_scriptListens_atTarget = ((aggregateScriptEvents & scriptEvents.at_target) != 0); + m_scriptListens_notAtTarget = ((aggregateScriptEvents & scriptEvents.not_at_target) != 0); - if (m_scriptListens_atTarget || m_scriptListens_notAtTarget) - { - } - else + if (!m_scriptListens_atTarget && !m_scriptListens_notAtTarget) { lock (m_targets) m_targets.Clear(); @@ -1787,9 +1765,6 @@ namespace OpenSim.Region.Framework.Scenes } } - - - /// /// Set the owner of the root part. /// 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) { public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) { - // In this case we're using a sphere with a radius of the largest dimention of the prim + // In this case we're using a sphere with a radius of the largest dimension of the prim // TODO: Change to take shape into account - - EntityIntersection returnresult = new EntityIntersection(); + EntityIntersection result = new EntityIntersection(); Vector3 vAbsolutePosition = AbsolutePosition; Vector3 vScale = Scale; Vector3 rOrigin = iray.Origin; @@ -2738,8 +2737,7 @@ if (m_shape != null) { Vector3 tmVal6 = vAbsolutePosition*rOrigin; - - // Set Radius to the largest dimention of the prim + // Set Radius to the largest dimension of the prim float radius = 0f; if (vScale.X > radius) radius = vScale.X; @@ -2765,7 +2763,7 @@ if (m_shape != null) { if (rootsqr < 0.0f) { // No intersection - return returnresult; + return result; } float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); @@ -2778,7 +2776,7 @@ if (m_shape != null) { if (root < 0.0f) { // nope, no intersection - return returnresult; + return result; } } @@ -2788,12 +2786,12 @@ if (m_shape != null) { new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root), iray.Origin.Z + (iray.Direction.Z*root)); - returnresult.HitTF = true; - returnresult.ipoint = ipoint; + result.HitTF = true; + result.ipoint = ipoint; // Normal is calculated by the difference and then normalizing the result Vector3 normalpart = ipoint - vAbsolutePosition; - returnresult.normal = normalpart / normalpart.Length(); + result.normal = normalpart / normalpart.Length(); // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't. // 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) { Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z); float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2); - returnresult.distance = distance; + result.distance = distance; - return returnresult; + return result; } public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) @@ -3008,9 +3006,9 @@ if (m_shape != null) { //distance[i] = (normals[i].X * AmBa.X + normals[i].Y * AmBa.Y + normals[i].Z * AmBa.Z) * -1; } - EntityIntersection returnresult = new EntityIntersection(); + EntityIntersection result = new EntityIntersection(); - returnresult.distance = 1024; + result.distance = 1024; float c = 0; float a = 0; float d = 0; @@ -3030,7 +3028,7 @@ if (m_shape != null) { //{ //if (iray.Origin.Dot(normals[i]) > d) //{ - //return returnresult; + //return result; //} // else //{ @@ -3044,7 +3042,7 @@ if (m_shape != null) { //{ //if (a > fmin) //{ - //return returnresult; + //return result; //} //fmax = a; //} @@ -3056,7 +3054,7 @@ if (m_shape != null) { //{ //if (a < 0 || a < fmax) //{ - //return returnresult; + //return result; //} //fmin = a; //} @@ -3112,17 +3110,17 @@ if (m_shape != null) { // distance2 = (float)GetDistanceTo(q, iray.Origin); //} - if (distance2 < returnresult.distance) + if (distance2 < result.distance) { - returnresult.distance = distance2; - returnresult.HitTF = true; - returnresult.ipoint = q; + result.distance = distance2; + result.HitTF = true; + result.ipoint = q; //m_log.Info("[FACE]:" + i.ToString()); //m_log.Info("[POINT]: " + q.ToString()); //m_log.Info("[DIST]: " + distance2.ToString()); if (faceCenters) { - returnresult.normal = AAfacenormals[i] * AXrot; + result.normal = AAfacenormals[i] * AXrot; Vector3 scaleComponent = AAfacenormals[i]; float ScaleOffset = 0.5f; @@ -3130,20 +3128,20 @@ if (m_shape != null) { if (scaleComponent.Y != 0) ScaleOffset = AXscale.Y; if (scaleComponent.Z != 0) ScaleOffset = AXscale.Z; ScaleOffset = Math.Abs(ScaleOffset); - Vector3 offset = returnresult.normal * ScaleOffset; - returnresult.ipoint = AXpos + offset; + Vector3 offset = result.normal * ScaleOffset; + result.ipoint = AXpos + offset; ///pos = (intersectionpoint + offset); } else { - returnresult.normal = normals[i]; + result.normal = normals[i]; } - returnresult.AAfaceNormal = AAfacenormals[i]; + result.AAfaceNormal = AAfacenormals[i]; } } } - return returnresult; + return result; } /// -- cgit v1.1