From b9546d12f230f4153b2c6e7e71520aa2d35c762b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Nov 2009 21:20:42 +0000 Subject: Change land packet sending back to what the careminster release used to use, remove the silly spiral stuff. Revert to double packets for improved user experience --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 83 +++++++++------------- 1 file changed, 34 insertions(+), 49 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7eb829e..49b9378 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -785,6 +785,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual void SendLayerData(float[] map) { Util.FireAndForget(DoSendLayerData, map); + + // Send it sync, and async. It's not that much data + // and it improves user experience just so much! + DoSendLayerData(map); } /// @@ -797,16 +801,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { - //for (int y = 0; y < 16; y++) - //{ - // for (int x = 0; x < 16; x++) - // { - // SendLayerData(x, y, map); - // } - //} - - // Send LayerData in a spiral pattern. Fun! - SendLayerTopRight(map, 0, 0, 15, 15); + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x+=4) + { + SendLayerPacket(x, y, map); + } + } } catch (Exception e) { @@ -814,51 +815,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) - { - // Row - for (int i = x1; i <= x2; i++) - SendLayerData(i, y1, map); - - // Column - for (int j = y1 + 1; j <= y2; j++) - SendLayerData(x2, j, map); - - if (x2 - x1 > 0) - SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); - } - - void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) - { - // Row in reverse - for (int i = x2; i >= x1; i--) - SendLayerData(i, y2, map); - - // Column in reverse - for (int j = y2 - 1; j >= y1; j--) - SendLayerData(x1, j, map); - - if (x2 - x1 > 0) - SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); - } - /// /// Sends a set of four patches (x, x+1, ..., x+3) to the client /// /// heightmap /// X coordinate for patches 0..12 /// Y coordinate for patches 0..15 - // private void SendLayerPacket(float[] map, int y, int x) - // { - // int[] patches = new int[4]; - // patches[0] = x + 0 + y * 16; - // patches[1] = x + 1 + y * 16; - // patches[2] = x + 2 + y * 16; - // patches[3] = x + 3 + y * 16; - - // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); - // OutPacket(layerpack, ThrottleOutPacketType.Land); - // } + private void SendLayerPacket(int x, int y, float[] map) + { + int[] patches = new int[4]; + patches[0] = x + 0 + y * 16; + patches[1] = x + 1 + y * 16; + patches[2] = x + 2 + y * 16; + patches[3] = x + 3 + y * 16; + + float[] heightmap = (map.Length == 65536) ? + map : + LLHeightFieldMoronize(map); + + try + { + Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); + OutPacket(layerpack, ThrottleOutPacketType.Land); + } + catch + { + for (int px = x ; px < x + 4 ; px++) + SendLayerData(px, y, map); + } + } /// /// Sends a specified patch to a client -- cgit v1.1