* 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.remotes/origin/0.6.7-post-fixes
parent
994c5e2094
commit
9505297fb1
|
@ -495,6 +495,29 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
}
|
||||
|
||||
public void UnCombineRegion(RegionData rdata)
|
||||
{
|
||||
lock (m_regions)
|
||||
{
|
||||
if (m_regions.ContainsKey(rdata.RegionId))
|
||||
{
|
||||
// uncombine root region and virtual regions
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (RegionConnections r in m_regions.Values)
|
||||
{
|
||||
foreach (RegionData rd in r.ConnectedRegions)
|
||||
{
|
||||
if (rd.RegionId == rdata.RegionId)
|
||||
{
|
||||
// uncombine virtual region
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create a set of infinite borders around the whole aabb of the combined island.
|
||||
private void AdjustLargeRegionBounds()
|
||||
{
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
case Cardinals.SE: // x+1, y-1
|
||||
break;
|
||||
case Cardinals.S: // x+0, y-1
|
||||
if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y-1 < BorderLine.Z)
|
||||
if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
case Cardinals.SW: // x-1, y-1
|
||||
break;
|
||||
case Cardinals.W: // x-1, y+0
|
||||
if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X-1 < BorderLine.Z)
|
||||
if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -337,22 +337,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
BordersLocked = true;
|
||||
|
||||
Border northBorder = new Border();
|
||||
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize + 1); //<---
|
||||
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
|
||||
northBorder.CrossDirection = Cardinals.N;
|
||||
NorthBorders.Add(northBorder);
|
||||
|
||||
Border southBorder = new Border();
|
||||
southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, -1); //--->
|
||||
southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
|
||||
southBorder.CrossDirection = Cardinals.S;
|
||||
SouthBorders.Add(southBorder);
|
||||
|
||||
Border eastBorder = new Border();
|
||||
eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize + 1); //<---
|
||||
eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
|
||||
eastBorder.CrossDirection = Cardinals.E;
|
||||
EastBorders.Add(eastBorder);
|
||||
|
||||
Border westBorder = new Border();
|
||||
westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, -1); //--->
|
||||
westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
|
||||
westBorder.CrossDirection = Cardinals.W;
|
||||
WestBorders.Add(westBorder);
|
||||
|
||||
|
@ -489,22 +489,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
BordersLocked = true;
|
||||
Border northBorder = new Border();
|
||||
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize + 1); //<---
|
||||
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
|
||||
northBorder.CrossDirection = Cardinals.N;
|
||||
NorthBorders.Add(northBorder);
|
||||
|
||||
Border southBorder = new Border();
|
||||
southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, -1); //--->
|
||||
southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,0); //--->
|
||||
southBorder.CrossDirection = Cardinals.S;
|
||||
SouthBorders.Add(southBorder);
|
||||
|
||||
Border eastBorder = new Border();
|
||||
eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize + 1); //<---
|
||||
eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize ); //<---
|
||||
eastBorder.CrossDirection = Cardinals.E;
|
||||
EastBorders.Add(eastBorder);
|
||||
|
||||
Border westBorder = new Border();
|
||||
westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, -1); //--->
|
||||
westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,0); //--->
|
||||
westBorder.CrossDirection = Cardinals.W;
|
||||
WestBorders.Add(westBorder);
|
||||
BordersLocked = false;
|
||||
|
@ -1709,6 +1709,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
int thisx = (int)RegionInfo.RegionLocX;
|
||||
int thisy = (int)RegionInfo.RegionLocY;
|
||||
Vector3 EastCross = new Vector3(0.1f,0,0);
|
||||
Vector3 WestCross = new Vector3(-0.1f, 0, 0);
|
||||
Vector3 NorthCross = new Vector3(0, 0.1f, 0);
|
||||
Vector3 SouthCross = new Vector3(0, -0.1f, 0);
|
||||
|
||||
|
||||
// use this if no borders were crossed!
|
||||
|
@ -1718,9 +1722,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
Vector3 pos = attemptedPosition;
|
||||
|
||||
if (TestBorderCross(attemptedPosition, Cardinals.W))
|
||||
if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
|
||||
{
|
||||
if (TestBorderCross(attemptedPosition, Cardinals.S))
|
||||
if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
|
||||
{
|
||||
//Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W);
|
||||
//Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S);
|
||||
|
@ -1733,7 +1737,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// x - 1
|
||||
// y - 1
|
||||
}
|
||||
else if (TestBorderCross(attemptedPosition, Cardinals.N))
|
||||
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
|
||||
{
|
||||
pos.X = ((pos.X + Constants.RegionSize));
|
||||
pos.Y = ((pos.Y - Constants.RegionSize));
|
||||
|
@ -1752,9 +1756,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// x - 1
|
||||
}
|
||||
}
|
||||
else if (TestBorderCross(attemptedPosition, Cardinals.E))
|
||||
else if (TestBorderCross(attemptedPosition + EastCross, Cardinals.E))
|
||||
{
|
||||
if (TestBorderCross(attemptedPosition, Cardinals.S))
|
||||
if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
|
||||
{
|
||||
pos.X = ((pos.X - Constants.RegionSize));
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
|
@ -1764,7 +1768,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// x + 1
|
||||
// y - 1
|
||||
}
|
||||
else if (TestBorderCross(attemptedPosition, Cardinals.N))
|
||||
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
|
||||
{
|
||||
pos.X = ((pos.X - Constants.RegionSize));
|
||||
pos.Y = ((pos.Y - Constants.RegionSize));
|
||||
|
@ -1783,14 +1787,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// x + 1
|
||||
}
|
||||
}
|
||||
else if (TestBorderCross(attemptedPosition, Cardinals.S))
|
||||
else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
|
||||
{
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
|
||||
// y - 1
|
||||
}
|
||||
else if (TestBorderCross(attemptedPosition, Cardinals.N))
|
||||
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
|
||||
{
|
||||
|
||||
pos.Y = ((pos.Y - Constants.RegionSize));
|
||||
|
|
|
@ -1181,7 +1181,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
uint neighbourx = m_regionInfo.RegionLocX;
|
||||
uint neighboury = m_regionInfo.RegionLocY;
|
||||
const float boundaryDistance = 1.7f;
|
||||
Vector3 northCross = new Vector3(0, boundaryDistance, 0);
|
||||
Vector3 northCross = new Vector3(0,boundaryDistance, 0);
|
||||
Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0);
|
||||
Vector3 eastCross = new Vector3(boundaryDistance, 0, 0);
|
||||
Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0);
|
||||
|
|
|
@ -263,9 +263,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
set
|
||||
{
|
||||
Vector3 val = value;
|
||||
|
||||
if ((m_scene.TestBorderCross(val,Cardinals.E) || m_scene.TestBorderCross(val,Cardinals.W)
|
||||
|| m_scene.TestBorderCross(val, Cardinals.N) || m_scene.TestBorderCross(val, Cardinals.S))
|
||||
|
||||
if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|
||||
|| m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
|
||||
&& !IsAttachment)
|
||||
{
|
||||
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
|
||||
|
|
|
@ -172,6 +172,11 @@ namespace OpenSim.Region.Physics.Manager
|
|||
return;
|
||||
}
|
||||
|
||||
public virtual void UnCombine(PhysicsScene pScene)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue a raycast against the physics scene.
|
||||
/// The provided callback method will be called when the raycast is complete
|
||||
|
|
|
@ -3436,7 +3436,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
|
||||
d.GeomSetRotation(GroundGeom, ref R);
|
||||
d.GeomSetPosition(GroundGeom, pOffset.X + ((int)Constants.RegionSize * 0.5f), pOffset.Y + ((int)Constants.RegionSize * 0.5f), 0);
|
||||
d.GeomSetPosition(GroundGeom, (pOffset.X + ((int)Constants.RegionSize * 0.5f)) - 1, (pOffset.Y + ((int)Constants.RegionSize * 0.5f)) - 1, 0);
|
||||
IntPtr testGround = IntPtr.Zero;
|
||||
if (RegionTerrain.TryGetValue(pOffset, out testGround))
|
||||
{
|
||||
|
@ -3457,7 +3457,78 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
return waterlevel;
|
||||
}
|
||||
|
||||
public override bool SupportsCombining()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void UnCombine(PhysicsScene pScene)
|
||||
{
|
||||
IntPtr localGround = IntPtr.Zero;
|
||||
float[] localHeightfield;
|
||||
bool proceed = false;
|
||||
List<IntPtr> geomDestroyList = new List<IntPtr>();
|
||||
|
||||
lock (OdeLock)
|
||||
{
|
||||
if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround))
|
||||
{
|
||||
foreach (IntPtr geom in TerrainHeightFieldHeights.Keys)
|
||||
{
|
||||
if (geom == localGround)
|
||||
{
|
||||
localHeightfield = TerrainHeightFieldHeights[geom];
|
||||
proceed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
geomDestroyList.Add(geom);
|
||||
}
|
||||
}
|
||||
|
||||
if (proceed)
|
||||
{
|
||||
m_worldOffset = Vector3.Zero;
|
||||
WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
|
||||
m_parentScene = null;
|
||||
|
||||
foreach (IntPtr g in geomDestroyList)
|
||||
{
|
||||
// removingHeightField needs to be done or the garbage collector will
|
||||
// collect the terrain data before we tell ODE to destroy it causing
|
||||
// memory corruption
|
||||
if (TerrainHeightFieldHeights.ContainsKey(g))
|
||||
{
|
||||
float[] removingHeightField = TerrainHeightFieldHeights[g];
|
||||
TerrainHeightFieldHeights.Remove(g);
|
||||
|
||||
if (RegionTerrain.ContainsKey(g))
|
||||
{
|
||||
RegionTerrain.Remove(g);
|
||||
}
|
||||
|
||||
d.GeomDestroy(g);
|
||||
removingHeightField = new float[0];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void SetWaterLevel(float baseheight)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue