diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 93 |
1 files changed, 38 insertions, 55 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index fba5090..2b5e632 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -770,16 +770,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
770 | } | 770 | } |
771 | } | 771 | } |
772 | 772 | ||
773 | public void SendGenericMessage(string method, List<string> message) | 773 | public void SendGenericMessage(string method, List<byte[]> message) |
774 | { | 774 | { |
775 | GenericMessagePacket gmp = new GenericMessagePacket(); | 775 | GenericMessagePacket gmp = new GenericMessagePacket(); |
776 | gmp.MethodData.Method = Util.StringToBytes256(method); | 776 | gmp.MethodData.Method = Util.StringToBytes256(method); |
777 | gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; | 777 | gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; |
778 | int i = 0; | 778 | int i = 0; |
779 | foreach (string val in message) | 779 | foreach (byte[] val in message) |
780 | { | 780 | { |
781 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); | 781 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); |
782 | gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); | 782 | gmp.ParamList[i++].Parameter = val; |
783 | } | 783 | } |
784 | OutPacket(gmp, ThrottleOutPacketType.Task); | 784 | OutPacket(gmp, ThrottleOutPacketType.Task); |
785 | } | 785 | } |
@@ -791,6 +791,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
791 | public virtual void SendLayerData(float[] map) | 791 | public virtual void SendLayerData(float[] map) |
792 | { | 792 | { |
793 | Util.FireAndForget(DoSendLayerData, map); | 793 | Util.FireAndForget(DoSendLayerData, map); |
794 | |||
795 | // Send it sync, and async. It's not that much data | ||
796 | // and it improves user experience just so much! | ||
797 | DoSendLayerData(map); | ||
794 | } | 798 | } |
795 | 799 | ||
796 | /// <summary> | 800 | /// <summary> |
@@ -803,16 +807,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
803 | 807 | ||
804 | try | 808 | try |
805 | { | 809 | { |
806 | //for (int y = 0; y < 16; y++) | 810 | for (int y = 0; y < 16; y++) |
807 | //{ | 811 | { |
808 | // for (int x = 0; x < 16; x++) | 812 | for (int x = 0; x < 16; x+=4) |
809 | // { | 813 | { |
810 | // SendLayerData(x, y, map); | 814 | SendLayerPacket(x, y, map); |
811 | // } | 815 | } |
812 | //} | 816 | } |
813 | |||
814 | // Send LayerData in a spiral pattern. Fun! | ||
815 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
816 | } | 817 | } |
817 | catch (Exception e) | 818 | catch (Exception e) |
818 | { | 819 | { |
@@ -820,51 +821,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
820 | } | 821 | } |
821 | } | 822 | } |
822 | 823 | ||
823 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
824 | { | ||
825 | // Row | ||
826 | for (int i = x1; i <= x2; i++) | ||
827 | SendLayerData(i, y1, map); | ||
828 | |||
829 | // Column | ||
830 | for (int j = y1 + 1; j <= y2; j++) | ||
831 | SendLayerData(x2, j, map); | ||
832 | |||
833 | if (x2 - x1 > 0) | ||
834 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
835 | } | ||
836 | |||
837 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
838 | { | ||
839 | // Row in reverse | ||
840 | for (int i = x2; i >= x1; i--) | ||
841 | SendLayerData(i, y2, map); | ||
842 | |||
843 | // Column in reverse | ||
844 | for (int j = y2 - 1; j >= y1; j--) | ||
845 | SendLayerData(x1, j, map); | ||
846 | |||
847 | if (x2 - x1 > 0) | ||
848 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
849 | } | ||
850 | |||
851 | /// <summary> | 824 | /// <summary> |
852 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 825 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
853 | /// </summary> | 826 | /// </summary> |
854 | /// <param name="map">heightmap</param> | 827 | /// <param name="map">heightmap</param> |
855 | /// <param name="px">X coordinate for patches 0..12</param> | 828 | /// <param name="px">X coordinate for patches 0..12</param> |
856 | /// <param name="py">Y coordinate for patches 0..15</param> | 829 | /// <param name="py">Y coordinate for patches 0..15</param> |
857 | // private void SendLayerPacket(float[] map, int y, int x) | 830 | private void SendLayerPacket(int x, int y, float[] map) |
858 | // { | 831 | { |
859 | // int[] patches = new int[4]; | 832 | int[] patches = new int[4]; |
860 | // patches[0] = x + 0 + y * 16; | 833 | patches[0] = x + 0 + y * 16; |
861 | // patches[1] = x + 1 + y * 16; | 834 | patches[1] = x + 1 + y * 16; |
862 | // patches[2] = x + 2 + y * 16; | 835 | patches[2] = x + 2 + y * 16; |
863 | // patches[3] = x + 3 + y * 16; | 836 | patches[3] = x + 3 + y * 16; |
864 | 837 | ||
865 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 838 | float[] heightmap = (map.Length == 65536) ? |
866 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 839 | map : |
867 | // } | 840 | LLHeightFieldMoronize(map); |
841 | |||
842 | try | ||
843 | { | ||
844 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
845 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
846 | } | ||
847 | catch | ||
848 | { | ||
849 | for (int px = x ; px < x + 4 ; px++) | ||
850 | SendLayerData(px, y, map); | ||
851 | } | ||
852 | } | ||
868 | 853 | ||
869 | /// <summary> | 854 | /// <summary> |
870 | /// Sends a specified patch to a client | 855 | /// Sends a specified patch to a client |
@@ -3142,7 +3127,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3142 | 3127 | ||
3143 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 3128 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
3144 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); | 3129 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); |
3145 | |||
3146 | OutPacket(objupdate, ThrottleOutPacketType.Task); | 3130 | OutPacket(objupdate, ThrottleOutPacketType.Task); |
3147 | } | 3131 | } |
3148 | 3132 | ||
@@ -3193,8 +3177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3193 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); | 3177 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); |
3194 | } | 3178 | } |
3195 | 3179 | ||
3196 | // HACK: Using the task category until the tiered reprioritization code is in | 3180 | OutPacket(terse, ThrottleOutPacketType.State); |
3197 | OutPacket(terse, ThrottleOutPacketType.Task); | ||
3198 | } | 3181 | } |
3199 | 3182 | ||
3200 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) | 3183 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) |