From 39777db8ef0604ad228854ce226bb530c2d27239 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Thu, 31 Oct 2013 09:24:06 -0700
Subject: varregion: fix problem of X/Y dimensions swapped and incorrect
terrain compression base computation. Complete replacement of float[] for
terrain heightmap with TerrainData instance.
---
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 25 ++++++++++++----------
1 file changed, 14 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region/ClientStack/Linden/UDP')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 2b8a04f..c8e7eb5 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1154,7 +1154,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// heightmap
public virtual void SendLayerData(float[] map)
{
- Util.FireAndForget(DoSendLayerData, map);
+ Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData());
}
///
@@ -1163,7 +1163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
private void DoSendLayerData(object o)
{
- float[] map = (float[])o;
+ TerrainData map = (TerrainData)o;
try
{
@@ -1177,7 +1177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//}
// Send LayerData in a spiral pattern. Fun!
- SendLayerTopRight(map, 0, 0, 15, 15);
+ SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1);
}
catch (Exception e)
{
@@ -1185,7 +1185,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
- private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
+ private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2)
{
// Row
for (int i = x1; i <= x2; i++)
@@ -1199,7 +1199,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
}
- void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
+ void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2)
{
// Row in reverse
for (int i = x2; i >= x1; i--)
@@ -1231,6 +1231,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// OutPacket(layerpack, ThrottleOutPacketType.Land);
// }
+ // 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.
+ public void SendLayerData(int px, int py, float[] map)
+ {
+ SendLayerData(px, py, m_scene.Heightmap.GetTerrainData());
+ }
+
///
/// Sends a terrain packet for the point specified.
/// This is a legacy call that has refarbed the terrain into a flat map of floats.
@@ -1239,15 +1246,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Patch coordinate (x) 0..15
/// Patch coordinate (y) 0..15
/// heightmap
- public void SendLayerData(int px, int py, float[] map)
+ public void SendLayerData(int px, int py, TerrainData terrData)
{
try
{
- // For unknown reasons, after this point, patch numbers are swapped X for y.
- // That means, that for