diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs) | 334 |
1 files changed, 69 insertions, 265 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs index 905540d..32eead0 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs | |||
@@ -36,14 +36,16 @@ using OpenSim.Framework.Client; | |||
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
39 | using OpenSim.Region.Physics.Manager; | 39 | using OpenSim.Region.PhysicsModules.SharedBase; |
40 | using Mono.Addins; | 40 | using Mono.Addins; |
41 | 41 | ||
42 | namespace OpenSim.Region.RegionCombinerModule | 42 | namespace OpenSim.Region.RegionCombinerModule |
43 | { | 43 | { |
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionCombinerModule")] | ||
44 | public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule | 45 | public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule |
45 | { | 46 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | // private static string LogHeader = "[REGION COMBINER MODULE]"; | ||
47 | 49 | ||
48 | public string Name | 50 | public string Name |
49 | { | 51 | { |
@@ -77,6 +79,8 @@ namespace OpenSim.Region.RegionCombinerModule | |||
77 | { | 79 | { |
78 | IConfig myConfig = source.Configs["Startup"]; | 80 | IConfig myConfig = source.Configs["Startup"]; |
79 | m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false); | 81 | m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false); |
82 | if (m_combineContiguousRegions) | ||
83 | m_log.ErrorFormat("[REGION COMBINER MODULE]: THIS MODULE IS BEING MARKED OBSOLETE AND MAY SOON BE REMOVED. PLEASE USE VARREGIONS INSTEAD."); | ||
80 | 84 | ||
81 | MainConsole.Instance.Commands.AddCommand( | 85 | MainConsole.Instance.Commands.AddCommand( |
82 | "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms", | 86 | "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms", |
@@ -134,6 +138,49 @@ namespace OpenSim.Region.RegionCombinerModule | |||
134 | throw new Exception(string.Format("Region with id {0} not found", regionId)); | 138 | throw new Exception(string.Format("Region with id {0} not found", regionId)); |
135 | } | 139 | } |
136 | 140 | ||
141 | // Test to see if this postiion (relative to the region) is within the area covered | ||
142 | // by this megaregion. | ||
143 | public bool PositionIsInMegaregion(UUID currentRegion, int xx, int yy) | ||
144 | { | ||
145 | bool ret = false; | ||
146 | if (xx < 0 || yy < 0) | ||
147 | return ret; | ||
148 | |||
149 | foreach (RegionConnections rootRegion in m_regions.Values) | ||
150 | { | ||
151 | if (currentRegion == rootRegion.RegionId) | ||
152 | { | ||
153 | // The caller is in the root region so this is an easy test | ||
154 | if (xx < rootRegion.XEnd && yy < rootRegion.YEnd) | ||
155 | { | ||
156 | ret = true; | ||
157 | } | ||
158 | break; | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | // Maybe the caller is in one of the sub-regions | ||
163 | foreach (RegionData childRegion in rootRegion.ConnectedRegions) | ||
164 | { | ||
165 | if (currentRegion == childRegion.RegionId) | ||
166 | { | ||
167 | // This is a child. Diddle the offsets and check if in | ||
168 | Vector3 positionInMegaregion = childRegion.Offset; | ||
169 | positionInMegaregion.X += xx; | ||
170 | positionInMegaregion.Y += yy; | ||
171 | if (positionInMegaregion.X < rootRegion.XEnd && positionInMegaregion.Y < rootRegion.YEnd) | ||
172 | { | ||
173 | ret = true; | ||
174 | } | ||
175 | break; | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | |||
181 | return ret; | ||
182 | } | ||
183 | |||
137 | private void NewPresence(ScenePresence presence) | 184 | private void NewPresence(ScenePresence presence) |
138 | { | 185 | { |
139 | if (presence.IsChildAgent) | 186 | if (presence.IsChildAgent) |
@@ -220,27 +267,6 @@ namespace OpenSim.Region.RegionCombinerModule | |||
220 | // | 267 | // |
221 | */ | 268 | */ |
222 | 269 | ||
223 | // Give each region a standard set of non-infinite borders | ||
224 | Border northBorder = new Border(); | ||
225 | northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- | ||
226 | northBorder.CrossDirection = Cardinals.N; | ||
227 | scene.NorthBorders[0] = northBorder; | ||
228 | |||
229 | Border southBorder = new Border(); | ||
230 | southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //---> | ||
231 | southBorder.CrossDirection = Cardinals.S; | ||
232 | scene.SouthBorders[0] = southBorder; | ||
233 | |||
234 | Border eastBorder = new Border(); | ||
235 | eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- | ||
236 | eastBorder.CrossDirection = Cardinals.E; | ||
237 | scene.EastBorders[0] = eastBorder; | ||
238 | |||
239 | Border westBorder = new Border(); | ||
240 | westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //---> | ||
241 | westBorder.CrossDirection = Cardinals.W; | ||
242 | scene.WestBorders[0] = westBorder; | ||
243 | |||
244 | RegionConnections newConn = new RegionConnections(); | 270 | RegionConnections newConn = new RegionConnections(); |
245 | newConn.ConnectedRegions = new List<RegionData>(); | 271 | newConn.ConnectedRegions = new List<RegionData>(); |
246 | newConn.RegionScene = scene; | 272 | newConn.RegionScene = scene; |
@@ -248,8 +274,8 @@ namespace OpenSim.Region.RegionCombinerModule | |||
248 | newConn.RegionId = scene.RegionInfo.originRegionID; | 274 | newConn.RegionId = scene.RegionInfo.originRegionID; |
249 | newConn.X = scene.RegionInfo.RegionLocX; | 275 | newConn.X = scene.RegionInfo.RegionLocX; |
250 | newConn.Y = scene.RegionInfo.RegionLocY; | 276 | newConn.Y = scene.RegionInfo.RegionLocY; |
251 | newConn.XEnd = (int)Constants.RegionSize; | 277 | newConn.XEnd = scene.RegionInfo.RegionSizeX; |
252 | newConn.YEnd = (int)Constants.RegionSize; | 278 | newConn.YEnd = scene.RegionInfo.RegionSizeX; |
253 | 279 | ||
254 | lock (m_regions) | 280 | lock (m_regions) |
255 | { | 281 | { |
@@ -415,36 +441,39 @@ namespace OpenSim.Region.RegionCombinerModule | |||
415 | */ | 441 | */ |
416 | #endregion | 442 | #endregion |
417 | 443 | ||
418 | // If we're one region over +x y | 444 | |
445 | // Check to see if this new region is adjacent to the root region. | ||
446 | // Note that we expect the regions to be combined from the root region outward | ||
447 | // thus the requirement for the ordering in the configuration files. | ||
448 | |||
449 | // If we're one region over +x y (i.e. root region is to the west) | ||
419 | //xxx | 450 | //xxx |
420 | //xxy | 451 | //xxy |
421 | //xxx | 452 | //xxx |
422 | |||
423 | if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY) | 453 | if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY) |
424 | { | 454 | { |
425 | connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); | 455 | connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); |
426 | break; | 456 | break; |
427 | } | 457 | } |
428 | 458 | ||
429 | // If we're one region over x +y | 459 | // If we're one region over x +y (i.e. root region is to the south) |
430 | //xyx | 460 | //xyx |
431 | //xxx | 461 | //xxx |
432 | //xxx | 462 | //xxx |
433 | if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) | 463 | if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) |
434 | { | 464 | { |
435 | connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene); | 465 | connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); |
436 | break; | 466 | break; |
437 | } | 467 | } |
438 | 468 | ||
439 | // If we're one region over +x +y | 469 | // If we're one region over +x +y (i.e. root region is to the south-west) |
440 | //xxy | 470 | //xxy |
441 | //xxx | 471 | //xxx |
442 | //xxx | 472 | //xxx |
443 | if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) | 473 | if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) |
444 | { | 474 | { |
445 | connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene); | 475 | connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); |
446 | break; | 476 | break; |
447 | |||
448 | } | 477 | } |
449 | } | 478 | } |
450 | 479 | ||
@@ -454,20 +483,20 @@ namespace OpenSim.Region.RegionCombinerModule | |||
454 | DoWorkForRootRegion(newConn, scene); | 483 | DoWorkForRootRegion(newConn, scene); |
455 | } | 484 | } |
456 | } | 485 | } |
457 | |||
458 | // Set up infinite borders around the entire AABB of the combined ConnectedRegions | ||
459 | AdjustLargeRegionBounds(); | ||
460 | } | 486 | } |
461 | 487 | ||
462 | private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene) | 488 | private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene) |
463 | { | 489 | { |
490 | // Offset (in meters) from the base of this region to the base of the root region. | ||
464 | Vector3 offset = Vector3.Zero; | 491 | Vector3 offset = Vector3.Zero; |
465 | offset.X = newConn.PosX - rootConn.PosX; | 492 | offset.X = newConn.PosX - rootConn.PosX; |
466 | offset.Y = newConn.PosY - rootConn.PosY; | 493 | offset.Y = newConn.PosY - rootConn.PosY; |
467 | 494 | ||
495 | // The new total size of the region (in meters) | ||
496 | // We just extend the X and Y dimensions so the extent might temporarily include areas without regions. | ||
468 | Vector3 extents = Vector3.Zero; | 497 | Vector3 extents = Vector3.Zero; |
469 | extents.Y = rootConn.YEnd; | 498 | extents.X = Math.Max(rootConn.XEnd, offset.X + newConn.RegionScene.RegionInfo.RegionSizeX); |
470 | extents.X = rootConn.XEnd + newConn.XEnd; | 499 | extents.Y = Math.Max(rootConn.YEnd, offset.Y + newConn.RegionScene.RegionInfo.RegionSizeY); |
471 | 500 | ||
472 | rootConn.UpdateExtents(extents); | 501 | rootConn.UpdateExtents(extents); |
473 | 502 | ||
@@ -476,9 +505,6 @@ namespace OpenSim.Region.RegionCombinerModule | |||
476 | rootConn.RegionScene.RegionInfo.RegionName, | 505 | rootConn.RegionScene.RegionInfo.RegionName, |
477 | newConn.RegionScene.RegionInfo.RegionName, offset, extents); | 506 | newConn.RegionScene.RegionInfo.RegionName, offset, extents); |
478 | 507 | ||
479 | scene.BordersLocked = true; | ||
480 | rootConn.RegionScene.BordersLocked = true; | ||
481 | |||
482 | RegionData ConnectedRegion = new RegionData(); | 508 | RegionData ConnectedRegion = new RegionData(); |
483 | ConnectedRegion.Offset = offset; | 509 | ConnectedRegion.Offset = offset; |
484 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | 510 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; |
@@ -491,34 +517,10 @@ namespace OpenSim.Region.RegionCombinerModule | |||
491 | // Inform Child region that it needs to forward it's terrain to the root region | 517 | // Inform Child region that it needs to forward it's terrain to the root region |
492 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 518 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
493 | 519 | ||
494 | // Extend the borders as appropriate | ||
495 | lock (rootConn.RegionScene.EastBorders) | ||
496 | rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
497 | |||
498 | lock (rootConn.RegionScene.NorthBorders) | ||
499 | rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
500 | |||
501 | lock (rootConn.RegionScene.SouthBorders) | ||
502 | rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
503 | |||
504 | lock (scene.WestBorders) | ||
505 | { | ||
506 | scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West | ||
507 | |||
508 | // Trigger auto teleport to root region | ||
509 | scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; | ||
510 | scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; | ||
511 | } | ||
512 | |||
513 | // Reset Terrain.. since terrain loads before we get here, we need to load | 520 | // Reset Terrain.. since terrain loads before we get here, we need to load |
514 | // it again so it loads in the root region | 521 | // it again so it loads in the root region |
515 | |||
516 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 522 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
517 | 523 | ||
518 | // Unlock borders | ||
519 | rootConn.RegionScene.BordersLocked = false; | ||
520 | scene.BordersLocked = false; | ||
521 | |||
522 | // Create a client event forwarder and add this region's events to the root region. | 524 | // Create a client event forwarder and add this region's events to the root region. |
523 | if (rootConn.ClientEventForwarder != null) | 525 | if (rootConn.ClientEventForwarder != null) |
524 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); | 526 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); |
@@ -526,6 +528,9 @@ namespace OpenSim.Region.RegionCombinerModule | |||
526 | return true; | 528 | return true; |
527 | } | 529 | } |
528 | 530 | ||
531 | /* | ||
532 | * 20140215 radams1: The border stuff was removed and the addition of regions to the mega-regions | ||
533 | * was generalized. These functions are not needed for the generalized solution but left for reference. | ||
529 | private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) | 534 | private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) |
530 | { | 535 | { |
531 | Vector3 offset = Vector3.Zero; | 536 | Vector3 offset = Vector3.Zero; |
@@ -537,9 +542,6 @@ namespace OpenSim.Region.RegionCombinerModule | |||
537 | extents.X = rootConn.XEnd; | 542 | extents.X = rootConn.XEnd; |
538 | rootConn.UpdateExtents(extents); | 543 | rootConn.UpdateExtents(extents); |
539 | 544 | ||
540 | scene.BordersLocked = true; | ||
541 | rootConn.RegionScene.BordersLocked = true; | ||
542 | |||
543 | RegionData ConnectedRegion = new RegionData(); | 545 | RegionData ConnectedRegion = new RegionData(); |
544 | ConnectedRegion.Offset = offset; | 546 | ConnectedRegion.Offset = offset; |
545 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | 547 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; |
@@ -554,30 +556,11 @@ namespace OpenSim.Region.RegionCombinerModule | |||
554 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 556 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
555 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 557 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
556 | 558 | ||
557 | lock (rootConn.RegionScene.NorthBorders) | ||
558 | rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
559 | |||
560 | lock (rootConn.RegionScene.EastBorders) | ||
561 | rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
562 | |||
563 | lock (rootConn.RegionScene.WestBorders) | ||
564 | rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
565 | |||
566 | lock (scene.SouthBorders) | ||
567 | { | ||
568 | scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south | ||
569 | scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; | ||
570 | scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; | ||
571 | } | ||
572 | |||
573 | // Reset Terrain.. since terrain normally loads first. | 559 | // Reset Terrain.. since terrain normally loads first. |
574 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 560 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
575 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 561 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
576 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 562 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
577 | 563 | ||
578 | scene.BordersLocked = false; | ||
579 | rootConn.RegionScene.BordersLocked = false; | ||
580 | |||
581 | if (rootConn.ClientEventForwarder != null) | 564 | if (rootConn.ClientEventForwarder != null) |
582 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); | 565 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); |
583 | 566 | ||
@@ -601,9 +584,6 @@ namespace OpenSim.Region.RegionCombinerModule | |||
601 | extents.Y = rootConn.YEnd; | 584 | extents.Y = rootConn.YEnd; |
602 | extents.X = rootConn.XEnd; | 585 | extents.X = rootConn.XEnd; |
603 | 586 | ||
604 | scene.BordersLocked = true; | ||
605 | rootConn.RegionScene.BordersLocked = true; | ||
606 | |||
607 | RegionData ConnectedRegion = new RegionData(); | 587 | RegionData ConnectedRegion = new RegionData(); |
608 | ConnectedRegion.Offset = offset; | 588 | ConnectedRegion.Offset = offset; |
609 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | 589 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; |
@@ -619,68 +599,10 @@ namespace OpenSim.Region.RegionCombinerModule | |||
619 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 599 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
620 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 600 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
621 | 601 | ||
622 | lock (rootConn.RegionScene.NorthBorders) | ||
623 | { | ||
624 | if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2) | ||
625 | { | ||
626 | //compound border | ||
627 | // already locked above | ||
628 | rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
629 | |||
630 | lock (rootConn.RegionScene.EastBorders) | ||
631 | rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
632 | |||
633 | lock (rootConn.RegionScene.WestBorders) | ||
634 | rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
635 | } | ||
636 | } | ||
637 | |||
638 | lock (scene.SouthBorders) | ||
639 | { | ||
640 | scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south | ||
641 | scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; | ||
642 | scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; | ||
643 | } | ||
644 | |||
645 | lock (rootConn.RegionScene.EastBorders) | ||
646 | { | ||
647 | if (rootConn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) | ||
648 | { | ||
649 | |||
650 | rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
651 | |||
652 | lock (rootConn.RegionScene.NorthBorders) | ||
653 | rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
654 | |||
655 | lock (rootConn.RegionScene.SouthBorders) | ||
656 | rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
657 | } | ||
658 | } | ||
659 | |||
660 | lock (scene.WestBorders) | ||
661 | { | ||
662 | scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West | ||
663 | scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; | ||
664 | scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; | ||
665 | } | ||
666 | |||
667 | /* | ||
668 | else | ||
669 | { | ||
670 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | ||
671 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
672 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
673 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | ||
674 | } | ||
675 | */ | ||
676 | |||
677 | |||
678 | // Reset Terrain.. since terrain normally loads first. | 602 | // Reset Terrain.. since terrain normally loads first. |
679 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 603 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
680 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 604 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
681 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 605 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
682 | scene.BordersLocked = false; | ||
683 | rootConn.RegionScene.BordersLocked = false; | ||
684 | 606 | ||
685 | if (rootConn.ClientEventForwarder != null) | 607 | if (rootConn.ClientEventForwarder != null) |
686 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); | 608 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); |
@@ -689,6 +611,7 @@ namespace OpenSim.Region.RegionCombinerModule | |||
689 | 611 | ||
690 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); | 612 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); |
691 | } | 613 | } |
614 | */ | ||
692 | 615 | ||
693 | private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene) | 616 | private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene) |
694 | { | 617 | { |
@@ -887,125 +810,6 @@ namespace OpenSim.Region.RegionCombinerModule | |||
887 | // } | 810 | // } |
888 | // } | 811 | // } |
889 | 812 | ||
890 | // Create a set of infinite borders around the whole aabb of the combined island. | ||
891 | private void AdjustLargeRegionBounds() | ||
892 | { | ||
893 | lock (m_regions) | ||
894 | { | ||
895 | foreach (RegionConnections rconn in m_regions.Values) | ||
896 | { | ||
897 | Vector3 offset = Vector3.Zero; | ||
898 | rconn.RegionScene.BordersLocked = true; | ||
899 | foreach (RegionData rdata in rconn.ConnectedRegions) | ||
900 | { | ||
901 | if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X; | ||
902 | if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y; | ||
903 | } | ||
904 | |||
905 | lock (rconn.RegionScene.NorthBorders) | ||
906 | { | ||
907 | Border northBorder = null; | ||
908 | // If we don't already have an infinite border, create one. | ||
909 | if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder)) | ||
910 | { | ||
911 | northBorder = new Border(); | ||
912 | rconn.RegionScene.NorthBorders.Add(northBorder); | ||
913 | } | ||
914 | |||
915 | northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, | ||
916 | offset.Y + (int) Constants.RegionSize); //<--- | ||
917 | northBorder.CrossDirection = Cardinals.N; | ||
918 | } | ||
919 | |||
920 | lock (rconn.RegionScene.SouthBorders) | ||
921 | { | ||
922 | Border southBorder = null; | ||
923 | // If we don't already have an infinite border, create one. | ||
924 | if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder)) | ||
925 | { | ||
926 | southBorder = new Border(); | ||
927 | rconn.RegionScene.SouthBorders.Add(southBorder); | ||
928 | } | ||
929 | southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> | ||
930 | southBorder.CrossDirection = Cardinals.S; | ||
931 | } | ||
932 | |||
933 | lock (rconn.RegionScene.EastBorders) | ||
934 | { | ||
935 | Border eastBorder = null; | ||
936 | // If we don't already have an infinite border, create one. | ||
937 | if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder)) | ||
938 | { | ||
939 | eastBorder = new Border(); | ||
940 | rconn.RegionScene.EastBorders.Add(eastBorder); | ||
941 | } | ||
942 | eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize); | ||
943 | //<--- | ||
944 | eastBorder.CrossDirection = Cardinals.E; | ||
945 | } | ||
946 | |||
947 | lock (rconn.RegionScene.WestBorders) | ||
948 | { | ||
949 | Border westBorder = null; | ||
950 | // If we don't already have an infinite border, create one. | ||
951 | if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder)) | ||
952 | { | ||
953 | westBorder = new Border(); | ||
954 | rconn.RegionScene.WestBorders.Add(westBorder); | ||
955 | |||
956 | } | ||
957 | westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //---> | ||
958 | westBorder.CrossDirection = Cardinals.W; | ||
959 | } | ||
960 | |||
961 | rconn.RegionScene.BordersLocked = false; | ||
962 | } | ||
963 | } | ||
964 | } | ||
965 | |||
966 | /// <summary> | ||
967 | /// Try and get an Infinite border out of a listT of borders | ||
968 | /// </summary> | ||
969 | /// <param name="borders"></param> | ||
970 | /// <param name="oborder"></param> | ||
971 | /// <returns></returns> | ||
972 | public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder) | ||
973 | { | ||
974 | // Warning! Should be locked before getting here! | ||
975 | foreach (Border b in borders) | ||
976 | { | ||
977 | if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue) | ||
978 | { | ||
979 | oborder = b; | ||
980 | return true; | ||
981 | } | ||
982 | } | ||
983 | |||
984 | oborder = null; | ||
985 | return false; | ||
986 | } | ||
987 | |||
988 | public RegionData GetRegionFromPosition(Vector3 pPosition) | ||
989 | { | ||
990 | pPosition = pPosition/(int) Constants.RegionSize; | ||
991 | int OffsetX = (int) pPosition.X; | ||
992 | int OffsetY = (int) pPosition.Y; | ||
993 | |||
994 | lock (m_regions) | ||
995 | { | ||
996 | foreach (RegionConnections regConn in m_regions.Values) | ||
997 | { | ||
998 | foreach (RegionData reg in regConn.ConnectedRegions) | ||
999 | { | ||
1000 | if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY) | ||
1001 | return reg; | ||
1002 | } | ||
1003 | } | ||
1004 | } | ||
1005 | |||
1006 | return new RegionData(); | ||
1007 | } | ||
1008 | |||
1009 | public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion) | 813 | public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion) |
1010 | { | 814 | { |
1011 | if (BigRegion.PermissionModule == null) | 815 | if (BigRegion.PermissionModule == null) |