diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs | 186 |
1 files changed, 183 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs b/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs index 2fc1623..8921085 100644 --- a/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs +++ b/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs | |||
@@ -42,6 +42,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
42 | RegionConnections regionConnections = new RegionConnections(); | 42 | RegionConnections regionConnections = new RegionConnections(); |
43 | regionConnections.ConnectedRegions = new List<RegionData>(); | 43 | regionConnections.ConnectedRegions = new List<RegionData>(); |
44 | regionConnections.RegionScene = scene; | 44 | regionConnections.RegionScene = scene; |
45 | regionConnections.RegionLandChannel = scene.LandChannel; | ||
45 | regionConnections.RegionId = scene.RegionInfo.originRegionID; | 46 | regionConnections.RegionId = scene.RegionInfo.originRegionID; |
46 | regionConnections.X = scene.RegionInfo.RegionLocX; | 47 | regionConnections.X = scene.RegionInfo.RegionLocX; |
47 | regionConnections.Y = scene.RegionInfo.RegionLocY; | 48 | regionConnections.Y = scene.RegionInfo.RegionLocY; |
@@ -240,6 +241,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
240 | 241 | ||
241 | scene.BordersLocked = true; | 242 | scene.BordersLocked = true; |
242 | conn.RegionScene.BordersLocked = true; | 243 | conn.RegionScene.BordersLocked = true; |
244 | |||
245 | RegionData ConnectedRegion = new RegionData(); | ||
246 | ConnectedRegion.Offset = offset; | ||
247 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
248 | ConnectedRegion.RegionScene = scene; | ||
249 | conn.ConnectedRegions.Add(ConnectedRegion); | ||
250 | |||
243 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 251 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
244 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 252 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
245 | 253 | ||
@@ -259,9 +267,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
259 | // | 267 | // |
260 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 268 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
261 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 269 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
270 | |||
262 | conn.RegionScene.BordersLocked = false; | 271 | conn.RegionScene.BordersLocked = false; |
263 | scene.BordersLocked = false; | 272 | scene.BordersLocked = false; |
264 | |||
265 | connectedYN = true; | 273 | connectedYN = true; |
266 | break; | 274 | break; |
267 | } | 275 | } |
@@ -292,6 +300,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
292 | scene.BordersLocked = true; | 300 | scene.BordersLocked = true; |
293 | conn.RegionScene.BordersLocked = true; | 301 | conn.RegionScene.BordersLocked = true; |
294 | 302 | ||
303 | RegionData ConnectedRegion = new RegionData(); | ||
304 | ConnectedRegion.Offset = offset; | ||
305 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
306 | ConnectedRegion.RegionScene = scene; | ||
307 | conn.ConnectedRegions.Add(ConnectedRegion); | ||
308 | |||
295 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", | 309 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", |
296 | conn.RegionScene.RegionInfo.RegionName, | 310 | conn.RegionScene.RegionInfo.RegionName, |
297 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 311 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
@@ -342,6 +356,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
342 | scene.BordersLocked = true; | 356 | scene.BordersLocked = true; |
343 | conn.RegionScene.BordersLocked = true; | 357 | conn.RegionScene.BordersLocked = true; |
344 | 358 | ||
359 | RegionData ConnectedRegion = new RegionData(); | ||
360 | ConnectedRegion.Offset = offset; | ||
361 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | ||
362 | ConnectedRegion.RegionScene = scene; | ||
363 | |||
364 | conn.ConnectedRegions.Add(ConnectedRegion); | ||
365 | |||
345 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", | 366 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", |
346 | conn.RegionScene.RegionInfo.RegionName, | 367 | conn.RegionScene.RegionInfo.RegionName, |
347 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 368 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
@@ -409,7 +430,19 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
409 | 430 | ||
410 | } | 431 | } |
411 | if (!connectedYN) | 432 | if (!connectedYN) |
433 | { | ||
434 | RegionData rdata = new RegionData(); | ||
435 | rdata.Offset = Vector3.Zero; | ||
436 | rdata.RegionId = scene.RegionInfo.originRegionID; | ||
437 | rdata.RegionScene = scene; | ||
438 | regionConnections.RegionLandChannel = scene.LandChannel; | ||
439 | |||
440 | LargeLandChannel lnd = new LargeLandChannel(rdata,scene.LandChannel,regionConnections.ConnectedRegions); | ||
441 | scene.LandChannel = lnd; | ||
442 | |||
412 | m_regions.Add(scene.RegionInfo.originRegionID,regionConnections); | 443 | m_regions.Add(scene.RegionInfo.originRegionID,regionConnections); |
444 | } | ||
445 | |||
413 | } | 446 | } |
414 | } | 447 | } |
415 | 448 | ||
@@ -431,12 +464,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
431 | { | 464 | { |
432 | 465 | ||
433 | } | 466 | } |
434 | } | ||
435 | 467 | ||
468 | |||
469 | public RegionData GetRegionFromPosition(Vector3 pPosition) | ||
470 | { | ||
471 | pPosition = pPosition/(int) Constants.RegionSize; | ||
472 | int OffsetX = (int) pPosition.X; | ||
473 | int OffsetY = (int) pPosition.Y; | ||
474 | foreach (RegionConnections regConn in m_regions.Values) | ||
475 | { | ||
476 | foreach (RegionData reg in regConn.ConnectedRegions) | ||
477 | { | ||
478 | if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY) | ||
479 | return reg; | ||
480 | } | ||
481 | } | ||
482 | return new RegionData(); | ||
483 | } | ||
484 | } | ||
436 | public class RegionConnections | 485 | public class RegionConnections |
437 | { | 486 | { |
438 | public UUID RegionId; | 487 | public UUID RegionId; |
439 | public Scene RegionScene; | 488 | public Scene RegionScene; |
489 | public ILandChannel RegionLandChannel; | ||
440 | public uint X; | 490 | public uint X; |
441 | public uint Y; | 491 | public uint Y; |
442 | public int XEnd; | 492 | public int XEnd; |
@@ -450,10 +500,140 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
450 | 500 | ||
451 | } | 501 | } |
452 | 502 | ||
453 | public struct RegionData | 503 | public class RegionData |
454 | { | 504 | { |
455 | public UUID RegionId; | 505 | public UUID RegionId; |
456 | public Scene RegionScene; | 506 | public Scene RegionScene; |
457 | public Vector3 Offset; | 507 | public Vector3 Offset; |
508 | |||
509 | } | ||
510 | |||
511 | public class LargeLandChannel : ILandChannel | ||
512 | { | ||
513 | private static readonly ILog m_log = | ||
514 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
515 | private RegionData RegData; | ||
516 | private ILandChannel RootRegionLandChannel; | ||
517 | private readonly List<RegionData> RegionConnections; | ||
518 | |||
519 | #region ILandChannel Members | ||
520 | |||
521 | public LargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,List<RegionData> regionConnections) | ||
522 | { | ||
523 | RegData = regData; | ||
524 | RootRegionLandChannel = rootRegionLandChannel; | ||
525 | RegionConnections = regionConnections; | ||
526 | } | ||
527 | |||
528 | public List<ILandObject> ParcelsNearPoint(Vector3 position) | ||
529 | { | ||
530 | m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position); | ||
531 | return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset); | ||
532 | } | ||
533 | |||
534 | public List<ILandObject> AllParcels() | ||
535 | { | ||
536 | |||
537 | return RootRegionLandChannel.AllParcels(); | ||
538 | |||
539 | } | ||
540 | |||
541 | public ILandObject GetLandObject(int x, int y) | ||
542 | { | ||
543 | m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y); | ||
544 | |||
545 | if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) | ||
546 | { | ||
547 | return RootRegionLandChannel.GetLandObject(x, y); | ||
548 | } | ||
549 | else | ||
550 | { | ||
551 | int offsetX = (x / (int)Constants.RegionSize); | ||
552 | int offsetY = (x / (int)Constants.RegionSize); | ||
553 | offsetX *= (int)Constants.RegionSize; | ||
554 | offsetY *= (int)Constants.RegionSize; | ||
555 | |||
556 | foreach (RegionData regionData in RegionConnections) | ||
557 | { | ||
558 | if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) | ||
559 | { | ||
560 | return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); | ||
561 | } | ||
562 | } | ||
563 | ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); | ||
564 | obj.landData.Name = "NO LAND"; | ||
565 | return obj; | ||
566 | } | ||
567 | } | ||
568 | |||
569 | public ILandObject GetLandObject(int localID) | ||
570 | { | ||
571 | return RootRegionLandChannel.GetLandObject(localID); | ||
572 | } | ||
573 | |||
574 | public ILandObject GetLandObject(float x, float y) | ||
575 | { | ||
576 | m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y); | ||
577 | |||
578 | if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize) | ||
579 | { | ||
580 | return RootRegionLandChannel.GetLandObject(x, y); | ||
581 | } | ||
582 | else | ||
583 | { | ||
584 | int offsetX = (int)(x/(int) Constants.RegionSize); | ||
585 | int offsetY = (int)(x/(int) Constants.RegionSize); | ||
586 | offsetX *= (int) Constants.RegionSize; | ||
587 | offsetY *= (int) Constants.RegionSize; | ||
588 | |||
589 | foreach (RegionData regionData in RegionConnections) | ||
590 | { | ||
591 | if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY) | ||
592 | { | ||
593 | return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); | ||
594 | } | ||
595 | } | ||
596 | ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); | ||
597 | obj.landData.Name = "NO LAND"; | ||
598 | return obj; | ||
599 | } | ||
600 | } | ||
601 | |||
602 | public bool IsLandPrimCountTainted() | ||
603 | { | ||
604 | return RootRegionLandChannel.IsLandPrimCountTainted(); | ||
605 | } | ||
606 | |||
607 | public bool IsForcefulBansAllowed() | ||
608 | { | ||
609 | return RootRegionLandChannel.IsForcefulBansAllowed(); | ||
610 | } | ||
611 | |||
612 | public void UpdateLandObject(int localID, LandData data) | ||
613 | { | ||
614 | RootRegionLandChannel.UpdateLandObject(localID, data); | ||
615 | } | ||
616 | |||
617 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | ||
618 | { | ||
619 | RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); | ||
620 | } | ||
621 | |||
622 | public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) | ||
623 | { | ||
624 | RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel); | ||
625 | } | ||
626 | |||
627 | public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) | ||
628 | { | ||
629 | RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel); | ||
630 | } | ||
631 | |||
632 | public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) | ||
633 | { | ||
634 | RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime); | ||
635 | } | ||
636 | |||
637 | #endregion | ||
458 | } | 638 | } |
459 | } | 639 | } |