From 0c38d52538a5d713e034fcec8da8df434e3ca924 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 20 Jan 2019 20:58:27 +0000
Subject: cosmetics on terrain patchs
---
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 138 +++++++--------------
1 file changed, 46 insertions(+), 92 deletions(-)
(limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index b61bdeb..d197f5c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1185,13 +1185,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// region's patches to the client.
///
/// heightmap
- public virtual void SendLayerData(float[] map)
+ public virtual void SendLayerData()
{
- Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData");
-
- // Send it sync, and async. It's not that much data
- // and it improves user experience just so much!
-// DoSendLayerData(map);
+ Util.FireAndForget(DoSendLayerData, null, "LLClientView.DoSendLayerData");
}
///
@@ -1200,21 +1196,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
private void DoSendLayerData(object o)
{
- TerrainData map = (TerrainData)o;
-
+ TerrainData map = m_scene.Heightmap.GetTerrainData();
try
{
- // Send LayerData in typerwriter pattern
- //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, map.SizeX / Constants.TerrainPatchSize - 1, map.SizeY / Constants.TerrainPatchSize - 1);
+ SendLayerTopRight(0, 0, map.SizeX / Constants.TerrainPatchSize - 1, map.SizeY / Constants.TerrainPatchSize - 1);
}
catch (Exception e)
{
@@ -1222,63 +1208,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
- private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2)
+ private void SendLayerTopRight(int x1, int y1, int x2, int y2)
{
+ int[] p = new int[2];
+
// Row
- for (int i = x1; i <= x2; i++)
- SendLayerData(i, y1, map);
+ p[1] = y1;
+ for (int i = x1; i <= x2; ++i)
+ {
+ p[0] = i;
+ SendLayerData(p);
+ }
// Column
- for (int j = y1 + 1; j <= y2; j++)
- SendLayerData(x2, j, map);
+ p[0] = x2;
+ for (int j = y1 + 1; j <= y2; ++j)
+ {
+ p[1] = j;
+ SendLayerData(p);
+ }
if (x2 - x1 > 0 && y2 - y1 > 0)
- SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
+ SendLayerBottomLeft(x1, y1 + 1, x2 - 1, y2);
}
- void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2)
+ void SendLayerBottomLeft(int x1, int y1, int x2, int y2)
{
+ int[] p = new int[2];
+
// Row in reverse
- for (int i = x2; i >= x1; i--)
- SendLayerData(i, y2, map);
+ p[1] = y2;
+ for (int i = x2; i >= x1; --i)
+ {
+ p[0] = i;
+ SendLayerData(p);
+ }
// Column in reverse
- for (int j = y2 - 1; j >= y1; j--)
- SendLayerData(x1, j, map);
+ p[0] = x1;
+ for (int j = y2 - 1; j >= y1; --j)
+ {
+ p[1] = j;
+ SendLayerData(p);
+ }
if (x2 - x1 > 0 && y2 - y1 > 0)
- SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
+ SendLayerTopRight(x1 + 1, y1, x2, y2 - 1);
}
-
- // Legacy form of invocation that passes around a bare data array.
- // Just ignore what was passed and use the real terrain info that is part of the scene.
- // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
- // there is a special form for specifying multiple terrain patches to send.
- // The form is to pass 'px' as negative the number of patches to send and to
- // pass the float array as pairs of patch X and Y coordinates. So, passing 'px'
- // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches
- // and the patches to send are <3,5> and <8,4>.
- public void SendLayerData(int px, int py, float[] map)
+ public void SendLayerData(int[] map)
{
- if (px >= 0)
+ if(map == null)
+ return;
+
+ try
{
- SendLayerData(px, py, m_scene.Heightmap.GetTerrainData());
+ List packets = OpenSimTerrainCompressor.CreateLayerDataPackets(m_scene.Heightmap.GetTerrainData(), map);
+ foreach (LayerDataPacket pkt in packets)
+ OutPacket(pkt, ThrottleOutPacketType.Land);
}
- else
+ catch (Exception e)
{
- int numPatches = -px;
- int[] xPatches = new int[numPatches];
- int[] yPatches = new int[numPatches];
- for (int pp = 0; pp < numPatches; pp++)
- {
- xPatches[pp] = (int)map[pp * 2];
- yPatches[pp] = (int)map[pp * 2 + 1];
- }
-
- // DebugSendingPatches("SendLayerData", xPatches, yPatches);
-
- SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData());
+ m_log.Error("[CLIENT]: SendLayerData() Failed with exception: " + e.Message, e);
}
}
@@ -1298,43 +1289,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
- ///
-
- /// Sends a terrain packet for the point specified.
- /// This is a legacy call that has refarbed the terrain into a flat map of floats.
- /// We just use the terrain from the region we know about.
- ///
- /// Patch coordinate (x) 0..15
- /// Patch coordinate (y) 0..15
- /// heightmap
- public void SendLayerData(int px, int py, TerrainData terrData)
- {
- int[] xPatches = new[] { px };
- int[] yPatches = new[] { py };
- SendLayerData(xPatches, yPatches, terrData);
- }
-
- private void SendLayerData(int[] px, int[] py, TerrainData terrData)
- {
- try
- {
- byte landPacketType;
- if (terrData.SizeX > Constants.RegionSize || terrData.SizeY > Constants.RegionSize)
- landPacketType = (byte)TerrainPatch.LayerType.LandExtended;
- else
- landPacketType = (byte)TerrainPatch.LayerType.Land;
-
- List packets = OpenSimTerrainCompressor.CreateLayerDataPackets(terrData, px, py, landPacketType);
- foreach(LayerDataPacket pkt in packets)
- OutPacket(pkt, ThrottleOutPacketType.Land);
- }
- catch (Exception e)
- {
- m_log.Error("[CLIENT]: SendLayerData() Failed with exception: " + e.Message, e);
- }
- }
-
-
// wind caching
private static Dictionary lastWindVersion = new Dictionary();
private static Dictionary> lastWindPackets =
--
cgit v1.1