aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs119
1 files changed, 59 insertions, 60 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 724c8bc..7e85396 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -489,18 +489,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
489 489
490 #region Client Methods 490 #region Client Methods
491 491
492
492 /// <summary> 493 /// <summary>
493 /// Shut down the client view 494 /// Shut down the client view
494 /// </summary> 495 /// </summary>
495 public void Close() 496 public void Close()
496 { 497 {
498 Close(true);
499 }
500
501 /// <summary>
502 /// Shut down the client view
503 /// </summary>
504 public void Close(bool sendStop)
505 {
497 m_log.DebugFormat( 506 m_log.DebugFormat(
498 "[CLIENT]: Close has been called for {0} attached to scene {1}", 507 "[CLIENT]: Close has been called for {0} attached to scene {1}",
499 Name, m_scene.RegionInfo.RegionName); 508 Name, m_scene.RegionInfo.RegionName);
500 509
501 // Send the STOP packet 510 if (sendStop)
502 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 511 {
503 OutPacket(disable, ThrottleOutPacketType.Unknown); 512 // Send the STOP packet
513 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
514 OutPacket(disable, ThrottleOutPacketType.Unknown);
515 }
504 516
505 IsActive = false; 517 IsActive = false;
506 518
@@ -833,16 +845,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
833 } 845 }
834 } 846 }
835 847
836 public void SendGenericMessage(string method, List<string> message) 848 public void SendGenericMessage(string method, List<byte[]> message)
837 { 849 {
838 GenericMessagePacket gmp = new GenericMessagePacket(); 850 GenericMessagePacket gmp = new GenericMessagePacket();
839 gmp.MethodData.Method = Util.StringToBytes256(method); 851 gmp.MethodData.Method = Util.StringToBytes256(method);
840 gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; 852 gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
841 int i = 0; 853 int i = 0;
842 foreach (string val in message) 854 foreach (byte[] val in message)
843 { 855 {
844 gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); 856 gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock();
845 gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); 857 gmp.ParamList[i++].Parameter = val;
846 } 858 }
847 OutPacket(gmp, ThrottleOutPacketType.Task); 859 OutPacket(gmp, ThrottleOutPacketType.Task);
848 } 860 }
@@ -1041,6 +1053,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1041 public virtual void SendLayerData(float[] map) 1053 public virtual void SendLayerData(float[] map)
1042 { 1054 {
1043 Util.FireAndForget(DoSendLayerData, map); 1055 Util.FireAndForget(DoSendLayerData, map);
1056
1057 // Send it sync, and async. It's not that much data
1058 // and it improves user experience just so much!
1059 DoSendLayerData(map);
1044 } 1060 }
1045 1061
1046 /// <summary> 1062 /// <summary>
@@ -1053,16 +1069,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1053 1069
1054 try 1070 try
1055 { 1071 {
1056 //for (int y = 0; y < 16; y++) 1072 for (int y = 0; y < 16; y++)
1057 //{ 1073 {
1058 // for (int x = 0; x < 16; x++) 1074 for (int x = 0; x < 16; x+=4)
1059 // { 1075 {
1060 // SendLayerData(x, y, map); 1076 SendLayerPacket(x, y, map);
1061 // } 1077 }
1062 //} 1078 }
1063
1064 // Send LayerData in a spiral pattern. Fun!
1065 SendLayerTopRight(map, 0, 0, 15, 15);
1066 } 1079 }
1067 catch (Exception e) 1080 catch (Exception e)
1068 { 1081 {
@@ -1070,51 +1083,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1070 } 1083 }
1071 } 1084 }
1072 1085
1073 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
1074 {
1075 // Row
1076 for (int i = x1; i <= x2; i++)
1077 SendLayerData(i, y1, map);
1078
1079 // Column
1080 for (int j = y1 + 1; j <= y2; j++)
1081 SendLayerData(x2, j, map);
1082
1083 if (x2 - x1 > 0)
1084 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1085 }
1086
1087 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
1088 {
1089 // Row in reverse
1090 for (int i = x2; i >= x1; i--)
1091 SendLayerData(i, y2, map);
1092
1093 // Column in reverse
1094 for (int j = y2 - 1; j >= y1; j--)
1095 SendLayerData(x1, j, map);
1096
1097 if (x2 - x1 > 0)
1098 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1099 }
1100
1101 /// <summary> 1086 /// <summary>
1102 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1087 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1103 /// </summary> 1088 /// </summary>
1104 /// <param name="map">heightmap</param> 1089 /// <param name="map">heightmap</param>
1105 /// <param name="px">X coordinate for patches 0..12</param> 1090 /// <param name="px">X coordinate for patches 0..12</param>
1106 /// <param name="py">Y coordinate for patches 0..15</param> 1091 /// <param name="py">Y coordinate for patches 0..15</param>
1107 // private void SendLayerPacket(float[] map, int y, int x) 1092 private void SendLayerPacket(int x, int y, float[] map)
1108 // { 1093 {
1109 // int[] patches = new int[4]; 1094 int[] patches = new int[4];
1110 // patches[0] = x + 0 + y * 16; 1095 patches[0] = x + 0 + y * 16;
1111 // patches[1] = x + 1 + y * 16; 1096 patches[1] = x + 1 + y * 16;
1112 // patches[2] = x + 2 + y * 16; 1097 patches[2] = x + 2 + y * 16;
1113 // patches[3] = x + 3 + y * 16; 1098 patches[3] = x + 3 + y * 16;
1114 1099
1115 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1100 float[] heightmap = (map.Length == 65536) ?
1116 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1101 map :
1117 // } 1102 LLHeightFieldMoronize(map);
1103
1104 try
1105 {
1106 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1107 OutPacket(layerpack, ThrottleOutPacketType.Land);
1108 }
1109 catch
1110 {
1111 for (int px = x ; px < x + 4 ; px++)
1112 SendLayerData(px, y, map);
1113 }
1114 }
1118 1115
1119 /// <summary> 1116 /// <summary>
1120 /// Sends a specified patch to a client 1117 /// Sends a specified patch to a client
@@ -1134,7 +1131,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1134 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1131 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1135 layerpack.Header.Reliable = true; 1132 layerpack.Header.Reliable = true;
1136 1133
1137 OutPacket(layerpack, ThrottleOutPacketType.Land); 1134 OutPacket(layerpack, ThrottleOutPacketType.Task);
1138 } 1135 }
1139 catch (Exception e) 1136 catch (Exception e)
1140 { 1137 {
@@ -3399,7 +3396,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3399 3396
3400 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 3397 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
3401 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); 3398 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data);
3402
3403 OutPacket(objupdate, ThrottleOutPacketType.Task); 3399 OutPacket(objupdate, ThrottleOutPacketType.Task);
3404 } 3400 }
3405 3401
@@ -3450,8 +3446,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3450 terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); 3446 terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue();
3451 } 3447 }
3452 3448
3453 // HACK: Using the task category until the tiered reprioritization code is in 3449 OutPacket(terse, ThrottleOutPacketType.State);
3454 OutPacket(terse, ThrottleOutPacketType.Task);
3455 } 3450 }
3456 3451
3457 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) 3452 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
@@ -3941,6 +3936,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3941 { 3936 {
3942 m_propertiesPacketTimer.Stop(); 3937 m_propertiesPacketTimer.Stop();
3943 3938
3939 if (m_propertiesBlocks.Count == 0)
3940 return;
3941
3944 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; 3942 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count];
3945 3943
3946 int index = 0; 3944 int index = 0;
@@ -4883,6 +4881,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4883 (x.CameraLeftAxis != lastarg.CameraLeftAxis) || 4881 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
4884 (x.CameraUpAxis != lastarg.CameraUpAxis) || 4882 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
4885 (x.ControlFlags != lastarg.ControlFlags) || 4883 (x.ControlFlags != lastarg.ControlFlags) ||
4884 (x.ControlFlags != 0) ||
4886 (x.Far != lastarg.Far) || 4885 (x.Far != lastarg.Far) ||
4887 (x.Flags != lastarg.Flags) || 4886 (x.Flags != lastarg.Flags) ||
4888 (x.State != lastarg.State) || 4887 (x.State != lastarg.State) ||
@@ -5250,7 +5249,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5250 args.Channel = ch; 5249 args.Channel = ch;
5251 args.From = String.Empty; 5250 args.From = String.Empty;
5252 args.Message = Utils.BytesToString(msg); 5251 args.Message = Utils.BytesToString(msg);
5253 args.Type = ChatTypeEnum.Shout; 5252 args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
5254 args.Position = new Vector3(); 5253 args.Position = new Vector3();
5255 args.Scene = Scene; 5254 args.Scene = Scene;
5256 args.Sender = this; 5255 args.Sender = this;