aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-09-02 04:39:00 -0400
committerTeravus Ovares (Dan Olivares)2009-09-02 04:39:00 -0400
commit9505297fb109e800be5733066f05f53d97eafe84 (patch)
tree45d659121e21932434310499c2ccf2690231793d /OpenSim
parentPrevent the Viewer's threaded inventory retrieval causing a OOM and overload (diff)
downloadopensim-SC_OLD-9505297fb109e800be5733066f05f53d97eafe84.zip
opensim-SC_OLD-9505297fb109e800be5733066f05f53d97eafe84.tar.gz
opensim-SC_OLD-9505297fb109e800be5733066f05f53d97eafe84.tar.bz2
opensim-SC_OLD-9505297fb109e800be5733066f05f53d97eafe84.tar.xz
* One last attempt to get the bordercrossing/primcrossing/attachmentcrossing right in the new border framework.
* This also contains some inactive preliminary code for disconnecting combined regions that will be used to make one root region a virtual region of a new root region.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Border.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs73
7 files changed, 126 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 035e6f8..6a5317b 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -495,6 +495,29 @@ namespace OpenSim.Region.CoreModules.World.Land
495 495
496 } 496 }
497 497
498 public void UnCombineRegion(RegionData rdata)
499 {
500 lock (m_regions)
501 {
502 if (m_regions.ContainsKey(rdata.RegionId))
503 {
504 // uncombine root region and virtual regions
505 }
506 else
507 {
508 foreach (RegionConnections r in m_regions.Values)
509 {
510 foreach (RegionData rd in r.ConnectedRegions)
511 {
512 if (rd.RegionId == rdata.RegionId)
513 {
514 // uncombine virtual region
515 }
516 }
517 }
518 }
519 }
520 }
498 // Create a set of infinite borders around the whole aabb of the combined island. 521 // Create a set of infinite borders around the whole aabb of the combined island.
499 private void AdjustLargeRegionBounds() 522 private void AdjustLargeRegionBounds()
500 { 523 {
diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 8f02a9c..9a08afe 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
103 case Cardinals.SE: // x+1, y-1 103 case Cardinals.SE: // x+1, y-1
104 break; 104 break;
105 case Cardinals.S: // x+0, y-1 105 case Cardinals.S: // x+0, y-1
106 if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y-1 < BorderLine.Z) 106 if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
107 { 107 {
108 return true; 108 return true;
109 } 109 }
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
111 case Cardinals.SW: // x-1, y-1 111 case Cardinals.SW: // x-1, y-1
112 break; 112 break;
113 case Cardinals.W: // x-1, y+0 113 case Cardinals.W: // x-1, y+0
114 if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X-1 < BorderLine.Z) 114 if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
115 { 115 {
116 return true; 116 return true;
117 } 117 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ec209ed..d1d82d6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -337,22 +337,22 @@ namespace OpenSim.Region.Framework.Scenes
337 BordersLocked = true; 337 BordersLocked = true;
338 338
339 Border northBorder = new Border(); 339 Border northBorder = new Border();
340 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize + 1); //<--- 340 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
341 northBorder.CrossDirection = Cardinals.N; 341 northBorder.CrossDirection = Cardinals.N;
342 NorthBorders.Add(northBorder); 342 NorthBorders.Add(northBorder);
343 343
344 Border southBorder = new Border(); 344 Border southBorder = new Border();
345 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, -1); //---> 345 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
346 southBorder.CrossDirection = Cardinals.S; 346 southBorder.CrossDirection = Cardinals.S;
347 SouthBorders.Add(southBorder); 347 SouthBorders.Add(southBorder);
348 348
349 Border eastBorder = new Border(); 349 Border eastBorder = new Border();
350 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize + 1); //<--- 350 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
351 eastBorder.CrossDirection = Cardinals.E; 351 eastBorder.CrossDirection = Cardinals.E;
352 EastBorders.Add(eastBorder); 352 EastBorders.Add(eastBorder);
353 353
354 Border westBorder = new Border(); 354 Border westBorder = new Border();
355 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, -1); //---> 355 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
356 westBorder.CrossDirection = Cardinals.W; 356 westBorder.CrossDirection = Cardinals.W;
357 WestBorders.Add(westBorder); 357 WestBorders.Add(westBorder);
358 358
@@ -489,22 +489,22 @@ namespace OpenSim.Region.Framework.Scenes
489 { 489 {
490 BordersLocked = true; 490 BordersLocked = true;
491 Border northBorder = new Border(); 491 Border northBorder = new Border();
492 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize + 1); //<--- 492 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
493 northBorder.CrossDirection = Cardinals.N; 493 northBorder.CrossDirection = Cardinals.N;
494 NorthBorders.Add(northBorder); 494 NorthBorders.Add(northBorder);
495 495
496 Border southBorder = new Border(); 496 Border southBorder = new Border();
497 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, -1); //---> 497 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,0); //--->
498 southBorder.CrossDirection = Cardinals.S; 498 southBorder.CrossDirection = Cardinals.S;
499 SouthBorders.Add(southBorder); 499 SouthBorders.Add(southBorder);
500 500
501 Border eastBorder = new Border(); 501 Border eastBorder = new Border();
502 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize + 1); //<--- 502 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize ); //<---
503 eastBorder.CrossDirection = Cardinals.E; 503 eastBorder.CrossDirection = Cardinals.E;
504 EastBorders.Add(eastBorder); 504 EastBorders.Add(eastBorder);
505 505
506 Border westBorder = new Border(); 506 Border westBorder = new Border();
507 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, -1); //---> 507 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,0); //--->
508 westBorder.CrossDirection = Cardinals.W; 508 westBorder.CrossDirection = Cardinals.W;
509 WestBorders.Add(westBorder); 509 WestBorders.Add(westBorder);
510 BordersLocked = false; 510 BordersLocked = false;
@@ -1709,6 +1709,10 @@ namespace OpenSim.Region.Framework.Scenes
1709 1709
1710 int thisx = (int)RegionInfo.RegionLocX; 1710 int thisx = (int)RegionInfo.RegionLocX;
1711 int thisy = (int)RegionInfo.RegionLocY; 1711 int thisy = (int)RegionInfo.RegionLocY;
1712 Vector3 EastCross = new Vector3(0.1f,0,0);
1713 Vector3 WestCross = new Vector3(-0.1f, 0, 0);
1714 Vector3 NorthCross = new Vector3(0, 0.1f, 0);
1715 Vector3 SouthCross = new Vector3(0, -0.1f, 0);
1712 1716
1713 1717
1714 // use this if no borders were crossed! 1718 // use this if no borders were crossed!
@@ -1718,9 +1722,9 @@ namespace OpenSim.Region.Framework.Scenes
1718 1722
1719 Vector3 pos = attemptedPosition; 1723 Vector3 pos = attemptedPosition;
1720 1724
1721 if (TestBorderCross(attemptedPosition, Cardinals.W)) 1725 if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
1722 { 1726 {
1723 if (TestBorderCross(attemptedPosition, Cardinals.S)) 1727 if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
1724 { 1728 {
1725 //Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W); 1729 //Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W);
1726 //Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S); 1730 //Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S);
@@ -1733,7 +1737,7 @@ namespace OpenSim.Region.Framework.Scenes
1733 // x - 1 1737 // x - 1
1734 // y - 1 1738 // y - 1
1735 } 1739 }
1736 else if (TestBorderCross(attemptedPosition, Cardinals.N)) 1740 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
1737 { 1741 {
1738 pos.X = ((pos.X + Constants.RegionSize)); 1742 pos.X = ((pos.X + Constants.RegionSize));
1739 pos.Y = ((pos.Y - Constants.RegionSize)); 1743 pos.Y = ((pos.Y - Constants.RegionSize));
@@ -1752,9 +1756,9 @@ namespace OpenSim.Region.Framework.Scenes
1752 // x - 1 1756 // x - 1
1753 } 1757 }
1754 } 1758 }
1755 else if (TestBorderCross(attemptedPosition, Cardinals.E)) 1759 else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E))
1756 { 1760 {
1757 if (TestBorderCross(attemptedPosition, Cardinals.S)) 1761 if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
1758 { 1762 {
1759 pos.X = ((pos.X - Constants.RegionSize)); 1763 pos.X = ((pos.X - Constants.RegionSize));
1760 pos.Y = ((pos.Y + Constants.RegionSize)); 1764 pos.Y = ((pos.Y + Constants.RegionSize));
@@ -1764,7 +1768,7 @@ namespace OpenSim.Region.Framework.Scenes
1764 // x + 1 1768 // x + 1
1765 // y - 1 1769 // y - 1
1766 } 1770 }
1767 else if (TestBorderCross(attemptedPosition, Cardinals.N)) 1771 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
1768 { 1772 {
1769 pos.X = ((pos.X - Constants.RegionSize)); 1773 pos.X = ((pos.X - Constants.RegionSize));
1770 pos.Y = ((pos.Y - Constants.RegionSize)); 1774 pos.Y = ((pos.Y - Constants.RegionSize));
@@ -1783,14 +1787,14 @@ namespace OpenSim.Region.Framework.Scenes
1783 // x + 1 1787 // x + 1
1784 } 1788 }
1785 } 1789 }
1786 else if (TestBorderCross(attemptedPosition, Cardinals.S)) 1790 else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
1787 { 1791 {
1788 pos.Y = ((pos.Y + Constants.RegionSize)); 1792 pos.Y = ((pos.Y + Constants.RegionSize));
1789 newRegionHandle 1793 newRegionHandle
1790 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize)); 1794 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
1791 // y - 1 1795 // y - 1
1792 } 1796 }
1793 else if (TestBorderCross(attemptedPosition, Cardinals.N)) 1797 else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
1794 { 1798 {
1795 1799
1796 pos.Y = ((pos.Y - Constants.RegionSize)); 1800 pos.Y = ((pos.Y - Constants.RegionSize));
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 1673a22..c6b3f30 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -1181,7 +1181,7 @@ namespace OpenSim.Region.Framework.Scenes
1181 uint neighbourx = m_regionInfo.RegionLocX; 1181 uint neighbourx = m_regionInfo.RegionLocX;
1182 uint neighboury = m_regionInfo.RegionLocY; 1182 uint neighboury = m_regionInfo.RegionLocY;
1183 const float boundaryDistance = 1.7f; 1183 const float boundaryDistance = 1.7f;
1184 Vector3 northCross = new Vector3(0, boundaryDistance, 0); 1184 Vector3 northCross = new Vector3(0,boundaryDistance, 0);
1185 Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0); 1185 Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0);
1186 Vector3 eastCross = new Vector3(boundaryDistance, 0, 0); 1186 Vector3 eastCross = new Vector3(boundaryDistance, 0, 0);
1187 Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0); 1187 Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5be074e..6ba7e41 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -263,9 +263,9 @@ namespace OpenSim.Region.Framework.Scenes
263 set 263 set
264 { 264 {
265 Vector3 val = value; 265 Vector3 val = value;
266 266
267 if ((m_scene.TestBorderCross(val,Cardinals.E) || m_scene.TestBorderCross(val,Cardinals.W) 267 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
268 || m_scene.TestBorderCross(val, Cardinals.N) || m_scene.TestBorderCross(val, Cardinals.S)) 268 || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
269 && !IsAttachment) 269 && !IsAttachment)
270 { 270 {
271 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 271 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 5c46344..8a07f71 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -172,6 +172,11 @@ namespace OpenSim.Region.Physics.Manager
172 return; 172 return;
173 } 173 }
174 174
175 public virtual void UnCombine(PhysicsScene pScene)
176 {
177
178 }
179
175 /// <summary> 180 /// <summary>
176 /// Queue a raycast against the physics scene. 181 /// Queue a raycast against the physics scene.
177 /// The provided callback method will be called when the raycast is complete 182 /// The provided callback method will be called when the raycast is complete
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index e702d5e..dc7010e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -3436,7 +3436,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3436 3436
3437 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); 3437 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3438 d.GeomSetRotation(GroundGeom, ref R); 3438 d.GeomSetRotation(GroundGeom, ref R);
3439 d.GeomSetPosition(GroundGeom, pOffset.X + ((int)Constants.RegionSize * 0.5f), pOffset.Y + ((int)Constants.RegionSize * 0.5f), 0); 3439 d.GeomSetPosition(GroundGeom, (pOffset.X + ((int)Constants.RegionSize * 0.5f)) - 1, (pOffset.Y + ((int)Constants.RegionSize * 0.5f)) - 1, 0);
3440 IntPtr testGround = IntPtr.Zero; 3440 IntPtr testGround = IntPtr.Zero;
3441 if (RegionTerrain.TryGetValue(pOffset, out testGround)) 3441 if (RegionTerrain.TryGetValue(pOffset, out testGround))
3442 { 3442 {
@@ -3457,7 +3457,78 @@ namespace OpenSim.Region.Physics.OdePlugin
3457 return waterlevel; 3457 return waterlevel;
3458 } 3458 }
3459 3459
3460 public override bool SupportsCombining()
3461 {
3462 return true;
3463 }
3464
3465 public override void UnCombine(PhysicsScene pScene)
3466 {
3467 IntPtr localGround = IntPtr.Zero;
3468 float[] localHeightfield;
3469 bool proceed = false;
3470 List<IntPtr> geomDestroyList = new List<IntPtr>();
3471
3472 lock (OdeLock)
3473 {
3474 if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround))
3475 {
3476 foreach (IntPtr geom in TerrainHeightFieldHeights.Keys)
3477 {
3478 if (geom == localGround)
3479 {
3480 localHeightfield = TerrainHeightFieldHeights[geom];
3481 proceed = true;
3482 }
3483 else
3484 {
3485 geomDestroyList.Add(geom);
3486 }
3487 }
3460 3488
3489 if (proceed)
3490 {
3491 m_worldOffset = Vector3.Zero;
3492 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
3493 m_parentScene = null;
3494
3495 foreach (IntPtr g in geomDestroyList)
3496 {
3497 // removingHeightField needs to be done or the garbage collector will
3498 // collect the terrain data before we tell ODE to destroy it causing
3499 // memory corruption
3500 if (TerrainHeightFieldHeights.ContainsKey(g))
3501 {
3502 float[] removingHeightField = TerrainHeightFieldHeights[g];
3503 TerrainHeightFieldHeights.Remove(g);
3504
3505 if (RegionTerrain.ContainsKey(g))
3506 {
3507 RegionTerrain.Remove(g);
3508 }
3509
3510 d.GeomDestroy(g);
3511 removingHeightField = new float[0];
3512
3513
3514
3515 }
3516
3517 }
3518
3519 }
3520 else
3521 {
3522 m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
3523
3524 }
3525
3526 }
3527
3528 }
3529 }
3530
3531
3461 3532
3462 public override void SetWaterLevel(float baseheight) 3533 public override void SetWaterLevel(float baseheight)
3463 { 3534 {