diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 75 |
1 files changed, 22 insertions, 53 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6b58fb7..7984acc 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 | } |
@@ -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 | float[] map = (float[])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++) |
@@ -1230,7 +1232,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1230 | // } | 1232 | // } |
1231 | 1233 | ||
1232 | /// <summary> | 1234 | /// <summary> |
1233 | /// Sends a specified patch to a client | 1235 | /// 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. | ||
1237 | /// We just use the terrain from the region we know about. | ||
1234 | /// </summary> | 1238 | /// </summary> |
1235 | /// <param name="px">Patch coordinate (x) 0..15</param> | 1239 | /// <param name="px">Patch coordinate (x) 0..15</param> |
1236 | /// <param name="py">Patch coordinate (y) 0..15</param> | 1240 | /// <param name="py">Patch coordinate (y) 0..15</param> |
@@ -1239,12 +1243,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1239 | { | 1243 | { |
1240 | try | 1244 | try |
1241 | { | 1245 | { |
1242 | int[] patches = new int[] { py * 16 + px }; | 1246 | // For unknown reasons, after this point, patch numbers are swapped X for y. |
1243 | float[] heightmap = (map.Length == 65536) ? | 1247 | // That means, that for <patchNumX, patchNumY, the array location is computed as map[patchNumY * 16 + patchNumX]. |
1244 | map : | 1248 | // TODO: someday straighten the below implementation to keep the X row order for patch numbers. |
1245 | LLHeightFieldMoronize(map); | 1249 | // Since this is passing only one patch, we just swap the patch numbers. |
1246 | 1250 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(m_scene.Heightmap.GetTerrainData(), px, py); | |
1247 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1248 | 1251 | ||
1249 | // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience. | 1252 | // 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. | 1253 | // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain. |
@@ -1262,14 +1265,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1262 | if (m_justEditedTerrain) | 1265 | if (m_justEditedTerrain) |
1263 | { | 1266 | { |
1264 | layerpack.Header.Reliable = false; | 1267 | layerpack.Header.Reliable = false; |
1265 | OutPacket(layerpack, | 1268 | OutPacket(layerpack, ThrottleOutPacketType.Unknown ); |
1266 | ThrottleOutPacketType.Unknown ); | ||
1267 | } | 1269 | } |
1268 | else | 1270 | else |
1269 | { | 1271 | { |
1270 | layerpack.Header.Reliable = true; | 1272 | layerpack.Header.Reliable = true; |
1271 | OutPacket(layerpack, | 1273 | OutPacket(layerpack, ThrottleOutPacketType.Land); |
1272 | ThrottleOutPacketType.Land); | ||
1273 | } | 1274 | } |
1274 | } | 1275 | } |
1275 | catch (Exception e) | 1276 | catch (Exception e) |
@@ -1279,38 +1280,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1279 | } | 1280 | } |
1280 | 1281 | ||
1281 | /// <summary> | 1282 | /// <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 | 1283 | /// Send the wind matrix to the client |
1315 | /// </summary> | 1284 | /// </summary> |
1316 | /// <param name="windSpeeds">16x16 array of wind speeds</param> | 1285 | /// <param name="windSpeeds">16x16 array of wind speeds</param> |
@@ -2782,8 +2751,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2782 | { | 2751 | { |
2783 | if (req.AssetInf.Data == null) | 2752 | if (req.AssetInf.Data == null) |
2784 | { | 2753 | { |
2785 | m_log.ErrorFormat("Cannot send asset {0} ({1}), asset data is null", | 2754 | m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null", |
2786 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2755 | LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2787 | return; | 2756 | return; |
2788 | } | 2757 | } |
2789 | 2758 | ||
@@ -2910,8 +2879,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2910 | { | 2879 | { |
2911 | pos = (land.AABBMax + land.AABBMin) * 0.5f; | 2880 | pos = (land.AABBMax + land.AABBMin) * 0.5f; |
2912 | } | 2881 | } |
2913 | reply.Data.GlobalX = info.RegionLocX + x; | 2882 | reply.Data.GlobalX = info.LegacyRegionLocX + x; |
2914 | reply.Data.GlobalY = info.RegionLocY + y; | 2883 | reply.Data.GlobalY = info.LegacyRegionLocY + y; |
2915 | reply.Data.GlobalZ = pos.Z; | 2884 | reply.Data.GlobalZ = pos.Z; |
2916 | reply.Data.SimName = Utils.StringToBytes(info.RegionName); | 2885 | reply.Data.SimName = Utils.StringToBytes(info.RegionName); |
2917 | reply.Data.SnapshotID = land.SnapshotID; | 2886 | reply.Data.SnapshotID = land.SnapshotID; |