aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs148
1 files changed, 89 insertions, 59 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index e67428d..173c9e5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -337,6 +337,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
337 private AgentUpdateArgs lastarg; 337 private AgentUpdateArgs lastarg;
338 private bool m_IsActive = true; 338 private bool m_IsActive = true;
339 private bool m_IsLoggingOut = false; 339 private bool m_IsLoggingOut = false;
340 private bool m_IsPresenceReady = false;
340 341
341 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); 342 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
342 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers 343 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
@@ -360,6 +361,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
360 361
361 private Timer m_propertiesPacketTimer; 362 private Timer m_propertiesPacketTimer;
362 private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); 363 private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>();
364 private List<Packet> m_pendingPackets;
363 365
364 #endregion Class Members 366 #endregion Class Members
365 367
@@ -400,6 +402,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
400 get { return m_IsActive; } 402 get { return m_IsActive; }
401 set { m_IsActive = value; } 403 set { m_IsActive = value; }
402 } 404 }
405
403 public bool IsLoggingOut 406 public bool IsLoggingOut
404 { 407 {
405 get { return m_IsLoggingOut; } 408 get { return m_IsLoggingOut; }
@@ -463,18 +466,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
463 466
464 #region Client Methods 467 #region Client Methods
465 468
469
466 /// <summary> 470 /// <summary>
467 /// Shut down the client view 471 /// Shut down the client view
468 /// </summary> 472 /// </summary>
469 public void Close() 473 public void Close()
470 { 474 {
475 Close(true);
476 }
477
478 /// <summary>
479 /// Shut down the client view
480 /// </summary>
481 public void Close(bool sendStop)
482 {
471 m_log.DebugFormat( 483 m_log.DebugFormat(
472 "[CLIENT]: Close has been called for {0} attached to scene {1}", 484 "[CLIENT]: Close has been called for {0} attached to scene {1}",
473 Name, m_scene.RegionInfo.RegionName); 485 Name, m_scene.RegionInfo.RegionName);
474 486
475 // Send the STOP packet 487 if (sendStop)
476 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 488 {
477 OutPacket(disable, ThrottleOutPacketType.Unknown); 489 // Send the STOP packet
490 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
491 OutPacket(disable, ThrottleOutPacketType.Unknown);
492 }
478 493
479 IsActive = false; 494 IsActive = false;
480 495
@@ -1040,6 +1055,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1040 public virtual void SendLayerData(float[] map) 1055 public virtual void SendLayerData(float[] map)
1041 { 1056 {
1042 Util.FireAndForget(DoSendLayerData, map); 1057 Util.FireAndForget(DoSendLayerData, map);
1058
1059 // Send it sync, and async. It's not that much data
1060 // and it improves user experience just so much!
1061 DoSendLayerData(map);
1043 } 1062 }
1044 1063
1045 /// <summary> 1064 /// <summary>
@@ -1052,16 +1071,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1052 1071
1053 try 1072 try
1054 { 1073 {
1055 //for (int y = 0; y < 16; y++) 1074 for (int y = 0; y < 16; y++)
1056 //{ 1075 {
1057 // for (int x = 0; x < 16; x++) 1076 for (int x = 0; x < 16; x+=4)
1058 // { 1077 {
1059 // SendLayerData(x, y, map); 1078 SendLayerPacket(x, y, map);
1060 // } 1079 }
1061 //} 1080 }
1062
1063 // Send LayerData in a spiral pattern. Fun!
1064 SendLayerTopRight(map, 0, 0, 15, 15);
1065 } 1081 }
1066 catch (Exception e) 1082 catch (Exception e)
1067 { 1083 {
@@ -1069,51 +1085,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1069 } 1085 }
1070 } 1086 }
1071 1087
1072 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
1073 {
1074 // Row
1075 for (int i = x1; i <= x2; i++)
1076 SendLayerData(i, y1, map);
1077
1078 // Column
1079 for (int j = y1 + 1; j <= y2; j++)
1080 SendLayerData(x2, j, map);
1081
1082 if (x2 - x1 > 0)
1083 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1084 }
1085
1086 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
1087 {
1088 // Row in reverse
1089 for (int i = x2; i >= x1; i--)
1090 SendLayerData(i, y2, map);
1091
1092 // Column in reverse
1093 for (int j = y2 - 1; j >= y1; j--)
1094 SendLayerData(x1, j, map);
1095
1096 if (x2 - x1 > 0)
1097 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1098 }
1099
1100 /// <summary> 1088 /// <summary>
1101 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1089 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1102 /// </summary> 1090 /// </summary>
1103 /// <param name="map">heightmap</param> 1091 /// <param name="map">heightmap</param>
1104 /// <param name="px">X coordinate for patches 0..12</param> 1092 /// <param name="px">X coordinate for patches 0..12</param>
1105 /// <param name="py">Y coordinate for patches 0..15</param> 1093 /// <param name="py">Y coordinate for patches 0..15</param>
1106 // private void SendLayerPacket(float[] map, int y, int x) 1094 private void SendLayerPacket(int x, int y, float[] map)
1107 // { 1095 {
1108 // int[] patches = new int[4]; 1096 int[] patches = new int[4];
1109 // patches[0] = x + 0 + y * 16; 1097 patches[0] = x + 0 + y * 16;
1110 // patches[1] = x + 1 + y * 16; 1098 patches[1] = x + 1 + y * 16;
1111 // patches[2] = x + 2 + y * 16; 1099 patches[2] = x + 2 + y * 16;
1112 // patches[3] = x + 3 + y * 16; 1100 patches[3] = x + 3 + y * 16;
1113 1101
1114 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1102 float[] heightmap = (map.Length == 65536) ?
1115 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1103 map :
1116 // } 1104 LLHeightFieldMoronize(map);
1105
1106 try
1107 {
1108 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1109 OutPacket(layerpack, ThrottleOutPacketType.Land);
1110 }
1111 catch
1112 {
1113 for (int px = x ; px < x + 4 ; px++)
1114 SendLayerData(px, y, map);
1115 }
1116 }
1117 1117
1118 /// <summary> 1118 /// <summary>
1119 /// Sends a specified patch to a client 1119 /// Sends a specified patch to a client
@@ -1133,7 +1133,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1133 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1133 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1134 layerpack.Header.Reliable = true; 1134 layerpack.Header.Reliable = true;
1135 1135
1136 OutPacket(layerpack, ThrottleOutPacketType.Land); 1136 OutPacket(layerpack, ThrottleOutPacketType.Task);
1137 } 1137 }
1138 catch (Exception e) 1138 catch (Exception e)
1139 { 1139 {
@@ -3896,6 +3896,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3896 { 3896 {
3897 m_propertiesPacketTimer.Stop(); 3897 m_propertiesPacketTimer.Stop();
3898 3898
3899 if (m_propertiesBlocks.Count == 0)
3900 return;
3901
3899 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; 3902 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count];
3900 3903
3901 int index = 0; 3904 int index = 0;
@@ -4887,6 +4890,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4887 (x.CameraLeftAxis != lastarg.CameraLeftAxis) || 4890 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
4888 (x.CameraUpAxis != lastarg.CameraUpAxis) || 4891 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
4889 (x.ControlFlags != lastarg.ControlFlags) || 4892 (x.ControlFlags != lastarg.ControlFlags) ||
4893 (x.ControlFlags != 0) ||
4890 (x.Far != lastarg.Far) || 4894 (x.Far != lastarg.Far) ||
4891 (x.Flags != lastarg.Flags) || 4895 (x.Flags != lastarg.Flags) ||
4892 (x.State != lastarg.State) || 4896 (x.State != lastarg.State) ||
@@ -5257,7 +5261,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5257 args.Channel = ch; 5261 args.Channel = ch;
5258 args.From = String.Empty; 5262 args.From = String.Empty;
5259 args.Message = Utils.BytesToString(msg); 5263 args.Message = Utils.BytesToString(msg);
5260 args.Type = ChatTypeEnum.Shout; 5264 args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
5261 args.Position = new Vector3(); 5265 args.Position = new Vector3();
5262 args.Scene = Scene; 5266 args.Scene = Scene;
5263 args.Sender = this; 5267 args.Sender = this;
@@ -11175,18 +11179,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11175 } 11179 }
11176 11180
11177 /// <summary> 11181 /// <summary>
11182 /// This processes packets which have accumulated while the presence was still in the process of initialising.
11183 /// </summary>
11184 public void ProcessPendingPackets()
11185 {
11186 m_IsPresenceReady = true;
11187 if (m_pendingPackets == null)
11188 return;
11189 foreach (Packet p in m_pendingPackets)
11190 {
11191 ProcessInPacket(p);
11192 }
11193 m_pendingPackets.Clear();
11194 }
11195
11196 /// <summary>
11178 /// Entryway from the client to the simulator. All UDP packets from the client will end up here 11197 /// Entryway from the client to the simulator. All UDP packets from the client will end up here
11179 /// </summary> 11198 /// </summary>
11180 /// <param name="Pack">OpenMetaverse.packet</param> 11199 /// <param name="Pack">OpenMetaverse.packet</param>
11181 public void ProcessInPacket(Packet Pack) 11200 public void ProcessInPacket(Packet Pack)
11182 { 11201 {
11183 if (m_debugPacketLevel >= 255) 11202 if (!m_IsPresenceReady)
11184 m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); 11203 {
11204 if (m_pendingPackets == null)
11205 {
11206 m_pendingPackets = new List<Packet>();
11207 }
11208 m_pendingPackets.Add(Pack);
11209 }
11210 else
11211 {
11212 if (m_debugPacketLevel >= 255)
11213 m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
11185 11214
11186 if (!ProcessPacketMethod(Pack)) 11215 if (!ProcessPacketMethod(Pack))
11187 m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); 11216 m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type);
11188 11217
11189 PacketPool.Instance.ReturnPacket(Pack); 11218 PacketPool.Instance.ReturnPacket(Pack);
11219 }
11190 } 11220 }
11191 11221
11192 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) 11222 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket)