Send multiple terrain patches per terrain update packet if terrain

draw distance optimization is enabled. Makes terrain editting a lot
snappier.
This commit is contained in:
Robert Adams
2014-06-01 19:22:26 -07:00
parent 3aa99b9a7f
commit 0aa0dad478
3 changed files with 118 additions and 27 deletions

View File

@@ -1035,12 +1035,24 @@ namespace OpenSim.Region.CoreModules.World.Terrain
// LogHeader, toSend.Count, pups.Presence.Name, m_scene.RegionInfo.RegionName);
// Sort the patches to send by the distance from the presence
toSend.Sort();
/*
foreach (PatchesToSend pts in toSend)
{
// TODO: one can send multiple patches in a packet. Do that.
pups.Presence.ControllingClient.SendLayerData(pts.PatchX, pts.PatchY, null);
// presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), null, TerrainPatch.LayerType.Land);
}
*/
int[] xPieces = new int[toSend.Count];
int[] yPieces = new int[toSend.Count];
float[] patchPieces = new float[toSend.Count * 2];
int pieceIndex = 0;
foreach (PatchesToSend pts in toSend)
{
patchPieces[pieceIndex++] = pts.PatchX;
patchPieces[pieceIndex++] = pts.PatchY;
}
pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces);
}
}
}