diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 119 |
1 files changed, 59 insertions, 60 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2ab713d..960e0a2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -470,18 +470,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
470 | 470 | ||
471 | #region Client Methods | 471 | #region Client Methods |
472 | 472 | ||
473 | |||
473 | /// <summary> | 474 | /// <summary> |
474 | /// Shut down the client view | 475 | /// Shut down the client view |
475 | /// </summary> | 476 | /// </summary> |
476 | public void Close() | 477 | public void Close() |
477 | { | 478 | { |
479 | Close(true); | ||
480 | } | ||
481 | |||
482 | /// <summary> | ||
483 | /// Shut down the client view | ||
484 | /// </summary> | ||
485 | public void Close(bool sendStop) | ||
486 | { | ||
478 | m_log.DebugFormat( | 487 | m_log.DebugFormat( |
479 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 488 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
480 | Name, m_scene.RegionInfo.RegionName); | 489 | Name, m_scene.RegionInfo.RegionName); |
481 | 490 | ||
482 | // Send the STOP packet | 491 | if (sendStop) |
483 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | 492 | { |
484 | OutPacket(disable, ThrottleOutPacketType.Unknown); | 493 | // Send the STOP packet |
494 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
495 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
496 | } | ||
485 | 497 | ||
486 | IsActive = false; | 498 | IsActive = false; |
487 | 499 | ||
@@ -814,16 +826,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
814 | } | 826 | } |
815 | } | 827 | } |
816 | 828 | ||
817 | public void SendGenericMessage(string method, List<string> message) | 829 | public void SendGenericMessage(string method, List<byte[]> message) |
818 | { | 830 | { |
819 | GenericMessagePacket gmp = new GenericMessagePacket(); | 831 | GenericMessagePacket gmp = new GenericMessagePacket(); |
820 | gmp.MethodData.Method = Util.StringToBytes256(method); | 832 | gmp.MethodData.Method = Util.StringToBytes256(method); |
821 | gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; | 833 | gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; |
822 | int i = 0; | 834 | int i = 0; |
823 | foreach (string val in message) | 835 | foreach (byte[] val in message) |
824 | { | 836 | { |
825 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); | 837 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); |
826 | gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); | 838 | gmp.ParamList[i++].Parameter = val; |
827 | } | 839 | } |
828 | OutPacket(gmp, ThrottleOutPacketType.Task); | 840 | OutPacket(gmp, ThrottleOutPacketType.Task); |
829 | } | 841 | } |
@@ -1022,6 +1034,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1022 | public virtual void SendLayerData(float[] map) | 1034 | public virtual void SendLayerData(float[] map) |
1023 | { | 1035 | { |
1024 | Util.FireAndForget(DoSendLayerData, map); | 1036 | Util.FireAndForget(DoSendLayerData, map); |
1037 | |||
1038 | // Send it sync, and async. It's not that much data | ||
1039 | // and it improves user experience just so much! | ||
1040 | DoSendLayerData(map); | ||
1025 | } | 1041 | } |
1026 | 1042 | ||
1027 | /// <summary> | 1043 | /// <summary> |
@@ -1034,16 +1050,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1034 | 1050 | ||
1035 | try | 1051 | try |
1036 | { | 1052 | { |
1037 | //for (int y = 0; y < 16; y++) | 1053 | for (int y = 0; y < 16; y++) |
1038 | //{ | 1054 | { |
1039 | // for (int x = 0; x < 16; x++) | 1055 | for (int x = 0; x < 16; x+=4) |
1040 | // { | 1056 | { |
1041 | // SendLayerData(x, y, map); | 1057 | SendLayerPacket(x, y, map); |
1042 | // } | 1058 | } |
1043 | //} | 1059 | } |
1044 | |||
1045 | // Send LayerData in a spiral pattern. Fun! | ||
1046 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1047 | } | 1060 | } |
1048 | catch (Exception e) | 1061 | catch (Exception e) |
1049 | { | 1062 | { |
@@ -1051,51 +1064,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1051 | } | 1064 | } |
1052 | } | 1065 | } |
1053 | 1066 | ||
1054 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1055 | { | ||
1056 | // Row | ||
1057 | for (int i = x1; i <= x2; i++) | ||
1058 | SendLayerData(i, y1, map); | ||
1059 | |||
1060 | // Column | ||
1061 | for (int j = y1 + 1; j <= y2; j++) | ||
1062 | SendLayerData(x2, j, map); | ||
1063 | |||
1064 | if (x2 - x1 > 0) | ||
1065 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1066 | } | ||
1067 | |||
1068 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1069 | { | ||
1070 | // Row in reverse | ||
1071 | for (int i = x2; i >= x1; i--) | ||
1072 | SendLayerData(i, y2, map); | ||
1073 | |||
1074 | // Column in reverse | ||
1075 | for (int j = y2 - 1; j >= y1; j--) | ||
1076 | SendLayerData(x1, j, map); | ||
1077 | |||
1078 | if (x2 - x1 > 0) | ||
1079 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1080 | } | ||
1081 | |||
1082 | /// <summary> | 1067 | /// <summary> |
1083 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1068 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1084 | /// </summary> | 1069 | /// </summary> |
1085 | /// <param name="map">heightmap</param> | 1070 | /// <param name="map">heightmap</param> |
1086 | /// <param name="px">X coordinate for patches 0..12</param> | 1071 | /// <param name="px">X coordinate for patches 0..12</param> |
1087 | /// <param name="py">Y coordinate for patches 0..15</param> | 1072 | /// <param name="py">Y coordinate for patches 0..15</param> |
1088 | // private void SendLayerPacket(float[] map, int y, int x) | 1073 | private void SendLayerPacket(int x, int y, float[] map) |
1089 | // { | 1074 | { |
1090 | // int[] patches = new int[4]; | 1075 | int[] patches = new int[4]; |
1091 | // patches[0] = x + 0 + y * 16; | 1076 | patches[0] = x + 0 + y * 16; |
1092 | // patches[1] = x + 1 + y * 16; | 1077 | patches[1] = x + 1 + y * 16; |
1093 | // patches[2] = x + 2 + y * 16; | 1078 | patches[2] = x + 2 + y * 16; |
1094 | // patches[3] = x + 3 + y * 16; | 1079 | patches[3] = x + 3 + y * 16; |
1095 | 1080 | ||
1096 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1081 | float[] heightmap = (map.Length == 65536) ? |
1097 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1082 | map : |
1098 | // } | 1083 | LLHeightFieldMoronize(map); |
1084 | |||
1085 | try | ||
1086 | { | ||
1087 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1088 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1089 | } | ||
1090 | catch | ||
1091 | { | ||
1092 | for (int px = x ; px < x + 4 ; px++) | ||
1093 | SendLayerData(px, y, map); | ||
1094 | } | ||
1095 | } | ||
1099 | 1096 | ||
1100 | /// <summary> | 1097 | /// <summary> |
1101 | /// Sends a specified patch to a client | 1098 | /// Sends a specified patch to a client |
@@ -1115,7 +1112,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1115 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1112 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1116 | layerpack.Header.Reliable = true; | 1113 | layerpack.Header.Reliable = true; |
1117 | 1114 | ||
1118 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1115 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1119 | } | 1116 | } |
1120 | catch (Exception e) | 1117 | catch (Exception e) |
1121 | { | 1118 | { |
@@ -3375,7 +3372,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3375 | 3372 | ||
3376 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 3373 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
3377 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); | 3374 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); |
3378 | |||
3379 | OutPacket(objupdate, ThrottleOutPacketType.Task); | 3375 | OutPacket(objupdate, ThrottleOutPacketType.Task); |
3380 | } | 3376 | } |
3381 | 3377 | ||
@@ -3426,8 +3422,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3426 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); | 3422 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); |
3427 | } | 3423 | } |
3428 | 3424 | ||
3429 | // HACK: Using the task category until the tiered reprioritization code is in | 3425 | OutPacket(terse, ThrottleOutPacketType.State); |
3430 | OutPacket(terse, ThrottleOutPacketType.Task); | ||
3431 | } | 3426 | } |
3432 | 3427 | ||
3433 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) | 3428 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) |
@@ -3904,6 +3899,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3904 | { | 3899 | { |
3905 | m_propertiesPacketTimer.Stop(); | 3900 | m_propertiesPacketTimer.Stop(); |
3906 | 3901 | ||
3902 | if (m_propertiesBlocks.Count == 0) | ||
3903 | return; | ||
3904 | |||
3907 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; | 3905 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; |
3908 | 3906 | ||
3909 | int index = 0; | 3907 | int index = 0; |
@@ -4846,6 +4844,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4846 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | 4844 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || |
4847 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | 4845 | (x.CameraUpAxis != lastarg.CameraUpAxis) || |
4848 | (x.ControlFlags != lastarg.ControlFlags) || | 4846 | (x.ControlFlags != lastarg.ControlFlags) || |
4847 | (x.ControlFlags != 0) || | ||
4849 | (x.Far != lastarg.Far) || | 4848 | (x.Far != lastarg.Far) || |
4850 | (x.Flags != lastarg.Flags) || | 4849 | (x.Flags != lastarg.Flags) || |
4851 | (x.State != lastarg.State) || | 4850 | (x.State != lastarg.State) || |
@@ -5213,7 +5212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5213 | args.Channel = ch; | 5212 | args.Channel = ch; |
5214 | args.From = String.Empty; | 5213 | args.From = String.Empty; |
5215 | args.Message = Utils.BytesToString(msg); | 5214 | args.Message = Utils.BytesToString(msg); |
5216 | args.Type = ChatTypeEnum.Shout; | 5215 | args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance |
5217 | args.Position = new Vector3(); | 5216 | args.Position = new Vector3(); |
5218 | args.Scene = Scene; | 5217 | args.Scene = Scene; |
5219 | args.Sender = this; | 5218 | args.Sender = this; |