From 8edf4225f32ab5fe1e9a1796e1c51b99c391de69 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 11 Mar 2014 07:12:47 -0700 Subject: varregion: remove serialization of region terrain to floats when sending patches. This should eliminate much memory thrashing and CPU usage while sending initial terrain. The old way of passing terrain was to convert it to an array of floats. This is really bad for large terrain (think 4096x4096 floats). This change passes a dummy float array since the real region info is used anyway and the floats are ignored. (The ignoring the terrain floats is a kludge so as to not change IClientAPI.) --- OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (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 daf9901..3fda67f 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -853,7 +853,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain /// The patch corner to send private void SendToClients(TerrainData terrData, int x, int y) { - float[] heightMap = terrData.GetFloatsSerialized(); + // We know the actual terrain data passed is ignored. This kludge saves changing IClientAPI. + //float[] heightMap = terrData.GetFloatsSerialized(); + float[] heightMap = new float[10]; m_scene.ForEachClient( delegate(IClientAPI controller) { @@ -975,7 +977,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain protected void client_OnUnackedTerrain(IClientAPI client, int patchX, int patchY) { //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); - client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); + // SendLayerData does not use the heightmap parameter. This kludge is so as to not change IClientAPI. + float[] heightMap = new float[10]; + client.SendLayerData(patchX, patchY, heightMap); } private void StoreUndoState() -- cgit v1.1