aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-11-10 18:59:37 +0000
committerJustin Clark-Casey (justincc)2009-11-10 18:59:37 +0000
commitd6a7f284a2f4e7a1b9ec44f92496977660426c63 (patch)
tree19cfc993391f9846c4cf9826972f0a0ee955c16f
parentStop OpenSim.Grid.GridServer.exe from building to reduce user/developer confu... (diff)
parentBroke the monster RegionLoaded method in RegionCombinerModule into 4 smaller ... (diff)
downloadopensim-SC-d6a7f284a2f4e7a1b9ec44f92496977660426c63.zip
opensim-SC-d6a7f284a2f4e7a1b9ec44f92496977660426c63.tar.gz
opensim-SC-d6a7f284a2f4e7a1b9ec44f92496977660426c63.tar.bz2
opensim-SC-d6a7f284a2f4e7a1b9ec44f92496977660426c63.tar.xz
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs472
1 files changed, 248 insertions, 224 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index d8c5ed9..ebd8ee7 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -299,76 +299,13 @@ namespace OpenSim.Region.CoreModules.World.Land
299 //xxy 299 //xxy
300 //xxx 300 //xxx
301 301
302
302 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd 303 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
303 >= (regionConnections.X * (int)Constants.RegionSize)) 304 >= (regionConnections.X * (int)Constants.RegionSize))
304 && (((int)conn.Y * (int)Constants.RegionSize) 305 && (((int)conn.Y * (int)Constants.RegionSize)
305 >= (regionConnections.Y * (int)Constants.RegionSize))) 306 >= (regionConnections.Y * (int)Constants.RegionSize)))
306 { 307 {
307 Vector3 offset = Vector3.Zero; 308 connectedYN = DoWorkForOneRegionOverPlusXY(conn, regionConnections, scene);
308 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
309 ((conn.X * (int)Constants.RegionSize)));
310 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
311 ((conn.Y * (int)Constants.RegionSize)));
312
313 Vector3 extents = Vector3.Zero;
314 extents.Y = conn.YEnd;
315 extents.X = conn.XEnd + regionConnections.XEnd;
316
317 conn.UpdateExtents(extents);
318
319 m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
320 conn.RegionScene.RegionInfo.RegionName,
321 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
322
323 scene.BordersLocked = true;
324 conn.RegionScene.BordersLocked = true;
325
326 RegionData ConnectedRegion = new RegionData();
327 ConnectedRegion.Offset = offset;
328 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
329 ConnectedRegion.RegionScene = scene;
330 conn.ConnectedRegions.Add(ConnectedRegion);
331
332 // Inform root region Physics about the extents of this region
333 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
334
335 // Inform Child region that it needs to forward it's terrain to the root region
336 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
337
338 // Extend the borders as appropriate
339 lock (conn.RegionScene.EastBorders)
340 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
341
342 lock (conn.RegionScene.NorthBorders)
343 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
344
345 lock (conn.RegionScene.SouthBorders)
346 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
347
348 lock (scene.WestBorders)
349 {
350
351
352 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
353
354 // Trigger auto teleport to root region
355 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
356 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
357 }
358
359 // Reset Terrain.. since terrain loads before we get here, we need to load
360 // it again so it loads in the root region
361
362 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
363
364 // Unlock borders
365 conn.RegionScene.BordersLocked = false;
366 scene.BordersLocked = false;
367
368 // Create a client event forwarder and add this region's events to the root region.
369 if (conn.ClientEventForwarder != null)
370 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
371 connectedYN = true;
372 break; 309 break;
373 } 310 }
374 311
@@ -381,57 +318,8 @@ namespace OpenSim.Region.CoreModules.World.Land
381 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd 318 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
382 >= (regionConnections.Y * (int)Constants.RegionSize))) 319 >= (regionConnections.Y * (int)Constants.RegionSize)))
383 { 320 {
384 Vector3 offset = Vector3.Zero; 321 connectedYN = DoWorkForOneRegionOverXPlusY(conn, regionConnections, scene);
385 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - 322 break;
386 ((conn.X * (int)Constants.RegionSize)));
387 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
388 ((conn.Y * (int)Constants.RegionSize)));
389
390 Vector3 extents = Vector3.Zero;
391 extents.Y = regionConnections.YEnd + conn.YEnd;
392 extents.X = conn.XEnd;
393 conn.UpdateExtents(extents);
394
395 scene.BordersLocked = true;
396 conn.RegionScene.BordersLocked = true;
397
398 RegionData ConnectedRegion = new RegionData();
399 ConnectedRegion.Offset = offset;
400 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
401 ConnectedRegion.RegionScene = scene;
402 conn.ConnectedRegions.Add(ConnectedRegion);
403
404 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
405 conn.RegionScene.RegionInfo.RegionName,
406 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
407
408 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
409 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
410
411 lock (conn.RegionScene.NorthBorders)
412 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
413 lock (conn.RegionScene.EastBorders)
414 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
415 lock (conn.RegionScene.WestBorders)
416 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
417 lock (scene.SouthBorders)
418 {
419 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
420 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
421 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
422 }
423
424 // Reset Terrain.. since terrain normally loads first.
425 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
426 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
427 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
428
429 scene.BordersLocked = false;
430 conn.RegionScene.BordersLocked = false;
431 if (conn.ClientEventForwarder != null)
432 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
433 connectedYN = true;
434 break;
435 } 323 }
436 324
437 // If we're one region over +x +y 325 // If we're one region over +x +y
@@ -443,140 +331,276 @@ namespace OpenSim.Region.CoreModules.World.Land
443 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd 331 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
444 >= (regionConnections.Y * (int)Constants.RegionSize))) 332 >= (regionConnections.Y * (int)Constants.RegionSize)))
445 { 333 {
446 Vector3 offset = Vector3.Zero; 334 connectedYN = DoWorkForOneRegionOverPlusXPlusY(conn, regionConnections, scene);
447 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - 335 break;
448 ((conn.X * (int)Constants.RegionSize)));
449 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
450 ((conn.Y * (int)Constants.RegionSize)));
451 336
452 Vector3 extents = Vector3.Zero; 337 }
453 extents.Y = regionConnections.YEnd + conn.YEnd; 338 }
454 extents.X = regionConnections.XEnd + conn.XEnd;
455 conn.UpdateExtents(extents);
456 339
457 scene.BordersLocked = true; 340 // If !connectYN means that this region is a root region
458 conn.RegionScene.BordersLocked = true; 341 if (!connectedYN)
342 {
343 DoWorkForRootRegion(regionConnections, scene);
459 344
460 RegionData ConnectedRegion = new RegionData(); 345 }
461 ConnectedRegion.Offset = offset; 346 }
462 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; 347 // Set up infinite borders around the entire AABB of the combined ConnectedRegions
463 ConnectedRegion.RegionScene = scene; 348 AdjustLargeRegionBounds();
349 }
464 350
465 conn.ConnectedRegions.Add(ConnectedRegion); 351 private bool DoWorkForOneRegionOverPlusXY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
352 {
353 Vector3 offset = Vector3.Zero;
354 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
355 ((conn.X * (int)Constants.RegionSize)));
356 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
357 ((conn.Y * (int)Constants.RegionSize)));
466 358
467 m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", 359 Vector3 extents = Vector3.Zero;
468 conn.RegionScene.RegionInfo.RegionName, 360 extents.Y = conn.YEnd;
469 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); 361 extents.X = conn.XEnd + regionConnections.XEnd;
470 362
471 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); 363 conn.UpdateExtents(extents);
472 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
473 lock (conn.RegionScene.NorthBorders)
474 {
475 if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
476 {
477 //compound border
478 // already locked above
479 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
480
481 lock (conn.RegionScene.EastBorders)
482 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
483 lock (conn.RegionScene.WestBorders)
484 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
485 }
486 }
487 364
488 lock (scene.SouthBorders) 365 m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
489 { 366 conn.RegionScene.RegionInfo.RegionName,
490 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south 367 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
491 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
492 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
493 }
494 368
495 lock (conn.RegionScene.EastBorders) 369 scene.BordersLocked = true;
496 { 370 conn.RegionScene.BordersLocked = true;
497 if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
498 {
499 371
500 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; 372 RegionData ConnectedRegion = new RegionData();
501 lock (conn.RegionScene.NorthBorders) 373 ConnectedRegion.Offset = offset;
502 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; 374 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
503 lock (conn.RegionScene.SouthBorders) 375 ConnectedRegion.RegionScene = scene;
504 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; 376 conn.ConnectedRegions.Add(ConnectedRegion);
505 377
378 // Inform root region Physics about the extents of this region
379 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
506 380
507 } 381 // Inform Child region that it needs to forward it's terrain to the root region
508 } 382 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
509 383
510 lock (scene.WestBorders) 384 // Extend the borders as appropriate
511 { 385 lock (conn.RegionScene.EastBorders)
512 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West 386 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
513 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
514 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
515 }
516 387
517 /* 388 lock (conn.RegionScene.NorthBorders)
518 else 389 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
519 {
520 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
521 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
522 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
523 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
524 }
525 */
526 390
391 lock (conn.RegionScene.SouthBorders)
392 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
527 393
528 // Reset Terrain.. since terrain normally loads first. 394 lock (scene.WestBorders)
529 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 395 {
530 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
531 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
532 scene.BordersLocked = false;
533 conn.RegionScene.BordersLocked = false;
534 396
535 if (conn.ClientEventForwarder != null)
536 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
537 397
538 connectedYN = true; 398 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
539 399
540 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); 400 // Trigger auto teleport to root region
401 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
402 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
403 }
541 404
542 break; 405 // Reset Terrain.. since terrain loads before we get here, we need to load
543 } 406 // it again so it loads in the root region
407
408 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
409
410 // Unlock borders
411 conn.RegionScene.BordersLocked = false;
412 scene.BordersLocked = false;
413
414 // Create a client event forwarder and add this region's events to the root region.
415 if (conn.ClientEventForwarder != null)
416 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
417
418 return true;
419 }
420
421 private bool DoWorkForOneRegionOverXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
422 {
423 Vector3 offset = Vector3.Zero;
424 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
425 ((conn.X * (int)Constants.RegionSize)));
426 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
427 ((conn.Y * (int)Constants.RegionSize)));
428
429 Vector3 extents = Vector3.Zero;
430 extents.Y = regionConnections.YEnd + conn.YEnd;
431 extents.X = conn.XEnd;
432 conn.UpdateExtents(extents);
433
434 scene.BordersLocked = true;
435 conn.RegionScene.BordersLocked = true;
436
437 RegionData ConnectedRegion = new RegionData();
438 ConnectedRegion.Offset = offset;
439 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
440 ConnectedRegion.RegionScene = scene;
441 conn.ConnectedRegions.Add(ConnectedRegion);
442
443 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
444 conn.RegionScene.RegionInfo.RegionName,
445 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
446
447 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
448 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
449
450 lock (conn.RegionScene.NorthBorders)
451 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
452 lock (conn.RegionScene.EastBorders)
453 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
454 lock (conn.RegionScene.WestBorders)
455 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
456 lock (scene.SouthBorders)
457 {
458 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
459 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
460 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
461 }
462
463 // Reset Terrain.. since terrain normally loads first.
464 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
465 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
466 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
467
468 scene.BordersLocked = false;
469 conn.RegionScene.BordersLocked = false;
470 if (conn.ClientEventForwarder != null)
471 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
472 return true;
473 }
474
475 private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene)
476 {
477 Vector3 offset = Vector3.Zero;
478 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
479 ((conn.X * (int)Constants.RegionSize)));
480 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
481 ((conn.Y * (int)Constants.RegionSize)));
482
483 Vector3 extents = Vector3.Zero;
484 extents.Y = regionConnections.YEnd + conn.YEnd;
485 extents.X = regionConnections.XEnd + conn.XEnd;
486 conn.UpdateExtents(extents);
487
488 scene.BordersLocked = true;
489 conn.RegionScene.BordersLocked = true;
490
491 RegionData ConnectedRegion = new RegionData();
492 ConnectedRegion.Offset = offset;
493 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
494 ConnectedRegion.RegionScene = scene;
495
496 conn.ConnectedRegions.Add(ConnectedRegion);
497
498 m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
499 conn.RegionScene.RegionInfo.RegionName,
500 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
501
502 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
503 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
504 lock (conn.RegionScene.NorthBorders)
505 {
506 if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
507 {
508 //compound border
509 // already locked above
510 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
511
512 lock (conn.RegionScene.EastBorders)
513 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
514 lock (conn.RegionScene.WestBorders)
515 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
544 } 516 }
517 }
545 518
546 // If !connectYN means that this region is a root region 519 lock (scene.SouthBorders)
547 if (!connectedYN) 520 {
521 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
522 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
523 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
524 }
525
526 lock (conn.RegionScene.EastBorders)
527 {
528 if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
548 { 529 {
549 RegionData rdata = new RegionData();
550 rdata.Offset = Vector3.Zero;
551 rdata.RegionId = scene.RegionInfo.originRegionID;
552 rdata.RegionScene = scene;
553 // save it's land channel
554 regionConnections.RegionLandChannel = scene.LandChannel;
555
556 // Substitue our landchannel
557 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
558 regionConnections.ConnectedRegions);
559 scene.LandChannel = lnd;
560 // Forward the permissions modules of each of the connected regions to the root region
561 lock (m_regions)
562 {
563 foreach (RegionData r in regionConnections.ConnectedRegions)
564 {
565 ForwardPermissionRequests(regionConnections, r.RegionScene);
566 }
567 }
568 // Create the root region's Client Event Forwarder
569 regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
570 530
571 // Sets up the CoarseLocationUpdate forwarder for this root region 531 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
572 scene.EventManager.OnNewPresence += SetCourseLocationDelegate; 532 lock (conn.RegionScene.NorthBorders)
533 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
534 lock (conn.RegionScene.SouthBorders)
535 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
536
573 537
574 // Adds this root region to a dictionary of regions that are connectable
575 m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
576 } 538 }
577 } 539 }
578 // Set up infinite borders around the entire AABB of the combined ConnectedRegions 540
579 AdjustLargeRegionBounds(); 541 lock (scene.WestBorders)
542 {
543 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
544 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
545 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
546 }
547
548 /*
549 else
550 {
551 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
552 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
553 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
554 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
555 }
556 */
557
558
559 // Reset Terrain.. since terrain normally loads first.
560 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
561 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
562 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
563 scene.BordersLocked = false;
564 conn.RegionScene.BordersLocked = false;
565
566 if (conn.ClientEventForwarder != null)
567 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
568
569 return true;
570
571 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
572
573 }
574
575 private void DoWorkForRootRegion(RegionConnections regionConnections, Scene scene)
576 {
577 RegionData rdata = new RegionData();
578 rdata.Offset = Vector3.Zero;
579 rdata.RegionId = scene.RegionInfo.originRegionID;
580 rdata.RegionScene = scene;
581 // save it's land channel
582 regionConnections.RegionLandChannel = scene.LandChannel;
583
584 // Substitue our landchannel
585 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
586 regionConnections.ConnectedRegions);
587 scene.LandChannel = lnd;
588 // Forward the permissions modules of each of the connected regions to the root region
589 lock (m_regions)
590 {
591 foreach (RegionData r in regionConnections.ConnectedRegions)
592 {
593 ForwardPermissionRequests(regionConnections, r.RegionScene);
594 }
595 }
596 // Create the root region's Client Event Forwarder
597 regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
598
599 // Sets up the CoarseLocationUpdate forwarder for this root region
600 scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
601
602 // Adds this root region to a dictionary of regions that are connectable
603 m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
580 } 604 }
581 605
582 private void SetCourseLocationDelegate(ScenePresence presence) 606 private void SetCourseLocationDelegate(ScenePresence presence)