Merge branch 'master' of /home/opensim/var/repo/opensim
commit
0464508a5b
|
@ -68,6 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SaveAssets { get; set; }
|
public bool SaveAssets { get; set; }
|
||||||
|
|
||||||
|
protected ArchiverModule m_module;
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
protected Stream m_saveStream;
|
protected Stream m_saveStream;
|
||||||
protected Guid m_requestId;
|
protected Guid m_requestId;
|
||||||
|
@ -75,13 +76,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene"></param>
|
/// <param name="module">Calling module</param>
|
||||||
/// <param name="savePath">The path to which to save data.</param>
|
/// <param name="savePath">The path to which to save data.</param>
|
||||||
/// <param name="requestId">The id associated with this request</param>
|
/// <param name="requestId">The id associated with this request</param>
|
||||||
/// <exception cref="System.IO.IOException">
|
/// <exception cref="System.IO.IOException">
|
||||||
/// If there was a problem opening a stream for the file specified by the savePath
|
/// If there was a problem opening a stream for the file specified by the savePath
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) : this(scene, requestId)
|
public ArchiveWriteRequestPreparation(ArchiverModule module, string savePath, Guid requestId) : this(module, requestId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -99,17 +100,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene"></param>
|
/// <param name="module">Calling module</param>
|
||||||
/// <param name="saveStream">The stream to which to save data.</param>
|
/// <param name="saveStream">The stream to which to save data.</param>
|
||||||
/// <param name="requestId">The id associated with this request</param>
|
/// <param name="requestId">The id associated with this request</param>
|
||||||
public ArchiveWriteRequestPreparation(Scene scene, Stream saveStream, Guid requestId) : this(scene, requestId)
|
public ArchiveWriteRequestPreparation(ArchiverModule module, Stream saveStream, Guid requestId) : this(module, requestId)
|
||||||
{
|
{
|
||||||
m_saveStream = saveStream;
|
m_saveStream = saveStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ArchiveWriteRequestPreparation(Scene scene, Guid requestId)
|
protected ArchiveWriteRequestPreparation(ArchiverModule module, Guid requestId)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_module = module;
|
||||||
|
|
||||||
|
// FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix
|
||||||
|
// this.
|
||||||
|
if (m_module != null)
|
||||||
|
m_scene = m_module.Scene;
|
||||||
|
|
||||||
m_requestId = requestId;
|
m_requestId = requestId;
|
||||||
|
|
||||||
SaveAssets = true;
|
SaveAssets = true;
|
||||||
|
@ -366,8 +373,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
|
// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
StringWriter sw = new StringWriter();
|
String s;
|
||||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
|
||||||
|
using (StringWriter sw = new StringWriter())
|
||||||
|
{
|
||||||
|
using (XmlTextWriter xtw = new XmlTextWriter(sw))
|
||||||
|
{
|
||||||
xtw.Formatting = Formatting.Indented;
|
xtw.Formatting = Formatting.Indented;
|
||||||
xtw.WriteStartDocument();
|
xtw.WriteStartDocument();
|
||||||
xtw.WriteStartElement("archive");
|
xtw.WriteStartElement("archive");
|
||||||
|
@ -381,15 +392,45 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
xtw.WriteElementString("id", UUID.Random().ToString());
|
xtw.WriteElementString("id", UUID.Random().ToString());
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
|
|
||||||
|
xtw.WriteStartElement("region_info");
|
||||||
|
|
||||||
|
bool isMegaregion;
|
||||||
|
Vector2 size;
|
||||||
|
IRegionCombinerModule rcMod = null;
|
||||||
|
|
||||||
|
// FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix
|
||||||
|
// this, possibly by doing control file creation somewhere else.
|
||||||
|
if (m_module != null)
|
||||||
|
rcMod = m_module.RegionCombinerModule;
|
||||||
|
|
||||||
|
if (rcMod != null)
|
||||||
|
isMegaregion = rcMod.IsRootForMegaregion(m_scene.RegionInfo.RegionID);
|
||||||
|
else
|
||||||
|
isMegaregion = false;
|
||||||
|
|
||||||
|
if (isMegaregion)
|
||||||
|
size = rcMod.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
|
||||||
|
else
|
||||||
|
size = new Vector2((float)Constants.RegionSize, (float)Constants.RegionSize);
|
||||||
|
|
||||||
|
xtw.WriteElementString("is_megaregion", isMegaregion.ToString());
|
||||||
|
xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
|
||||||
|
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
|
||||||
xtw.WriteElementString("assets_included", SaveAssets.ToString());
|
xtw.WriteElementString("assets_included", SaveAssets.ToString());
|
||||||
|
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
|
|
||||||
xtw.Flush();
|
xtw.Flush();
|
||||||
xtw.Close();
|
}
|
||||||
|
|
||||||
String s = sw.ToString();
|
s = sw.ToString();
|
||||||
sw.Close();
|
}
|
||||||
|
|
||||||
|
if (m_scene != null)
|
||||||
|
Console.WriteLine(
|
||||||
|
"[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Scene m_scene;
|
public Scene Scene { get; private set; }
|
||||||
|
public IRegionCombinerModule RegionCombinerModule { get; private set; }
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The file used to load and save an opensimulator archive if no filename has been specified
|
/// The file used to load and save an opensimulator archive if no filename has been specified
|
||||||
|
@ -70,13 +71,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
Scene = scene;
|
||||||
m_scene.RegisterModuleInterface<IRegionArchiverModule>(this);
|
Scene.RegisterModuleInterface<IRegionArchiverModule>(this);
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Enabled for region {0}", scene.RegionInfo.RegionName);
|
//m_log.DebugFormat("[ARCHIVER]: Enabled for region {0}", scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
|
RegionCombinerModule = scene.RequestModuleInterface<IRegionCombinerModule>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
|
@ -165,9 +167,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
public void ArchiveRegion(string savePath, Guid requestId, Dictionary<string, object> options)
|
public void ArchiveRegion(string savePath, Guid requestId, Dictionary<string, object> options)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[ARCHIVER]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath);
|
"[ARCHIVER]: Writing archive for region {0} to {1}", Scene.RegionInfo.RegionName, savePath);
|
||||||
|
|
||||||
new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion(options);
|
new ArchiveWriteRequestPreparation(this, savePath, requestId).ArchiveRegion(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ArchiveRegion(Stream saveStream)
|
public void ArchiveRegion(Stream saveStream)
|
||||||
|
@ -182,7 +184,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
public void ArchiveRegion(Stream saveStream, Guid requestId, Dictionary<string, object> options)
|
public void ArchiveRegion(Stream saveStream, Guid requestId, Dictionary<string, object> options)
|
||||||
{
|
{
|
||||||
new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion(options);
|
new ArchiveWriteRequestPreparation(this, saveStream, requestId).ArchiveRegion(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DearchiveRegion(string loadPath)
|
public void DearchiveRegion(string loadPath)
|
||||||
|
@ -193,9 +195,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId)
|
public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath);
|
"[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
|
||||||
|
|
||||||
new ArchiveReadRequest(m_scene, loadPath, merge, skipAssets, requestId).DearchiveRegion();
|
new ArchiveReadRequest(Scene, loadPath, merge, skipAssets, requestId).DearchiveRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DearchiveRegion(Stream loadStream)
|
public void DearchiveRegion(Stream loadStream)
|
||||||
|
@ -205,7 +207,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId)
|
public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId)
|
||||||
{
|
{
|
||||||
new ArchiveReadRequest(m_scene, loadStream, merge, skipAssets, requestId).DearchiveRegion();
|
new ArchiveReadRequest(Scene, loadStream, merge, skipAssets, requestId).DearchiveRegion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using System.IO;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
{
|
||||||
|
public interface IRegionCombinerModule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Does the given id belong to the root region of a megaregion?
|
||||||
|
/// </summary>
|
||||||
|
bool IsRootForMegaregion(UUID regionId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the size of megaregion.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Returns size in meters.
|
||||||
|
/// Do not rely on this method remaining the same - this area is actively under development.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="sceneId">
|
||||||
|
/// The id of the root region for a megaregion.
|
||||||
|
/// This may change in the future to allow any region id that makes up a megaregion.
|
||||||
|
/// Currently, will throw an exception if this does not match a root region.
|
||||||
|
/// </param>
|
||||||
|
Vector2 GetSizeOfMegaregion(UUID regionId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,9 +43,8 @@ using Mono.Addins;
|
||||||
[assembly: AddinDependency("OpenSim", "0.5")]
|
[assembly: AddinDependency("OpenSim", "0.5")]
|
||||||
namespace OpenSim.Region.RegionCombinerModule
|
namespace OpenSim.Region.RegionCombinerModule
|
||||||
{
|
{
|
||||||
|
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
|
||||||
public class RegionCombinerModule : ISharedRegionModule
|
public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -59,8 +58,22 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
get { return null; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
|
/// <summary>
|
||||||
|
/// Is this module enabled?
|
||||||
|
/// </summary>
|
||||||
private bool enabledYN = false;
|
private bool enabledYN = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This holds the root regions for the megaregions.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Usually there is only ever one megaregion (and hence only one entry here).
|
||||||
|
/// </remarks>
|
||||||
|
private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The scenes that comprise the megaregion.
|
||||||
|
/// </summary>
|
||||||
private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
|
private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
|
@ -69,10 +82,12 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
|
enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
|
||||||
|
|
||||||
if (enabledYN)
|
if (enabledYN)
|
||||||
|
{
|
||||||
MainConsole.Instance.Commands.AddCommand(
|
MainConsole.Instance.Commands.AddCommand(
|
||||||
"RegionCombinerModule", false, "fix-phantoms", "fix-phantoms",
|
"RegionCombinerModule", false, "fix-phantoms", "fix-phantoms",
|
||||||
"Fixes phantom objects after an import to megaregions", FixPhantoms);
|
"Fixes phantom objects after an import to megaregions", FixPhantoms);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
|
@ -80,6 +95,8 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (enabledYN)
|
||||||
|
scene.RegisterModuleInterface<IRegionCombinerModule>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
|
@ -96,6 +113,27 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsRootForMegaregion(UUID regionId)
|
||||||
|
{
|
||||||
|
lock (m_regions)
|
||||||
|
return m_regions.ContainsKey(regionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2 GetSizeOfMegaregion(UUID regionId)
|
||||||
|
{
|
||||||
|
lock (m_regions)
|
||||||
|
{
|
||||||
|
if (m_regions.ContainsKey(regionId))
|
||||||
|
{
|
||||||
|
RegionConnections rootConn = m_regions[regionId];
|
||||||
|
|
||||||
|
return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception(string.Format("Region with id {0} not found", regionId));
|
||||||
|
}
|
||||||
|
|
||||||
private void NewPresence(ScenePresence presence)
|
private void NewPresence(ScenePresence presence)
|
||||||
{
|
{
|
||||||
if (presence.IsChildAgent)
|
if (presence.IsChildAgent)
|
||||||
|
@ -206,24 +244,21 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
westBorder.CrossDirection = Cardinals.W;
|
westBorder.CrossDirection = Cardinals.W;
|
||||||
scene.WestBorders[0] = westBorder;
|
scene.WestBorders[0] = westBorder;
|
||||||
|
|
||||||
|
RegionConnections newConn = new RegionConnections();
|
||||||
|
newConn.ConnectedRegions = new List<RegionData>();
|
||||||
RegionConnections regionConnections = new RegionConnections();
|
newConn.RegionScene = scene;
|
||||||
regionConnections.ConnectedRegions = new List<RegionData>();
|
newConn.RegionLandChannel = scene.LandChannel;
|
||||||
regionConnections.RegionScene = scene;
|
newConn.RegionId = scene.RegionInfo.originRegionID;
|
||||||
regionConnections.RegionLandChannel = scene.LandChannel;
|
newConn.X = scene.RegionInfo.RegionLocX;
|
||||||
regionConnections.RegionId = scene.RegionInfo.originRegionID;
|
newConn.Y = scene.RegionInfo.RegionLocY;
|
||||||
regionConnections.X = scene.RegionInfo.RegionLocX;
|
newConn.XEnd = (int)Constants.RegionSize;
|
||||||
regionConnections.Y = scene.RegionInfo.RegionLocY;
|
newConn.YEnd = (int)Constants.RegionSize;
|
||||||
regionConnections.XEnd = (int)Constants.RegionSize;
|
|
||||||
regionConnections.YEnd = (int)Constants.RegionSize;
|
|
||||||
|
|
||||||
|
|
||||||
lock (m_regions)
|
lock (m_regions)
|
||||||
{
|
{
|
||||||
bool connectedYN = false;
|
bool connectedYN = false;
|
||||||
|
|
||||||
foreach (RegionConnections conn in m_regions.Values)
|
foreach (RegionConnections rootConn in m_regions.Values)
|
||||||
{
|
{
|
||||||
#region commented
|
#region commented
|
||||||
/*
|
/*
|
||||||
|
@ -388,13 +423,9 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
//xxy
|
//xxy
|
||||||
//xxx
|
//xxx
|
||||||
|
|
||||||
|
if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY)
|
||||||
if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
|
|
||||||
>= (regionConnections.X * (int)Constants.RegionSize))
|
|
||||||
&& (((int)conn.Y * (int)Constants.RegionSize)
|
|
||||||
>= (regionConnections.Y * (int)Constants.RegionSize)))
|
|
||||||
{
|
{
|
||||||
connectedYN = DoWorkForOneRegionOverPlusXY(conn, regionConnections, scene);
|
connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,12 +433,9 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
//xyx
|
//xyx
|
||||||
//xxx
|
//xxx
|
||||||
//xxx
|
//xxx
|
||||||
if ((((int)conn.X * (int)Constants.RegionSize)
|
if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
|
||||||
>= (regionConnections.X * (int)Constants.RegionSize))
|
|
||||||
&& (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
|
|
||||||
>= (regionConnections.Y * (int)Constants.RegionSize)))
|
|
||||||
{
|
{
|
||||||
connectedYN = DoWorkForOneRegionOverXPlusY(conn, regionConnections, scene);
|
connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,12 +443,9 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
//xxy
|
//xxy
|
||||||
//xxx
|
//xxx
|
||||||
//xxx
|
//xxx
|
||||||
if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
|
if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY)
|
||||||
>= (regionConnections.X * (int)Constants.RegionSize))
|
|
||||||
&& (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
|
|
||||||
>= (regionConnections.Y * (int)Constants.RegionSize)))
|
|
||||||
{
|
{
|
||||||
connectedYN = DoWorkForOneRegionOverPlusXPlusY(conn, regionConnections, scene);
|
connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -429,66 +454,63 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
// If !connectYN means that this region is a root region
|
// If !connectYN means that this region is a root region
|
||||||
if (!connectedYN)
|
if (!connectedYN)
|
||||||
{
|
{
|
||||||
DoWorkForRootRegion(regionConnections, scene);
|
DoWorkForRootRegion(newConn, scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Set up infinite borders around the entire AABB of the combined ConnectedRegions
|
// Set up infinite borders around the entire AABB of the combined ConnectedRegions
|
||||||
AdjustLargeRegionBounds();
|
AdjustLargeRegionBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool DoWorkForOneRegionOverPlusXY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
|
private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||||
{
|
{
|
||||||
Vector3 offset = Vector3.Zero;
|
Vector3 offset = Vector3.Zero;
|
||||||
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
|
offset.X = newConn.PosX - rootConn.PosX;
|
||||||
((conn.X * (int)Constants.RegionSize)));
|
offset.Y = newConn.PosY - rootConn.PosY;
|
||||||
offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
|
|
||||||
((conn.Y * (int)Constants.RegionSize)));
|
|
||||||
|
|
||||||
Vector3 extents = Vector3.Zero;
|
Vector3 extents = Vector3.Zero;
|
||||||
extents.Y = conn.YEnd;
|
extents.Y = rootConn.YEnd;
|
||||||
extents.X = conn.XEnd + regionConnections.XEnd;
|
extents.X = rootConn.XEnd + newConn.XEnd;
|
||||||
|
|
||||||
conn.UpdateExtents(extents);
|
rootConn.UpdateExtents(extents);
|
||||||
|
|
||||||
m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
|
m_log.DebugFormat(
|
||||||
conn.RegionScene.RegionInfo.RegionName,
|
"[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}",
|
||||||
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
|
rootConn.RegionScene.RegionInfo.RegionName,
|
||||||
|
newConn.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||||
|
|
||||||
scene.BordersLocked = true;
|
scene.BordersLocked = true;
|
||||||
conn.RegionScene.BordersLocked = true;
|
rootConn.RegionScene.BordersLocked = true;
|
||||||
|
|
||||||
RegionData ConnectedRegion = new RegionData();
|
RegionData ConnectedRegion = new RegionData();
|
||||||
ConnectedRegion.Offset = offset;
|
ConnectedRegion.Offset = offset;
|
||||||
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
||||||
ConnectedRegion.RegionScene = scene;
|
ConnectedRegion.RegionScene = scene;
|
||||||
conn.ConnectedRegions.Add(ConnectedRegion);
|
rootConn.ConnectedRegions.Add(ConnectedRegion);
|
||||||
|
|
||||||
// Inform root region Physics about the extents of this region
|
// Inform root region Physics about the extents of this region
|
||||||
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
||||||
|
|
||||||
// Inform Child region that it needs to forward it's terrain to the root region
|
// Inform Child region that it needs to forward it's terrain to the root region
|
||||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
||||||
|
|
||||||
// Extend the borders as appropriate
|
// Extend the borders as appropriate
|
||||||
lock (conn.RegionScene.EastBorders)
|
lock (rootConn.RegionScene.EastBorders)
|
||||||
conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
||||||
|
|
||||||
lock (conn.RegionScene.NorthBorders)
|
lock (rootConn.RegionScene.NorthBorders)
|
||||||
conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||||
|
|
||||||
lock (conn.RegionScene.SouthBorders)
|
lock (rootConn.RegionScene.SouthBorders)
|
||||||
conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||||
|
|
||||||
lock (scene.WestBorders)
|
lock (scene.WestBorders)
|
||||||
{
|
{
|
||||||
|
scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
|
||||||
|
|
||||||
scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
|
|
||||||
|
|
||||||
// Trigger auto teleport to root region
|
// Trigger auto teleport to root region
|
||||||
scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
|
scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
|
||||||
scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
|
scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset Terrain.. since terrain loads before we get here, we need to load
|
// Reset Terrain.. since terrain loads before we get here, we need to load
|
||||||
|
@ -497,56 +519,58 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||||
|
|
||||||
// Unlock borders
|
// Unlock borders
|
||||||
conn.RegionScene.BordersLocked = false;
|
rootConn.RegionScene.BordersLocked = false;
|
||||||
scene.BordersLocked = false;
|
scene.BordersLocked = false;
|
||||||
|
|
||||||
// Create a client event forwarder and add this region's events to the root region.
|
// Create a client event forwarder and add this region's events to the root region.
|
||||||
if (conn.ClientEventForwarder != null)
|
if (rootConn.ClientEventForwarder != null)
|
||||||
conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool DoWorkForOneRegionOverXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
|
private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||||
{
|
{
|
||||||
Vector3 offset = Vector3.Zero;
|
Vector3 offset = Vector3.Zero;
|
||||||
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
|
offset.X = newConn.PosX - rootConn.PosX;
|
||||||
((conn.X * (int)Constants.RegionSize)));
|
offset.Y = newConn.PosY - rootConn.PosY;
|
||||||
offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
|
|
||||||
((conn.Y * (int)Constants.RegionSize)));
|
|
||||||
|
|
||||||
Vector3 extents = Vector3.Zero;
|
Vector3 extents = Vector3.Zero;
|
||||||
extents.Y = regionConnections.YEnd + conn.YEnd;
|
extents.Y = newConn.YEnd + rootConn.YEnd;
|
||||||
extents.X = conn.XEnd;
|
extents.X = rootConn.XEnd;
|
||||||
conn.UpdateExtents(extents);
|
rootConn.UpdateExtents(extents);
|
||||||
|
|
||||||
scene.BordersLocked = true;
|
scene.BordersLocked = true;
|
||||||
conn.RegionScene.BordersLocked = true;
|
rootConn.RegionScene.BordersLocked = true;
|
||||||
|
|
||||||
RegionData ConnectedRegion = new RegionData();
|
RegionData ConnectedRegion = new RegionData();
|
||||||
ConnectedRegion.Offset = offset;
|
ConnectedRegion.Offset = offset;
|
||||||
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
||||||
ConnectedRegion.RegionScene = scene;
|
ConnectedRegion.RegionScene = scene;
|
||||||
conn.ConnectedRegions.Add(ConnectedRegion);
|
rootConn.ConnectedRegions.Add(ConnectedRegion);
|
||||||
|
|
||||||
m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
|
m_log.DebugFormat(
|
||||||
conn.RegionScene.RegionInfo.RegionName,
|
"[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}",
|
||||||
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
|
rootConn.RegionScene.RegionInfo.RegionName,
|
||||||
|
newConn.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||||
|
|
||||||
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
||||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
||||||
|
|
||||||
|
lock (rootConn.RegionScene.NorthBorders)
|
||||||
|
rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
||||||
|
|
||||||
|
lock (rootConn.RegionScene.EastBorders)
|
||||||
|
rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||||
|
|
||||||
|
lock (rootConn.RegionScene.WestBorders)
|
||||||
|
rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||||
|
|
||||||
lock (conn.RegionScene.NorthBorders)
|
|
||||||
conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
|
||||||
lock (conn.RegionScene.EastBorders)
|
|
||||||
conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
|
||||||
lock (conn.RegionScene.WestBorders)
|
|
||||||
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
|
||||||
lock (scene.SouthBorders)
|
lock (scene.SouthBorders)
|
||||||
{
|
{
|
||||||
scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
|
scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
|
||||||
scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
|
scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
|
||||||
scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
|
scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset Terrain.. since terrain normally loads first.
|
// Reset Terrain.. since terrain normally loads first.
|
||||||
|
@ -555,83 +579,92 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||||
|
|
||||||
scene.BordersLocked = false;
|
scene.BordersLocked = false;
|
||||||
conn.RegionScene.BordersLocked = false;
|
rootConn.RegionScene.BordersLocked = false;
|
||||||
if (conn.ClientEventForwarder != null)
|
|
||||||
conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
if (rootConn.ClientEventForwarder != null)
|
||||||
|
rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
|
private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene)
|
||||||
{
|
{
|
||||||
Vector3 offset = Vector3.Zero;
|
Vector3 offset = Vector3.Zero;
|
||||||
offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
|
offset.X = newConn.PosX - rootConn.PosX;
|
||||||
((conn.X * (int)Constants.RegionSize)));
|
offset.Y = newConn.PosY - rootConn.PosY;
|
||||||
offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
|
|
||||||
((conn.Y * (int)Constants.RegionSize)));
|
|
||||||
|
|
||||||
Vector3 extents = Vector3.Zero;
|
Vector3 extents = Vector3.Zero;
|
||||||
extents.Y = regionConnections.YEnd + conn.YEnd;
|
|
||||||
extents.X = regionConnections.XEnd + conn.XEnd;
|
// We do not want to inflate the extents for regions strictly to the NE of the root region, since this
|
||||||
conn.UpdateExtents(extents);
|
// would double count regions strictly to the north and east that have already been added.
|
||||||
|
// extents.Y = regionConnections.YEnd + conn.YEnd;
|
||||||
|
// extents.X = regionConnections.XEnd + conn.XEnd;
|
||||||
|
// conn.UpdateExtents(extents);
|
||||||
|
|
||||||
|
extents.Y = rootConn.YEnd;
|
||||||
|
extents.X = rootConn.XEnd;
|
||||||
|
|
||||||
scene.BordersLocked = true;
|
scene.BordersLocked = true;
|
||||||
conn.RegionScene.BordersLocked = true;
|
rootConn.RegionScene.BordersLocked = true;
|
||||||
|
|
||||||
RegionData ConnectedRegion = new RegionData();
|
RegionData ConnectedRegion = new RegionData();
|
||||||
ConnectedRegion.Offset = offset;
|
ConnectedRegion.Offset = offset;
|
||||||
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
|
||||||
ConnectedRegion.RegionScene = scene;
|
ConnectedRegion.RegionScene = scene;
|
||||||
|
|
||||||
conn.ConnectedRegions.Add(ConnectedRegion);
|
rootConn.ConnectedRegions.Add(ConnectedRegion);
|
||||||
|
|
||||||
m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
|
m_log.DebugFormat(
|
||||||
conn.RegionScene.RegionInfo.RegionName,
|
"[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}",
|
||||||
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
|
rootConn.RegionScene.RegionInfo.RegionName,
|
||||||
|
newConn.RegionScene.RegionInfo.RegionName, offset, extents);
|
||||||
|
|
||||||
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
|
||||||
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero);
|
||||||
lock (conn.RegionScene.NorthBorders)
|
|
||||||
|
lock (rootConn.RegionScene.NorthBorders)
|
||||||
{
|
{
|
||||||
if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
|
if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2)
|
||||||
{
|
{
|
||||||
//compound border
|
//compound border
|
||||||
// already locked above
|
// already locked above
|
||||||
conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
||||||
|
|
||||||
lock (conn.RegionScene.EastBorders)
|
lock (rootConn.RegionScene.EastBorders)
|
||||||
conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||||
lock (conn.RegionScene.WestBorders)
|
|
||||||
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
lock (rootConn.RegionScene.WestBorders)
|
||||||
|
rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (scene.SouthBorders)
|
lock (scene.SouthBorders)
|
||||||
{
|
{
|
||||||
scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
|
scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
|
||||||
scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
|
scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
|
||||||
scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
|
scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (conn.RegionScene.EastBorders)
|
lock (rootConn.RegionScene.EastBorders)
|
||||||
{
|
{
|
||||||
if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
|
if (rootConn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
|
||||||
{
|
{
|
||||||
|
|
||||||
conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
|
||||||
lock (conn.RegionScene.NorthBorders)
|
|
||||||
conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
|
||||||
lock (conn.RegionScene.SouthBorders)
|
|
||||||
conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
|
||||||
|
|
||||||
|
lock (rootConn.RegionScene.NorthBorders)
|
||||||
|
rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||||
|
|
||||||
|
lock (rootConn.RegionScene.SouthBorders)
|
||||||
|
rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (scene.WestBorders)
|
lock (scene.WestBorders)
|
||||||
{
|
{
|
||||||
scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
|
scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
|
||||||
scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
|
scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX;
|
||||||
scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
|
scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -650,46 +683,50 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||||
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
|
||||||
scene.BordersLocked = false;
|
scene.BordersLocked = false;
|
||||||
conn.RegionScene.BordersLocked = false;
|
rootConn.RegionScene.BordersLocked = false;
|
||||||
|
|
||||||
if (conn.ClientEventForwarder != null)
|
if (rootConn.ClientEventForwarder != null)
|
||||||
conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
|
//scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoWorkForRootRegion(RegionConnections regionConnections, Scene scene)
|
private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
RegionData rdata = new RegionData();
|
RegionData rdata = new RegionData();
|
||||||
rdata.Offset = Vector3.Zero;
|
rdata.Offset = Vector3.Zero;
|
||||||
rdata.RegionId = scene.RegionInfo.originRegionID;
|
rdata.RegionId = scene.RegionInfo.originRegionID;
|
||||||
rdata.RegionScene = scene;
|
rdata.RegionScene = scene;
|
||||||
// save it's land channel
|
// save it's land channel
|
||||||
regionConnections.RegionLandChannel = scene.LandChannel;
|
rootConn.RegionLandChannel = scene.LandChannel;
|
||||||
|
|
||||||
// Substitue our landchannel
|
// Substitue our landchannel
|
||||||
RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
|
RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
|
||||||
regionConnections.ConnectedRegions);
|
rootConn.ConnectedRegions);
|
||||||
|
|
||||||
scene.LandChannel = lnd;
|
scene.LandChannel = lnd;
|
||||||
|
|
||||||
// Forward the permissions modules of each of the connected regions to the root region
|
// Forward the permissions modules of each of the connected regions to the root region
|
||||||
lock (m_regions)
|
lock (m_regions)
|
||||||
{
|
{
|
||||||
foreach (RegionData r in regionConnections.ConnectedRegions)
|
foreach (RegionData r in rootConn.ConnectedRegions)
|
||||||
{
|
{
|
||||||
ForwardPermissionRequests(regionConnections, r.RegionScene);
|
ForwardPermissionRequests(rootConn, r.RegionScene);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the root region's Client Event Forwarder
|
// Create the root region's Client Event Forwarder
|
||||||
regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
|
rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
|
||||||
|
|
||||||
// Sets up the CoarseLocationUpdate forwarder for this root region
|
// Sets up the CoarseLocationUpdate forwarder for this root region
|
||||||
scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
|
scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
|
||||||
|
|
||||||
// Adds this root region to a dictionary of regions that are connectable
|
// Adds this root region to a dictionary of regions that are connectable
|
||||||
m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
|
m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetCourseLocationDelegate(ScenePresence presence)
|
private void SetCourseLocationDelegate(ScenePresence presence)
|
||||||
|
@ -946,6 +983,7 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oborder = null;
|
oborder = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -955,6 +993,9 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
pPosition = pPosition/(int) Constants.RegionSize;
|
pPosition = pPosition/(int) Constants.RegionSize;
|
||||||
int OffsetX = (int) pPosition.X;
|
int OffsetX = (int) pPosition.X;
|
||||||
int OffsetY = (int) pPosition.Y;
|
int OffsetY = (int) pPosition.Y;
|
||||||
|
|
||||||
|
lock (m_regions)
|
||||||
|
{
|
||||||
foreach (RegionConnections regConn in m_regions.Values)
|
foreach (RegionConnections regConn in m_regions.Values)
|
||||||
{
|
{
|
||||||
foreach (RegionData reg in regConn.ConnectedRegions)
|
foreach (RegionData reg in regConn.ConnectedRegions)
|
||||||
|
@ -963,6 +1004,8 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
return reg;
|
return reg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new RegionData();
|
return new RegionData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,18 +1061,17 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
}
|
}
|
||||||
|
|
||||||
#region console commands
|
#region console commands
|
||||||
|
|
||||||
public void FixPhantoms(string module, string[] cmdparams)
|
public void FixPhantoms(string module, string[] cmdparams)
|
||||||
{
|
{
|
||||||
List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
|
List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
|
||||||
|
|
||||||
foreach (Scene s in scenes)
|
foreach (Scene s in scenes)
|
||||||
{
|
{
|
||||||
s.ForEachSOG(delegate(SceneObjectGroup e)
|
s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition);
|
||||||
{
|
|
||||||
e.AbsolutePosition = e.AbsolutePosition;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
|
@ -49,17 +50,45 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
/// LargeLandChannel for combined region
|
/// LargeLandChannel for combined region
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ILandChannel RegionLandChannel;
|
public ILandChannel RegionLandChannel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The x map co-ordinate for this region (where each co-ordinate is a Constants.RegionSize block).
|
||||||
|
/// </summary>
|
||||||
public uint X;
|
public uint X;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The y co-ordinate for this region (where each cor-odinate is a Constants.RegionSize block).
|
||||||
|
/// </summary>
|
||||||
public uint Y;
|
public uint Y;
|
||||||
public int XEnd;
|
|
||||||
public int YEnd;
|
/// <summary>
|
||||||
|
/// The X meters position of this connection.
|
||||||
|
/// </summary>
|
||||||
|
public uint PosX { get { return X * Constants.RegionSize; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Y meters co-ordinate of this connection.
|
||||||
|
/// </summary>
|
||||||
|
public uint PosY { get { return Y * Constants.RegionSize; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the megaregion in meters.
|
||||||
|
/// </summary>
|
||||||
|
public uint XEnd;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the megaregion in meters.
|
||||||
|
/// </summary>
|
||||||
|
public uint YEnd;
|
||||||
|
|
||||||
public List<RegionData> ConnectedRegions;
|
public List<RegionData> ConnectedRegions;
|
||||||
public RegionCombinerPermissionModule PermissionModule;
|
public RegionCombinerPermissionModule PermissionModule;
|
||||||
public RegionCombinerClientEventForwarder ClientEventForwarder;
|
public RegionCombinerClientEventForwarder ClientEventForwarder;
|
||||||
|
|
||||||
public void UpdateExtents(Vector3 extents)
|
public void UpdateExtents(Vector3 extents)
|
||||||
{
|
{
|
||||||
XEnd = (int)extents.X;
|
XEnd = (uint)extents.X;
|
||||||
YEnd = (int)extents.Y;
|
YEnd = (uint)extents.Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue