From c2086e6257bbf63c4b4edf56729bdf78e4ce3195 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 00:47:45 +0000 Subject: add a few extra checks for viewers animated objects support, to avoid timming issues --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1c5d23d..e663055 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2180,6 +2180,9 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + // recheck to reduce timing issues + ControllingClient.CheckViewerCaps(); + bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; int delayctnr = Util.EnvironmentTickCount(); @@ -4040,6 +4043,9 @@ namespace OpenSim.Region.Framework.Scenes } } + // recheck to reduce timing issues + ControllingClient.CheckViewerCaps(); + SendOtherAgentsAvatarFullToMe(); if(m_scene.ObjectsCullingByDistance) -- cgit v1.1 From 182977a872f837a29f936964d8df55942187261a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:38:43 +0000 Subject: do not send parceloverlay on crossings (may be bad, or not) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e663055..a67d701 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2244,11 +2244,12 @@ namespace OpenSim.Region.Framework.Scenes // start sending terrain patchs if (!gotCrossUpdate) Scene.SendLayerData(ControllingClient); + + // send initial land overlay and parcel + ILandChannel landch = m_scene.LandChannel; + if (landch != null) + landch.sendClientInitialLandInfo(client, !gotCrossUpdate); } - // send initial land overlay and parcel - ILandChannel landch = m_scene.LandChannel; - if (landch != null) - landch.sendClientInitialLandInfo(client); if (!IsChildAgent) { -- cgit v1.1 From b10a3ba0232031a1daac2a972478b7c34b7ec7ff Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 06:52:57 +0000 Subject: take the deafult on the parameter overlay --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a67d701..f010035 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4040,7 +4040,7 @@ namespace OpenSim.Region.Framework.Scenes ILandChannel landch = m_scene.LandChannel; if (landch != null) { - landch.sendClientInitialLandInfo(ControllingClient); + landch.sendClientInitialLandInfo(ControllingClient, true); } } -- cgit v1.1 From 7884278097d49730606afca20cad60510a70269d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 10:29:48 +0000 Subject: try to avoid some useless full object updates --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 312ce26..edcdbd3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1038,8 +1038,8 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (m_text.Length > 256) // yes > 254 - return m_text.Substring(0, 256); + if (m_text.Length > 254) + return m_text.Substring(0, 254); return m_text; } set { m_text = value; } @@ -4004,9 +4004,10 @@ namespace OpenSim.Region.Framework.Scenes /// public void SetText(string text) { - Text = text; + string oldtext = m_text; + m_text = text; - if (ParentGroup != null) + if (ParentGroup != null && oldtext != text) { ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); @@ -4021,11 +4022,18 @@ namespace OpenSim.Region.Framework.Scenes /// public void SetText(string text, Vector3 color, double alpha) { + Color oldcolor = Color; + string oldtext = m_text; Color = Color.FromArgb((int) (alpha*0xff), (int) (color.X*0xff), (int) (color.Y*0xff), (int) (color.Z*0xff)); - SetText(text); + m_text = text; + if(ParentGroup != null && (oldcolor != Color || oldtext != m_text)) + { + ParentGroup.HasGroupChanged = true; + ScheduleFullUpdate(); + } } public void StoreUndoState(ObjectChangeType change) -- cgit v1.1 From af35882eda75c1a406ec7a2890370380810bf19f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 13:00:11 +0000 Subject: prevent spurius acceleration values --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index edcdbd3..1a5e9d6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1001,7 +1001,7 @@ namespace OpenSim.Region.Framework.Scenes get { PhysicsActor actor = PhysActor; - if (actor != null) + if (actor != null && actor.IsPhysical) { m_acceleration = actor.Acceleration; } -- cgit v1.1 From fe6317f009cbdbe9b075c32584e1188cb59ddf94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Mar 2019 21:37:58 +0000 Subject: LSL update texture entry is heavy, set all parameters on same update --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1a5e9d6..cf9dfee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2338,10 +2338,7 @@ namespace OpenSim.Region.Framework.Scenes { ParentGroup.Scene.RemovePhysicalPrim(1); - Velocity = new Vector3(0, 0, 0); - Acceleration = new Vector3(0, 0, 0); - AngularVelocity = new Vector3(0, 0, 0); - APIDActive = false; + Stop(); if (pa.Phantom && !VolumeDetectActive) { @@ -4730,14 +4727,13 @@ namespace OpenSim.Region.Framework.Scenes if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none || (Shape.PathCurve == (byte)Extrusion.Flexible)) { + Stop(); if (pa != null) { if(wasUsingPhysics) ParentGroup.Scene.RemovePhysicalPrim(1); RemoveFromPhysics(); } - - Stop(); } else -- cgit v1.1 From b1cf06796f498be162ae8e3dedca2ae9d8af9bda Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Mar 2019 06:21:57 +0000 Subject: do send flag PrimFlags.InventoryEmpty --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cf9dfee..6fb0eed 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2478,7 +2478,10 @@ namespace OpenSim.Region.Framework.Scenes // if (m_parentGroup == null || m_parentGroup.RootPart == this) // f &= ~(PrimFlags.Touch | PrimFlags.Money); - return (uint)Flags | (uint)LocalFlags; + uint eff = (uint)Flags | (uint)LocalFlags; + if(m_inventory == null || m_inventory.Count == 0) + eff = (uint)PrimFlags.InventoryEmpty; + return eff; } // some of this lines need be moved to other place later -- cgit v1.1 From db191cd4e26c759a2a66946329f07cc52fe1cab3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Mar 2019 07:13:39 +0000 Subject: oops send flag PrimFlags.InventoryEmpty but do not override others --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6fb0eed..5c38bf3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2480,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes uint eff = (uint)Flags | (uint)LocalFlags; if(m_inventory == null || m_inventory.Count == 0) - eff = (uint)PrimFlags.InventoryEmpty; + eff |= (uint)PrimFlags.InventoryEmpty; return eff; } -- cgit v1.1 From d0052c817486a1691fc4e2e7027ac41240b966aa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 02:18:32 +0000 Subject: add more test code to make usage od compressed updates etc. Should be disable, but well many things can go wrong. --- .../Framework/Scenes/Scene.PacketHandlers.cs | 19 +- OpenSim/Region/Framework/Scenes/Scene.cs | 35 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 66 ++-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 16 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 399 +++++++++++++-------- 5 files changed, 308 insertions(+), 227 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 0c080d2..2995091 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -153,10 +153,23 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestPrim(uint primLocalID, IClientAPI remoteClient) { - SceneObjectGroup sog = GetGroupByPrim(primLocalID); + SceneObjectPart part = GetSceneObjectPart(primLocalID); + if (part != null) + { + SceneObjectGroup sog = part.ParentGroup; + if(!sog.IsDeleted) + { + PrimUpdateFlags update = PrimUpdateFlags.FullUpdate; + if (sog.RootPart.Shape.MeshFlagEntry) + update = PrimUpdateFlags.FullUpdatewithAnim; + part.SendUpdate(remoteClient, update); + } + } + + //SceneObjectGroup sog = GetGroupByPrim(primLocalID); - if (sog != null) - sog.SendFullAnimUpdateToClient(remoteClient); + //if (sog != null) + //sog.SendFullAnimUpdateToClient(remoteClient); } /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7668a87..7d312e9 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -170,8 +170,6 @@ namespace OpenSim.Region.Framework.Scenes } private bool m_scripts_enabled; - public SynchronizeSceneHandler SynchronizeScene; - public bool ClampNegativeZ { get { return m_clampNegativeZ; } @@ -1006,11 +1004,9 @@ namespace OpenSim.Region.Framework.Scenes m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); - m_dontPersistBefore = - startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); + m_dontPersistBefore = startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); m_dontPersistBefore *= 10000000; - m_persistAfter = - startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); + m_persistAfter = startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); m_persistAfter *= 10000000; m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); @@ -1695,9 +1691,6 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysicsEnabled) physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime); - - if (SynchronizeScene != null) - SynchronizeScene(this); } tmpMS2 = Util.GetTimeStampMS(); @@ -1775,30 +1768,6 @@ namespace OpenSim.Region.Framework.Scenes // Region ready should always be set Ready = true; - - - IConfig restartConfig = m_config.Configs["RestartModule"]; - if (restartConfig != null) - { - string markerPath = restartConfig.GetString("MarkerPath", String.Empty); - - if (markerPath != String.Empty) - { - string path = Path.Combine(markerPath, RegionInfo.RegionID.ToString() + ".ready"); - try - { - string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); - FileStream fs = File.Create(path); - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); - Byte[] buf = enc.GetBytes(pidstring); - fs.Write(buf, 0, buf.Length); - fs.Close(); - } - catch (Exception) - { - } - } - } } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7d5bbbf..0b38179 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -119,6 +119,21 @@ namespace OpenSim.Region.Framework.Scenes // private PrimCountTaintedDelegate handlerPrimCountTainted = null; + public bool IsViewerCachable + { + get + { + // needs more exclusion ? + return(Backup && !IsTemporary && !inTransit && !IsSelected && !UsesPhysics && !IsAttachmentCheckFull() && + !RootPart.Shape.MeshFlagEntry && // animations are not sent correctly for now + RootPart.KeyframeMotion == null && + (DateTime.UtcNow.Ticks - timeLastChanged > 36000000000) && //36000000000 is one hour + RootPart.Velocity.LengthSquared() < 1e8f && // should not be needed + RootPart.Acceleration.LengthSquared() < 1e4f // should not be needed + ); + } + } + /// /// Signal whether the non-inventory attributes of any prims in the group have changed /// since the group's last persistent backup @@ -128,7 +143,8 @@ namespace OpenSim.Region.Framework.Scenes private long timeLastChanged = 0; private long m_maxPersistTime = 0; private long m_minPersistTime = 0; -// private Random m_rand; + + public int PseudoCRC; /// /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage @@ -145,40 +161,26 @@ namespace OpenSim.Region.Framework.Scenes { if (value) { - if (Backup) - { m_scene.SceneGraph.FireChangeBackup(this); - } + + PseudoCRC = (int)(DateTime.UtcNow.Ticks); ; timeLastChanged = DateTime.UtcNow.Ticks; if (!m_hasGroupChanged) - timeFirstChanged = DateTime.UtcNow.Ticks; + timeFirstChanged = timeLastChanged; if (m_rootPart != null && m_scene != null) { -/* - if (m_rand == null) - { - byte[] val = new byte[16]; - m_rootPart.UUID.ToBytes(val, 0); - m_rand = new Random(BitConverter.ToInt32(val, 0)); - } - */ if (m_scene.GetRootAgentCount() == 0) { //If the region is empty, this change has been made by an automated process //and thus we delay the persist time by a random amount between 1.5 and 2.5. -// float factor = 1.5f + (float)(m_rand.NextDouble()); float factor = 2.0f; - m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor); - m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor); + m_maxPersistTime = (long)(m_scene.m_persistAfter * factor); + m_minPersistTime = (long)(m_scene.m_dontPersistBefore * factor); } else { - //If the region is not empty, we want to obey the minimum and maximum persist times - //but add a random factor so we stagger the object persistance a little -// m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 -// m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 m_maxPersistTime = m_scene.m_persistAfter; m_minPersistTime = m_scene.m_dontPersistBefore; } @@ -1330,6 +1332,7 @@ namespace OpenSim.Region.Framework.Scenes public SceneObjectGroup() { m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0; + PseudoCRC = (int)(DateTime.UtcNow.Ticks); } /// @@ -2441,6 +2444,21 @@ namespace OpenSim.Region.Framework.Scenes } } + public void SendUpdateProbes(IClientAPI remoteClient) + { + PrimUpdateFlags update = PrimUpdateFlags.UpdateProbe; + + RootPart.SendUpdate(remoteClient, update); + + SceneObjectPart[] parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; + if (part != RootPart) + part.SendUpdate(remoteClient, update); + } + } + #region Copying /// @@ -2516,6 +2534,7 @@ namespace OpenSim.Region.Framework.Scenes } dupe.InvalidatePartsLinkMaps(); + dupe.PseudoCRC = (int)(DateTime.UtcNow.Ticks); m_dupeInProgress = false; return dupe; } @@ -2769,6 +2788,7 @@ namespace OpenSim.Region.Framework.Scenes } } + PseudoCRC = (int)(DateTime.UtcNow.Ticks); rpart.ScheduleFullUpdate(); } @@ -2808,6 +2828,7 @@ namespace OpenSim.Region.Framework.Scenes part.ResetIDs(part.LinkNum); // Don't change link nums m_parts.Add(part.UUID, part); } + PseudoCRC = (int)(DateTime.UtcNow.Ticks); } } @@ -3117,7 +3138,6 @@ namespace OpenSim.Region.Framework.Scenes } } - // 'linkPart' == the root of the group being linked into this group SceneObjectPart linkPart = objectGroup.m_rootPart; @@ -3160,7 +3180,6 @@ namespace OpenSim.Region.Framework.Scenes axPos *= Quaternion.Conjugate(parentRot); linkPart.OffsetPosition = axPos; - // If there is only one SOP in a SOG, the LinkNum is zero. I.e., not a linkset. // Now that we know this SOG has at least two SOPs in it, the new root // SOP becomes the first in the linkset. @@ -3193,8 +3212,7 @@ namespace OpenSim.Region.Framework.Scenes linkPart.CreateSelected = true; - // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now - linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive, true); + linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive || RootPart.VolumeDetectActive, true); // If the added SOP is physical, also tell the physics engine about the link relationship. if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5c38bf3..4f3f83a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1179,9 +1179,10 @@ namespace OpenSim.Region.Framework.Scenes set { + string old = m_mediaUrl; m_mediaUrl = value; - if (ParentGroup != null) + if (ParentGroup != null && old != m_mediaUrl) ParentGroup.HasGroupChanged = true; } } @@ -1385,13 +1386,6 @@ namespace OpenSim.Region.Framework.Scenes } } - [XmlIgnore] - public bool IsOccupied // KF If an av is sittingon this prim - { - get { return m_occupied; } - set { m_occupied = value; } - } - /// /// ID of the avatar that is sat on us if we have a sit target. If there is no such avatar then is UUID.Zero /// @@ -2472,12 +2466,6 @@ namespace OpenSim.Region.Framework.Scenes public uint GetEffectiveObjectFlags() { - // Commenting this section of code out since it doesn't actually do anything, as enums are handled by - // value rather than reference -// PrimFlags f = _flags; -// if (m_parentGroup == null || m_parentGroup.RootPart == this) -// f &= ~(PrimFlags.Touch | PrimFlags.Money); - uint eff = (uint)Flags | (uint)LocalFlags; if(m_inventory == null || m_inventory.Count == 0) eff |= (uint)PrimFlags.InventoryEmpty; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f010035..e635841 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1212,7 +1212,9 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; ControllingClient.OnAutoPilotGo += MoveToTargetHandle; ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; -// ControllingClient.OnAgentFOV += HandleAgentFOV; + ControllingClient.OnRegionHandShakeReply += RegionHandShakeReply; + + // ControllingClient.OnAgentFOV += HandleAgentFOV; // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); @@ -1232,7 +1234,9 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; ControllingClient.OnAutoPilotGo -= MoveToTargetHandle; ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; -// ControllingClient.OnAgentFOV += HandleAgentFOV; + ControllingClient.OnRegionHandShakeReply -= RegionHandShakeReply; + + // ControllingClient.OnAgentFOV += HandleAgentFOV; } private void SetDirectionVectors() @@ -2126,56 +2130,54 @@ namespace OpenSim.Region.Framework.Scenes return; } - + if(IsChildAgent) + { + return; // how? + } //m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - if(!haveGroupInformation && !IsChildAgent && !IsNPC) + if (!IsNPC) { - IGroupsModule gm = m_scene.RequestModuleInterface(); - if (gm != null) - Grouptitle = gm.GetGroupTitle(m_uuid); + if (!haveGroupInformation && !IsNPC) + { + IGroupsModule gm = m_scene.RequestModuleInterface(); + if (gm != null) + Grouptitle = gm.GetGroupTitle(m_uuid); - //m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + //m_log.DebugFormat("[CompleteMovement] Missing Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); - if (cof == null) - COF = UUID.Zero; - else - COF = cof.ID; + InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46); + if (cof == null) + COF = UUID.Zero; + else + COF = cof.ID; - m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); - } + m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); + } - if (!string.IsNullOrEmpty(m_callbackURI)) - { - // We cannot sleep here since this would hold up the inbound packet processing thread, as - // CompleteMovement() is executed synchronously. However, it might be better to delay the release - // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete - // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this - // region as the current region, meaning that a close sent before then will fail the teleport. - // System.Threading.Thread.Sleep(2000); + if (!string.IsNullOrEmpty(m_callbackURI)) + { + // We cannot sleep here since this would hold up the inbound packet processing thread, as + // CompleteMovement() is executed synchronously. However, it might be better to delay the release + // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete + // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this + // region as the current region, meaning that a close sent before then will fail the teleport. + // System.Threading.Thread.Sleep(2000); - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_callbackURI); + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", + client.Name, client.AgentId, m_callbackURI); - UUID originID; + UUID originID; - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; - Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); - m_callbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); + m_callbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } } -// else -// { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}", -// client.Name, client.AgentId, m_scene.RegionInfo.RegionName); -// } - - // Tell the client that we're totally ready ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); @@ -2187,32 +2189,29 @@ namespace OpenSim.Region.Framework.Scenes int delayctnr = Util.EnvironmentTickCount(); - if (!IsChildAgent) + if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) { - if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) - { - ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); - } + ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); + } - // verify baked textures and cache - bool cachedbaked = false; + // verify baked textures and cache + bool cachedbaked = false; - if (IsNPC) - cachedbaked = true; - else - { - if (m_scene.AvatarFactory != null && !isHGTP) - cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); + if (IsNPC) + cachedbaked = true; + else + { + if (m_scene.AvatarFactory != null && !isHGTP) + cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); - // not sure we need this - if (!cachedbaked) - { - if (m_scene.AvatarFactory != null) - m_scene.AvatarFactory.QueueAppearanceSave(UUID); - } + // not sure we need this + if (!cachedbaked) + { + if (m_scene.AvatarFactory != null) + m_scene.AvatarFactory.QueueAppearanceSave(UUID); } - //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } + //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); if(m_teleportFlags > 0) { @@ -2251,104 +2250,103 @@ namespace OpenSim.Region.Framework.Scenes landch.sendClientInitialLandInfo(client, !gotCrossUpdate); } - if (!IsChildAgent) - { - List allpresences = m_scene.GetScenePresences(); + List allpresences = m_scene.GetScenePresences(); - // send avatar object to all presences including us, so they cross it into region - // then hide if necessary + // send avatar object to all presences including us, so they cross it into region + // then hide if necessary - SendInitialAvatarDataToAllAgents(allpresences); + SendInitialAvatarDataToAllAgents(allpresences); - // send this look - SendAppearanceToAgent(this); + // send this look + SendAppearanceToAgent(this); - // send this animations + // send this animations - UUID[] animIDs = null; - int[] animseqs = null; - UUID[] animsobjs = null; + UUID[] animIDs = null; + int[] animseqs = null; + UUID[] animsobjs = null; - if (Animator != null) - Animator.GetArrays(out animIDs, out animseqs, out animsobjs); + if (Animator != null) + Animator.GetArrays(out animIDs, out animseqs, out animsobjs); - bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); + bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); - if (haveAnims) - SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); + if (haveAnims) + SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); - // we should be able to receive updates, etc - // so release them - m_inTransit = false; + // we should be able to receive updates, etc + // so release them + m_inTransit = false; - // send look and animations to others - // if not cached we send greys - // uncomented if will wait till avatar does baking - //if (cachedbaked) + // send look and animations to others + // if not cached we send greys + // uncomented if will wait till avatar does baking + //if (cachedbaked) + { + foreach (ScenePresence p in allpresences) { - foreach (ScenePresence p in allpresences) - { - if (p == this) - continue; + if (p == this) + continue; - if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) - continue; + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) + continue; - SendAppearanceToAgentNF(p); - if (haveAnims) - SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); - } - } // greys if + SendAppearanceToAgentNF(p); + if (haveAnims) + SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); + } + } // greys if - //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // attachments - if (IsNPC || IsRealLogin(m_teleportFlags)) - { - if (Scene.AttachmentsModule != null) - // Util.FireAndForget( - // o => - // { + // attachments + if (IsNPC || IsRealLogin(m_teleportFlags)) + { + if (Scene.AttachmentsModule != null) + // Util.FireAndForget( + // o => + // { - if (!IsNPC) + if (!IsNPC) + Scene.AttachmentsModule.RezAttachments(this); + else + Util.FireAndForget(x => + { Scene.AttachmentsModule.RezAttachments(this); - else - Util.FireAndForget(x => - { - Scene.AttachmentsModule.RezAttachments(this); - }); + }); - // }); - } - else + // }); + } + else + { + if (m_attachments.Count > 0) { - if (m_attachments.Count > 0) - { // m_log.DebugFormat( // "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); - foreach (SceneObjectGroup sog in m_attachments) - { - sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); - sog.ResumeScripts(); - } + foreach (SceneObjectGroup sog in m_attachments) + { + sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); + sog.ResumeScripts(); + } - foreach (ScenePresence p in allpresences) + foreach (ScenePresence p in allpresences) + { + if (p == this) { - if (p == this) - { - SendAttachmentsToAgentNF(this); - continue; - } + SendAttachmentsToAgentNF(this); + continue; + } - if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) - continue; + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) + continue; - SendAttachmentsToAgentNF(p); - } + SendAttachmentsToAgentNF(p); } } - + } + if(!IsNPC) + { //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); if (openChildAgents) { @@ -2366,34 +2364,33 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them - } - //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // send the rest of the world - if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide) - SendInitialDataToMe(); + // send the rest of the world + if (m_teleportFlags > 0 | m_currentParcelHide) + SendInitialDataToMe(); - // priority uses avatar position only -// m_reprioritizationLastPosition = AbsolutePosition; -// m_reprioritizationLastDrawDistance = DrawDistance; -// m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it -// m_reprioritizationBusy = false; + // priority uses avatar position only + // m_reprioritizationLastPosition = AbsolutePosition; + // m_reprioritizationLastDrawDistance = DrawDistance; + // m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it + // m_reprioritizationBusy = false; - //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - if (!IsChildAgent && openChildAgents) - { - IFriendsModule friendsModule = m_scene.RequestModuleInterface(); - if (friendsModule != null) + if (openChildAgents) { - if(gotCrossUpdate) - friendsModule.IsNowRoot(this); - else - friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); + IFriendsModule friendsModule = m_scene.RequestModuleInterface(); + if (friendsModule != null) + { + if(gotCrossUpdate) + friendsModule.IsNowRoot(this); + else + friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); + } + //m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } - //m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } } finally @@ -4024,10 +4021,100 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); } + + public void RegionHandShakeReply (IClientAPI client, uint flags) + { + if(IsNPC) + return; + + bool selfappearance = (flags & 4) != 0; + bool cacheCulling = (flags & 1) != 0; + bool cacheEmpty; + if(cacheCulling) + cacheEmpty = (flags & 2) != 0; + else + cacheEmpty = true; + + if (m_teleportFlags > 0) // only doing for child for now + return; + + lock (m_completeMovementLock) + { + if (SentInitialData) + return; + SentInitialData = true; + } + + Util.FireAndForget(delegate + { + Scene.SendLayerData(ControllingClient); + + ILandChannel landch = m_scene.LandChannel; + if (landch != null) + landch.sendClientInitialLandInfo(ControllingClient, true); + + // recheck to reduce timing issues + ControllingClient.CheckViewerCaps(); + + SendOtherAgentsAvatarFullToMe(); + /* + if (m_scene.ObjectsCullingByDistance && cacheCulling) + { + m_reprioritizationBusy = true; + m_reprioritizationLastPosition = AbsolutePosition; + m_reprioritizationLastDrawDistance = DrawDistance; + + ControllingClient.ReprioritizeUpdates(); + m_reprioritizationLastTime = Util.EnvironmentTickCount(); + m_reprioritizationBusy = false; + return; + } + */ + + EntityBase[] entities = Scene.Entities.GetEntities(); + if(cacheEmpty) + { + foreach (EntityBase e in entities) + { + if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); + } + } + else + { + foreach (EntityBase e in entities) + { + if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + { + SceneObjectGroup grp = e as SceneObjectGroup; + if(grp.IsViewerCachable) + grp.SendUpdateProbes(ControllingClient); + else + grp.SendFullAnimUpdateToClient(ControllingClient); + } + } + } + + m_reprioritizationLastPosition = AbsolutePosition; + m_reprioritizationLastDrawDistance = DrawDistance; + m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it + + m_reprioritizationBusy = false; + + }); + + } + public void SendInitialDataToMe() { // Send all scene object to the new client - SentInitialData = true; + lock (m_completeMovementLock) + { + if (SentInitialData) + return; + SentInitialData = true; + } + Util.FireAndForget(delegate { // we created a new ScenePresence (a new child agent) in a fresh region. @@ -4280,7 +4367,13 @@ namespace OpenSim.Region.Framework.Scenes if(IsDeleted || !ControllingClient.IsActive) return; - if(!SentInitialData) + bool needsendinitial = false; + lock(m_completeMovementLock) + { + needsendinitial = SentInitialData; + } + + if(!needsendinitial) { SendInitialDataToMe(); return; -- cgit v1.1 From a9aba562b11d2b45eee0ad9edbae97167cf1ae8d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 02:24:32 +0000 Subject: pesty warning --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4f3f83a..ebb8eda 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -312,7 +312,6 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_sitTargetOrientation = Quaternion.Identity; private Vector3 m_sitTargetPosition; private string m_sitAnimation = "SIT"; - private bool m_occupied; // KF if any av is sitting on this prim private string m_text = String.Empty; private string m_touchName = String.Empty; private UndoRedoState m_UndoRedo = null; -- cgit v1.1 From 010d64dcd2d55850750b3c67ae901d7b183fd741 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Mar 2019 03:58:22 +0000 Subject: a bit more suicidal... --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 32 +++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e635841..e35481f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2368,8 +2368,9 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); // send the rest of the world - if (m_teleportFlags > 0 | m_currentParcelHide) - SendInitialDataToMe(); + if (m_teleportFlags > 0 || m_currentParcelHide) + //SendInitialDataToMe(); + SendOtherAgentsAvatarFullToMe(); // priority uses avatar position only // m_reprioritizationLastPosition = AbsolutePosition; @@ -4035,8 +4036,8 @@ namespace OpenSim.Region.Framework.Scenes else cacheEmpty = true; - if (m_teleportFlags > 0) // only doing for child for now - return; +// if (m_teleportFlags > 0) // only doing for child for now +// return; lock (m_completeMovementLock) { @@ -4047,18 +4048,21 @@ namespace OpenSim.Region.Framework.Scenes Util.FireAndForget(delegate { - Scene.SendLayerData(ControllingClient); + if (m_teleportFlags <= 0) + { + Scene.SendLayerData(ControllingClient); - ILandChannel landch = m_scene.LandChannel; - if (landch != null) - landch.sendClientInitialLandInfo(ControllingClient, true); + ILandChannel landch = m_scene.LandChannel; + if (landch != null) + landch.sendClientInitialLandInfo(ControllingClient, true); + + SendOtherAgentsAvatarFullToMe(); + } // recheck to reduce timing issues ControllingClient.CheckViewerCaps(); - SendOtherAgentsAvatarFullToMe(); - /* - if (m_scene.ObjectsCullingByDistance && cacheCulling) + if (m_scene.ObjectsCullingByDistance) { m_reprioritizationBusy = true; m_reprioritizationLastPosition = AbsolutePosition; @@ -4069,7 +4073,6 @@ namespace OpenSim.Region.Framework.Scenes m_reprioritizationBusy = false; return; } - */ EntityBase[] entities = Scene.Entities.GetEntities(); if(cacheEmpty) @@ -4367,18 +4370,19 @@ namespace OpenSim.Region.Framework.Scenes if(IsDeleted || !ControllingClient.IsActive) return; +/* bool needsendinitial = false; lock(m_completeMovementLock) { needsendinitial = SentInitialData; } - if(!needsendinitial) + if(needsendinitial) { SendInitialDataToMe(); return; } - +*/ if(m_reprioritizationBusy) return; -- cgit v1.1 From 027750e98ff40b87d774dc6ad4700969b3714087 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Mar 2019 00:35:30 +0000 Subject: compact the trivial te case, a more complete one may be needed even beening heavy --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ebb8eda..5e2204e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3883,15 +3883,15 @@ namespace OpenSim.Region.Framework.Scenes { if (Shape.SculptEntry && !ignoreSculpt) return PrimType.SCULPT; - - if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) + ProfileShape ps = (ProfileShape)(Shape.ProfileCurve & 0x07); + if (ps == ProfileShape.Square) { if (Shape.PathCurve == (byte)Extrusion.Straight) return PrimType.BOX; else if (Shape.PathCurve == (byte)Extrusion.Curve1) return PrimType.TUBE; } - else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) + else if (ps == ProfileShape.Circle) { if (Shape.PathCurve == (byte)Extrusion.Straight || Shape.PathCurve == (byte)Extrusion.Flexible) return PrimType.CYLINDER; @@ -3899,12 +3899,12 @@ namespace OpenSim.Region.Framework.Scenes else if (Shape.PathCurve == (byte)Extrusion.Curve1) return PrimType.TORUS; } - else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) + else if (ps == ProfileShape.HalfCircle) { if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) return PrimType.SPHERE; } - else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) + else if (ps == ProfileShape.EquilateralTriangle) { if (Shape.PathCurve == (byte)Extrusion.Straight || Shape.PathCurve == (byte)Extrusion.Flexible) return PrimType.PRISM; @@ -5124,7 +5124,13 @@ namespace OpenSim.Region.Framework.Scenes if (changeFlags == 0) return; - m_shape.TextureEntry = newTex.GetBytes(9); + // we do need better compacter do just the trivial case + if(nsides == 1 && newTex.FaceTextures[0] != null) + { + newTex.DefaultTexture = newTex.GetFace(0); + newTex.FaceTextures[0] = null; + } + m_shape.TextureEntry = newTex.GetBytes(nsides); TriggerScriptChangedEvent(changeFlags); ParentGroup.HasGroupChanged = true; ScheduleUpdate(PrimUpdateFlags.Textures); -- cgit v1.1 From b32b104996289b3e28c179b992cb5f44b6d1327a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Mar 2019 16:15:24 +0000 Subject: some more changes on objects sending --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 79 +++--------------------- 1 file changed, 8 insertions(+), 71 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e35481f..9a879f7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1214,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; ControllingClient.OnRegionHandShakeReply += RegionHandShakeReply; - // ControllingClient.OnAgentFOV += HandleAgentFOV; + // ControllingClient.OnAgentFOV += HandleAgentFOV; // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); @@ -4022,12 +4022,18 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); } - public void RegionHandShakeReply (IClientAPI client, uint flags) { if(IsNPC) return; + lock (m_completeMovementLock) + { + if (SentInitialData) + return; + SentInitialData = true; + } + bool selfappearance = (flags & 4) != 0; bool cacheCulling = (flags & 1) != 0; bool cacheEmpty; @@ -4036,16 +4042,6 @@ namespace OpenSim.Region.Framework.Scenes else cacheEmpty = true; -// if (m_teleportFlags > 0) // only doing for child for now -// return; - - lock (m_completeMovementLock) - { - if (SentInitialData) - return; - SentInitialData = true; - } - Util.FireAndForget(delegate { if (m_teleportFlags <= 0) @@ -4108,65 +4104,6 @@ namespace OpenSim.Region.Framework.Scenes } - public void SendInitialDataToMe() - { - // Send all scene object to the new client - lock (m_completeMovementLock) - { - if (SentInitialData) - return; - SentInitialData = true; - } - - Util.FireAndForget(delegate - { - // we created a new ScenePresence (a new child agent) in a fresh region. - // Request info about all the (root) agents in this region - // Note: This won't send data *to* other clients in that region (children don't send) - if (m_teleportFlags <= 0) - { - Scene.SendLayerData(ControllingClient); - - ILandChannel landch = m_scene.LandChannel; - if (landch != null) - { - landch.sendClientInitialLandInfo(ControllingClient, true); - } - } - - // recheck to reduce timing issues - ControllingClient.CheckViewerCaps(); - - SendOtherAgentsAvatarFullToMe(); - - if(m_scene.ObjectsCullingByDistance) - { - m_reprioritizationBusy = true; - m_reprioritizationLastPosition = AbsolutePosition; - m_reprioritizationLastDrawDistance = DrawDistance; - - ControllingClient.ReprioritizeUpdates(); - m_reprioritizationLastTime = Util.EnvironmentTickCount(); - m_reprioritizationBusy = false; - return; - } - - EntityBase[] entities = Scene.Entities.GetEntities(); - foreach (EntityBase e in entities) - { - if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) - ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); - } - - m_reprioritizationLastPosition = AbsolutePosition; - m_reprioritizationLastDrawDistance = DrawDistance; - m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it - - m_reprioritizationBusy = false; - - }); - } - /// /// Send avatar full data appearance and animations for all other root agents to this agent, this agent /// can be either a child or root -- cgit v1.1 From 83fd05f13165477b82615c74a12f08b0a2bdfb05 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Mar 2019 02:04:11 +0000 Subject: timming issues on fast tp back to same region on new code --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9a879f7..63eb29f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -6797,7 +6797,12 @@ namespace OpenSim.Region.Framework.Scenes } else { - GodController.HasMovedAway(); + lock (m_completeMovementLock) + { + GodController.HasMovedAway(); + SentInitialData = false; + } + List allpresences = m_scene.GetScenePresences(); foreach (ScenePresence p in allpresences) { -- cgit v1.1 From 5663e2c0c82756268c5a6aa767e6ca765c00e71d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Mar 2019 07:32:06 +0000 Subject: try another way --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 63eb29f..2145fcd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2179,6 +2179,7 @@ namespace OpenSim.Region.Framework.Scenes } } // Tell the client that we're totally ready + ControllingClient.SendRegionHandshake(); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); -- cgit v1.1 From 1847a42a861d6a0f575c56f566b947dfb21c1f03 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Mar 2019 00:02:24 +0000 Subject: changes on teleports v7 --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 69 ++++++++++++++---------- 1 file changed, 42 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2145fcd..a95036c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -457,9 +457,10 @@ namespace OpenSim.Region.Framework.Scenes #region For teleports and crossings callbacks /// - /// In the V1 teleport protocol, the destination simulator sends ReleaseAgent to this address. + /// the destination simulator sends ReleaseAgent to this address, for very long range tps, HG. /// - private string m_callbackURI; + private string m_callbackURI; // to remove with v1 support + private string m_newCallbackURI; /// /// Records the region from which this presence originated, if not from login. @@ -2155,28 +2156,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); } - if (!string.IsNullOrEmpty(m_callbackURI)) - { - // We cannot sleep here since this would hold up the inbound packet processing thread, as - // CompleteMovement() is executed synchronously. However, it might be better to delay the release - // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete - // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this - // region as the current region, meaning that a close sent before then will fail the teleport. - // System.Threading.Thread.Sleep(2000); - - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_callbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); - m_callbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } } // Tell the client that we're totally ready ControllingClient.SendRegionHandshake(); @@ -2381,6 +2360,37 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!string.IsNullOrEmpty(m_callbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with old callback to {2}", + client.Name, client.AgentId, m_callbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); + m_callbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + else if (!string.IsNullOrEmpty(m_newCallbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", + client.Name, client.AgentId, m_newCallbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); + m_newCallbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + if (openChildAgents) { IFriendsModule friendsModule = m_scene.RequestModuleInterface(); @@ -4589,12 +4599,15 @@ namespace OpenSim.Region.Framework.Scenes byebyeRegions.Add(handle); else if(handle == curRegionHandle) { + continue; + /* RegionInfo curreg = m_scene.RegionInfo; if (Util.IsOutsideView(255, curreg.RegionLocX, newRegionX, curreg.RegionLocY, newRegionY, (int)curreg.RegionSizeX, (int)curreg.RegionSizeX, newRegionSizeX, newRegionSizeY)) { byebyeRegions.Add(handle); } + */ } else { @@ -4774,6 +4787,7 @@ namespace OpenSim.Region.Framework.Scenes public void CopyTo(AgentData cAgent, bool isCrossUpdate) { cAgent.CallbackURI = m_callbackURI; + cAgent.NewCallbackURI = m_newCallbackURI; cAgent.AgentID = UUID; cAgent.RegionID = Scene.RegionInfo.RegionID; @@ -4860,9 +4874,10 @@ namespace OpenSim.Region.Framework.Scenes private void CopyFrom(AgentData cAgent) { m_callbackURI = cAgent.CallbackURI; -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", -// Name, m_scene.RegionInfo.RegionName, m_callbackURI); + m_newCallbackURI = cAgent.NewCallbackURI; + // m_log.DebugFormat( + // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", + // Name, m_scene.RegionInfo.RegionName, m_callbackURI); GodController.SetState(cAgent.GodData); -- cgit v1.1 From 6cf85a3db111c2f8e56dde8a05ff3cf13f5ecd14 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 30 Mar 2019 12:07:49 +0000 Subject: a few more changes on initial objects send --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 126 ++++++++++++----------- 1 file changed, 68 insertions(+), 58 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a95036c..123b605 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -99,6 +99,8 @@ namespace OpenSim.Region.Framework.Scenes public bool IsViewerUIGod { get; set; } public bool IsGod { get; set; } + private bool m_gotRegionHandShake = false; + private PresenceType m_presenceType; public PresenceType PresenceType { @@ -288,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_lastRotation; private Vector3 m_lastVelocity; private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); - private bool SentInitialData = false; + private bool NeedInitialData = false; private int m_userFlags; public int UserFlags @@ -881,7 +883,6 @@ namespace OpenSim.Region.Framework.Scenes } public bool IsChildAgent { get; set; } - public bool IsLoggingIn { get; set; } /// /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero. @@ -1074,7 +1075,6 @@ namespace OpenSim.Region.Framework.Scenes AttachmentsSyncLock = new Object(); AllowMovement = true; IsChildAgent = true; - IsLoggingIn = false; m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); Overrides = new MovementAnimationOverrides(); @@ -1307,7 +1307,6 @@ namespace OpenSim.Region.Framework.Scenes ParentPart = null; PrevSitOffset = Vector3.Zero; HandleForceReleaseControls(ControllingClient, UUID); // needs testing - IsLoggingIn = false; } else { @@ -1331,10 +1330,6 @@ namespace OpenSim.Region.Framework.Scenes } ParentUUID = UUID.Zero; } - else - { - IsLoggingIn = false; - } IsChildAgent = false; } @@ -2163,7 +2158,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); // recheck to reduce timing issues - ControllingClient.CheckViewerCaps(); + ControllingClient.GetViewerCaps(); bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; @@ -2325,9 +2320,40 @@ namespace OpenSim.Region.Framework.Scenes } } } - if(!IsNPC) + //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!IsNPC) { - //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!string.IsNullOrEmpty(m_callbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with old callback to {2}", + client.Name, client.AgentId, m_callbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); + m_callbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + else if (!string.IsNullOrEmpty(m_newCallbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", + client.Name, client.AgentId, m_newCallbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); + m_newCallbackURI = null; + //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + if (openChildAgents) { // Create child agents in neighbouring regions @@ -2360,36 +2386,6 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - if (!string.IsNullOrEmpty(m_callbackURI)) - { - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with old callback to {2}", - client.Name, client.AgentId, m_callbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); - m_callbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } - else if (!string.IsNullOrEmpty(m_newCallbackURI)) - { - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_newCallbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); - m_newCallbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } if (openChildAgents) { @@ -3850,15 +3846,21 @@ namespace OpenSim.Region.Framework.Scenes public override void Update() { - if(IsChildAgent || IsDeleted) + if (IsDeleted) return; - CheckForBorderCrossing(); + if (NeedInitialData) + { + SendInitialData(); + return; + } - if (IsInTransit || IsLoggingIn) + if (IsChildAgent || IsInTransit) return; - if(m_movingToTarget) + CheckForBorderCrossing(); + + if (m_movingToTarget) { m_delayedStop = -1; Vector3 control = Vector3.Zero; @@ -4033,25 +4035,28 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); } - public void RegionHandShakeReply (IClientAPI client, uint flags) + public void RegionHandShakeReply (IClientAPI client) { if(IsNPC) return; lock (m_completeMovementLock) { - if (SentInitialData) + if(m_gotRegionHandShake) return; - SentInitialData = true; + NeedInitialData = true; } + } + + private void SendInitialData() + { + uint flags = ControllingClient.GetViewerCaps(); + if((flags & 0x1000) == 0) // wait for seeds sending + return; + + NeedInitialData = false; bool selfappearance = (flags & 4) != 0; - bool cacheCulling = (flags & 1) != 0; - bool cacheEmpty; - if(cacheCulling) - cacheEmpty = (flags & 2) != 0; - else - cacheEmpty = true; Util.FireAndForget(delegate { @@ -4066,9 +4071,6 @@ namespace OpenSim.Region.Framework.Scenes SendOtherAgentsAvatarFullToMe(); } - // recheck to reduce timing issues - ControllingClient.CheckViewerCaps(); - if (m_scene.ObjectsCullingByDistance) { m_reprioritizationBusy = true; @@ -4081,6 +4083,13 @@ namespace OpenSim.Region.Framework.Scenes return; } + bool cacheCulling = (flags & 1) != 0; + bool cacheEmpty; + if (cacheCulling) + cacheEmpty = (flags & 2) != 0; + else + cacheEmpty = true; + EntityBase[] entities = Scene.Entities.GetEntities(); if(cacheEmpty) { @@ -6816,7 +6825,8 @@ namespace OpenSim.Region.Framework.Scenes lock (m_completeMovementLock) { GodController.HasMovedAway(); - SentInitialData = false; + NeedInitialData = false; + m_gotRegionHandShake = false; } List allpresences = m_scene.GetScenePresences(); -- cgit v1.1 From 3a6d87da9519e0c3be3e6711d02301f72196bba7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 19:28:06 +0100 Subject: a few more changes on initial data sending --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 138 +++++++---------------- 1 file changed, 40 insertions(+), 98 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 123b605..2f26320 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2130,11 +2130,12 @@ namespace OpenSim.Region.Framework.Scenes { return; // how? } + //m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); if (!IsNPC) { - if (!haveGroupInformation && !IsNPC) + if (!haveGroupInformation) { IGroupsModule gm = m_scene.RequestModuleInterface(); if (gm != null) @@ -2150,53 +2151,45 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); } - } - // Tell the client that we're totally ready - ControllingClient.SendRegionHandshake(); - ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); - //m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // recheck to reduce timing issues - ControllingClient.GetViewerCaps(); + if (m_teleportFlags > 0) + gotCrossUpdate = false; // sanity check - bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; + if (!gotCrossUpdate) + RotateToLookAt(look); - int delayctnr = Util.EnvironmentTickCount(); + m_previusParcelHide = false; + m_previusParcelUUID = UUID.Zero; + m_currentParcelHide = false; + m_currentParcelUUID = UUID.Zero; + ParcelDwellTickMS = Util.GetTimeStampMS(); - if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0) - { - ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); - } + m_inTransit = false; - // verify baked textures and cache - bool cachedbaked = false; + // Tell the client that we're ready to send rest + ControllingClient.SendRegionHandshake(); - if (IsNPC) - cachedbaked = true; - else + ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); + + bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; + + if(!IsNPC) { - if (m_scene.AvatarFactory != null && !isHGTP) - cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this); + if( ParentPart != null && (crossingFlags & 0x08) != 0) + { + ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); + } - // not sure we need this - if (!cachedbaked) + // verify baked textures and cache + if (m_scene.AvatarFactory != null && !isHGTP) { - if (m_scene.AvatarFactory != null) + if (!m_scene.AvatarFactory.ValidateBakedTextureCache(this)) m_scene.AvatarFactory.QueueAppearanceSave(UUID); } } - //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - - if(m_teleportFlags > 0) - { - gotCrossUpdate = false; // sanity check - if(Util.EnvironmentTickCountSubtract(delayctnr)< 500) - Thread.Sleep(500); // let viewers catch us - } - if(!gotCrossUpdate) - RotateToLookAt(look); + //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); // HG if(isHGTP) @@ -2205,16 +2198,10 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement] HG"); } - m_previusParcelHide = false; - m_previusParcelUUID = UUID.Zero; - m_currentParcelHide = false; - m_currentParcelUUID = UUID.Zero; - ParcelDwellTickMS = Util.GetTimeStampMS(); - - if(!IsNPC) + if (!IsNPC) { GodController.SyncViewerState(); - + // start sending terrain patchs if (!gotCrossUpdate) Scene.SendLayerData(ControllingClient); @@ -2229,11 +2216,11 @@ namespace OpenSim.Region.Framework.Scenes // send avatar object to all presences including us, so they cross it into region // then hide if necessary - SendInitialAvatarDataToAllAgents(allpresences); // send this look - SendAppearanceToAgent(this); + if (!IsNPC) + SendAppearanceToAgent(this); // send this animations @@ -2246,13 +2233,9 @@ namespace OpenSim.Region.Framework.Scenes bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null); - if (haveAnims) + if (!IsNPC && haveAnims) SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); - // we should be able to receive updates, etc - // so release them - m_inTransit = false; - // send look and animations to others // if not cached we send greys // uncomented if will wait till avatar does baking @@ -2272,33 +2255,16 @@ namespace OpenSim.Region.Framework.Scenes } } // greys if - //m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // attachments if (IsNPC || IsRealLogin(m_teleportFlags)) { if (Scene.AttachmentsModule != null) - // Util.FireAndForget( - // o => - // { - - if (!IsNPC) - Scene.AttachmentsModule.RezAttachments(this); - else - Util.FireAndForget(x => - { - Scene.AttachmentsModule.RezAttachments(this); - }); - - // }); + Scene.AttachmentsModule.RezAttachments(this); } else { if (m_attachments.Count > 0) { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); - foreach (SceneObjectGroup sog in m_attachments) { sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); @@ -2320,7 +2286,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - //m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!IsNPC) { if (!string.IsNullOrEmpty(m_callbackURI)) @@ -2371,8 +2337,6 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them - //m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - // send the rest of the world if (m_teleportFlags > 0 || m_currentParcelHide) //SendInitialDataToMe(); @@ -2384,9 +2348,6 @@ namespace OpenSim.Region.Framework.Scenes // m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it // m_reprioritizationBusy = false; - //m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - - if (openChildAgents) { IFriendsModule friendsModule = m_scene.RequestModuleInterface(); @@ -3718,10 +3679,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsChildAgent) return; -// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. sitAnimation = "SIT_GROUND_CONSTRAINED"; -// Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); -// TriggerScenePresenceUpdated(); SitGround = true; RemoveFromPhysicalScene(); @@ -3822,14 +3780,6 @@ namespace OpenSim.Region.Framework.Scenes direc.Z = 0; } - // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); -/* - lock(m_forceToApplyLock) - { - m_forceToApply = direc; - m_forceToApplyValid = true; - } -*/ TargetVelocity = direc; Animator.UpdateMovementAnimations(); } @@ -4054,7 +4004,12 @@ namespace OpenSim.Region.Framework.Scenes if((flags & 0x1000) == 0) // wait for seeds sending return; - NeedInitialData = false; + lock (m_completeMovementLock) + { + if(!NeedInitialData) + return; + NeedInitialData = false; + } bool selfappearance = (flags & 4) != 0; @@ -4327,19 +4282,6 @@ namespace OpenSim.Region.Framework.Scenes if(IsDeleted || !ControllingClient.IsActive) return; -/* - bool needsendinitial = false; - lock(m_completeMovementLock) - { - needsendinitial = SentInitialData; - } - - if(needsendinitial) - { - SendInitialDataToMe(); - return; - } -*/ if(m_reprioritizationBusy) return; -- cgit v1.1 From 9650cb87083ed40a55f5fc54c129e9ec18c93f46 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 20:31:35 +0100 Subject: remove a potencially dang. lock --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2f26320..0687da4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4004,7 +4004,7 @@ namespace OpenSim.Region.Framework.Scenes if((flags & 0x1000) == 0) // wait for seeds sending return; - lock (m_completeMovementLock) +// lock (m_completeMovementLock) { if(!NeedInitialData) return; -- cgit v1.1 From 939aff5c3ba6b667c22f371ec8250cd8ac9f8271 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 20:43:32 +0100 Subject: oops RegionHandShakeReply is not reentrant --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0687da4..cd630b8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3994,6 +3994,7 @@ namespace OpenSim.Region.Framework.Scenes { if(m_gotRegionHandShake) return; + m_gotRegionHandShake = true; NeedInitialData = true; } } -- cgit v1.1 From 7110e988155943168c5cf55281f4c57961d1be9a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 31 Mar 2019 23:31:18 +0100 Subject: rez npcs attachments async again --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd630b8..5faa764 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2259,7 +2259,17 @@ namespace OpenSim.Region.Framework.Scenes if (IsNPC || IsRealLogin(m_teleportFlags)) { if (Scene.AttachmentsModule != null) - Scene.AttachmentsModule.RezAttachments(this); + { + if(IsNPC) + { + Util.FireAndForget(x => + { + Scene.AttachmentsModule.RezAttachments(this); + }); + } + else + Scene.AttachmentsModule.RezAttachments(this); + } } else { -- cgit v1.1 From 1984cbdbe5beaa26b46cb9e03ddf6cbcaf56815b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 13:49:25 +0100 Subject: add extra delay before sending initial data --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5faa764..8c46211 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -290,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_lastRotation; private Vector3 m_lastVelocity; private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); - private bool NeedInitialData = false; + private int NeedInitialData = -1; private int m_userFlags; public int UserFlags @@ -3809,7 +3809,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsDeleted) return; - if (NeedInitialData) + if (NeedInitialData > 0) { SendInitialData(); return; @@ -4005,7 +4005,7 @@ namespace OpenSim.Region.Framework.Scenes if(m_gotRegionHandShake) return; m_gotRegionHandShake = true; - NeedInitialData = true; + NeedInitialData = 1; } } @@ -4017,15 +4017,21 @@ namespace OpenSim.Region.Framework.Scenes // lock (m_completeMovementLock) { - if(!NeedInitialData) + if(NeedInitialData < 0) + return; + + // give some extra time to make sure viewers did process seeds + if(++NeedInitialData < 4) // needs fix if update rate changes on heartbeat return; - NeedInitialData = false; } + NeedInitialData = -1; + bool selfappearance = (flags & 4) != 0; Util.FireAndForget(delegate { + m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID); if (m_teleportFlags <= 0) { Scene.SendLayerData(ControllingClient); @@ -6778,7 +6784,7 @@ namespace OpenSim.Region.Framework.Scenes lock (m_completeMovementLock) { GodController.HasMovedAway(); - NeedInitialData = false; + NeedInitialData = -1; m_gotRegionHandShake = false; } -- cgit v1.1 From 8152e47a4a3a460590825e9475599075c9e31e9d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 15:10:42 +0100 Subject: change the point where child regions are closed/opened --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 160 ++++++++++++----------- 1 file changed, 83 insertions(+), 77 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8c46211..12887fb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2168,6 +2168,7 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = false; // Tell the client that we're ready to send rest + m_gotRegionHandShake = false; // allow it ControllingClient.SendRegionHandshake(); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); @@ -2299,54 +2300,6 @@ namespace OpenSim.Region.Framework.Scenes if (!IsNPC) { - if (!string.IsNullOrEmpty(m_callbackURI)) - { - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with old callback to {2}", - client.Name, client.AgentId, m_callbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); - m_callbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } - else if (!string.IsNullOrEmpty(m_newCallbackURI)) - { - m_log.DebugFormat( - "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", - client.Name, client.AgentId, m_newCallbackURI); - - UUID originID; - - lock (m_originRegionIDAccessLock) - originID = m_originRegionID; - - Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); - m_newCallbackURI = null; - //m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - } - - if (openChildAgents) - { - // Create child agents in neighbouring regions - IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); - if (m_agentTransfer != null) - { - m_agentTransfer.EnableChildAgents(this); - } - } - - m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; - m_lastChildAgentUpdatePosition = AbsolutePosition; - m_lastChildAgentUpdateDrawDistance = DrawDistance; - - m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; - m_childUpdatesBusy = false; // allow them - // send the rest of the world if (m_teleportFlags > 0 || m_currentParcelHide) //SendInitialDataToMe(); @@ -4029,8 +3982,61 @@ namespace OpenSim.Region.Framework.Scenes bool selfappearance = (flags & 4) != 0; + // this should enqueued on the client processing job to save threads Util.FireAndForget(delegate { + if(!IsChildAgent) + { + // close v1 sender region obsolete + if (!string.IsNullOrEmpty(m_callbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE({0})]: Releasing {1} {2} with old callback to {3}", + Scene.RegionInfo.RegionName, Name, UUID, m_callbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); + m_callbackURI = null; + NeedInitialData = 4; + return; + } + // v0.7 close HG sender region + if (!string.IsNullOrEmpty(m_newCallbackURI)) + { + m_log.DebugFormat( + "[SCENE PRESENCE({0})]: Releasing {1} {2} with callback to {3}", + Scene.RegionInfo.RegionName, Name, UUID, m_newCallbackURI); + + UUID originID; + + lock (m_originRegionIDAccessLock) + originID = m_originRegionID; + + Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); + m_newCallbackURI = null; + NeedInitialData = 4; + return; + } + + // Create child agents in neighbouring regions + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); + if (m_agentTransfer != null) + { + m_agentTransfer.EnableChildAgents(this); + } + + m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; + m_lastChildAgentUpdatePosition = AbsolutePosition; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_childUpdatesBusy = false; // allow them + } + m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID); if (m_teleportFlags <= 0) { @@ -4052,46 +4058,46 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.ReprioritizeUpdates(); m_reprioritizationLastTime = Util.EnvironmentTickCount(); m_reprioritizationBusy = false; - return; } - - bool cacheCulling = (flags & 1) != 0; - bool cacheEmpty; - if (cacheCulling) - cacheEmpty = (flags & 2) != 0; else - cacheEmpty = true; - - EntityBase[] entities = Scene.Entities.GetEntities(); - if(cacheEmpty) { - foreach (EntityBase e in entities) + bool cacheCulling = (flags & 1) != 0; + bool cacheEmpty; + if (cacheCulling) + cacheEmpty = (flags & 2) != 0; + else + cacheEmpty = true; + + EntityBase[] entities = Scene.Entities.GetEntities(); + if(cacheEmpty) { - if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) - ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); + foreach (EntityBase e in entities) + { + if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); + } } - } - else - { - foreach (EntityBase e in entities) + else { - if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + foreach (EntityBase e in entities) { - SceneObjectGroup grp = e as SceneObjectGroup; - if(grp.IsViewerCachable) - grp.SendUpdateProbes(ControllingClient); - else - grp.SendFullAnimUpdateToClient(ControllingClient); + if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) + { + SceneObjectGroup grp = e as SceneObjectGroup; + if(grp.IsViewerCachable) + grp.SendUpdateProbes(ControllingClient); + else + grp.SendFullAnimUpdateToClient(ControllingClient); + } } } - } - - m_reprioritizationLastPosition = AbsolutePosition; - m_reprioritizationLastDrawDistance = DrawDistance; - m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it - m_reprioritizationBusy = false; + m_reprioritizationLastPosition = AbsolutePosition; + m_reprioritizationLastDrawDistance = DrawDistance; + m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it + m_reprioritizationBusy = false; + } }); } -- cgit v1.1 From 433e529512b20aed91412e0f8c0f02f38d422035 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 15:58:36 +0100 Subject: make tests happy again; try to speedup crossings --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 31 +++++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 12887fb..c71d20d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2168,8 +2168,11 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = false; // Tell the client that we're ready to send rest - m_gotRegionHandShake = false; // allow it - ControllingClient.SendRegionHandshake(); + if (!gotCrossUpdate) + { + m_gotRegionHandShake = false; // allow it if not a crossing + ControllingClient.SendRegionHandshake(); + } ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); @@ -2300,6 +2303,22 @@ namespace OpenSim.Region.Framework.Scenes if (!IsNPC) { + if(gotCrossUpdate) + { + // Create child agents in neighbouring regions + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); + if (m_agentTransfer != null) + { + m_agentTransfer.EnableChildAgents(this); + } + + m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; + m_lastChildAgentUpdatePosition = AbsolutePosition; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_childUpdatesBusy = false; // allow them + } // send the rest of the world if (m_teleportFlags > 0 || m_currentParcelHide) //SendInitialDataToMe(); @@ -4001,8 +4020,8 @@ namespace OpenSim.Region.Framework.Scenes Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); m_callbackURI = null; - NeedInitialData = 4; - return; + //NeedInitialData = 4; + //return; } // v0.7 close HG sender region if (!string.IsNullOrEmpty(m_newCallbackURI)) @@ -4018,8 +4037,8 @@ namespace OpenSim.Region.Framework.Scenes Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); m_newCallbackURI = null; - NeedInitialData = 4; - return; + //NeedInitialData = 4; + //return; } // Create child agents in neighbouring regions -- cgit v1.1 From e7f0131509c33e0af55d361f476f2c270aedb152 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 17:05:47 +0100 Subject: another test.... --- .../Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs index abf8c48..7c3eab1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs @@ -155,11 +155,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests sp1SceneA.AbsolutePosition = so1StartPos; sp1SceneA.HandleAgentRequestSit(sp1SceneA.ControllingClient, sp1SceneA.UUID, so1.UUID, Vector3.Zero); + sceneA.Update(4); + sceneB.Update(4); // Cross sceneA.SceneGraph.UpdatePrimGroupPosition( so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient); // crossing is async + sceneA.Update(4); + sceneB.Update(4); Thread.Sleep(500); SceneObjectGroup so1PostCross; @@ -171,6 +175,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); sceneBTc.CompleteMovement(); + sceneA.Update(4); + sceneB.Update(4); + Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); @@ -188,6 +195,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests sceneB.SceneGraph.UpdatePrimGroupPosition( so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient); + sceneA.Update(4); + sceneB.Update(4); // crossing is async Thread.Sleep(500); -- cgit v1.1 From b458c5a9b4ffeff738d4e854bdf81e70427845fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 17:26:06 +0100 Subject: another test.... --- .../Scenes/Tests/ScenePresenceTeleportTests.cs | 41 ++++++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 94e6b99..676d7eb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -212,6 +212,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); sp.AbsolutePosition = new Vector3(30, 31, 32); + sceneA.Update(4); + sceneB.Update(4); + List destinationTestClients = new List(); EntityTransferHelpers.SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement( (TestClient)sp.ControllingClient, destinationTestClients); @@ -224,11 +227,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests (uint)TeleportFlags.ViaLocation); // Assert.That(sceneA.GetScenePresence(userId), Is.Null); + sceneA.Update(4); + sceneB.Update(4); ScenePresence sceneBSp = sceneB.GetScenePresence(userId); Assert.That(sceneBSp, Is.Not.Null); Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); - Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); + Assert.That(sceneBSp.AbsolutePosition.X, Is.EqualTo(teleportPosition.X)); + Assert.That(sceneBSp.AbsolutePosition.Y, Is.EqualTo(teleportPosition.Y)); //Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); //Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); @@ -239,7 +245,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera // position instead). -// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); + // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); } /// @@ -310,7 +316,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sceneASp = sceneA.GetScenePresence(userId); Assert.That(sceneASp, Is.Not.Null); Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); - Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); + Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); + Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); @@ -369,6 +376,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); sp.AbsolutePosition = preTeleportPosition; + sceneA.Update(4); + sceneB.Update(4); + // Make sceneB refuse CreateAgent sceneB.LoginsEnabled = false; @@ -379,14 +389,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests teleportLookAt, (uint)TeleportFlags.ViaLocation); -// ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); + // ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); + + sceneA.Update(4); + sceneB.Update(4); Assert.That(sceneB.GetScenePresence(userId), Is.Null); ScenePresence sceneASp = sceneA.GetScenePresence(userId); Assert.That(sceneASp, Is.Not.Null); Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); - Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); + Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); + Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); @@ -458,6 +472,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); sp.AbsolutePosition = preTeleportPosition; + sceneA.Update(4); + sceneB.Update(4); + sceneA.RequestTeleportLocation( sp.ControllingClient, sceneB.RegionInfo.RegionHandle, @@ -468,13 +485,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate // communication with the destination region. But this is a very non-obvious way of doing it - really we // should be forced to expicitly set this up. + sceneA.Update(4); + sceneB.Update(4); Assert.That(sceneB.GetScenePresence(userId), Is.Null); ScenePresence sceneASp = sceneA.GetScenePresence(userId); Assert.That(sceneASp, Is.Not.Null); Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); - Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); + Assert.That(sceneASp.AbsolutePosition.X, Is.EqualTo(preTeleportPosition.X)); + Assert.That(sceneASp.AbsolutePosition.Y, Is.EqualTo(preTeleportPosition.Y)); Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); @@ -614,6 +634,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); + sceneA.Update(4); + sceneB.Update(4); + Assert.That(beforeSceneASp, Is.Not.Null); Assert.That(beforeSceneASp.IsChildAgent, Is.False); @@ -638,6 +661,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests teleportLookAt, (uint)TeleportFlags.ViaLocation); + sceneA.Update(4); + sceneB.Update(4); + ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); Assert.That(afterSceneASp, Is.Not.Null); Assert.That(afterSceneASp.IsChildAgent, Is.True); @@ -646,7 +672,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(afterSceneBSp, Is.Not.Null); Assert.That(afterSceneBSp.IsChildAgent, Is.False); Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); - Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); + Assert.That(afterSceneBSp.AbsolutePosition.X, Is.EqualTo(teleportPosition.X)); + Assert.That(afterSceneBSp.AbsolutePosition.Y, Is.EqualTo(teleportPosition.Y)); Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); -- cgit v1.1 From 8e094887cd72fb878a5ac33bcb2fd95fcf771462 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Apr 2019 20:27:56 +0100 Subject: change avatars sending point --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c71d20d..2c20da6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2193,9 +2193,6 @@ namespace OpenSim.Region.Framework.Scenes } } - //m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - - // HG if(isHGTP) { // ControllingClient.SendNameReply(m_uuid, Firstname, Lastname); @@ -2244,6 +2241,7 @@ namespace OpenSim.Region.Framework.Scenes // if not cached we send greys // uncomented if will wait till avatar does baking //if (cachedbaked) + { foreach (ScenePresence p in allpresences) { @@ -2257,7 +2255,7 @@ namespace OpenSim.Region.Framework.Scenes if (haveAnims) SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs); } - } // greys if + } // attachments if (IsNPC || IsRealLogin(m_teleportFlags)) @@ -2305,6 +2303,8 @@ namespace OpenSim.Region.Framework.Scenes { if(gotCrossUpdate) { + SendOtherAgentsAvatarFullToMe(); + // Create child agents in neighbouring regions IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) @@ -2318,11 +2318,13 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them + } + // send the rest of the world - if (m_teleportFlags > 0 || m_currentParcelHide) + //if (m_teleportFlags > 0 || m_currentParcelHide) //SendInitialDataToMe(); - SendOtherAgentsAvatarFullToMe(); + //SendOtherAgentsAvatarFullToMe(); // priority uses avatar position only // m_reprioritizationLastPosition = AbsolutePosition; @@ -4064,10 +4066,10 @@ namespace OpenSim.Region.Framework.Scenes ILandChannel landch = m_scene.LandChannel; if (landch != null) landch.sendClientInitialLandInfo(ControllingClient, true); - - SendOtherAgentsAvatarFullToMe(); } + SendOtherAgentsAvatarFullToMe(); + if (m_scene.ObjectsCullingByDistance) { m_reprioritizationBusy = true; -- cgit v1.1 From 15b6d8c1477e6a294819bf5c0c510d909997fb8f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 00:50:54 +0100 Subject: send agent view range to new child agents --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2c20da6..be593ad 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1079,7 +1079,14 @@ namespace OpenSim.Region.Framework.Scenes Animator = new ScenePresenceAnimator(this); Overrides = new MovementAnimationOverrides(); PresenceType = type; - DrawDistance = world.DefaultDrawDistance; + m_drawDistance = client.StartFar; + if(m_drawDistance > 32) + { + if(m_drawDistance > world.MaxDrawDistance) + m_drawDistance = world.MaxDrawDistance; + } + else + m_drawDistance = world.DefaultDrawDistance; RegionHandle = world.RegionInfo.RegionHandle; ControllingClient = client; Firstname = ControllingClient.FirstName; -- cgit v1.1 From a56f40470efd0b3ca6000cb4561efc59c6b3c25e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 18:55:40 +0100 Subject: control visible regions by avatar position and view range, first dirty code --- .../Framework/Interfaces/IEntityTransferModule.cs | 2 + OpenSim/Region/Framework/Scenes/Scene.cs | 6 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 150 +++++++++++++-------- 3 files changed, 96 insertions(+), 62 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 1b690ba..9377564 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs @@ -90,6 +90,8 @@ namespace OpenSim.Region.Framework.Interfaces void AgentArrivedAtDestination(UUID agent); void EnableChildAgents(ScenePresence agent); + void CheckChildAgents(ScenePresence agent); + void CloseOldChildAgents(ScenePresence agent); void EnableChildAgent(ScenePresence agent, GridRegion region); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7d312e9..e130bd7 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1286,7 +1286,6 @@ namespace OpenSim.Region.Framework.Scenes { if (RegionInfo.RegionHandle != otherRegion.RegionHandle) { - if (isNeighborRegion(otherRegion)) { // Let the grid service module know, so this can be cached @@ -1296,9 +1295,6 @@ namespace OpenSim.Region.Framework.Scenes { ForEachRootScenePresence(delegate(ScenePresence agent) { - //agent.ControllingClient.new - //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); - List old = new List(); old.Add(otherRegion.RegionHandle); agent.DropOldNeighbours(old); @@ -1324,7 +1320,7 @@ namespace OpenSim.Region.Framework.Scenes public bool isNeighborRegion(GridRegion otherRegion) { - int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; ; + int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX) return false; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index be593ad..fbf9b4a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -165,6 +165,7 @@ namespace OpenSim.Region.Framework.Scenes public static readonly float MOVEMENT = .25f; public static readonly float SIGNIFICANT_MOVEMENT = 16.0f; public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; + public static readonly float CHILDAGENTSCHECK_MOVEMENT = 1024f; // 32m public static readonly float CHILDUPDATES_TIME = 2000f; // min time between child updates (ms) private UUID m_previusParcelUUID = UUID.Zero; @@ -342,7 +343,8 @@ namespace OpenSim.Region.Framework.Scenes private int m_lastChildAgentUpdateGodLevel; private float m_lastChildAgentUpdateDrawDistance; private Vector3 m_lastChildAgentUpdatePosition; -// private Vector3 m_lastChildAgentUpdateCamPosition; + private Vector3 m_lastChildAgentCheckPosition; + // private Vector3 m_lastChildAgentUpdateCamPosition; private Vector3 m_lastCameraRayCastCam; private Vector3 m_lastCameraRayCastPos; @@ -627,7 +629,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance); + return Util.Clamp(m_drawDistance + 64f, 64f, m_scene.MaxRegionViewDistance); } } @@ -2321,6 +2323,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; m_lastChildAgentUpdatePosition = AbsolutePosition; + m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; m_lastChildAgentUpdateDrawDistance = DrawDistance; m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; @@ -4049,20 +4052,11 @@ namespace OpenSim.Region.Framework.Scenes //NeedInitialData = 4; //return; } - - // Create child agents in neighbouring regions IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) { - m_agentTransfer.EnableChildAgents(this); + m_agentTransfer.CloseOldChildAgents(this); } - - m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; - m_lastChildAgentUpdatePosition = AbsolutePosition; - m_lastChildAgentUpdateDrawDistance = DrawDistance; - - m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; - m_childUpdatesBusy = false; // allow them } m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", Scene.RegionInfo.RegionName, UUID); @@ -4126,6 +4120,24 @@ namespace OpenSim.Region.Framework.Scenes m_reprioritizationBusy = false; } + + if (!IsChildAgent) + { + // Create child agents in neighbouring regions + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); + if (m_agentTransfer != null) + { + m_agentTransfer.EnableChildAgents(this); + } + + m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; + m_lastChildAgentUpdatePosition = AbsolutePosition; + m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_childUpdatesBusy = false; // allow them + } }); } @@ -4399,56 +4411,80 @@ namespace OpenSim.Region.Framework.Scenes if(m_childUpdatesBusy) return; - //possible KnownRegionHandles always contains current region and this check is not needed - int minhandles = KnownRegionHandles.Contains(RegionHandle) ? 1 : 0; - if(KnownRegionHandles.Count > minhandles) - { - int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); - if(tdiff < CHILDUPDATES_TIME) - return; + int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); + if (tdiff < CHILDUPDATES_TIME) + return; - bool doUpdate = false; - if(m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) - doUpdate = true; - - if(!doUpdate && Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f) - doUpdate = true; + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); + float dx = pos.X - m_lastChildAgentCheckPosition.Y; + float dy = pos.Y - m_lastChildAgentCheckPosition.Y; + if ((m_agentTransfer != null) && ((dx * dx + dy *dy) > CHILDAGENTSCHECK_MOVEMENT)) + { + m_childUpdatesBusy = true; + m_lastChildAgentCheckPosition = pos; + m_lastChildAgentUpdatePosition = pos; + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + // m_lastChildAgentUpdateCamPosition = CameraPosition; - if(!doUpdate) + Util.FireAndForget( + o => + { + m_agentTransfer.EnableChildAgents(this); + m_lastChildUpdatesTime = Util.EnvironmentTickCount(); + m_childUpdatesBusy = false; + }, null, "ScenePresence.CheckChildAgents"); + } + else + { + //possible KnownRegionHandles always contains current region and this check is not needed + int minhandles = KnownRegionHandles.Contains(RegionHandle) ? 1 : 0; + if(KnownRegionHandles.Count > minhandles) { - diff = pos - m_lastChildAgentUpdatePosition; - if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) + bool doUpdate = false; + if (m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) doUpdate = true; - } - if(doUpdate) - { - m_childUpdatesBusy = true; - m_lastChildAgentUpdatePosition = pos; - m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; - m_lastChildAgentUpdateDrawDistance = DrawDistance; -// m_lastChildAgentUpdateCamPosition = CameraPosition; - - AgentPosition agentpos = new AgentPosition(); - agentpos.AgentID = new UUID(UUID.Guid); - agentpos.SessionID = ControllingClient.SessionId; - agentpos.Size = Appearance.AvatarSize; - agentpos.Center = CameraPosition; - agentpos.Far = DrawDistance; - agentpos.Position = AbsolutePosition; - agentpos.Velocity = Velocity; - agentpos.RegionHandle = RegionHandle; - agentpos.GodData = GodController.State(); - agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); - - // Let's get this out of the update loop - Util.FireAndForget( - o => - { - m_scene.SendOutChildAgentUpdates(agentpos, this); - m_lastChildUpdatesTime = Util.EnvironmentTickCount(); - m_childUpdatesBusy = false; - }, null, "ScenePresence.SendOutChildAgentUpdates"); + bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; + if (!viewchanged) + doUpdate = true; + + if(!doUpdate) + { + diff = pos - m_lastChildAgentUpdatePosition; + if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) + doUpdate = true; + } + + if (doUpdate) + { + m_childUpdatesBusy = true; + m_lastChildAgentUpdatePosition = pos; + m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; + m_lastChildAgentUpdateDrawDistance = DrawDistance; + // m_lastChildAgentUpdateCamPosition = CameraPosition; + + AgentPosition agentpos = new AgentPosition(); + agentpos.AgentID = new UUID(UUID.Guid); + agentpos.SessionID = ControllingClient.SessionId; + agentpos.Size = Appearance.AvatarSize; + agentpos.Center = CameraPosition; + agentpos.Far = DrawDistance; + agentpos.Position = AbsolutePosition; + agentpos.Velocity = Velocity; + agentpos.RegionHandle = RegionHandle; + agentpos.GodData = GodController.State(); + agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); + + // Let's get this out of the update loop + Util.FireAndForget( + o => + { + m_scene.SendOutChildAgentUpdates(agentpos, this); + m_lastChildUpdatesTime = Util.EnvironmentTickCount(); + m_childUpdatesBusy = false; + }, null, "ScenePresence.SendOutChildAgentUpdates"); + } } } } -- cgit v1.1 From 50c810549c5faf87017c189326732ba8899a58d0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 4 Apr 2019 20:16:23 +0100 Subject: change visible regions also by view range change; fix check on crossings --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fbf9b4a..438ae4c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4415,10 +4415,12 @@ namespace OpenSim.Region.Framework.Scenes if (tdiff < CHILDUPDATES_TIME) return; + bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); - float dx = pos.X - m_lastChildAgentCheckPosition.Y; + float dx = pos.X - m_lastChildAgentCheckPosition.X; float dy = pos.Y - m_lastChildAgentCheckPosition.Y; - if ((m_agentTransfer != null) && ((dx * dx + dy *dy) > CHILDAGENTSCHECK_MOVEMENT)) + if ((m_agentTransfer != null) && (viewchanged || ((dx * dx + dy * dy) > CHILDAGENTSCHECK_MOVEMENT))) { m_childUpdatesBusy = true; m_lastChildAgentCheckPosition = pos; @@ -4445,7 +4447,6 @@ namespace OpenSim.Region.Framework.Scenes if (m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) doUpdate = true; - bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; if (!viewchanged) doUpdate = true; -- cgit v1.1 From 0652f01d4cbae9585f4288b68d1feff1711d6be4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 03:45:27 +0100 Subject: duhhh npcs don't have child agents; plus minor typos --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 17 ++++++++++++----- OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 438ae4c..f9d1f54 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3072,10 +3072,14 @@ namespace OpenSim.Region.Framework.Scenes Vector2 regionSize; regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); - if (pos.X < 0 || pos.X >= regionSize.X - || pos.Y < 0 || pos.Y >= regionSize.Y - || pos.Z < 0) - return; + if (pos.X < 0.5f) + pos.X = 0.5f; + else if (pos.X > regionSize.X - 0.5f) + pos.X = regionSize.X - 0.5f; + if (pos.Y < 0.5f) + pos.Y = 0.5f; + else if (pos.Y > regionSize.Y - 0.5f) + pos.Y = regionSize.Y - 0.5f; float terrainHeight; Scene targetScene = m_scene; @@ -4405,6 +4409,9 @@ namespace OpenSim.Region.Framework.Scenes m_scene.EventManager.TriggerSignificantClientMovement(this); } + if(IsNPC) + return; + // updates priority recalc checkRePrioritization(); @@ -6720,7 +6727,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; - // only those on previus parcel need receive kills + // only those on previous parcel need receive kills if (previusParcelID == p.currentParcelUUID) { if(!p.IsViewerUIGod) diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index bc440fc..50b0cb5 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -556,7 +556,7 @@ namespace OpenSim.Region.Framework.Scenes sb[27].StatID = (uint)Stats.PhysicsLodTasks; sb[27].StatValue = 0; - sb[28].StatID = (uint)Stats.ScriptEps; // we actuall have this, but not messing array order AGAIN + sb[28].StatID = (uint)Stats.ScriptEps; // we actually have this, but not messing array order AGAIN sb[28].StatValue = (float)Math.Round(m_scriptEventsPerSecond * updateTimeFactor); sb[29].StatID = (uint)Stats.SimAIStepTimeMS; -- cgit v1.1 From 63321f9ccc1e35db8034da64c510f334e7d5e7d5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 04:08:14 +0100 Subject: add option RegionViewDistance --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e130bd7..351592d 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -275,6 +275,12 @@ namespace OpenSim.Region.Framework.Scenes get { return m_maxRegionViewDistance; } } + protected float m_minRegionViewDistance = 96f; + public float MinRegionViewDistance + { + get { return m_minRegionViewDistance; } + } + private List m_AllowedViewers = new List(); private List m_BannedViewers = new List(); @@ -920,6 +926,7 @@ namespace OpenSim.Region.Framework.Scenes m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance); + m_minRegionViewDistance = startupConfig.GetFloat("MinRegionsViewDistance", m_maxRegionViewDistance); // old versions compatibility LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets); @@ -930,6 +937,11 @@ namespace OpenSim.Region.Framework.Scenes if (m_maxRegionViewDistance > m_maxDrawDistance) m_maxRegionViewDistance = m_maxDrawDistance; + if(m_minRegionViewDistance < 96f) + m_minRegionViewDistance = 96f; + if(m_minRegionViewDistance > m_maxRegionViewDistance) + m_minRegionViewDistance = m_maxRegionViewDistance; + UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); if (!UseBackup) m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f9d1f54..60a9c3a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -629,7 +629,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - return Util.Clamp(m_drawDistance + 64f, 64f, m_scene.MaxRegionViewDistance); + return Util.Clamp(m_drawDistance + 64f, m_scene.MinRegionViewDistance, m_scene.MaxRegionViewDistance); } } -- cgit v1.1 From 6485377ecd8ece0e1a998e03d5f38db9bf6890a8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 04:21:40 +0100 Subject: fix MinRegionViewDistance option (added in last commit); change regions view control --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 351592d..2fa92b3 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -926,7 +926,7 @@ namespace OpenSim.Region.Framework.Scenes m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance); - m_minRegionViewDistance = startupConfig.GetFloat("MinRegionsViewDistance", m_maxRegionViewDistance); + m_minRegionViewDistance = startupConfig.GetFloat("MinRegionsViewDistance", m_minRegionViewDistance); // old versions compatibility LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 60a9c3a..200036c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -342,6 +342,7 @@ namespace OpenSim.Region.Framework.Scenes private int m_lastChildUpdatesTime; private int m_lastChildAgentUpdateGodLevel; private float m_lastChildAgentUpdateDrawDistance; + private float m_lastRegionsDrawDistance; private Vector3 m_lastChildAgentUpdatePosition; private Vector3 m_lastChildAgentCheckPosition; // private Vector3 m_lastChildAgentUpdateCamPosition; @@ -2325,6 +2326,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdatePosition = AbsolutePosition; m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; m_lastChildAgentUpdateDrawDistance = DrawDistance; + m_lastRegionsDrawDistance = RegionViewDistance; m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them @@ -4138,6 +4140,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdatePosition = AbsolutePosition; m_lastChildAgentCheckPosition = m_lastChildAgentUpdatePosition; m_lastChildAgentUpdateDrawDistance = DrawDistance; + m_lastRegionsDrawDistance = RegionViewDistance; m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_childUpdatesBusy = false; // allow them @@ -4422,7 +4425,7 @@ namespace OpenSim.Region.Framework.Scenes if (tdiff < CHILDUPDATES_TIME) return; - bool viewchanged = Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f; + bool viewchanged = Math.Abs(RegionViewDistance - m_lastRegionsDrawDistance) > 32.0f; IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); float dx = pos.X - m_lastChildAgentCheckPosition.X; @@ -4434,6 +4437,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastChildAgentUpdatePosition = pos; m_lastChildAgentUpdateGodLevel = GodController.ViwerUIGodLevel; m_lastChildAgentUpdateDrawDistance = DrawDistance; + m_lastRegionsDrawDistance = RegionViewDistance; // m_lastChildAgentUpdateCamPosition = CameraPosition; Util.FireAndForget( @@ -4454,7 +4458,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_lastChildAgentUpdateGodLevel != GodController.ViwerUIGodLevel) doUpdate = true; - if (!viewchanged) + if (Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f) doUpdate = true; if(!doUpdate) -- cgit v1.1 From 7ce45235e61b1ee48a2b5208e5fdfb39a76ad96c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 11:19:38 +0100 Subject: make sure viewer knows where to place a sitting avatar, this will need deep revision with culling --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 200036c..a52fa76 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4210,8 +4210,17 @@ namespace OpenSim.Region.Framework.Scenes { m_lastSize = Appearance.AvatarSize; int count = 0; + SceneObjectPart sitroot = null; + if (ParentID != 0 && ParentPart != null) // we need to send the sitting root prim + { + sitroot = ParentPart.ParentGroup.RootPart; + } foreach (ScenePresence p in presences) { + if (sitroot != null) // we need to send the sitting root prim + { + p.ControllingClient.SendEntityFullUpdateImmediate(ParentPart.ParentGroup.RootPart); + } p.ControllingClient.SendEntityFullUpdateImmediate(this); if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) // either just kill the object @@ -4225,6 +4234,10 @@ namespace OpenSim.Region.Framework.Scenes public void SendInitialAvatarDataToAgent(ScenePresence p) { + if(ParentID != 0 && ParentPart != null) // we need to send the sitting root prim + { + p.ControllingClient.SendEntityFullUpdateImmediate(ParentPart.ParentGroup.RootPart); + } p.ControllingClient.SendEntityFullUpdateImmediate(this); if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod) // either just kill the object -- cgit v1.1 From 28c97257302a6f6596dca0b79f4c57f0e7f28225 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 12:31:43 +0100 Subject: kill avatar on agents that do not see its new region --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a52fa76..c728d9b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1655,6 +1655,14 @@ namespace OpenSim.Region.Framework.Scenes CollisionPlane = Vector4.UnitW; + // we need to kill this on agents that do not see the new region + m_scene.ForEachRootScenePresence(delegate(ScenePresence p) + { + if (!p.knowsNeighbourRegion(newRegionHandle)) + { + SendKillTo(p); + } + }); m_scene.EventManager.TriggerOnMakeChildAgent(this); } -- cgit v1.1 From 5ed2b5c990a9d0037a15347cb8bb4db1a105c5e8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Apr 2019 14:43:48 +0100 Subject: try handle the special case MaxRegionsViewDistance = 0 (agents only see void around region, even if there are regions around --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c728d9b..aea3a8d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1651,8 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes m_previusParcelUUID = UUID.Zero; m_currentParcelHide = false; m_currentParcelUUID = UUID.Zero; - // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into - + CollisionPlane = Vector4.UnitW; // we need to kill this on agents that do not see the new region @@ -4439,7 +4438,7 @@ namespace OpenSim.Region.Framework.Scenes // updates priority recalc checkRePrioritization(); - if(m_childUpdatesBusy) + if(m_childUpdatesBusy || RegionViewDistance == 0) return; int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime); -- cgit v1.1 From ec6a52c029792e78d31100a742d575ae71b402e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 6 Apr 2019 21:26:12 +0100 Subject: change interpretation of a viewer flag --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index aea3a8d..c536184 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4045,11 +4045,9 @@ namespace OpenSim.Region.Framework.Scenes Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI); m_callbackURI = null; - //NeedInitialData = 4; - //return; } // v0.7 close HG sender region - if (!string.IsNullOrEmpty(m_newCallbackURI)) + else if (!string.IsNullOrEmpty(m_newCallbackURI)) { m_log.DebugFormat( "[SCENE PRESENCE({0})]: Releasing {1} {2} with callback to {3}", @@ -4062,8 +4060,6 @@ namespace OpenSim.Region.Framework.Scenes Scene.SimulationService.ReleaseAgent(originID, UUID, m_newCallbackURI); m_newCallbackURI = null; - //NeedInitialData = 4; - //return; } IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) @@ -4096,12 +4092,8 @@ namespace OpenSim.Region.Framework.Scenes } else { - bool cacheCulling = (flags & 1) != 0; - bool cacheEmpty; - if (cacheCulling) - cacheEmpty = (flags & 2) != 0; - else - cacheEmpty = true; + //bool cacheCulling = (flags & 1) != 0; + bool cacheEmpty = (flags & 2) != 0;; EntityBase[] entities = Scene.Entities.GetEntities(); if(cacheEmpty) -- cgit v1.1 From e9587c88354964f7b1e5ca38e1b1f8b6da7ef9d4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Apr 2019 22:56:31 +0100 Subject: sop: rename a few fields --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 14 +++--- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 50 +++++++++++----------- 2 files changed, 32 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0b38179..c0bafc5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -770,9 +770,9 @@ namespace OpenSim.Region.Framework.Scenes } if(av.IsNPC) - av.crossingFlags = 0; + av.m_crossingFlags = 0; else - av.crossingFlags = cflags; + av.m_crossingFlags = cflags; av.PrevSitOffset = av.OffsetPosition; av.ParentID = 0; @@ -821,7 +821,7 @@ namespace OpenSim.Region.Framework.Scenes if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx)) crossedfar = true; else - av.crossingFlags = 0; + av.m_crossingFlags = 0; } if(crossedfar) @@ -834,7 +834,7 @@ namespace OpenSim.Region.Framework.Scenes av.IsInTransit = true; m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); - if(av.crossingFlags > 0) + if(av.m_crossingFlags > 0) entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx); if (av.IsChildAgent) @@ -849,7 +849,7 @@ namespace OpenSim.Region.Framework.Scenes av.ParentPart = null; // In any case av.IsInTransit = false; - av.crossingFlags = 0; + av.m_crossingFlags = 0; m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); } else @@ -865,7 +865,7 @@ namespace OpenSim.Region.Framework.Scenes oldp.X = Util.Clamp(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f); oldp.Y = Util.Clamp(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f); av.AbsolutePosition = oldp; - av.crossingFlags = 0; + av.m_crossingFlags = 0; av.sitAnimation = "SIT"; av.IsInTransit = false; if(av.Animator!= null) @@ -926,7 +926,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avinfo.av; av.ParentUUID = UUID.Zero; av.ParentID = avinfo.ParentID; - av.crossingFlags = 0; + av.m_crossingFlags = 0; } } avsToCross.Clear(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c536184..b341d48 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -601,9 +601,9 @@ namespace OpenSim.Region.Framework.Scenes public string Firstname { get; private set; } public string Lastname { get; private set; } - public bool haveGroupInformation; - public bool gotCrossUpdate; - public byte crossingFlags; + public bool m_haveGroupInformation; + public bool m_gotCrossUpdate; + public byte m_crossingFlags; public string Grouptitle { @@ -1322,7 +1322,7 @@ namespace OpenSim.Region.Framework.Scenes { part.AddSittingAvatar(this); // if not actually on the target invalidate it - if(gotCrossUpdate && (crossingFlags & 0x04) == 0) + if(m_gotCrossUpdate && (m_crossingFlags & 0x04) == 0) part.SitTargetAvatar = UUID.Zero; ParentID = part.LocalId; @@ -1604,9 +1604,9 @@ namespace OpenSim.Region.Framework.Scenes public void MakeChildAgent(ulong newRegionHandle) { m_updateAgentReceivedAfterTransferEvent.Reset(); - haveGroupInformation = false; - gotCrossUpdate = false; - crossingFlags = 0; + m_haveGroupInformation = false; + m_gotCrossUpdate = false; + m_crossingFlags = 0; m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; RegionHandle = newRegionHandle; @@ -2152,7 +2152,7 @@ namespace OpenSim.Region.Framework.Scenes if (!IsNPC) { - if (!haveGroupInformation) + if (!m_haveGroupInformation) { IGroupsModule gm = m_scene.RequestModuleInterface(); if (gm != null) @@ -2171,9 +2171,9 @@ namespace OpenSim.Region.Framework.Scenes } if (m_teleportFlags > 0) - gotCrossUpdate = false; // sanity check + m_gotCrossUpdate = false; // sanity check - if (!gotCrossUpdate) + if (!m_gotCrossUpdate) RotateToLookAt(look); m_previusParcelHide = false; @@ -2185,7 +2185,7 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = false; // Tell the client that we're ready to send rest - if (!gotCrossUpdate) + if (!m_gotCrossUpdate) { m_gotRegionHandShake = false; // allow it if not a crossing ControllingClient.SendRegionHandshake(); @@ -2197,7 +2197,7 @@ namespace OpenSim.Region.Framework.Scenes if(!IsNPC) { - if( ParentPart != null && (crossingFlags & 0x08) != 0) + if( ParentPart != null && (m_crossingFlags & 0x08) != 0) { ParentPart.ParentGroup.SendFullAnimUpdateToClient(ControllingClient); } @@ -2221,13 +2221,13 @@ namespace OpenSim.Region.Framework.Scenes GodController.SyncViewerState(); // start sending terrain patchs - if (!gotCrossUpdate) + if (!m_gotCrossUpdate) Scene.SendLayerData(ControllingClient); // send initial land overlay and parcel ILandChannel landch = m_scene.LandChannel; if (landch != null) - landch.sendClientInitialLandInfo(client, !gotCrossUpdate); + landch.sendClientInitialLandInfo(client, !m_gotCrossUpdate); } List allpresences = m_scene.GetScenePresences(); @@ -2318,7 +2318,7 @@ namespace OpenSim.Region.Framework.Scenes if (!IsNPC) { - if(gotCrossUpdate) + if(m_gotCrossUpdate) { SendOtherAgentsAvatarFullToMe(); @@ -2356,7 +2356,7 @@ namespace OpenSim.Region.Framework.Scenes IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) { - if(gotCrossUpdate) + if(m_gotCrossUpdate) friendsModule.IsNowRoot(this); else friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); @@ -2367,9 +2367,9 @@ namespace OpenSim.Region.Framework.Scenes } finally { - haveGroupInformation = false; - gotCrossUpdate = false; - crossingFlags = 0; + m_haveGroupInformation = false; + m_gotCrossUpdate = false; + m_crossingFlags = 0; m_inTransit = false; } @@ -4910,7 +4910,7 @@ namespace OpenSim.Region.Framework.Scenes if(isCrossUpdate) { - cAgent.CrossingFlags = crossingFlags; + cAgent.CrossingFlags = m_crossingFlags; cAgent.CrossingFlags |= 1; cAgent.CrossExtraFlags = 0; if((LastCommands & ScriptControlled.CONTROL_LBUTTON) != 0) @@ -5047,9 +5047,9 @@ namespace OpenSim.Region.Framework.Scenes if (cAgent.MotionState != 0) Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; - crossingFlags = cAgent.CrossingFlags; - gotCrossUpdate = (crossingFlags != 0); - if(gotCrossUpdate) + m_crossingFlags = cAgent.CrossingFlags; + m_gotCrossUpdate = (m_crossingFlags != 0); + if(m_gotCrossUpdate) { LastCommands &= ~(ScriptControlled.CONTROL_LBUTTON | ScriptControlled.CONTROL_ML_LBUTTON); if((cAgent.CrossExtraFlags & 1) != 0) @@ -5059,11 +5059,11 @@ namespace OpenSim.Region.Framework.Scenes MouseDown = (cAgent.CrossExtraFlags & 3) != 0; } - haveGroupInformation = false; + m_haveGroupInformation = false; // using this as protocol detection don't want to mess with the numbers for now if(cAgent.ActiveGroupTitle != null) { - haveGroupInformation = true; + m_haveGroupInformation = true; COF = cAgent.agentCOF; if(ControllingClient.IsGroupMember(cAgent.ActiveGroupID)) { -- cgit v1.1 From 11c945a5651d8e55c6948df9a026ff3d85566b51 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 1 May 2019 01:35:45 +0100 Subject: add osLocalTeleportAgent(key agent, vector position, vector velocity, vector lookat, LSL_Integer flags). Velocity only works with ubOde but still not good. flags = bit field: 1 use velocity, 2 use lookat, 4 rotate avatar look in current velocity direction (ignored if 2 ie flag = 7 is same as 3). This bypasses most the unnecessary logic of osTeleportAgent, having usage same permissions. It may do region crossings(?). Experimental stage, feedbakc expected ;) --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 +++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 49 +++++++++++------------- 2 files changed, 37 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2fa92b3..073d11f 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4795,6 +4795,20 @@ Label_GroupsDone: return true; } + + /// + /// Tries to teleport agent within region. + /// + /// + /// + /// + /// + public void RequestLocalTeleport(ScenePresence sp, Vector3 position, Vector3 vel, + Vector3 lookat, int flags) + { + sp.LocalTeleport(position, vel, lookat, flags); + } + /// /// Tries to teleport agent to another region. /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b341d48..56e822a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1688,10 +1688,6 @@ namespace OpenSim.Region.Framework.Scenes // } } - /// - /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. - /// - /// public void Teleport(Vector3 pos) { TeleportWithMomentum(pos, Vector3.Zero); @@ -1736,36 +1732,37 @@ namespace OpenSim.Region.Framework.Scenes SendTerseUpdateToAllClients(); } - public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) + public void LocalTeleport(Vector3 newpos, Vector3 newvel, Vector3 newlookat, int flags) { if(!CheckLocalTPLandingPoint(ref newpos)) return; AbsolutePosition = newpos; - if (newvel.HasValue) + if ((flags & 1) != 0) { - if ((Vector3)newvel == Vector3.Zero) - { - if (PhysicsActor != null) - PhysicsActor.SetMomentum(Vector3.Zero); - m_velocity = Vector3.Zero; - } - else - { - if (PhysicsActor != null) - PhysicsActor.SetMomentum((Vector3)newvel); - m_velocity = (Vector3)newvel; + if (PhysicsActor != null) + PhysicsActor.SetMomentum(newvel); + m_velocity = newvel; + } - if (rotateToVelXY) - { - Vector3 lookAt = (Vector3)newvel; - lookAt.Z = 0; - lookAt.Normalize(); - ControllingClient.SendLocalTeleport(newpos, lookAt, (uint)TeleportFlags.ViaLocation); - return; - } - } + if ((flags & 2) != 0) + { + newlookat.Z = 0; + newlookat.Normalize(); + if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) + ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation); + } + else if((flags & 4) != 0) + { + if((flags & 1) != 0) + newlookat = newvel; + else + newlookat = m_velocity; + newlookat.Z = 0; + newlookat.Normalize(); + if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) + ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation); } SendTerseUpdateToAllClients(); } -- cgit v1.1 From ea32a73103b3df4b6c5d904ae92e088e0b5bbdc2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 1 May 2019 03:49:24 +0100 Subject: osLocalTeleportAgent: no region crossings :( ; check avatar access to target position; flag 8 == force fly; 16 force nofly (both == fly) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 77 +++++++++++++++++++++--- 1 file changed, 68 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 56e822a..cd2b9b4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1734,24 +1734,72 @@ namespace OpenSim.Region.Framework.Scenes public void LocalTeleport(Vector3 newpos, Vector3 newvel, Vector3 newlookat, int flags) { - if(!CheckLocalTPLandingPoint(ref newpos)) - return; + if (newpos.X <= 0) + { + newpos.X = 0.1f; + if (newvel.X < 0) + newvel.X = 0; + } + else if (newpos.X >= Scene.RegionInfo.RegionSizeX) + { + newpos.X = Scene.RegionInfo.RegionSizeX - 0.1f; + if (newvel.X > 0) + newvel.X = 0; + } - AbsolutePosition = newpos; + if (newpos.Y <= 0) + { + newpos.Y = 0.1f; + if (newvel.Y < 0) + newvel.Y = 0; + } + else if (newpos.Y >= Scene.RegionInfo.RegionSizeY) + { + newpos.Y = Scene.RegionInfo.RegionSizeY - 0.1f; + if (newvel.Y > 0) + newvel.Y = 0; + } - if ((flags & 1) != 0) + string reason; + if (!m_scene.TestLandRestrictions(UUID, out reason, ref newpos.X, ref newpos.Y)) + return ; + + if (IsSatOnObject) + StandUp(); + + float localHalfAVHeight = 0.8f; + if (Appearance != null) + localHalfAVHeight = Appearance.AvatarHeight / 2; + + float posZLimit = 22; + + // TODO: Check other Scene HeightField + posZLimit = (float)Scene.Heightmap[(int)newpos.X, (int)newpos.Y]; + + posZLimit += localHalfAVHeight + 0.1f; + + if ((newpos.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) { - if (PhysicsActor != null) - PhysicsActor.SetMomentum(newvel); - m_velocity = newvel; + newpos.Z = posZLimit; } + if ((flags & 8) != 0) + Flying = true; + else if ((flags & 16) != 0) + Flying = false; + + uint tpflags = (uint)TeleportFlags.ViaLocation; + if(Flying) + tpflags |= (uint)TeleportFlags.IsFlying; + + Vector3 lookat = Lookat; + if ((flags & 2) != 0) { newlookat.Z = 0; newlookat.Normalize(); if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) - ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation); + lookat = newlookat; } else if((flags & 4) != 0) { @@ -1762,8 +1810,19 @@ namespace OpenSim.Region.Framework.Scenes newlookat.Z = 0; newlookat.Normalize(); if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) - ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation); + lookat = newlookat; + } + + AbsolutePosition = newpos; + ControllingClient.SendLocalTeleport(newpos, lookat, tpflags); + + if ((flags & 1) != 0) + { + if (PhysicsActor != null) + PhysicsActor.SetMomentum(newvel); + m_velocity = newvel; } + SendTerseUpdateToAllClients(); } -- cgit v1.1 From 3a055c578d9fb2e1f6c0c9ba47a7b8c9c5d8af48 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 2 May 2019 03:11:16 +0100 Subject: soem cleanup --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd2b9b4..b12bb45 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1769,19 +1769,12 @@ namespace OpenSim.Region.Framework.Scenes float localHalfAVHeight = 0.8f; if (Appearance != null) - localHalfAVHeight = Appearance.AvatarHeight / 2; - - float posZLimit = 22; - - // TODO: Check other Scene HeightField - posZLimit = (float)Scene.Heightmap[(int)newpos.X, (int)newpos.Y]; + localHalfAVHeight = Appearance.AvatarHeight * 0.5f; + float posZLimit = (float)Scene.Heightmap[(int)newpos.X, (int)newpos.Y]; posZLimit += localHalfAVHeight + 0.1f; - - if ((newpos.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) - { + if (newpos.Z < posZLimit) newpos.Z = posZLimit; - } if ((flags & 8) != 0) Flying = true; -- cgit v1.1 From 3ae4115e4390eab1391b74ba82792dc5df9dac1e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 3 May 2019 00:39:55 +0100 Subject: osLocalTeleportAgent: if lookat or fly options, just move the avatar, not telling viewer about any teleport --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 61 +++++++++++++----------- 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b12bb45..f569d21 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1776,38 +1776,43 @@ namespace OpenSim.Region.Framework.Scenes if (newpos.Z < posZLimit) newpos.Z = posZLimit; - if ((flags & 8) != 0) - Flying = true; - else if ((flags & 16) != 0) - Flying = false; + if((flags & 0x1e) != 0) + { + if ((flags & 8) != 0) + Flying = true; + else if ((flags & 16) != 0) + Flying = false; - uint tpflags = (uint)TeleportFlags.ViaLocation; - if(Flying) - tpflags |= (uint)TeleportFlags.IsFlying; + uint tpflags = (uint)TeleportFlags.ViaLocation; + if(Flying) + tpflags |= (uint)TeleportFlags.IsFlying; - Vector3 lookat = Lookat; + Vector3 lookat = Lookat; - if ((flags & 2) != 0) - { - newlookat.Z = 0; - newlookat.Normalize(); - if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) - lookat = newlookat; - } - else if((flags & 4) != 0) - { - if((flags & 1) != 0) - newlookat = newvel; - else - newlookat = m_velocity; - newlookat.Z = 0; - newlookat.Normalize(); - if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) - lookat = newlookat; - } + if ((flags & 2) != 0) + { + newlookat.Z = 0; + newlookat.Normalize(); + if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) + lookat = newlookat; + } + else if((flags & 4) != 0) + { + if((flags & 1) != 0) + newlookat = newvel; + else + newlookat = m_velocity; + newlookat.Z = 0; + newlookat.Normalize(); + if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001) + lookat = newlookat; + } - AbsolutePosition = newpos; - ControllingClient.SendLocalTeleport(newpos, lookat, tpflags); + AbsolutePosition = newpos; + ControllingClient.SendLocalTeleport(newpos, lookat, tpflags); + } + else + AbsolutePosition = newpos; if ((flags & 1) != 0) { -- cgit v1.1