From 0aa0dad47868d6f64fa19f81b0f5daf35196fc3b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 1 Jun 2014 19:22:26 -0700 Subject: Send multiple terrain patches per terrain update packet if terrain draw distance optimization is enabled. Makes terrain editting a lot snappier. --- OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/World') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index c22c5b6..51016c2 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -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); } } } -- cgit v1.1