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.)
0.8.0.3
Robert Adams 2014-03-11 07:12:47 -07:00
parent 6b17c9bd98
commit 8edf4225f3
1 changed files with 6 additions and 2 deletions

View File

@ -853,7 +853,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
/// <param name="y">The patch corner to send</param>
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()