diff options
author | UbitUmarov | 2019-01-20 20:58:27 +0000 |
---|---|---|
committer | UbitUmarov | 2019-01-20 20:58:27 +0000 |
commit | 0c38d52538a5d713e034fcec8da8df434e3ca924 (patch) | |
tree | b54bb1749bae275e77bbfcaafb98833fd436748b /OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |
parent | cosmetics (diff) | |
download | opensim-SC-0c38d52538a5d713e034fcec8da8df434e3ca924.zip opensim-SC-0c38d52538a5d713e034fcec8da8df434e3ca924.tar.gz opensim-SC-0c38d52538a5d713e034fcec8da8df434e3ca924.tar.bz2 opensim-SC-0c38d52538a5d713e034fcec8da8df434e3ca924.tar.xz |
cosmetics on terrain patchs
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 138 |
1 files changed, 46 insertions, 92 deletions
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 | |||
1185 | /// region's patches to the client. | 1185 | /// region's patches to the client. |
1186 | /// </summary> | 1186 | /// </summary> |
1187 | /// <param name="map">heightmap</param> | 1187 | /// <param name="map">heightmap</param> |
1188 | public virtual void SendLayerData(float[] map) | 1188 | public virtual void SendLayerData() |
1189 | { | 1189 | { |
1190 | Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData"); | 1190 | Util.FireAndForget(DoSendLayerData, null, "LLClientView.DoSendLayerData"); |
1191 | |||
1192 | // Send it sync, and async. It's not that much data | ||
1193 | // and it improves user experience just so much! | ||
1194 | // DoSendLayerData(map); | ||
1195 | } | 1191 | } |
1196 | 1192 | ||
1197 | /// <summary> | 1193 | /// <summary> |
@@ -1200,21 +1196,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1200 | /// <param name="o"></param> | 1196 | /// <param name="o"></param> |
1201 | private void DoSendLayerData(object o) | 1197 | private void DoSendLayerData(object o) |
1202 | { | 1198 | { |
1203 | TerrainData map = (TerrainData)o; | 1199 | TerrainData map = m_scene.Heightmap.GetTerrainData(); |
1204 | |||
1205 | try | 1200 | try |
1206 | { | 1201 | { |
1207 | // Send LayerData in typerwriter pattern | ||
1208 | //for (int y = 0; y < 16; y++) | ||
1209 | //{ | ||
1210 | // for (int x = 0; x < 16; x++) | ||
1211 | // { | ||
1212 | // SendLayerData(x, y, map); | ||
1213 | // } | ||
1214 | //} | ||
1215 | |||
1216 | // Send LayerData in a spiral pattern. Fun! | 1202 | // Send LayerData in a spiral pattern. Fun! |
1217 | SendLayerTopRight(map, 0, 0, map.SizeX / Constants.TerrainPatchSize - 1, map.SizeY / Constants.TerrainPatchSize - 1); | 1203 | SendLayerTopRight(0, 0, map.SizeX / Constants.TerrainPatchSize - 1, map.SizeY / Constants.TerrainPatchSize - 1); |
1218 | } | 1204 | } |
1219 | catch (Exception e) | 1205 | catch (Exception e) |
1220 | { | 1206 | { |
@@ -1222,63 +1208,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1222 | } | 1208 | } |
1223 | } | 1209 | } |
1224 | 1210 | ||
1225 | private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2) | 1211 | private void SendLayerTopRight(int x1, int y1, int x2, int y2) |
1226 | { | 1212 | { |
1213 | int[] p = new int[2]; | ||
1214 | |||
1227 | // Row | 1215 | // Row |
1228 | for (int i = x1; i <= x2; i++) | 1216 | p[1] = y1; |
1229 | SendLayerData(i, y1, map); | 1217 | for (int i = x1; i <= x2; ++i) |
1218 | { | ||
1219 | p[0] = i; | ||
1220 | SendLayerData(p); | ||
1221 | } | ||
1230 | 1222 | ||
1231 | // Column | 1223 | // Column |
1232 | for (int j = y1 + 1; j <= y2; j++) | 1224 | p[0] = x2; |
1233 | SendLayerData(x2, j, map); | 1225 | for (int j = y1 + 1; j <= y2; ++j) |
1226 | { | ||
1227 | p[1] = j; | ||
1228 | SendLayerData(p); | ||
1229 | } | ||
1234 | 1230 | ||
1235 | if (x2 - x1 > 0 && y2 - y1 > 0) | 1231 | if (x2 - x1 > 0 && y2 - y1 > 0) |
1236 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | 1232 | SendLayerBottomLeft(x1, y1 + 1, x2 - 1, y2); |
1237 | } | 1233 | } |
1238 | 1234 | ||
1239 | void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2) | 1235 | void SendLayerBottomLeft(int x1, int y1, int x2, int y2) |
1240 | { | 1236 | { |
1237 | int[] p = new int[2]; | ||
1238 | |||
1241 | // Row in reverse | 1239 | // Row in reverse |
1242 | for (int i = x2; i >= x1; i--) | 1240 | p[1] = y2; |
1243 | SendLayerData(i, y2, map); | 1241 | for (int i = x2; i >= x1; --i) |
1242 | { | ||
1243 | p[0] = i; | ||
1244 | SendLayerData(p); | ||
1245 | } | ||
1244 | 1246 | ||
1245 | // Column in reverse | 1247 | // Column in reverse |
1246 | for (int j = y2 - 1; j >= y1; j--) | 1248 | p[0] = x1; |
1247 | SendLayerData(x1, j, map); | 1249 | for (int j = y2 - 1; j >= y1; --j) |
1250 | { | ||
1251 | p[1] = j; | ||
1252 | SendLayerData(p); | ||
1253 | } | ||
1248 | 1254 | ||
1249 | if (x2 - x1 > 0 && y2 - y1 > 0) | 1255 | if (x2 - x1 > 0 && y2 - y1 > 0) |
1250 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | 1256 | SendLayerTopRight(x1 + 1, y1, x2, y2 - 1); |
1251 | } | 1257 | } |
1252 | 1258 | ||
1253 | 1259 | public void SendLayerData(int[] map) | |
1254 | // Legacy form of invocation that passes around a bare data array. | ||
1255 | // Just ignore what was passed and use the real terrain info that is part of the scene. | ||
1256 | // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI, | ||
1257 | // there is a special form for specifying multiple terrain patches to send. | ||
1258 | // The form is to pass 'px' as negative the number of patches to send and to | ||
1259 | // pass the float array as pairs of patch X and Y coordinates. So, passing 'px' | ||
1260 | // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches | ||
1261 | // and the patches to send are <3,5> and <8,4>. | ||
1262 | public void SendLayerData(int px, int py, float[] map) | ||
1263 | { | 1260 | { |
1264 | if (px >= 0) | 1261 | if(map == null) |
1262 | return; | ||
1263 | |||
1264 | try | ||
1265 | { | 1265 | { |
1266 | SendLayerData(px, py, m_scene.Heightmap.GetTerrainData()); | 1266 | List<LayerDataPacket> packets = OpenSimTerrainCompressor.CreateLayerDataPackets(m_scene.Heightmap.GetTerrainData(), map); |
1267 | foreach (LayerDataPacket pkt in packets) | ||
1268 | OutPacket(pkt, ThrottleOutPacketType.Land); | ||
1267 | } | 1269 | } |
1268 | else | 1270 | catch (Exception e) |
1269 | { | 1271 | { |
1270 | int numPatches = -px; | 1272 | m_log.Error("[CLIENT]: SendLayerData() Failed with exception: " + e.Message, e); |
1271 | int[] xPatches = new int[numPatches]; | ||
1272 | int[] yPatches = new int[numPatches]; | ||
1273 | for (int pp = 0; pp < numPatches; pp++) | ||
1274 | { | ||
1275 | xPatches[pp] = (int)map[pp * 2]; | ||
1276 | yPatches[pp] = (int)map[pp * 2 + 1]; | ||
1277 | } | ||
1278 | |||
1279 | // DebugSendingPatches("SendLayerData", xPatches, yPatches); | ||
1280 | |||
1281 | SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData()); | ||
1282 | } | 1273 | } |
1283 | } | 1274 | } |
1284 | 1275 | ||
@@ -1298,43 +1289,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1298 | } | 1289 | } |
1299 | } | 1290 | } |
1300 | 1291 | ||
1301 | /// <summary> | ||
1302 | |||
1303 | /// Sends a terrain packet for the point specified. | ||
1304 | /// This is a legacy call that has refarbed the terrain into a flat map of floats. | ||
1305 | /// We just use the terrain from the region we know about. | ||
1306 | /// </summary> | ||
1307 | /// <param name="px">Patch coordinate (x) 0..15</param> | ||
1308 | /// <param name="py">Patch coordinate (y) 0..15</param> | ||
1309 | /// <param name="map">heightmap</param> | ||
1310 | public void SendLayerData(int px, int py, TerrainData terrData) | ||
1311 | { | ||
1312 | int[] xPatches = new[] { px }; | ||
1313 | int[] yPatches = new[] { py }; | ||
1314 | SendLayerData(xPatches, yPatches, terrData); | ||
1315 | } | ||
1316 | |||
1317 | private void SendLayerData(int[] px, int[] py, TerrainData terrData) | ||
1318 | { | ||
1319 | try | ||
1320 | { | ||
1321 | byte landPacketType; | ||
1322 | if (terrData.SizeX > Constants.RegionSize || terrData.SizeY > Constants.RegionSize) | ||
1323 | landPacketType = (byte)TerrainPatch.LayerType.LandExtended; | ||
1324 | else | ||
1325 | landPacketType = (byte)TerrainPatch.LayerType.Land; | ||
1326 | |||
1327 | List<LayerDataPacket> packets = OpenSimTerrainCompressor.CreateLayerDataPackets(terrData, px, py, landPacketType); | ||
1328 | foreach(LayerDataPacket pkt in packets) | ||
1329 | OutPacket(pkt, ThrottleOutPacketType.Land); | ||
1330 | } | ||
1331 | catch (Exception e) | ||
1332 | { | ||
1333 | m_log.Error("[CLIENT]: SendLayerData() Failed with exception: " + e.Message, e); | ||
1334 | } | ||
1335 | } | ||
1336 | |||
1337 | |||
1338 | // wind caching | 1292 | // wind caching |
1339 | private static Dictionary<ulong,int> lastWindVersion = new Dictionary<ulong,int>(); | 1293 | private static Dictionary<ulong,int> lastWindVersion = new Dictionary<ulong,int>(); |
1340 | private static Dictionary<ulong,List<LayerDataPacket>> lastWindPackets = | 1294 | private static Dictionary<ulong,List<LayerDataPacket>> lastWindPackets = |