diff options
author | Robert Adams | 2013-10-31 09:24:06 -0700 |
---|---|---|
committer | Robert Adams | 2013-10-31 09:24:06 -0700 |
commit | 39777db8ef0604ad228854ce226bb530c2d27239 (patch) | |
tree | e351cd0c09bb9af6c10776a494f53563b0ec480c /OpenSim/Region/ClientStack/Linden/UDP | |
parent | Merge branch 'master' into varregion (diff) | |
download | opensim-SC_OLD-39777db8ef0604ad228854ce226bb530c2d27239.zip opensim-SC_OLD-39777db8ef0604ad228854ce226bb530c2d27239.tar.gz opensim-SC_OLD-39777db8ef0604ad228854ce226bb530c2d27239.tar.bz2 opensim-SC_OLD-39777db8ef0604ad228854ce226bb530c2d27239.tar.xz |
varregion: fix problem of X/Y dimensions swapped and incorrect terrain
compression base computation.
Complete replacement of float[] for terrain heightmap with TerrainData instance.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 25 |
1 files changed, 14 insertions, 11 deletions
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 | |||
1154 | /// <param name="map">heightmap</param> | 1154 | /// <param name="map">heightmap</param> |
1155 | public virtual void SendLayerData(float[] map) | 1155 | public virtual void SendLayerData(float[] map) |
1156 | { | 1156 | { |
1157 | Util.FireAndForget(DoSendLayerData, map); | 1157 | Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData()); |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | /// <summary> | 1160 | /// <summary> |
@@ -1163,7 +1163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1163 | /// <param name="o"></param> | 1163 | /// <param name="o"></param> |
1164 | private void DoSendLayerData(object o) | 1164 | private void DoSendLayerData(object o) |
1165 | { | 1165 | { |
1166 | float[] map = (float[])o; | 1166 | TerrainData map = (TerrainData)o; |
1167 | 1167 | ||
1168 | try | 1168 | try |
1169 | { | 1169 | { |
@@ -1177,7 +1177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1177 | //} | 1177 | //} |
1178 | 1178 | ||
1179 | // Send LayerData in a spiral pattern. Fun! | 1179 | // Send LayerData in a spiral pattern. Fun! |
1180 | SendLayerTopRight(map, 0, 0, 15, 15); | 1180 | SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1); |
1181 | } | 1181 | } |
1182 | catch (Exception e) | 1182 | catch (Exception e) |
1183 | { | 1183 | { |
@@ -1185,7 +1185,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1185 | } | 1185 | } |
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | 1188 | private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2) |
1189 | { | 1189 | { |
1190 | // Row | 1190 | // Row |
1191 | for (int i = x1; i <= x2; i++) | 1191 | for (int i = x1; i <= x2; i++) |
@@ -1199,7 +1199,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1199 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | 1199 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | 1202 | void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2) |
1203 | { | 1203 | { |
1204 | // Row in reverse | 1204 | // Row in reverse |
1205 | for (int i = x2; i >= x1; i--) | 1205 | for (int i = x2; i >= x1; i--) |
@@ -1231,6 +1231,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1231 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1231 | // OutPacket(layerpack, ThrottleOutPacketType.Land); |
1232 | // } | 1232 | // } |
1233 | 1233 | ||
1234 | // Legacy form of invocation that passes around a bare data array. | ||
1235 | // Just ignore what was passed and use the real terrain info that is part of the scene. | ||
1236 | public void SendLayerData(int px, int py, float[] map) | ||
1237 | { | ||
1238 | SendLayerData(px, py, m_scene.Heightmap.GetTerrainData()); | ||
1239 | } | ||
1240 | |||
1234 | /// <summary> | 1241 | /// <summary> |
1235 | /// Sends a terrain packet for the point specified. | 1242 | /// Sends a terrain packet for the point specified. |
1236 | /// This is a legacy call that has refarbed the terrain into a flat map of floats. | 1243 | /// 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 | |||
1239 | /// <param name="px">Patch coordinate (x) 0..15</param> | 1246 | /// <param name="px">Patch coordinate (x) 0..15</param> |
1240 | /// <param name="py">Patch coordinate (y) 0..15</param> | 1247 | /// <param name="py">Patch coordinate (y) 0..15</param> |
1241 | /// <param name="map">heightmap</param> | 1248 | /// <param name="map">heightmap</param> |
1242 | public void SendLayerData(int px, int py, float[] map) | 1249 | public void SendLayerData(int px, int py, TerrainData terrData) |
1243 | { | 1250 | { |
1244 | try | 1251 | try |
1245 | { | 1252 | { |
1246 | // For unknown reasons, after this point, patch numbers are swapped X for y. | 1253 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, px, py); |
1247 | // That means, that for <patchNumX, patchNumY, the array location is computed as map[patchNumY * 16 + patchNumX]. | ||
1248 | // TODO: someday straighten the below implementation to keep the X row order for patch numbers. | ||
1249 | // Since this is passing only one patch, we just swap the patch numbers. | ||
1250 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(m_scene.Heightmap.GetTerrainData(), px, py); | ||
1251 | 1254 | ||
1252 | // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience. | 1255 | // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience. |
1253 | // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain. | 1256 | // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain. |