diff options
author | Robert Adams | 2013-10-02 16:59:37 -0700 |
---|---|---|
committer | Robert Adams | 2013-10-07 13:57:40 -0700 |
commit | 7416809077227f35ab70ed44060e51f2bcf66937 (patch) | |
tree | 7578cbfed07777d5c60af986791dc7d8b09b2cd5 /OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |
parent | varregion: remove scattered use of Constants.RegionSize by having routines re... (diff) | |
download | opensim-SC_OLD-7416809077227f35ab70ed44060e51f2bcf66937.zip opensim-SC_OLD-7416809077227f35ab70ed44060e51f2bcf66937.tar.gz opensim-SC_OLD-7416809077227f35ab70ed44060e51f2bcf66937.tar.bz2 opensim-SC_OLD-7416809077227f35ab70ed44060e51f2bcf66937.tar.xz |
varregion: plug in TerrainData class and modify TerrainModule and LLClientView to use same. This passes a terrain info class around rather than passing a one dimensional array thus allowing variable regions. Update the database storage for variable region sizes. This should be downward compatible (same format for 256x256 regions).
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 69 |
1 files changed, 20 insertions, 49 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fea9ddf..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,10 +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) ? map : LLHeightFieldMoronize(map); | 1247 | // That means, that for <patchNumX, patchNumY, the array location is computed as map[patchNumY * 16 + patchNumX]. |
1244 | 1248 | // TODO: someday straighten the below implementation to keep the X row order for patch numbers. | |
1245 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 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); | ||
1246 | 1251 | ||
1247 | // 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. |
1248 | // 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. |
@@ -1260,14 +1265,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1260 | if (m_justEditedTerrain) | 1265 | if (m_justEditedTerrain) |
1261 | { | 1266 | { |
1262 | layerpack.Header.Reliable = false; | 1267 | layerpack.Header.Reliable = false; |
1263 | OutPacket(layerpack, | 1268 | OutPacket(layerpack, ThrottleOutPacketType.Unknown ); |
1264 | ThrottleOutPacketType.Unknown ); | ||
1265 | } | 1269 | } |
1266 | else | 1270 | else |
1267 | { | 1271 | { |
1268 | layerpack.Header.Reliable = true; | 1272 | layerpack.Header.Reliable = true; |
1269 | OutPacket(layerpack, | 1273 | OutPacket(layerpack, ThrottleOutPacketType.Land); |
1270 | ThrottleOutPacketType.Land); | ||
1271 | } | 1274 | } |
1272 | } | 1275 | } |
1273 | catch (Exception e) | 1276 | catch (Exception e) |
@@ -1277,38 +1280,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1277 | } | 1280 | } |
1278 | 1281 | ||
1279 | /// <summary> | 1282 | /// <summary> |
1280 | /// Munges heightfield into the LLUDP backed in restricted heightfield. | ||
1281 | /// </summary> | ||
1282 | /// <param name="map">float array in the base; Constants.RegionSize</param> | ||
1283 | /// <returns>float array in the base 256</returns> | ||
1284 | internal float[] LLHeightFieldMoronize(float[] map) | ||
1285 | { | ||
1286 | if (map.Length == 65536) | ||
1287 | return map; | ||
1288 | else | ||
1289 | { | ||
1290 | float[] returnmap = new float[65536]; | ||
1291 | |||
1292 | if (map.Length < 65535) | ||
1293 | { | ||
1294 | // rebase the vector stride to 256 | ||
1295 | for (int i = 0; i < Constants.RegionSize; i++) | ||
1296 | Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, (int)Constants.RegionSize); | ||
1297 | } | ||
1298 | else | ||
1299 | { | ||
1300 | for (int i = 0; i < 256; i++) | ||
1301 | Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, 256); | ||
1302 | } | ||
1303 | |||
1304 | //Array.Copy(map,0,returnmap,0,(map.Length < 65536)? map.Length : 65536); | ||
1305 | |||
1306 | return returnmap; | ||
1307 | } | ||
1308 | |||
1309 | } | ||
1310 | |||
1311 | /// <summary> | ||
1312 | /// Send the wind matrix to the client | 1283 | /// Send the wind matrix to the client |
1313 | /// </summary> | 1284 | /// </summary> |
1314 | /// <param name="windSpeeds">16x16 array of wind speeds</param> | 1285 | /// <param name="windSpeeds">16x16 array of wind speeds</param> |
@@ -2780,8 +2751,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2780 | { | 2751 | { |
2781 | if (req.AssetInf.Data == null) | 2752 | if (req.AssetInf.Data == null) |
2782 | { | 2753 | { |
2783 | 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", |
2784 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2755 | LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2785 | return; | 2756 | return; |
2786 | } | 2757 | } |
2787 | 2758 | ||