aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-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 20e53fc..0e4a0d0 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -500,18 +500,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
500 500
501 #region Client Methods 501 #region Client Methods
502 502
503
503 /// <summary> 504 /// <summary>
504 /// Shut down the client view 505 /// Shut down the client view
505 /// </summary> 506 /// </summary>
506 public void Close() 507 public void Close()
507 { 508 {
509 Close(true);
510 }
511
512 /// <summary>
513 /// Shut down the client view
514 /// </summary>
515 public void Close(bool sendStop)
516 {
508 m_log.DebugFormat( 517 m_log.DebugFormat(
509 "[CLIENT]: Close has been called for {0} attached to scene {1}", 518 "[CLIENT]: Close has been called for {0} attached to scene {1}",
510 Name, m_scene.RegionInfo.RegionName); 519 Name, m_scene.RegionInfo.RegionName);
511 520
512 // Send the STOP packet 521 if (sendStop)
513 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 522 {
514 OutPacket(disable, ThrottleOutPacketType.Unknown); 523 // Send the STOP packet
524 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
525 OutPacket(disable, ThrottleOutPacketType.Unknown);
526 }
515 527
516 IsActive = false; 528 IsActive = false;
517 529
@@ -843,16 +855,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
843 } 855 }
844 } 856 }
845 857
846 public void SendGenericMessage(string method, List<string> message) 858 public void SendGenericMessage(string method, List<byte[]> message)
847 { 859 {
848 GenericMessagePacket gmp = new GenericMessagePacket(); 860 GenericMessagePacket gmp = new GenericMessagePacket();
849 gmp.MethodData.Method = Util.StringToBytes256(method); 861 gmp.MethodData.Method = Util.StringToBytes256(method);
850 gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; 862 gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
851 int i = 0; 863 int i = 0;
852 foreach (string val in message) 864 foreach (byte[] val in message)
853 { 865 {
854 gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); 866 gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock();
855 gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); 867 gmp.ParamList[i++].Parameter = val;
856 } 868 }
857 OutPacket(gmp, ThrottleOutPacketType.Task); 869 OutPacket(gmp, ThrottleOutPacketType.Task);
858 } 870 }
@@ -1051,6 +1063,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1051 public virtual void SendLayerData(float[] map) 1063 public virtual void SendLayerData(float[] map)
1052 { 1064 {
1053 Util.FireAndForget(DoSendLayerData, map); 1065 Util.FireAndForget(DoSendLayerData, map);
1066
1067 // Send it sync, and async. It's not that much data
1068 // and it improves user experience just so much!
1069 DoSendLayerData(map);
1054 } 1070 }
1055 1071
1056 /// <summary> 1072 /// <summary>
@@ -1063,16 +1079,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1063 1079
1064 try 1080 try
1065 { 1081 {
1066 //for (int y = 0; y < 16; y++) 1082 for (int y = 0; y < 16; y++)
1067 //{ 1083 {
1068 // for (int x = 0; x < 16; x++) 1084 for (int x = 0; x < 16; x+=4)
1069 // { 1085 {
1070 // SendLayerData(x, y, map); 1086 SendLayerPacket(x, y, map);
1071 // } 1087 }
1072 //} 1088 }
1073
1074 // Send LayerData in a spiral pattern. Fun!
1075 SendLayerTopRight(map, 0, 0, 15, 15);
1076 } 1089 }
1077 catch (Exception e) 1090 catch (Exception e)
1078 { 1091 {
@@ -1080,51 +1093,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1080 } 1093 }
1081 } 1094 }
1082 1095
1083 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
1084 {
1085 // Row
1086 for (int i = x1; i <= x2; i++)
1087 SendLayerData(i, y1, map);
1088
1089 // Column
1090 for (int j = y1 + 1; j <= y2; j++)
1091 SendLayerData(x2, j, map);
1092
1093 if (x2 - x1 > 0)
1094 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1095 }
1096
1097 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
1098 {
1099 // Row in reverse
1100 for (int i = x2; i >= x1; i--)
1101 SendLayerData(i, y2, map);
1102
1103 // Column in reverse
1104 for (int j = y2 - 1; j >= y1; j--)
1105 SendLayerData(x1, j, map);
1106
1107 if (x2 - x1 > 0)
1108 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1109 }
1110
1111 /// <summary> 1096 /// <summary>
1112 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1097 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1113 /// </summary> 1098 /// </summary>
1114 /// <param name="map">heightmap</param> 1099 /// <param name="map">heightmap</param>
1115 /// <param name="px">X coordinate for patches 0..12</param> 1100 /// <param name="px">X coordinate for patches 0..12</param>
1116 /// <param name="py">Y coordinate for patches 0..15</param> 1101 /// <param name="py">Y coordinate for patches 0..15</param>
1117 // private void SendLayerPacket(float[] map, int y, int x) 1102 private void SendLayerPacket(int x, int y, float[] map)
1118 // { 1103 {
1119 // int[] patches = new int[4]; 1104 int[] patches = new int[4];
1120 // patches[0] = x + 0 + y * 16; 1105 patches[0] = x + 0 + y * 16;
1121 // patches[1] = x + 1 + y * 16; 1106 patches[1] = x + 1 + y * 16;
1122 // patches[2] = x + 2 + y * 16; 1107 patches[2] = x + 2 + y * 16;
1123 // patches[3] = x + 3 + y * 16; 1108 patches[3] = x + 3 + y * 16;
1124 1109
1125 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1110 float[] heightmap = (map.Length == 65536) ?
1126 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1111 map :
1127 // } 1112 LLHeightFieldMoronize(map);
1113
1114 try
1115 {
1116 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1117 OutPacket(layerpack, ThrottleOutPacketType.Land);
1118 }
1119 catch
1120 {
1121 for (int px = x ; px < x + 4 ; px++)
1122 SendLayerData(px, y, map);
1123 }
1124 }
1128 1125
1129 /// <summary> 1126 /// <summary>
1130 /// Sends a specified patch to a client 1127 /// Sends a specified patch to a client
@@ -1144,7 +1141,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1144 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1141 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1145 layerpack.Header.Reliable = true; 1142 layerpack.Header.Reliable = true;
1146 1143
1147 OutPacket(layerpack, ThrottleOutPacketType.Land); 1144 OutPacket(layerpack, ThrottleOutPacketType.Task);
1148 } 1145 }
1149 catch (Exception e) 1146 catch (Exception e)
1150 { 1147 {
@@ -3409,7 +3406,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3409 3406
3410 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 3407 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
3411 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); 3408 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data);
3412
3413 OutPacket(objupdate, ThrottleOutPacketType.Task); 3409 OutPacket(objupdate, ThrottleOutPacketType.Task);
3414 3410
3415 // We need to record the avatar local id since the root prim of an attachment points to this. 3411 // We need to record the avatar local id since the root prim of an attachment points to this.
@@ -3463,8 +3459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3463 terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); 3459 terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue();
3464 } 3460 }
3465 3461
3466 // HACK: Using the task category until the tiered reprioritization code is in 3462 OutPacket(terse, ThrottleOutPacketType.State);
3467 OutPacket(terse, ThrottleOutPacketType.Task);
3468 } 3463 }
3469 3464
3470 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) 3465 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
@@ -3979,6 +3974,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3979 { 3974 {
3980 m_propertiesPacketTimer.Stop(); 3975 m_propertiesPacketTimer.Stop();
3981 3976
3977 if (m_propertiesBlocks.Count == 0)
3978 return;
3979
3982 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; 3980 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count];
3983 3981
3984 int index = 0; 3982 int index = 0;
@@ -4926,6 +4924,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4926 (x.CameraLeftAxis != lastarg.CameraLeftAxis) || 4924 (x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
4927 (x.CameraUpAxis != lastarg.CameraUpAxis) || 4925 (x.CameraUpAxis != lastarg.CameraUpAxis) ||
4928 (x.ControlFlags != lastarg.ControlFlags) || 4926 (x.ControlFlags != lastarg.ControlFlags) ||
4927 (x.ControlFlags != 0) ||
4929 (x.Far != lastarg.Far) || 4928 (x.Far != lastarg.Far) ||
4930 (x.Flags != lastarg.Flags) || 4929 (x.Flags != lastarg.Flags) ||
4931 (x.State != lastarg.State) || 4930 (x.State != lastarg.State) ||
@@ -5293,7 +5292,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5293 args.Channel = ch; 5292 args.Channel = ch;
5294 args.From = String.Empty; 5293 args.From = String.Empty;
5295 args.Message = Utils.BytesToString(msg); 5294 args.Message = Utils.BytesToString(msg);
5296 args.Type = ChatTypeEnum.Shout; 5295 args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
5297 args.Position = new Vector3(); 5296 args.Position = new Vector3();
5298 args.Scene = Scene; 5297 args.Scene = Scene;
5299 args.Sender = this; 5298 args.Sender = this;