aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-28 14:45:17 -0400
committerTeravus Ovares (Dan Olivares)2009-08-28 14:45:17 -0400
commitac718843d92df3b512c4b9194bc05940ab064faf (patch)
treee594a16d6a0e8006d353a50d4910f81a628928b3
parentMerge branch 'master' of ssh://MyConnection/var/git/opensim (diff)
downloadopensim-SC_OLD-ac718843d92df3b512c4b9194bc05940ab064faf.zip
opensim-SC_OLD-ac718843d92df3b512c4b9194bc05940ab064faf.tar.gz
opensim-SC_OLD-ac718843d92df3b512c4b9194bc05940ab064faf.tar.bz2
opensim-SC_OLD-ac718843d92df3b512c4b9194bc05940ab064faf.tar.xz
* Allow corner prim crossings. Previously this was only on a single cardinal direction
* Some leg work in getting avatar teleports into 'virtual regions' moved to the proper region.
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs67
-rw-r--r--OpenSim/Region/Framework/Scenes/Border.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs145
3 files changed, 201 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs b/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs
index 3a4a17b..22ef107 100644
--- a/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs
@@ -216,9 +216,9 @@ namespace OpenSim.Region.CoreModules.World.Land
216 //xxy 216 //xxy
217 //xxx 217 //xxx
218 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd 218 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
219 == (regionConnections.X * (int)Constants.RegionSize)) 219 >= (regionConnections.X * (int)Constants.RegionSize))
220 && (((int)conn.Y * (int)Constants.RegionSize) 220 && (((int)conn.Y * (int)Constants.RegionSize)
221 == (regionConnections.Y * (int)Constants.RegionSize))) 221 >= (regionConnections.Y * (int)Constants.RegionSize)))
222 { 222 {
223 Vector3 offset = Vector3.Zero; 223 Vector3 offset = Vector3.Zero;
224 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - 224 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
@@ -262,9 +262,9 @@ namespace OpenSim.Region.CoreModules.World.Land
262 //xxx 262 //xxx
263 //xxx 263 //xxx
264 if ((((int)conn.X * (int)Constants.RegionSize) 264 if ((((int)conn.X * (int)Constants.RegionSize)
265 == (regionConnections.X * (int)Constants.RegionSize)) 265 >= (regionConnections.X * (int)Constants.RegionSize))
266 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd 266 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
267 == (regionConnections.Y * (int)Constants.RegionSize))) 267 >= (regionConnections.Y * (int)Constants.RegionSize)))
268 { 268 {
269 Vector3 offset = Vector3.Zero; 269 Vector3 offset = Vector3.Zero;
270 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - 270 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
@@ -303,9 +303,9 @@ namespace OpenSim.Region.CoreModules.World.Land
303 //xxx 303 //xxx
304 //xxx 304 //xxx
305 if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd 305 if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd
306 == (regionConnections.X * (int)Constants.RegionSize)) 306 >= (regionConnections.X * (int)Constants.RegionSize))
307 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd 307 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
308 == (regionConnections.Y * (int)Constants.RegionSize))) 308 >= (regionConnections.Y * (int)Constants.RegionSize)))
309 { 309 {
310 Vector3 offset = Vector3.Zero; 310 Vector3 offset = Vector3.Zero;
311 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - 311 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
@@ -315,13 +315,58 @@ namespace OpenSim.Region.CoreModules.World.Land
315 315
316 Vector3 extents = Vector3.Zero; 316 Vector3 extents = Vector3.Zero;
317 extents.Y = regionConnections.YEnd + conn.YEnd; 317 extents.Y = regionConnections.YEnd + conn.YEnd;
318 extents.X = conn.XEnd + conn.XEnd; 318 extents.X = regionConnections.XEnd + conn.XEnd;
319 conn.UpdateExtents(extents);
320
321 m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
322 conn.RegionScene.RegionInfo.RegionName,
323 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
324
325 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
326 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
327
328 if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
329 {
330 //compound border
331 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
332 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
333 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
334
335
336
337 }
338
339 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
340
341 if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
342 {
343
344 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
345 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
346 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
347
348
349 }
350 scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
351/*
352 else
353 {
354 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
355 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
356 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
357 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
358 }
359*/
360
319 361
320 m_log.DebugFormat("Scene: {0} to the south of Scene{1} Offset: {2}. Extents:{3}", 362 // Reset Terrain.. since terrain normally loads first.
321 conn.RegionScene.RegionInfo.RegionName, 363 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
322 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); 364 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
365 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
366
367 connectedYN = true;
323 368
324 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); 369 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
325 370
326 break; 371 break;
327 } 372 }
diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 19ecb4f..9a08afe 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.Framework.Scenes
34{ 34{
35 public class Border 35 public class Border
36 { 36 {
37 37
38 /// <summary> 38 /// <summary>
39 /// Line perpendicular to the Direction Cardinal. Z value is the 39 /// Line perpendicular to the Direction Cardinal. Z value is the
40 /// </summary> 40 /// </summary>
@@ -125,6 +125,25 @@ namespace OpenSim.Region.Framework.Scenes
125 return result; 125 return result;
126 } 126 }
127 127
128 public float Extent
129 {
130 get
131 {
132 switch (CrossDirection)
133 {
134 case Cardinals.N:
135 break;
136 case Cardinals.S:
137 break;
138 case Cardinals.W:
139 break;
140 case Cardinals.E:
141 break;
142 }
143 return 0;
144 }
145 }
146
128 } 147 }
129 148
130 149
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index acf0375..dfd06bb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1706,37 +1706,86 @@ namespace OpenSim.Region.Framework.Scenes
1706 ulong newRegionHandle = 0; 1706 ulong newRegionHandle = 0;
1707 Vector3 pos = attemptedPosition; 1707 Vector3 pos = attemptedPosition;
1708 1708
1709 1709 if (TestBorderCross(attemptedPosition, Cardinals.W))
1710
1711 if (TestBorderCross(attemptedPosition, Cardinals.E))
1712 { 1710 {
1713 pos.X = ((pos.X - Constants.RegionSize)); 1711 if (TestBorderCross(attemptedPosition, Cardinals.S))
1714 newRegionHandle 1712 {
1715 = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); 1713 //Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W);
1716 // x + 1 1714 //Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S);
1715 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
1716 pos.X = ((pos.X + Constants.RegionSize));
1717 pos.Y = ((pos.Y + Constants.RegionSize));
1718 newRegionHandle
1719 = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
1720 (uint)((thisy - 1) * Constants.RegionSize));
1721 // x - 1
1722 // y - 1
1723 }
1724 else if (TestBorderCross(attemptedPosition, Cardinals.N))
1725 {
1726 pos.X = ((pos.X + Constants.RegionSize));
1727 pos.Y = ((pos.Y - Constants.RegionSize));
1728 newRegionHandle
1729 = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
1730 (uint)((thisy + 1) * Constants.RegionSize));
1731 // x - 1
1732 // y + 1
1733 }
1734 else
1735 {
1736 pos.X = ((pos.X + Constants.RegionSize));
1737 newRegionHandle
1738 = Util.UIntsToLong((uint) ((thisx - 1)*Constants.RegionSize),
1739 (uint) (thisy*Constants.RegionSize));
1740 // x - 1
1741 }
1717 } 1742 }
1718 else if (TestBorderCross(attemptedPosition, Cardinals.W)) 1743 else if (TestBorderCross(attemptedPosition, Cardinals.E))
1719 { 1744 {
1720 pos.X = ((pos.X + Constants.RegionSize)); 1745 if (TestBorderCross(attemptedPosition, Cardinals.S))
1746 {
1747 pos.X = ((pos.X - Constants.RegionSize));
1748 pos.Y = ((pos.Y + Constants.RegionSize));
1749 newRegionHandle
1750 = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
1751 (uint)((thisy - 1) * Constants.RegionSize));
1752 // x + 1
1753 // y - 1
1754 }
1755 else if (TestBorderCross(attemptedPosition, Cardinals.N))
1756 {
1757 pos.X = ((pos.X - Constants.RegionSize));
1758 pos.Y = ((pos.Y - Constants.RegionSize));
1759 newRegionHandle
1760 = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
1761 (uint)((thisy + 1) * Constants.RegionSize));
1762 // x + 1
1763 // y + 1
1764 }
1765 else
1766 {
1767 pos.X = ((pos.X - Constants.RegionSize));
1768 newRegionHandle
1769 = Util.UIntsToLong((uint) ((thisx + 1)*Constants.RegionSize),
1770 (uint) (thisy*Constants.RegionSize));
1771 // x + 1
1772 }
1773 }
1774 else if (TestBorderCross(attemptedPosition, Cardinals.S))
1775 {
1776 pos.Y = ((pos.Y + Constants.RegionSize));
1721 newRegionHandle 1777 newRegionHandle
1722 = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); 1778 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
1723 // x - 1 1779 // y - 1
1724 } 1780 }
1725 1781 else if (TestBorderCross(attemptedPosition, Cardinals.N))
1726 if (TestBorderCross(attemptedPosition, Cardinals.N))
1727 { 1782 {
1783
1728 pos.Y = ((pos.Y - Constants.RegionSize)); 1784 pos.Y = ((pos.Y - Constants.RegionSize));
1729 newRegionHandle 1785 newRegionHandle
1730 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize)); 1786 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
1731 // y + 1 1787 // y + 1
1732 } 1788 }
1733 else if (TestBorderCross(attemptedPosition, Cardinals.S))
1734 {
1735 pos.Y = ((pos.Y + Constants.RegionSize));
1736 newRegionHandle
1737 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
1738 // y - 1
1739 }
1740 1789
1741 // Offset the positions for the new region across the border 1790 // Offset the positions for the new region across the border
1742 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 1791 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
@@ -1750,6 +1799,62 @@ namespace OpenSim.Region.Framework.Scenes
1750 } 1799 }
1751 } 1800 }
1752 1801
1802 public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
1803 {
1804
1805 switch (gridline)
1806 {
1807 case Cardinals.N:
1808 lock (NorthBorders)
1809 {
1810 foreach (Border b in NorthBorders)
1811 {
1812 if (b.TestCross(position))
1813 return b;
1814 }
1815 }
1816 break;
1817 case Cardinals.S:
1818
1819
1820 lock (SouthBorders)
1821 {
1822 foreach (Border b in SouthBorders)
1823 {
1824 if (b.TestCross(position))
1825 return b;
1826 }
1827 }
1828
1829 break;
1830 case Cardinals.E:
1831 lock (EastBorders)
1832 {
1833 foreach (Border b in EastBorders)
1834 {
1835 if (b.TestCross(position))
1836 return b;
1837 }
1838 }
1839
1840 break;
1841 case Cardinals.W:
1842
1843 lock (WestBorders)
1844 {
1845 foreach (Border b in WestBorders)
1846 {
1847 if (b.TestCross(position))
1848 return b;
1849 }
1850 }
1851 break;
1852
1853 }
1854
1855 return null;
1856 }
1857
1753 public bool TestBorderCross(Vector3 position, Cardinals border) 1858 public bool TestBorderCross(Vector3 position, Cardinals border)
1754 { 1859 {
1755 switch (border) 1860 switch (border)