diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 92 |
1 files changed, 32 insertions, 60 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1a2d4de..00fa5db 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -34,11 +34,13 @@ using System.Text; | |||
34 | using System.Threading; | 34 | using System.Threading; |
35 | using System.Timers; | 35 | using System.Timers; |
36 | using System.Xml; | 36 | using System.Xml; |
37 | |||
37 | using log4net; | 38 | using log4net; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | using OpenMetaverse.Packets; | 40 | using OpenMetaverse.Packets; |
40 | using OpenMetaverse.Messages.Linden; | 41 | using OpenMetaverse.Messages.Linden; |
41 | using OpenMetaverse.StructuredData; | 42 | using OpenMetaverse.StructuredData; |
43 | |||
42 | using OpenSim.Framework; | 44 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Client; | 45 | using OpenSim.Framework.Client; |
44 | using OpenSim.Framework.Monitoring; | 46 | using OpenSim.Framework.Monitoring; |
@@ -48,7 +50,6 @@ using OpenSim.Services.Interfaces; | |||
48 | using Timer = System.Timers.Timer; | 50 | using Timer = System.Timers.Timer; |
49 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 51 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
50 | using RegionFlags = OpenMetaverse.RegionFlags; | 52 | using RegionFlags = OpenMetaverse.RegionFlags; |
51 | using Nini.Config; | ||
52 | 53 | ||
53 | using System.IO; | 54 | using System.IO; |
54 | using PermissionMask = OpenSim.Framework.PermissionMask; | 55 | using PermissionMask = OpenSim.Framework.PermissionMask; |
@@ -307,6 +308,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
307 | private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; | 308 | private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; |
308 | 309 | ||
309 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 310 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
311 | private static string LogHeader = "[LLCLIENTVIEW]"; | ||
310 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | 312 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients |
311 | 313 | ||
312 | /// <summary> | 314 | /// <summary> |
@@ -447,7 +449,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
447 | 449 | ||
448 | // ~LLClientView() | 450 | // ~LLClientView() |
449 | // { | 451 | // { |
450 | // m_log.DebugFormat("[LLCLIENTVIEW]: Destructor called for {0}, circuit code {1}", Name, CircuitCode); | 452 | // m_log.DebugFormat("{0} Destructor called for {1}, circuit code {2}", LogHeader, Name, CircuitCode); |
451 | // } | 453 | // } |
452 | 454 | ||
453 | /// <summary> | 455 | /// <summary> |
@@ -513,9 +515,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
513 | // there is some unidentified connection problem, not where we have issues due to deadlock | 515 | // there is some unidentified connection problem, not where we have issues due to deadlock |
514 | if (!IsActive && !force) | 516 | if (!IsActive && !force) |
515 | { | 517 | { |
516 | m_log.DebugFormat( | 518 | m_log.DebugFormat( "{0} Not attempting to close inactive client {1} in {2} since force flag is not set", |
517 | "[CLIENT]: Not attempting to close inactive client {0} in {1} since force flag is not set", | 519 | LogHeader, Name, m_scene.Name); |
518 | Name, m_scene.Name); | ||
519 | 520 | ||
520 | return; | 521 | return; |
521 | } | 522 | } |
@@ -1153,7 +1154,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1153 | /// <param name="map">heightmap</param> | 1154 | /// <param name="map">heightmap</param> |
1154 | public virtual void SendLayerData(float[] map) | 1155 | public virtual void SendLayerData(float[] map) |
1155 | { | 1156 | { |
1156 | Util.FireAndForget(DoSendLayerData, map); | 1157 | Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData()); |
1157 | } | 1158 | } |
1158 | 1159 | ||
1159 | /// <summary> | 1160 | /// <summary> |
@@ -1162,10 +1163,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1162 | /// <param name="o"></param> | 1163 | /// <param name="o"></param> |
1163 | private void DoSendLayerData(object o) | 1164 | private void DoSendLayerData(object o) |
1164 | { | 1165 | { |
1165 | float[] map = LLHeightFieldMoronize((float[])o); | 1166 | TerrainData map = (TerrainData)o; |
1166 | 1167 | ||
1167 | try | 1168 | try |
1168 | { | 1169 | { |
1170 | // Send LayerData in typerwriter pattern | ||
1169 | //for (int y = 0; y < 16; y++) | 1171 | //for (int y = 0; y < 16; y++) |
1170 | //{ | 1172 | //{ |
1171 | // for (int x = 0; x < 16; x++) | 1173 | // for (int x = 0; x < 16; x++) |
@@ -1175,7 +1177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1175 | //} | 1177 | //} |
1176 | 1178 | ||
1177 | // Send LayerData in a spiral pattern. Fun! | 1179 | // Send LayerData in a spiral pattern. Fun! |
1178 | SendLayerTopRight(map, 0, 0, 15, 15); | 1180 | SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1); |
1179 | } | 1181 | } |
1180 | catch (Exception e) | 1182 | catch (Exception e) |
1181 | { | 1183 | { |
@@ -1183,7 +1185,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1183 | } | 1185 | } |
1184 | } | 1186 | } |
1185 | 1187 | ||
1186 | 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) |
1187 | { | 1189 | { |
1188 | // Row | 1190 | // Row |
1189 | for (int i = x1; i <= x2; i++) | 1191 | for (int i = x1; i <= x2; i++) |
@@ -1193,11 +1195,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1193 | for (int j = y1 + 1; j <= y2; j++) | 1195 | for (int j = y1 + 1; j <= y2; j++) |
1194 | SendLayerData(x2, j, map); | 1196 | SendLayerData(x2, j, map); |
1195 | 1197 | ||
1196 | if (x2 - x1 > 0) | 1198 | if (x2 - x1 > 0 && y2 - y1 > 0) |
1197 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | 1199 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); |
1198 | } | 1200 | } |
1199 | 1201 | ||
1200 | 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) |
1201 | { | 1203 | { |
1202 | // Row in reverse | 1204 | // Row in reverse |
1203 | for (int i = x2; i >= x1; i--) | 1205 | for (int i = x2; i >= x1; i--) |
@@ -1207,7 +1209,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1207 | for (int j = y2 - 1; j >= y1; j--) | 1209 | for (int j = y2 - 1; j >= y1; j--) |
1208 | SendLayerData(x1, j, map); | 1210 | SendLayerData(x1, j, map); |
1209 | 1211 | ||
1210 | if (x2 - x1 > 0) | 1212 | if (x2 - x1 > 0 && y2 - y1 > 0) |
1211 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | 1213 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); |
1212 | } | 1214 | } |
1213 | 1215 | ||
@@ -1229,22 +1231,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1229 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1231 | // OutPacket(layerpack, ThrottleOutPacketType.Land); |
1230 | // } | 1232 | // } |
1231 | 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 | |||
1232 | /// <summary> | 1241 | /// <summary> |
1233 | /// Sends a specified patch to a client | 1242 | /// Sends a terrain packet for the point specified. |
1243 | /// This is a legacy call that has refarbed the terrain into a flat map of floats. | ||
1244 | /// We just use the terrain from the region we know about. | ||
1234 | /// </summary> | 1245 | /// </summary> |
1235 | /// <param name="px">Patch coordinate (x) 0..15</param> | 1246 | /// <param name="px">Patch coordinate (x) 0..15</param> |
1236 | /// <param name="py">Patch coordinate (y) 0..15</param> | 1247 | /// <param name="py">Patch coordinate (y) 0..15</param> |
1237 | /// <param name="map">heightmap</param> | 1248 | /// <param name="map">heightmap</param> |
1238 | public void SendLayerData(int px, int py, float[] map) | 1249 | public void SendLayerData(int px, int py, TerrainData terrData) |
1239 | { | 1250 | { |
1240 | try | 1251 | try |
1241 | { | 1252 | { |
1242 | int[] patches = new int[] { py * 16 + px }; | 1253 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, px, py); |
1243 | float[] heightmap = (map.Length == 65536) ? | ||
1244 | map : | ||
1245 | LLHeightFieldMoronize(map); | ||
1246 | |||
1247 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1248 | 1254 | ||
1249 | // 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. |
1250 | // 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. |
@@ -1262,14 +1268,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1262 | if (m_justEditedTerrain) | 1268 | if (m_justEditedTerrain) |
1263 | { | 1269 | { |
1264 | layerpack.Header.Reliable = false; | 1270 | layerpack.Header.Reliable = false; |
1265 | OutPacket(layerpack, | 1271 | OutPacket(layerpack, ThrottleOutPacketType.Unknown ); |
1266 | ThrottleOutPacketType.Unknown ); | ||
1267 | } | 1272 | } |
1268 | else | 1273 | else |
1269 | { | 1274 | { |
1270 | layerpack.Header.Reliable = true; | 1275 | layerpack.Header.Reliable = true; |
1271 | OutPacket(layerpack, | 1276 | OutPacket(layerpack, ThrottleOutPacketType.Land); |
1272 | ThrottleOutPacketType.Land); | ||
1273 | } | 1277 | } |
1274 | } | 1278 | } |
1275 | catch (Exception e) | 1279 | catch (Exception e) |
@@ -1279,38 +1283,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1279 | } | 1283 | } |
1280 | 1284 | ||
1281 | /// <summary> | 1285 | /// <summary> |
1282 | /// Munges heightfield into the LLUDP backed in restricted heightfield. | ||
1283 | /// </summary> | ||
1284 | /// <param name="map">float array in the base; Constants.RegionSize</param> | ||
1285 | /// <returns>float array in the base 256</returns> | ||
1286 | internal float[] LLHeightFieldMoronize(float[] map) | ||
1287 | { | ||
1288 | if (map.Length == 65536) | ||
1289 | return map; | ||
1290 | else | ||
1291 | { | ||
1292 | float[] returnmap = new float[65536]; | ||
1293 | |||
1294 | if (map.Length < 65535) | ||
1295 | { | ||
1296 | // rebase the vector stride to 256 | ||
1297 | for (int i = 0; i < Constants.RegionSize; i++) | ||
1298 | Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, (int)Constants.RegionSize); | ||
1299 | } | ||
1300 | else | ||
1301 | { | ||
1302 | for (int i = 0; i < 256; i++) | ||
1303 | Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, 256); | ||
1304 | } | ||
1305 | |||
1306 | //Array.Copy(map,0,returnmap,0,(map.Length < 65536)? map.Length : 65536); | ||
1307 | |||
1308 | return returnmap; | ||
1309 | } | ||
1310 | |||
1311 | } | ||
1312 | |||
1313 | /// <summary> | ||
1314 | /// Send the wind matrix to the client | 1286 | /// Send the wind matrix to the client |
1315 | /// </summary> | 1287 | /// </summary> |
1316 | /// <param name="windSpeeds">16x16 array of wind speeds</param> | 1288 | /// <param name="windSpeeds">16x16 array of wind speeds</param> |
@@ -2782,8 +2754,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2782 | { | 2754 | { |
2783 | if (req.AssetInf.Data == null) | 2755 | if (req.AssetInf.Data == null) |
2784 | { | 2756 | { |
2785 | m_log.ErrorFormat("Cannot send asset {0} ({1}), asset data is null", | 2757 | m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null", |
2786 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2758 | LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2787 | return; | 2759 | return; |
2788 | } | 2760 | } |
2789 | 2761 | ||
@@ -2910,8 +2882,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2910 | { | 2882 | { |
2911 | pos = (land.AABBMax + land.AABBMin) * 0.5f; | 2883 | pos = (land.AABBMax + land.AABBMin) * 0.5f; |
2912 | } | 2884 | } |
2913 | reply.Data.GlobalX = info.RegionLocX + x; | 2885 | reply.Data.GlobalX = info.LegacyRegionLocX + x; |
2914 | reply.Data.GlobalY = info.RegionLocY + y; | 2886 | reply.Data.GlobalY = info.LegacyRegionLocY + y; |
2915 | reply.Data.GlobalZ = pos.Z; | 2887 | reply.Data.GlobalZ = pos.Z; |
2916 | reply.Data.SimName = Utils.StringToBytes(info.RegionName); | 2888 | reply.Data.SimName = Utils.StringToBytes(info.RegionName); |
2917 | reply.Data.SnapshotID = land.SnapshotID; | 2889 | reply.Data.SnapshotID = land.SnapshotID; |