From 895c612647c0e5ccc01b1d7a270dbec751188d62 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Mon, 31 Aug 2009 16:29:27 -0400 Subject: [PATCH 1/3] * When the RegionCombinerModule is active add an extra set of borders with Infinite distances around the whole AABB of the region --- .../World/Land/RegionCombinerModule.cs | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs index a6e3859473..eabdf51d48 100644 --- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs @@ -478,7 +478,62 @@ namespace OpenSim.Region.CoreModules.World.Land public void PostInitialise() { - + if (!enabledYN) + return; + + // Create a set of infinite borders around the whole aabb of the combined island. + lock (m_regions) + { + foreach (RegionConnections rconn in m_regions.Values) + { + Vector3 offset = Vector3.Zero; + rconn.RegionScene.BordersLocked = true; + foreach (RegionData rdata in rconn.ConnectedRegions) + { + if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X; + if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y; + + } + + lock (rconn.RegionScene.NorthBorders) + { + Border northBorder = new Border(); + northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, + offset.Y + (int) Constants.RegionSize); //<--- + northBorder.CrossDirection = Cardinals.N; + rconn.RegionScene.NorthBorders.Add(northBorder); + } + + lock (rconn.RegionScene.SouthBorders) + { + Border southBorder = new Border(); + southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> + southBorder.CrossDirection = Cardinals.S; + rconn.RegionScene.SouthBorders.Add(southBorder); + } + + lock (rconn.RegionScene.EastBorders) + { + Border eastBorder = new Border(); + eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.Y + (int)Constants.RegionSize); + //<--- + eastBorder.CrossDirection = Cardinals.E; + rconn.RegionScene.EastBorders.Add(eastBorder); + } + + lock (rconn.RegionScene.WestBorders) + { + Border westBorder = new Border(); + westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> + westBorder.CrossDirection = Cardinals.W; + rconn.RegionScene.WestBorders.Add(westBorder); + } + + + + rconn.RegionScene.BordersLocked = false; + } + } } public void OnFrame() { From b997174d08919fc69f29109b28e054d995672d0e Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Mon, 31 Aug 2009 20:07:33 -0400 Subject: [PATCH 2/3] * Fix attachment cross issues with new borders. --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 ++++++- .../Framework/Scenes/SceneObjectGroup.cs | 18 ++++++++++++++++++ .../Region/Framework/Scenes/ScenePresence.cs | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b8c8f3268a..f4a0d2ee67 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1710,7 +1710,12 @@ namespace OpenSim.Region.Framework.Scenes int thisx = (int)RegionInfo.RegionLocX; int thisy = (int)RegionInfo.RegionLocY; - ulong newRegionHandle = 0; + + // use this if no borders were crossed! + ulong newRegionHandle + = Util.UIntsToLong((uint)((thisx) * Constants.RegionSize), + (uint)((thisy) * Constants.RegionSize)); + Vector3 pos = attemptedPosition; if (TestBorderCross(attemptedPosition, Cardinals.W)) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e5c6bf111e..d72ed7dadf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1477,8 +1477,26 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); dupe.m_isBackedUp = false; dupe.m_parts = new Dictionary(); + + // Warning, The following code related to previousAttachmentStatus is needed so that clones of + // attachments do not bordercross while they're being duplicated. This is hacktastic! + // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! + // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state + // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, + // then restore it's attachment state + + // This is only necessary when userExposed is false! + + bool previousAttachmentStatus = dupe.RootPart.IsAttachment; + + if (!userExposed) + dupe.RootPart.IsAttachment = true; + dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); + if (!userExposed) + dupe.RootPart.IsAttachment = previousAttachmentStatus; + dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 46e3289524..857dc11267 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3509,8 +3509,8 @@ namespace OpenSim.Region.Framework.Scenes { // Set the parent localID to 0 so it transfers over properly. gobj.RootPart.SetParentLocalId(0); - gobj.RootPart.IsAttachment = false; gobj.AbsolutePosition = gobj.RootPart.AttachedPos; + gobj.RootPart.IsAttachment = false; //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle); m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent); From b8d21d9eae0d14c240668e4c73eb64d5bc773b07 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Mon, 31 Aug 2009 20:10:08 -0400 Subject: [PATCH 3/3] * Get rid of some debug info and kill the code to make a large AABB until I can figure out how to detect the fact that the system is done starting up new regions. --- .../World/Land/RegionCombinerModule.cs | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs index eabdf51d48..4e03e951ef 100644 --- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs @@ -14,7 +14,10 @@ namespace OpenSim.Region.CoreModules.World.Land { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public string Name { get { return "RegionCombinerModule"; } } + public string Name { get + { + return "RegionCombinerModule"; + } } public Type ReplaceableInterface { get { return null; } @@ -22,11 +25,15 @@ namespace OpenSim.Region.CoreModules.World.Land private Dictionary m_regions = new Dictionary(); private bool enabledYN = false; + private Dictionary m_startingScenes = new Dictionary(); + public void Initialise(IConfigSource source) { + IConfig myConfig = source.Configs["Startup"]; enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); //enabledYN = true; + } public void Close() @@ -36,9 +43,13 @@ namespace OpenSim.Region.CoreModules.World.Land public void AddRegion(Scene scene) { + if (!enabledYN) return; + lock (m_startingScenes) + m_startingScenes.Add(scene.RegionInfo.originRegionID, scene); + Border northBorder = new Border(); northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- northBorder.CrossDirection = Cardinals.N; @@ -464,11 +475,13 @@ namespace OpenSim.Region.CoreModules.World.Land } } + } public void RemoveRegion(Scene scene) { - + + } public void RegionLoaded(Scene scene) @@ -478,10 +491,12 @@ namespace OpenSim.Region.CoreModules.World.Land public void PostInitialise() { - if (!enabledYN) - return; - - // Create a set of infinite borders around the whole aabb of the combined island. + + } + + // Create a set of infinite borders around the whole aabb of the combined island. + private void MakeLargeRegionBounds() + { lock (m_regions) { foreach (RegionConnections rconn in m_regions.Values) @@ -499,7 +514,7 @@ namespace OpenSim.Region.CoreModules.World.Land { Border northBorder = new Border(); northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, - offset.Y + (int) Constants.RegionSize); //<--- + offset.Y); //<--- northBorder.CrossDirection = Cardinals.N; rconn.RegionScene.NorthBorders.Add(northBorder); } @@ -515,8 +530,8 @@ namespace OpenSim.Region.CoreModules.World.Land lock (rconn.RegionScene.EastBorders) { Border eastBorder = new Border(); - eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.Y + (int)Constants.RegionSize); - //<--- + eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.Y); + //<--- eastBorder.CrossDirection = Cardinals.E; rconn.RegionScene.EastBorders.Add(eastBorder); } @@ -535,10 +550,6 @@ namespace OpenSim.Region.CoreModules.World.Land } } } - public void OnFrame() - { - - } public RegionData GetRegionFromPosition(Vector3 pPosition)