diff options
author | John Hurliman | 2009-10-18 20:24:20 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-18 20:24:20 -0700 |
commit | 233e16b99cc80190d41143ecdfe01308eb39932a (patch) | |
tree | 340a75427ec8fc9082a0f543021dbfebacdb3033 /OpenSim/Region | |
parent | * Process the avatar terse update priority queue as soon as an update for our... (diff) | |
download | opensim-SC_OLD-233e16b99cc80190d41143ecdfe01308eb39932a.zip opensim-SC_OLD-233e16b99cc80190d41143ecdfe01308eb39932a.tar.gz opensim-SC_OLD-233e16b99cc80190d41143ecdfe01308eb39932a.tar.bz2 opensim-SC_OLD-233e16b99cc80190d41143ecdfe01308eb39932a.tar.xz |
* Rewrote the methods that build ObjectUpdate and ImprovedTerseObjectUpdate packets to fill in the data more accurately and avoid allocating memory that is immediately thrown away
* Changed the Send*Data structs in IClientAPI to use public readonly members instead of private members and getters
* Made Parallel.ProcessorCount public
* Started switching over packet building methods in LLClientView to use Util.StringToBytes[256/1024]() instead of Utils.StringToBytes()
* More cleanup of the ScenePresences vs. ClientManager nightmare
* ScenePresence.HandleAgentUpdate() will now time out and drop incoming AgentUpdate packets after three seconds. This fixes a deadlock on m_AgentUpdates that was blocking up the LLUDP server
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1015 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 35 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 22 |
5 files changed, 398 insertions, 684 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 83a7184..1c463ea 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -342,7 +342,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
342 | protected Thread m_clientThread; | 342 | protected Thread m_clientThread; |
343 | protected Vector3 m_startpos; | 343 | protected Vector3 m_startpos; |
344 | protected EndPoint m_userEndPoint; | 344 | protected EndPoint m_userEndPoint; |
345 | protected UUID m_activeGroupID = UUID.Zero; | 345 | protected UUID m_activeGroupID; |
346 | protected string m_activeGroupName = String.Empty; | 346 | protected string m_activeGroupName = String.Empty; |
347 | protected ulong m_activeGroupPowers; | 347 | protected ulong m_activeGroupPowers; |
348 | protected Dictionary<UUID,ulong> m_groupPowers = new Dictionary<UUID, ulong>(); | 348 | protected Dictionary<UUID,ulong> m_groupPowers = new Dictionary<UUID, ulong>(); |
@@ -422,7 +422,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
422 | m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); | 422 | m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); |
423 | m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); | 423 | m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); |
424 | m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); | 424 | m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); |
425 | m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion()); | 425 | m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion()); |
426 | m_agentId = agentId; | 426 | m_agentId = agentId; |
427 | m_sessionId = sessionId; | 427 | m_sessionId = sessionId; |
428 | m_secureSessionId = sessionInfo.LoginInfo.SecureSession; | 428 | m_secureSessionId = sessionInfo.LoginInfo.SecureSession; |
@@ -498,7 +498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
498 | kupack.UserInfo.SessionID = SessionId; | 498 | kupack.UserInfo.SessionID = SessionId; |
499 | kupack.TargetBlock.TargetIP = 0; | 499 | kupack.TargetBlock.TargetIP = 0; |
500 | kupack.TargetBlock.TargetPort = 0; | 500 | kupack.TargetBlock.TargetPort = 0; |
501 | kupack.UserInfo.Reason = Utils.StringToBytes(message); | 501 | kupack.UserInfo.Reason = Util.StringToBytes256(message); |
502 | OutPacket(kupack, ThrottleOutPacketType.Task); | 502 | OutPacket(kupack, ThrottleOutPacketType.Task); |
503 | // You must sleep here or users get no message! | 503 | // You must sleep here or users get no message! |
504 | Thread.Sleep(500); | 504 | Thread.Sleep(500); |
@@ -643,7 +643,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
643 | handshake.RegionInfo.WaterHeight = args.waterHeight; | 643 | handshake.RegionInfo.WaterHeight = args.waterHeight; |
644 | 644 | ||
645 | handshake.RegionInfo.RegionFlags = args.regionFlags; | 645 | handshake.RegionInfo.RegionFlags = args.regionFlags; |
646 | handshake.RegionInfo.SimName = Utils.StringToBytes(args.regionName); | 646 | handshake.RegionInfo.SimName = Util.StringToBytes256(args.regionName); |
647 | handshake.RegionInfo.SimOwner = args.SimOwner; | 647 | handshake.RegionInfo.SimOwner = args.SimOwner; |
648 | handshake.RegionInfo.TerrainBase0 = args.terrainBase0; | 648 | handshake.RegionInfo.TerrainBase0 = args.terrainBase0; |
649 | handshake.RegionInfo.TerrainBase1 = args.terrainBase1; | 649 | handshake.RegionInfo.TerrainBase1 = args.terrainBase1; |
@@ -699,11 +699,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
699 | { | 699 | { |
700 | ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); | 700 | ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); |
701 | reply.ChatData.Audible = audible; | 701 | reply.ChatData.Audible = audible; |
702 | reply.ChatData.Message = Utils.StringToBytes(message); | 702 | reply.ChatData.Message = Util.StringToBytes1024(message); |
703 | reply.ChatData.ChatType = type; | 703 | reply.ChatData.ChatType = type; |
704 | reply.ChatData.SourceType = source; | 704 | reply.ChatData.SourceType = source; |
705 | reply.ChatData.Position = fromPos; | 705 | reply.ChatData.Position = fromPos; |
706 | reply.ChatData.FromName = Utils.StringToBytes(fromName); | 706 | reply.ChatData.FromName = Util.StringToBytes256(fromName); |
707 | reply.ChatData.OwnerID = fromAgentID; | 707 | reply.ChatData.OwnerID = fromAgentID; |
708 | reply.ChatData.SourceID = fromAgentID; | 708 | reply.ChatData.SourceID = fromAgentID; |
709 | 709 | ||
@@ -724,7 +724,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
724 | 724 | ||
725 | msg.AgentData.AgentID = new UUID(im.fromAgentID); | 725 | msg.AgentData.AgentID = new UUID(im.fromAgentID); |
726 | msg.AgentData.SessionID = UUID.Zero; | 726 | msg.AgentData.SessionID = UUID.Zero; |
727 | msg.MessageBlock.FromAgentName = Utils.StringToBytes(im.fromAgentName); | 727 | msg.MessageBlock.FromAgentName = Util.StringToBytes256(im.fromAgentName); |
728 | msg.MessageBlock.Dialog = im.dialog; | 728 | msg.MessageBlock.Dialog = im.dialog; |
729 | msg.MessageBlock.FromGroup = im.fromGroup; | 729 | msg.MessageBlock.FromGroup = im.fromGroup; |
730 | if (im.imSessionID == UUID.Zero.Guid) | 730 | if (im.imSessionID == UUID.Zero.Guid) |
@@ -737,12 +737,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
737 | msg.MessageBlock.RegionID = new UUID(im.RegionID); | 737 | msg.MessageBlock.RegionID = new UUID(im.RegionID); |
738 | msg.MessageBlock.Timestamp = im.timestamp; | 738 | msg.MessageBlock.Timestamp = im.timestamp; |
739 | msg.MessageBlock.ToAgentID = new UUID(im.toAgentID); | 739 | msg.MessageBlock.ToAgentID = new UUID(im.toAgentID); |
740 | // Cap the message length at 1099. There is a limit in ImprovedInstantMessagePacket | 740 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); |
741 | // the limit is 1100 but a 0 byte gets added to mark the end of the string | ||
742 | if (im.message != null && im.message.Length > 1099) | ||
743 | msg.MessageBlock.Message = Utils.StringToBytes(im.message.Substring(0, 1099)); | ||
744 | else | ||
745 | msg.MessageBlock.Message = Utils.StringToBytes(im.message); | ||
746 | msg.MessageBlock.BinaryBucket = im.binaryBucket; | 741 | msg.MessageBlock.BinaryBucket = im.binaryBucket; |
747 | 742 | ||
748 | if (im.message.StartsWith("[grouptest]")) | 743 | if (im.message.StartsWith("[grouptest]")) |
@@ -760,7 +755,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
760 | eq.ChatterboxInvitation( | 755 | eq.ChatterboxInvitation( |
761 | new UUID("00000000-68f9-1111-024e-222222111123"), | 756 | new UUID("00000000-68f9-1111-024e-222222111123"), |
762 | "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0, | 757 | "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0, |
763 | false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Utils.StringToBytes("OpenSimulator Testing")); | 758 | false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing")); |
764 | 759 | ||
765 | eq.ChatterBoxSessionAgentListUpdates( | 760 | eq.ChatterBoxSessionAgentListUpdates( |
766 | new UUID("00000000-68f9-1111-024e-222222111123"), | 761 | new UUID("00000000-68f9-1111-024e-222222111123"), |
@@ -777,13 +772,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
777 | public void SendGenericMessage(string method, List<string> message) | 772 | public void SendGenericMessage(string method, List<string> message) |
778 | { | 773 | { |
779 | GenericMessagePacket gmp = new GenericMessagePacket(); | 774 | GenericMessagePacket gmp = new GenericMessagePacket(); |
780 | gmp.MethodData.Method = Utils.StringToBytes(method); | 775 | gmp.MethodData.Method = Util.StringToBytes256(method); |
781 | gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; | 776 | gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; |
782 | int i = 0; | 777 | int i = 0; |
783 | foreach (string val in message) | 778 | foreach (string val in message) |
784 | { | 779 | { |
785 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); | 780 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); |
786 | gmp.ParamList[i++].Parameter = Utils.StringToBytes(val); | 781 | gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); |
787 | } | 782 | } |
788 | OutPacket(gmp, ThrottleOutPacketType.Task); | 783 | OutPacket(gmp, ThrottleOutPacketType.Task); |
789 | } | 784 | } |
@@ -1047,7 +1042,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1047 | newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; | 1042 | newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; |
1048 | newSimPack.RegionData.SimIP += (uint)byteIP[0]; | 1043 | newSimPack.RegionData.SimIP += (uint)byteIP[0]; |
1049 | newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; | 1044 | newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; |
1050 | newSimPack.RegionData.SeedCapability = Utils.StringToBytes(capsURL); | 1045 | newSimPack.RegionData.SeedCapability = Util.StringToBytes256(capsURL); |
1051 | 1046 | ||
1052 | // Hack to get this out immediately and skip throttles | 1047 | // Hack to get this out immediately and skip throttles |
1053 | OutPacket(newSimPack, ThrottleOutPacketType.Unknown); | 1048 | OutPacket(newSimPack, ThrottleOutPacketType.Unknown); |
@@ -1125,7 +1120,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1125 | teleport.Info.RegionHandle = regionHandle; | 1120 | teleport.Info.RegionHandle = regionHandle; |
1126 | teleport.Info.SimAccess = simAccess; | 1121 | teleport.Info.SimAccess = simAccess; |
1127 | 1122 | ||
1128 | teleport.Info.SeedCapability = Utils.StringToBytes(capsURL); | 1123 | teleport.Info.SeedCapability = Util.StringToBytes256(capsURL); |
1129 | 1124 | ||
1130 | IPAddress oIP = newRegionEndPoint.Address; | 1125 | IPAddress oIP = newRegionEndPoint.Address; |
1131 | byte[] byteIP = oIP.GetAddressBytes(); | 1126 | byte[] byteIP = oIP.GetAddressBytes(); |
@@ -1150,7 +1145,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1150 | { | 1145 | { |
1151 | TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed); | 1146 | TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed); |
1152 | tpFailed.Info.AgentID = AgentId; | 1147 | tpFailed.Info.AgentID = AgentId; |
1153 | tpFailed.Info.Reason = Utils.StringToBytes(reason); | 1148 | tpFailed.Info.Reason = Util.StringToBytes256(reason); |
1154 | tpFailed.AlertInfo = new TeleportFailedPacket.AlertInfoBlock[0]; | 1149 | tpFailed.AlertInfo = new TeleportFailedPacket.AlertInfoBlock[0]; |
1155 | 1150 | ||
1156 | // Hack to get this out immediately and skip throttles | 1151 | // Hack to get this out immediately and skip throttles |
@@ -1882,11 +1877,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1882 | AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); | 1877 | AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); |
1883 | sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid; | 1878 | sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid; |
1884 | sendAgentDataUpdate.AgentData.AgentID = agentid; | 1879 | sendAgentDataUpdate.AgentData.AgentID = agentid; |
1885 | sendAgentDataUpdate.AgentData.FirstName = Utils.StringToBytes(firstname); | 1880 | sendAgentDataUpdate.AgentData.FirstName = Util.StringToBytes256(firstname); |
1886 | sendAgentDataUpdate.AgentData.GroupName = Utils.StringToBytes(groupname); | 1881 | sendAgentDataUpdate.AgentData.GroupName = Util.StringToBytes256(groupname); |
1887 | sendAgentDataUpdate.AgentData.GroupPowers = grouppowers; | 1882 | sendAgentDataUpdate.AgentData.GroupPowers = grouppowers; |
1888 | sendAgentDataUpdate.AgentData.GroupTitle = Utils.StringToBytes(grouptitle); | 1883 | sendAgentDataUpdate.AgentData.GroupTitle = Util.StringToBytes256(grouptitle); |
1889 | sendAgentDataUpdate.AgentData.LastName = Utils.StringToBytes(lastname); | 1884 | sendAgentDataUpdate.AgentData.LastName = Util.StringToBytes256(lastname); |
1890 | OutPacket(sendAgentDataUpdate, ThrottleOutPacketType.Task); | 1885 | OutPacket(sendAgentDataUpdate, ThrottleOutPacketType.Task); |
1891 | } | 1886 | } |
1892 | 1887 | ||
@@ -1899,7 +1894,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1899 | { | 1894 | { |
1900 | AlertMessagePacket alertPack = (AlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AlertMessage); | 1895 | AlertMessagePacket alertPack = (AlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AlertMessage); |
1901 | alertPack.AlertData = new AlertMessagePacket.AlertDataBlock(); | 1896 | alertPack.AlertData = new AlertMessagePacket.AlertDataBlock(); |
1902 | alertPack.AlertData.Message = Utils.StringToBytes(message); | 1897 | alertPack.AlertData.Message = Util.StringToBytes256(message); |
1903 | alertPack.AlertInfo = new AlertMessagePacket.AlertInfoBlock[0]; | 1898 | alertPack.AlertInfo = new AlertMessagePacket.AlertInfoBlock[0]; |
1904 | OutPacket(alertPack, ThrottleOutPacketType.Task); | 1899 | OutPacket(alertPack, ThrottleOutPacketType.Task); |
1905 | } | 1900 | } |
@@ -1926,7 +1921,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1926 | { | 1921 | { |
1927 | AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); | 1922 | AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); |
1928 | alertPack.AgentData.AgentID = AgentId; | 1923 | alertPack.AgentData.AgentID = AgentId; |
1929 | alertPack.AlertData.Message = Utils.StringToBytes(message); | 1924 | alertPack.AlertData.Message = Util.StringToBytes256(message); |
1930 | alertPack.AlertData.Modal = modal; | 1925 | alertPack.AlertData.Modal = modal; |
1931 | 1926 | ||
1932 | return alertPack; | 1927 | return alertPack; |
@@ -1936,12 +1931,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1936 | string url) | 1931 | string url) |
1937 | { | 1932 | { |
1938 | LoadURLPacket loadURL = (LoadURLPacket)PacketPool.Instance.GetPacket(PacketType.LoadURL); | 1933 | LoadURLPacket loadURL = (LoadURLPacket)PacketPool.Instance.GetPacket(PacketType.LoadURL); |
1939 | loadURL.Data.ObjectName = Utils.StringToBytes(objectname); | 1934 | loadURL.Data.ObjectName = Util.StringToBytes256(objectname); |
1940 | loadURL.Data.ObjectID = objectID; | 1935 | loadURL.Data.ObjectID = objectID; |
1941 | loadURL.Data.OwnerID = ownerID; | 1936 | loadURL.Data.OwnerID = ownerID; |
1942 | loadURL.Data.OwnerIsGroup = groupOwned; | 1937 | loadURL.Data.OwnerIsGroup = groupOwned; |
1943 | loadURL.Data.Message = Utils.StringToBytes(message); | 1938 | loadURL.Data.Message = Util.StringToBytes256(message); |
1944 | loadURL.Data.URL = Utils.StringToBytes(url); | 1939 | loadURL.Data.URL = Util.StringToBytes256(url); |
1945 | OutPacket(loadURL, ThrottleOutPacketType.Task); | 1940 | OutPacket(loadURL, ThrottleOutPacketType.Task); |
1946 | } | 1941 | } |
1947 | 1942 | ||
@@ -1949,18 +1944,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1949 | { | 1944 | { |
1950 | ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); | 1945 | ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); |
1951 | dialog.Data.ObjectID = objectID; | 1946 | dialog.Data.ObjectID = objectID; |
1952 | dialog.Data.ObjectName = Utils.StringToBytes(objectname); | 1947 | dialog.Data.ObjectName = Util.StringToBytes256(objectname); |
1953 | // this is the username of the *owner* | 1948 | // this is the username of the *owner* |
1954 | dialog.Data.FirstName = Utils.StringToBytes(ownerFirstName); | 1949 | dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); |
1955 | dialog.Data.LastName = Utils.StringToBytes(ownerLastName); | 1950 | dialog.Data.LastName = Util.StringToBytes256(ownerLastName); |
1956 | dialog.Data.Message = Utils.StringToBytes(msg); | 1951 | dialog.Data.Message = Util.StringToBytes1024(msg); |
1957 | dialog.Data.ImageID = textureID; | 1952 | dialog.Data.ImageID = textureID; |
1958 | dialog.Data.ChatChannel = ch; | 1953 | dialog.Data.ChatChannel = ch; |
1959 | ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[buttonlabels.Length]; | 1954 | ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[buttonlabels.Length]; |
1960 | for (int i = 0; i < buttonlabels.Length; i++) | 1955 | for (int i = 0; i < buttonlabels.Length; i++) |
1961 | { | 1956 | { |
1962 | buttons[i] = new ScriptDialogPacket.ButtonsBlock(); | 1957 | buttons[i] = new ScriptDialogPacket.ButtonsBlock(); |
1963 | buttons[i].ButtonLabel = Utils.StringToBytes(buttonlabels[i]); | 1958 | buttons[i].ButtonLabel = Util.StringToBytes256(buttonlabels[i]); |
1964 | } | 1959 | } |
1965 | dialog.Buttons = buttons; | 1960 | dialog.Buttons = buttons; |
1966 | OutPacket(dialog, ThrottleOutPacketType.Task); | 1961 | OutPacket(dialog, ThrottleOutPacketType.Task); |
@@ -2116,19 +2111,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2116 | avatarReply.AgentData.AgentID = AgentId; | 2111 | avatarReply.AgentData.AgentID = AgentId; |
2117 | avatarReply.AgentData.AvatarID = avatarID; | 2112 | avatarReply.AgentData.AvatarID = avatarID; |
2118 | if (aboutText != null) | 2113 | if (aboutText != null) |
2119 | avatarReply.PropertiesData.AboutText = Utils.StringToBytes(aboutText); | 2114 | avatarReply.PropertiesData.AboutText = Util.StringToBytes1024(aboutText); |
2120 | else | 2115 | else |
2121 | avatarReply.PropertiesData.AboutText = Utils.StringToBytes(""); | 2116 | avatarReply.PropertiesData.AboutText = Utils.EmptyBytes; |
2122 | avatarReply.PropertiesData.BornOn = Utils.StringToBytes(bornOn); | 2117 | avatarReply.PropertiesData.BornOn = Util.StringToBytes256(bornOn); |
2123 | avatarReply.PropertiesData.CharterMember = charterMember; | 2118 | avatarReply.PropertiesData.CharterMember = charterMember; |
2124 | if (flAbout != null) | 2119 | if (flAbout != null) |
2125 | avatarReply.PropertiesData.FLAboutText = Utils.StringToBytes(flAbout); | 2120 | avatarReply.PropertiesData.FLAboutText = Util.StringToBytes256(flAbout); |
2126 | else | 2121 | else |
2127 | avatarReply.PropertiesData.FLAboutText = Utils.StringToBytes(""); | 2122 | avatarReply.PropertiesData.FLAboutText = Utils.EmptyBytes; |
2128 | avatarReply.PropertiesData.Flags = flags; | 2123 | avatarReply.PropertiesData.Flags = flags; |
2129 | avatarReply.PropertiesData.FLImageID = flImageID; | 2124 | avatarReply.PropertiesData.FLImageID = flImageID; |
2130 | avatarReply.PropertiesData.ImageID = imageID; | 2125 | avatarReply.PropertiesData.ImageID = imageID; |
2131 | avatarReply.PropertiesData.ProfileURL = Utils.StringToBytes(profileURL); | 2126 | avatarReply.PropertiesData.ProfileURL = Util.StringToBytes256(profileURL); |
2132 | avatarReply.PropertiesData.PartnerID = partnerID; | 2127 | avatarReply.PropertiesData.PartnerID = partnerID; |
2133 | OutPacket(avatarReply, ThrottleOutPacketType.Task); | 2128 | OutPacket(avatarReply, ThrottleOutPacketType.Task); |
2134 | } | 2129 | } |
@@ -2255,7 +2250,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2255 | Group.Contribution = GroupMembership[i].Contribution; | 2250 | Group.Contribution = GroupMembership[i].Contribution; |
2256 | Group.GroupID = GroupMembership[i].GroupID; | 2251 | Group.GroupID = GroupMembership[i].GroupID; |
2257 | Group.GroupInsigniaID = GroupMembership[i].GroupPicture; | 2252 | Group.GroupInsigniaID = GroupMembership[i].GroupPicture; |
2258 | Group.GroupName = Utils.StringToBytes(GroupMembership[i].GroupName); | 2253 | Group.GroupName = Util.StringToBytes256(GroupMembership[i].GroupName); |
2259 | Group.GroupPowers = GroupMembership[i].GroupPowers; | 2254 | Group.GroupPowers = GroupMembership[i].GroupPowers; |
2260 | Groups[i] = Group; | 2255 | Groups[i] = Group; |
2261 | 2256 | ||
@@ -2289,7 +2284,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2289 | UUIDGroupNameReplyPacket.UUIDNameBlockBlock[] uidnameblock = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock[1]; | 2284 | UUIDGroupNameReplyPacket.UUIDNameBlockBlock[] uidnameblock = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock[1]; |
2290 | UUIDGroupNameReplyPacket.UUIDNameBlockBlock uidnamebloc = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock(); | 2285 | UUIDGroupNameReplyPacket.UUIDNameBlockBlock uidnamebloc = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock(); |
2291 | uidnamebloc.ID = groupLLUID; | 2286 | uidnamebloc.ID = groupLLUID; |
2292 | uidnamebloc.GroupName = Utils.StringToBytes(GroupName); | 2287 | uidnamebloc.GroupName = Util.StringToBytes256(GroupName); |
2293 | uidnameblock[0] = uidnamebloc; | 2288 | uidnameblock[0] = uidnamebloc; |
2294 | pack.UUIDNameBlock = uidnameblock; | 2289 | pack.UUIDNameBlock = uidnameblock; |
2295 | OutPacket(pack, ThrottleOutPacketType.Task); | 2290 | OutPacket(pack, ThrottleOutPacketType.Task); |
@@ -2314,8 +2309,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2314 | lsrepdb.Score = lsrpia[i].Score; | 2309 | lsrepdb.Score = lsrpia[i].Score; |
2315 | lsrepdb.TaskID = lsrpia[i].TaskID; | 2310 | lsrepdb.TaskID = lsrpia[i].TaskID; |
2316 | lsrepdb.TaskLocalID = lsrpia[i].TaskLocalID; | 2311 | lsrepdb.TaskLocalID = lsrpia[i].TaskLocalID; |
2317 | lsrepdb.TaskName = Utils.StringToBytes(lsrpia[i].TaskName); | 2312 | lsrepdb.TaskName = Util.StringToBytes256(lsrpia[i].TaskName); |
2318 | lsrepdb.OwnerName = Utils.StringToBytes(lsrpia[i].OwnerName); | 2313 | lsrepdb.OwnerName = Util.StringToBytes256(lsrpia[i].OwnerName); |
2319 | lsrepdba[i] = lsrepdb; | 2314 | lsrepdba[i] = lsrepdb; |
2320 | } | 2315 | } |
2321 | lsrp.ReportData = lsrepdba; | 2316 | lsrp.ReportData = lsrepdba; |
@@ -3257,127 +3252,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3257 | canUseImproved = false; | 3252 | canUseImproved = false; |
3258 | } | 3253 | } |
3259 | } | 3254 | } |
3260 | } | ||
3261 | |||
3262 | static ObjectUpdatePacket.ObjectDataBlock BuildUpdateBlockFromPrim(SceneObjectPart prim, UUID assetID, PrimFlags flags, uint crc) | ||
3263 | { | ||
3264 | byte[] objectData = new byte[60]; | ||
3265 | prim.OffsetPosition.ToBytes(objectData, 0); | ||
3266 | prim.Velocity.ToBytes(objectData, 12); | ||
3267 | prim.Acceleration.ToBytes(objectData, 24); | ||
3268 | prim.RotationOffset.ToBytes(objectData, 36); | ||
3269 | prim.AngularVelocity.ToBytes(objectData, 48); | ||
3270 | |||
3271 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | ||
3272 | update.ClickAction = (byte)prim.ClickAction; | ||
3273 | update.CRC = crc; | ||
3274 | update.ExtraParams = prim.Shape.ExtraParams ?? Utils.EmptyBytes; | ||
3275 | update.Flags = (byte)flags; | ||
3276 | update.FullID = prim.UUID; | ||
3277 | update.ID = prim.LocalId; | ||
3278 | //update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated | ||
3279 | //update.JointPivot = Vector3.Zero; | ||
3280 | //update.JointType = 0; | ||
3281 | update.Material = prim.Material; | ||
3282 | update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim | ||
3283 | if (prim.IsAttachment) | ||
3284 | update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + assetID); | ||
3285 | else | ||
3286 | update.NameValue = Utils.EmptyBytes; | ||
3287 | update.ObjectData = objectData; | ||
3288 | update.ParentID = prim.ParentID; | ||
3289 | update.PathBegin = prim.Shape.PathBegin; | ||
3290 | update.PathCurve = prim.Shape.PathCurve; | ||
3291 | update.PathEnd = prim.Shape.PathEnd; | ||
3292 | update.PathRadiusOffset = prim.Shape.PathRadiusOffset; | ||
3293 | update.PathRevolutions = prim.Shape.PathRevolutions; | ||
3294 | update.PathScaleX = prim.Shape.PathScaleX; | ||
3295 | update.PathScaleY = prim.Shape.PathScaleY; | ||
3296 | update.PathShearX = prim.Shape.PathShearX; | ||
3297 | update.PathShearY = prim.Shape.PathShearY; | ||
3298 | update.PathSkew = prim.Shape.PathSkew; | ||
3299 | update.PathTaperX = prim.Shape.PathTaperX; | ||
3300 | update.PathTaperY = prim.Shape.PathTaperY; | ||
3301 | update.PathTwist = prim.Shape.PathTwist; | ||
3302 | update.PathTwistBegin = prim.Shape.PathTwistBegin; | ||
3303 | update.PCode = prim.Shape.PCode; | ||
3304 | update.ProfileBegin = prim.Shape.ProfileBegin; | ||
3305 | update.ProfileCurve = prim.Shape.ProfileCurve; | ||
3306 | update.ProfileEnd = prim.Shape.ProfileEnd; | ||
3307 | update.ProfileHollow = prim.Shape.ProfileHollow; | ||
3308 | update.PSBlock = prim.ParticleSystem ?? Utils.EmptyBytes; | ||
3309 | update.TextColor = new Color4(prim.Color).GetBytes(true); | ||
3310 | update.TextureAnim = prim.TextureAnimation ?? Utils.EmptyBytes; | ||
3311 | update.TextureEntry = prim.Shape.TextureEntry ?? Utils.EmptyBytes; | ||
3312 | update.Scale = prim.Scale; | ||
3313 | update.State = prim.Shape.State; | ||
3314 | update.Text = Util.StringToBytes256(prim.Text); | ||
3315 | update.UpdateFlags = (uint)flags; | ||
3316 | |||
3317 | if (prim.Sound != UUID.Zero) | ||
3318 | { | ||
3319 | update.Sound = prim.Sound; | ||
3320 | update.OwnerID = prim.OwnerID; | ||
3321 | update.Gain = (float)prim.SoundGain; | ||
3322 | update.Radius = (float)prim.SoundRadius; | ||
3323 | } | ||
3324 | |||
3325 | switch ((PCode)prim.Shape.PCode) | ||
3326 | { | ||
3327 | case PCode.Grass: | ||
3328 | case PCode.Tree: | ||
3329 | case PCode.NewTree: | ||
3330 | update.Data = new byte[] { prim.Shape.State }; | ||
3331 | break; | ||
3332 | default: | ||
3333 | // TODO: Support ScratchPad | ||
3334 | //if (prim.ScratchPad != null) | ||
3335 | //{ | ||
3336 | // update.Data = new byte[prim.ScratchPad.Length]; | ||
3337 | // Buffer.BlockCopy(prim.ScratchPad, 0, update.Data, 0, update.Data.Length); | ||
3338 | //} | ||
3339 | //else | ||
3340 | //{ | ||
3341 | // update.Data = Utils.EmptyBytes; | ||
3342 | //} | ||
3343 | update.Data = Utils.EmptyBytes; | ||
3344 | break; | ||
3345 | } | ||
3346 | |||
3347 | return update; | ||
3348 | }*/ | 3255 | }*/ |
3349 | 3256 | ||
3350 | #endregion Prim/Avatar Updates | 3257 | #endregion Prim/Avatar Updates |
3351 | 3258 | ||
3352 | #region Avatar Packet/data sending Methods | 3259 | #region Avatar Packet/Data Sending Methods |
3353 | 3260 | ||
3354 | /// <summary> | 3261 | /// <summary> |
3355 | /// send a objectupdate packet with information about the clients avatar | 3262 | /// Send an ObjectUpdate packet with information about an avatar |
3356 | /// </summary> | 3263 | /// </summary> |
3357 | public void SendAvatarData(SendAvatarData data) | 3264 | public void SendAvatarData(SendAvatarData data) |
3358 | { | 3265 | { |
3359 | ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | 3266 | ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
3360 | // TODO: don't create new blocks if recycling an old packet | 3267 | objupdate.Header.Zerocoded = true; |
3361 | objupdate.RegionData.RegionHandle = data.regionHandle; | 3268 | |
3269 | objupdate.RegionData.RegionHandle = data.RegionHandle; | ||
3362 | objupdate.RegionData.TimeDilation = ushort.MaxValue; | 3270 | objupdate.RegionData.TimeDilation = ushort.MaxValue; |
3271 | |||
3363 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 3272 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
3364 | objupdate.ObjectData[0] = CreateDefaultAvatarPacket(data.textureEntry); | 3273 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); |
3365 | |||
3366 | //give this avatar object a local id and assign the user a name | ||
3367 | objupdate.ObjectData[0].ID = data.avatarLocalID; | ||
3368 | objupdate.ObjectData[0].FullID = data.avatarID; | ||
3369 | objupdate.ObjectData[0].ParentID = data.parentID; | ||
3370 | objupdate.ObjectData[0].NameValue = | ||
3371 | Utils.StringToBytes("FirstName STRING RW SV " + data.firstName + "\nLastName STRING RW SV " + data.lastName + "\nTitle STRING RW SV " + data.grouptitle); | ||
3372 | |||
3373 | Vector3 pos2 = new Vector3(data.Pos.X, data.Pos.Y, data.Pos.Z); | ||
3374 | byte[] pb = pos2.GetBytes(); | ||
3375 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
3376 | |||
3377 | byte[] rot = data.rotation.GetBytes(); | ||
3378 | Array.Copy(rot, 0, objupdate.ObjectData[0].ObjectData, 52, rot.Length); | ||
3379 | 3274 | ||
3380 | objupdate.Header.Zerocoded = true; | ||
3381 | OutPacket(objupdate, ThrottleOutPacketType.Task); | 3275 | OutPacket(objupdate, ThrottleOutPacketType.Task); |
3382 | } | 3276 | } |
3383 | 3277 | ||
@@ -3387,27 +3281,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3387 | /// </summary> | 3281 | /// </summary> |
3388 | public virtual void SendAvatarTerseUpdate(SendAvatarTerseData data) | 3282 | public virtual void SendAvatarTerseUpdate(SendAvatarTerseData data) |
3389 | { | 3283 | { |
3390 | if (data.priority == double.NaN) | 3284 | if (data.Priority == double.NaN) |
3391 | { | 3285 | { |
3392 | m_log.Error("[LLClientView] SendAvatarTerseUpdate received a NaN priority, dropping update"); | 3286 | m_log.Error("[LLClientView] SendAvatarTerseUpdate received a NaN priority, dropping update"); |
3393 | return; | 3287 | return; |
3394 | } | 3288 | } |
3395 | 3289 | ||
3396 | Quaternion rotation = data.rotation; | 3290 | Quaternion rotation = data.Rotation; |
3397 | 3291 | ||
3398 | if (rotation.X == rotation.Y && | 3292 | if (rotation.X == rotation.Y && |
3399 | rotation.Y == rotation.Z && | 3293 | rotation.Y == rotation.Z && |
3400 | rotation.Z == rotation.W && rotation.W == 0) | 3294 | rotation.Z == rotation.W && rotation.W == 0.0f) |
3401 | rotation = Quaternion.Identity; | 3295 | rotation = Quaternion.Identity; |
3402 | 3296 | ||
3403 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = | 3297 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateImprovedTerseBlock(data); |
3404 | CreateAvatarImprovedBlock(data.localID, data.position, data.velocity, rotation); | ||
3405 | 3298 | ||
3406 | lock (m_avatarTerseUpdates.SyncRoot) | 3299 | lock (m_avatarTerseUpdates.SyncRoot) |
3407 | m_avatarTerseUpdates.Enqueue(data.priority, terseBlock, data.localID); | 3300 | m_avatarTerseUpdates.Enqueue(data.Priority, terseBlock, data.LocalID); |
3408 | 3301 | ||
3409 | // If we received an update about our own avatar, process the avatar update priority queue immediately | 3302 | // If we received an update about our own avatar, process the avatar update priority queue immediately |
3410 | if (data.agentid == m_agentId) | 3303 | if (data.AgentID == m_agentId) |
3411 | ProcessAvatarTerseUpdates(); | 3304 | ProcessAvatarTerseUpdates(); |
3412 | } | 3305 | } |
3413 | 3306 | ||
@@ -3471,33 +3364,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3471 | OutPacket(loc, ThrottleOutPacketType.Task); | 3364 | OutPacket(loc, ThrottleOutPacketType.Task); |
3472 | } | 3365 | } |
3473 | 3366 | ||
3474 | #endregion | 3367 | #endregion Avatar Packet/Data Sending Methods |
3475 | 3368 | ||
3476 | #region Primitive Packet/data Sending Methods | 3369 | #region Primitive Packet/Data Sending Methods |
3477 | |||
3478 | /// <summary> | ||
3479 | /// | ||
3480 | /// </summary> | ||
3481 | /// <param name="localID"></param> | ||
3482 | /// <param name="rotation"></param> | ||
3483 | /// <param name="attachPoint"></param> | ||
3484 | public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID) | ||
3485 | { | ||
3486 | if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD | ||
3487 | return; | ||
3488 | |||
3489 | ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); | ||
3490 | // TODO: don't create new blocks if recycling an old packet | ||
3491 | attach.AgentData.AgentID = AgentId; | ||
3492 | attach.AgentData.SessionID = m_sessionId; | ||
3493 | attach.AgentData.AttachmentPoint = attachPoint; | ||
3494 | attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; | ||
3495 | attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); | ||
3496 | attach.ObjectData[0].ObjectLocalID = localID; | ||
3497 | attach.ObjectData[0].Rotation = rotation; | ||
3498 | attach.Header.Zerocoded = true; | ||
3499 | OutPacket(attach, ThrottleOutPacketType.Task); | ||
3500 | } | ||
3501 | 3370 | ||
3502 | public void SendPrimitiveToClient(SendPrimitiveData data) | 3371 | public void SendPrimitiveToClient(SendPrimitiveData data) |
3503 | { | 3372 | { |
@@ -3513,136 +3382,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3513 | return; | 3382 | return; |
3514 | if (data.primShape.PCode == 9 && data.primShape.State != 0 && data.parentID == 0) | 3383 | if (data.primShape.PCode == 9 && data.primShape.State != 0 && data.parentID == 0) |
3515 | return; | 3384 | return; |
3516 | 3385 | ||
3517 | if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0.0f) | 3386 | if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0.0f) |
3518 | rotation = Quaternion.Identity; | 3387 | rotation = Quaternion.Identity; |
3519 | 3388 | ||
3520 | ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data.primShape, data.flags); | 3389 | ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data); |
3521 | |||
3522 | objectData.ID = data.localID; | ||
3523 | objectData.FullID = data.objectID; | ||
3524 | objectData.OwnerID = data.ownerID; | ||
3525 | |||
3526 | objectData.Text = Util.StringToBytes256(data.text); | ||
3527 | objectData.TextColor[0] = data.color[0]; | ||
3528 | objectData.TextColor[1] = data.color[1]; | ||
3529 | objectData.TextColor[2] = data.color[2]; | ||
3530 | objectData.TextColor[3] = data.color[3]; | ||
3531 | objectData.ParentID = data.parentID; | ||
3532 | objectData.PSBlock = data.particleSystem; | ||
3533 | objectData.ClickAction = data.clickAction; | ||
3534 | objectData.Material = data.material; | ||
3535 | objectData.Flags = 0; | ||
3536 | |||
3537 | if (data.attachment) | ||
3538 | { | ||
3539 | // Necessary??? | ||
3540 | objectData.JointAxisOrAnchor = new Vector3(0, 0, 2); | ||
3541 | objectData.JointPivot = new Vector3(0, 0, 0); | ||
3542 | |||
3543 | // Item from inventory??? | ||
3544 | objectData.NameValue = | ||
3545 | Utils.StringToBytes("AttachItemID STRING RW SV " + data.AssetId.Guid); | ||
3546 | objectData.State = (byte)((data.AttachPoint % 16) * 16 + (data.AttachPoint / 16)); | ||
3547 | } | ||
3548 | |||
3549 | // Xantor 20080528: Send sound info as well | ||
3550 | // Xantor 20080530: Zero out everything if there's no SoundId, so zerocompression will work again | ||
3551 | objectData.Sound = data.SoundId; | ||
3552 | if (data.SoundId == UUID.Zero) | ||
3553 | { | ||
3554 | objectData.OwnerID = UUID.Zero; | ||
3555 | objectData.Gain = 0.0f; | ||
3556 | objectData.Radius = 0.0f; | ||
3557 | objectData.Flags = 0; | ||
3558 | } | ||
3559 | else | ||
3560 | { | ||
3561 | objectData.OwnerID = data.ownerID; | ||
3562 | objectData.Gain = (float)data.SoundVolume; | ||
3563 | objectData.Radius = (float)data.SoundRadius; | ||
3564 | objectData.Flags = data.SoundFlags; | ||
3565 | } | ||
3566 | |||
3567 | byte[] pb = data.pos.GetBytes(); | ||
3568 | Buffer.BlockCopy(pb, 0, objectData.ObjectData, 0, pb.Length); | ||
3569 | |||
3570 | byte[] vel = data.vel.GetBytes(); | ||
3571 | Buffer.BlockCopy(vel, 0, objectData.ObjectData, pb.Length, vel.Length); | ||
3572 | |||
3573 | byte[] rot = rotation.GetBytes(); | ||
3574 | Buffer.BlockCopy(rot, 0, objectData.ObjectData, 36, rot.Length); | ||
3575 | |||
3576 | byte[] rvel = data.rvel.GetBytes(); | ||
3577 | Buffer.BlockCopy(rvel, 0, objectData.ObjectData, 36 + rot.Length, rvel.Length); | ||
3578 | |||
3579 | if (data.textureanim.Length > 0) | ||
3580 | { | ||
3581 | objectData.TextureAnim = data.textureanim; | ||
3582 | } | ||
3583 | 3390 | ||
3584 | lock (m_primFullUpdates.SyncRoot) | 3391 | lock (m_primFullUpdates.SyncRoot) |
3585 | m_primFullUpdates.Enqueue(data.priority, objectData, data.localID); | 3392 | m_primFullUpdates.Enqueue(data.priority, objectData, data.localID); |
3586 | } | 3393 | } |
3587 | 3394 | ||
3588 | void HandleQueueEmpty(ThrottleOutPacketType queue) | ||
3589 | { | ||
3590 | switch (queue) | ||
3591 | { | ||
3592 | case ThrottleOutPacketType.Texture: | ||
3593 | ProcessTextureRequests(); | ||
3594 | break; | ||
3595 | case ThrottleOutPacketType.Task: | ||
3596 | if (Monitor.TryEnter(m_avatarTerseUpdates.SyncRoot, 1)) | ||
3597 | { | ||
3598 | try | ||
3599 | { | ||
3600 | if (m_avatarTerseUpdates.Count > 0) | ||
3601 | { | ||
3602 | |||
3603 | ProcessAvatarTerseUpdates(); | ||
3604 | return; | ||
3605 | } | ||
3606 | } | ||
3607 | finally { Monitor.Exit(m_avatarTerseUpdates.SyncRoot); } | ||
3608 | } | ||
3609 | break; | ||
3610 | case ThrottleOutPacketType.State: | ||
3611 | if (Monitor.TryEnter(m_primFullUpdates.SyncRoot, 1)) | ||
3612 | { | ||
3613 | try | ||
3614 | { | ||
3615 | if (m_primFullUpdates.Count > 0) | ||
3616 | { | ||
3617 | ProcessPrimFullUpdates(); | ||
3618 | return; | ||
3619 | } | ||
3620 | } | ||
3621 | finally { Monitor.Exit(m_primFullUpdates.SyncRoot); } | ||
3622 | } | ||
3623 | |||
3624 | if (Monitor.TryEnter(m_primTerseUpdates.SyncRoot, 1)) | ||
3625 | { | ||
3626 | try | ||
3627 | { | ||
3628 | if (m_primTerseUpdates.Count > 0) | ||
3629 | { | ||
3630 | ProcessPrimTerseUpdates(); | ||
3631 | return; | ||
3632 | } | ||
3633 | } | ||
3634 | finally { Monitor.Exit(m_primTerseUpdates.SyncRoot); } | ||
3635 | } | ||
3636 | break; | ||
3637 | } | ||
3638 | } | ||
3639 | |||
3640 | void ProcessTextureRequests() | ||
3641 | { | ||
3642 | if (m_imageManager != null) | ||
3643 | m_imageManager.ProcessImageQueue(m_textureSendLimit); | ||
3644 | } | ||
3645 | |||
3646 | void ProcessPrimFullUpdates() | 3395 | void ProcessPrimFullUpdates() |
3647 | { | 3396 | { |
3648 | ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | 3397 | ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
@@ -3666,33 +3415,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3666 | OutPacket(outPacket, ThrottleOutPacketType.State); | 3415 | OutPacket(outPacket, ThrottleOutPacketType.State); |
3667 | } | 3416 | } |
3668 | 3417 | ||
3669 | /// <summary> | ||
3670 | /// | ||
3671 | /// </summary> | ||
3672 | //public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, | ||
3673 | // Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID ownerID, int attachPoint) | ||
3674 | public void SendPrimTerseUpdate(SendPrimitiveTerseData data) | 3418 | public void SendPrimTerseUpdate(SendPrimitiveTerseData data) |
3675 | { | 3419 | { |
3676 | if (data.priority == double.NaN) | 3420 | if (data.Priority == double.NaN) |
3677 | { | 3421 | { |
3678 | m_log.Error("[LLClientView] SendPrimTerseUpdate received a NaN priority, dropping update"); | 3422 | m_log.Error("[LLClientView] SendPrimTerseUpdate received a NaN priority, dropping update"); |
3679 | return; | 3423 | return; |
3680 | } | 3424 | } |
3681 | 3425 | ||
3682 | Quaternion rotation = data.rotation; | 3426 | Quaternion rotation = data.Rotation; |
3683 | 3427 | ||
3684 | if (data.attachPoint > 30 && data.owner != AgentId) // Someone else's HUD | 3428 | if (data.AttachPoint > 30 && data.OwnerID != AgentId) // Someone else's HUD |
3685 | return; | 3429 | return; |
3686 | 3430 | ||
3687 | if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) | 3431 | if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) |
3688 | rotation = Quaternion.Identity; | 3432 | rotation = Quaternion.Identity; |
3689 | 3433 | ||
3690 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock objectData = | 3434 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock objectData = CreateImprovedTerseBlock(data); |
3691 | CreatePrimImprovedBlock(data.localID, data.position, rotation, | ||
3692 | data.velocity, data.rotationalvelocity, data.state); | ||
3693 | 3435 | ||
3694 | lock (m_primTerseUpdates.SyncRoot) | 3436 | lock (m_primTerseUpdates.SyncRoot) |
3695 | m_primTerseUpdates.Enqueue(data.priority, objectData, data.localID); | 3437 | m_primTerseUpdates.Enqueue(data.Priority, objectData, data.LocalID); |
3696 | } | 3438 | } |
3697 | 3439 | ||
3698 | void ProcessPrimTerseUpdates() | 3440 | void ProcessPrimTerseUpdates() |
@@ -3733,17 +3475,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3733 | return priority != double.NaN; | 3475 | return priority != double.NaN; |
3734 | }; | 3476 | }; |
3735 | 3477 | ||
3736 | if ((type & StateUpdateTypes.AvatarTerse) != 0) { | 3478 | if ((type & StateUpdateTypes.AvatarTerse) != 0) |
3479 | { | ||
3737 | lock (m_avatarTerseUpdates.SyncRoot) | 3480 | lock (m_avatarTerseUpdates.SyncRoot) |
3738 | m_avatarTerseUpdates.Reprioritize(terse_update_priority_handler); | 3481 | m_avatarTerseUpdates.Reprioritize(terse_update_priority_handler); |
3739 | } | 3482 | } |
3740 | 3483 | ||
3741 | if ((type & StateUpdateTypes.PrimitiveFull) != 0) { | 3484 | if ((type & StateUpdateTypes.PrimitiveFull) != 0) |
3485 | { | ||
3742 | lock (m_primFullUpdates.SyncRoot) | 3486 | lock (m_primFullUpdates.SyncRoot) |
3743 | m_primFullUpdates.Reprioritize(update_priority_handler); | 3487 | m_primFullUpdates.Reprioritize(update_priority_handler); |
3744 | } | 3488 | } |
3745 | 3489 | ||
3746 | if ((type & StateUpdateTypes.PrimitiveTerse) != 0) { | 3490 | if ((type & StateUpdateTypes.PrimitiveTerse) != 0) |
3491 | { | ||
3747 | lock (m_primTerseUpdates.SyncRoot) | 3492 | lock (m_primTerseUpdates.SyncRoot) |
3748 | m_primTerseUpdates.Reprioritize(terse_update_priority_handler); | 3493 | m_primTerseUpdates.Reprioritize(terse_update_priority_handler); |
3749 | } | 3494 | } |
@@ -3765,6 +3510,90 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3765 | } | 3510 | } |
3766 | } | 3511 | } |
3767 | 3512 | ||
3513 | #endregion Primitive Packet/Data Sending Methods | ||
3514 | |||
3515 | /// <summary> | ||
3516 | /// | ||
3517 | /// </summary> | ||
3518 | /// <param name="localID"></param> | ||
3519 | /// <param name="rotation"></param> | ||
3520 | /// <param name="attachPoint"></param> | ||
3521 | public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID) | ||
3522 | { | ||
3523 | if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD | ||
3524 | return; | ||
3525 | |||
3526 | ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); | ||
3527 | // TODO: don't create new blocks if recycling an old packet | ||
3528 | attach.AgentData.AgentID = AgentId; | ||
3529 | attach.AgentData.SessionID = m_sessionId; | ||
3530 | attach.AgentData.AttachmentPoint = attachPoint; | ||
3531 | attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; | ||
3532 | attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); | ||
3533 | attach.ObjectData[0].ObjectLocalID = localID; | ||
3534 | attach.ObjectData[0].Rotation = rotation; | ||
3535 | attach.Header.Zerocoded = true; | ||
3536 | OutPacket(attach, ThrottleOutPacketType.Task); | ||
3537 | } | ||
3538 | |||
3539 | void HandleQueueEmpty(ThrottleOutPacketType queue) | ||
3540 | { | ||
3541 | switch (queue) | ||
3542 | { | ||
3543 | case ThrottleOutPacketType.Texture: | ||
3544 | ProcessTextureRequests(); | ||
3545 | break; | ||
3546 | case ThrottleOutPacketType.Task: | ||
3547 | if (Monitor.TryEnter(m_avatarTerseUpdates.SyncRoot, 1)) | ||
3548 | { | ||
3549 | try | ||
3550 | { | ||
3551 | if (m_avatarTerseUpdates.Count > 0) | ||
3552 | { | ||
3553 | |||
3554 | ProcessAvatarTerseUpdates(); | ||
3555 | return; | ||
3556 | } | ||
3557 | } | ||
3558 | finally { Monitor.Exit(m_avatarTerseUpdates.SyncRoot); } | ||
3559 | } | ||
3560 | break; | ||
3561 | case ThrottleOutPacketType.State: | ||
3562 | if (Monitor.TryEnter(m_primFullUpdates.SyncRoot, 1)) | ||
3563 | { | ||
3564 | try | ||
3565 | { | ||
3566 | if (m_primFullUpdates.Count > 0) | ||
3567 | { | ||
3568 | ProcessPrimFullUpdates(); | ||
3569 | return; | ||
3570 | } | ||
3571 | } | ||
3572 | finally { Monitor.Exit(m_primFullUpdates.SyncRoot); } | ||
3573 | } | ||
3574 | |||
3575 | if (Monitor.TryEnter(m_primTerseUpdates.SyncRoot, 1)) | ||
3576 | { | ||
3577 | try | ||
3578 | { | ||
3579 | if (m_primTerseUpdates.Count > 0) | ||
3580 | { | ||
3581 | ProcessPrimTerseUpdates(); | ||
3582 | return; | ||
3583 | } | ||
3584 | } | ||
3585 | finally { Monitor.Exit(m_primTerseUpdates.SyncRoot); } | ||
3586 | } | ||
3587 | break; | ||
3588 | } | ||
3589 | } | ||
3590 | |||
3591 | void ProcessTextureRequests() | ||
3592 | { | ||
3593 | if (m_imageManager != null) | ||
3594 | m_imageManager.ProcessImageQueue(m_textureSendLimit); | ||
3595 | } | ||
3596 | |||
3768 | public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) | 3597 | public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) |
3769 | { | 3598 | { |
3770 | AssetUploadCompletePacket newPack = new AssetUploadCompletePacket(); | 3599 | AssetUploadCompletePacket newPack = new AssetUploadCompletePacket(); |
@@ -3946,8 +3775,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3946 | OutPacket(proper, ThrottleOutPacketType.Task); | 3775 | OutPacket(proper, ThrottleOutPacketType.Task); |
3947 | } | 3776 | } |
3948 | 3777 | ||
3949 | #endregion | ||
3950 | |||
3951 | #region Estate Data Sending Methods | 3778 | #region Estate Data Sending Methods |
3952 | 3779 | ||
3953 | private static bool convertParamStringToBool(byte[] field) | 3780 | private static bool convertParamStringToBool(byte[] field) |
@@ -4354,325 +4181,221 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4354 | 4181 | ||
4355 | #region Helper Methods | 4182 | #region Helper Methods |
4356 | 4183 | ||
4357 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, Vector3 pos, | 4184 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(SendAvatarTerseData data) |
4358 | Vector3 velocity, | ||
4359 | Quaternion rotation) | ||
4360 | { | 4185 | { |
4361 | byte[] bytes = new byte[60]; | 4186 | return CreateImprovedTerseBlock(true, data.LocalID, 0, data.CollisionPlane, data.Position, data.Velocity, |
4362 | int i = 0; | 4187 | data.Acceleration, data.Rotation, Vector3.Zero, data.TextureEntry); |
4363 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = PacketPool.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); | ||
4364 | |||
4365 | dat.TextureEntry = new byte[0]; // AvatarTemplate.TextureEntry; | ||
4366 | |||
4367 | uint ID = localID; | ||
4368 | |||
4369 | bytes[i++] = (byte)(ID % 256); | ||
4370 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
4371 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
4372 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
4373 | bytes[i++] = 0; | ||
4374 | bytes[i++] = 1; | ||
4375 | i += 14; | ||
4376 | bytes[i++] = 128; | ||
4377 | bytes[i++] = 63; | ||
4378 | |||
4379 | byte[] pb = pos.GetBytes(); | ||
4380 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
4381 | i += 12; | ||
4382 | |||
4383 | Vector3 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); | ||
4384 | |||
4385 | internDirec = internDirec / 128.0f; | ||
4386 | internDirec.X += 1; | ||
4387 | internDirec.Y += 1; | ||
4388 | internDirec.Z += 1; | ||
4389 | |||
4390 | ushort InternVelocityX = (ushort)(32768 * internDirec.X); | ||
4391 | ushort InternVelocityY = (ushort)(32768 * internDirec.Y); | ||
4392 | ushort InternVelocityZ = (ushort)(32768 * internDirec.Z); | ||
4393 | |||
4394 | ushort ac = 32767; | ||
4395 | bytes[i++] = (byte)(InternVelocityX % 256); | ||
4396 | bytes[i++] = (byte)((InternVelocityX >> 8) % 256); | ||
4397 | bytes[i++] = (byte)(InternVelocityY % 256); | ||
4398 | bytes[i++] = (byte)((InternVelocityY >> 8) % 256); | ||
4399 | bytes[i++] = (byte)(InternVelocityZ % 256); | ||
4400 | bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); | ||
4401 | |||
4402 | //accel | ||
4403 | bytes[i++] = (byte)(ac % 256); | ||
4404 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4405 | bytes[i++] = (byte)(ac % 256); | ||
4406 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4407 | bytes[i++] = (byte)(ac % 256); | ||
4408 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4409 | |||
4410 | //rotation | ||
4411 | ushort rw, rx, ry, rz; | ||
4412 | rw = (ushort)(32768 * (rotation.W + 1)); | ||
4413 | rx = (ushort)(32768 * (rotation.X + 1)); | ||
4414 | ry = (ushort)(32768 * (rotation.Y + 1)); | ||
4415 | rz = (ushort)(32768 * (rotation.Z + 1)); | ||
4416 | |||
4417 | //rot | ||
4418 | bytes[i++] = (byte)(rx % 256); | ||
4419 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
4420 | bytes[i++] = (byte)(ry % 256); | ||
4421 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
4422 | bytes[i++] = (byte)(rz % 256); | ||
4423 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
4424 | bytes[i++] = (byte)(rw % 256); | ||
4425 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
4426 | |||
4427 | //rotation vel | ||
4428 | bytes[i++] = (byte)(ac % 256); | ||
4429 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4430 | bytes[i++] = (byte)(ac % 256); | ||
4431 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4432 | bytes[i++] = (byte)(ac % 256); | ||
4433 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4434 | |||
4435 | dat.Data = bytes; | ||
4436 | |||
4437 | return (dat); | ||
4438 | } | 4188 | } |
4439 | 4189 | ||
4440 | /// <summary> | 4190 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(SendPrimitiveTerseData data) |
4441 | /// | ||
4442 | /// </summary> | ||
4443 | /// <param name="localID"></param> | ||
4444 | /// <param name="position"></param> | ||
4445 | /// <param name="rotation"></param> | ||
4446 | /// <returns></returns> | ||
4447 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, | ||
4448 | Vector3 position, | ||
4449 | Quaternion rotation, | ||
4450 | Vector3 velocity, | ||
4451 | Vector3 rotationalvelocity, | ||
4452 | byte state) | ||
4453 | { | 4191 | { |
4454 | uint ID = localID; | 4192 | return CreateImprovedTerseBlock(false, data.LocalID, data.State, Vector4.Zero, data.Position, data.Velocity, |
4455 | byte[] bytes = new byte[60]; | 4193 | data.Acceleration, data.Rotation, data.AngularVelocity, data.TextureEntry); |
4456 | |||
4457 | int i = 0; | ||
4458 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = PacketPool.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); | ||
4459 | dat.TextureEntry = new byte[0]; | ||
4460 | bytes[i++] = (byte)(ID % 256); | ||
4461 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
4462 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
4463 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
4464 | bytes[i++] = (byte)(((state & 0xf0) >> 4) | ((state & 0x0f) << 4)); | ||
4465 | bytes[i++] = 0; | ||
4466 | |||
4467 | byte[] pb = position.GetBytes(); | ||
4468 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
4469 | i += 12; | ||
4470 | ushort ac = 32767; | ||
4471 | |||
4472 | ushort velx, vely, velz; | ||
4473 | Vector3 vel = new Vector3(velocity.X, velocity.Y, velocity.Z); | ||
4474 | |||
4475 | vel = vel / 128.0f; | ||
4476 | vel.X += 1; | ||
4477 | vel.Y += 1; | ||
4478 | vel.Z += 1; | ||
4479 | //vel | ||
4480 | velx = (ushort)(32768 * (vel.X)); | ||
4481 | vely = (ushort)(32768 * (vel.Y)); | ||
4482 | velz = (ushort)(32768 * (vel.Z)); | ||
4483 | |||
4484 | bytes[i++] = (byte)(velx % 256); | ||
4485 | bytes[i++] = (byte)((velx >> 8) % 256); | ||
4486 | bytes[i++] = (byte)(vely % 256); | ||
4487 | bytes[i++] = (byte)((vely >> 8) % 256); | ||
4488 | bytes[i++] = (byte)(velz % 256); | ||
4489 | bytes[i++] = (byte)((velz >> 8) % 256); | ||
4490 | |||
4491 | //accel | ||
4492 | bytes[i++] = (byte)(ac % 256); | ||
4493 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4494 | bytes[i++] = (byte)(ac % 256); | ||
4495 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4496 | bytes[i++] = (byte)(ac % 256); | ||
4497 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
4498 | |||
4499 | ushort rw, rx, ry, rz; | ||
4500 | rw = (ushort)(32768 * (rotation.W + 1)); | ||
4501 | rx = (ushort)(32768 * (rotation.X + 1)); | ||
4502 | ry = (ushort)(32768 * (rotation.Y + 1)); | ||
4503 | rz = (ushort)(32768 * (rotation.Z + 1)); | ||
4504 | |||
4505 | //rot | ||
4506 | bytes[i++] = (byte)(rx % 256); | ||
4507 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
4508 | bytes[i++] = (byte)(ry % 256); | ||
4509 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
4510 | bytes[i++] = (byte)(rz % 256); | ||
4511 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
4512 | bytes[i++] = (byte)(rw % 256); | ||
4513 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
4514 | |||
4515 | //rotation vel | ||
4516 | Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z); | ||
4517 | |||
4518 | rvel = rvel / 128.0f; | ||
4519 | rvel.X += 1; | ||
4520 | rvel.Y += 1; | ||
4521 | rvel.Z += 1; | ||
4522 | //vel | ||
4523 | ushort rvelx = (ushort)(32768 * (rvel.X)); | ||
4524 | ushort rvely = (ushort)(32768 * (rvel.Y)); | ||
4525 | ushort rvelz = (ushort)(32768 * (rvel.Z)); | ||
4526 | |||
4527 | bytes[i++] = (byte)(rvelx % 256); | ||
4528 | bytes[i++] = (byte)((rvelx >> 8) % 256); | ||
4529 | bytes[i++] = (byte)(rvely % 256); | ||
4530 | bytes[i++] = (byte)((rvely >> 8) % 256); | ||
4531 | bytes[i++] = (byte)(rvelz % 256); | ||
4532 | bytes[i++] = (byte)((rvelz >> 8) % 256); | ||
4533 | dat.Data = bytes; | ||
4534 | |||
4535 | return dat; | ||
4536 | } | 4194 | } |
4537 | 4195 | ||
4538 | /// <summary> | 4196 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(bool avatar, uint localID, byte state, |
4539 | /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive) | 4197 | Vector4 collisionPlane, Vector3 position, Vector3 velocity, Vector3 acceleration, Quaternion rotation, |
4540 | /// </summary> | 4198 | Vector3 angularVelocity, byte[] textureEntry) |
4541 | /// <param name="primData"></param> | 4199 | { |
4542 | /// <returns></returns> | 4200 | int pos = 0; |
4543 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags) | 4201 | byte[] data = new byte[(avatar ? 60 : 44)]; |
4544 | { | 4202 | |
4545 | ObjectUpdatePacket.ObjectDataBlock objupdate = PacketPool.GetDataBlock<ObjectUpdatePacket.ObjectDataBlock>(); | 4203 | // LocalID |
4546 | SetDefaultPrimPacketValues(objupdate); | 4204 | Utils.UIntToBytes(localID, data, pos); |
4547 | objupdate.UpdateFlags = flags; | 4205 | pos += 4; |
4548 | SetPrimPacketShapeData(objupdate, primShape); | 4206 | |
4549 | 4207 | // Avatar/CollisionPlane | |
4550 | if ((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)) | 4208 | data[pos++] = state; |
4551 | { | 4209 | if (avatar) |
4552 | objupdate.Data = new byte[1]; | 4210 | { |
4553 | objupdate.Data[0] = primShape.State; | 4211 | data[pos++] = 1; |
4554 | } | 4212 | |
4555 | return objupdate; | 4213 | if (collisionPlane == Vector4.Zero) |
4556 | } | 4214 | collisionPlane = Vector4.UnitW; |
4557 | 4215 | ||
4558 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) | 4216 | collisionPlane.ToBytes(data, pos); |
4559 | { | 4217 | pos += 16; |
4560 | objectData.TextureEntry = primData.TextureEntry; | 4218 | } |
4561 | objectData.PCode = primData.PCode; | 4219 | else |
4562 | objectData.State = primData.State; | 4220 | { |
4563 | objectData.PathBegin = primData.PathBegin; | 4221 | ++pos; |
4564 | objectData.PathEnd = primData.PathEnd; | 4222 | } |
4565 | objectData.PathScaleX = primData.PathScaleX; | 4223 | |
4566 | objectData.PathScaleY = primData.PathScaleY; | 4224 | // Position |
4567 | objectData.PathShearX = primData.PathShearX; | 4225 | position.ToBytes(data, pos); |
4568 | objectData.PathShearY = primData.PathShearY; | 4226 | pos += 12; |
4569 | objectData.PathSkew = primData.PathSkew; | 4227 | |
4570 | objectData.ProfileBegin = primData.ProfileBegin; | 4228 | // Velocity |
4571 | objectData.ProfileEnd = primData.ProfileEnd; | 4229 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.X, -128.0f, 128.0f), data, pos); pos += 2; |
4572 | objectData.Scale = primData.Scale; | 4230 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.Y, -128.0f, 128.0f), data, pos); pos += 2; |
4573 | objectData.PathCurve = primData.PathCurve; | 4231 | Utils.UInt16ToBytes(Utils.FloatToUInt16(velocity.Z, -128.0f, 128.0f), data, pos); pos += 2; |
4574 | objectData.ProfileCurve = primData.ProfileCurve; | 4232 | |
4575 | objectData.ProfileHollow = primData.ProfileHollow; | 4233 | // Acceleration |
4576 | objectData.PathRadiusOffset = primData.PathRadiusOffset; | 4234 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.X, -64.0f, 64.0f), data, pos); pos += 2; |
4577 | objectData.PathRevolutions = primData.PathRevolutions; | 4235 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.Y, -64.0f, 64.0f), data, pos); pos += 2; |
4578 | objectData.PathTaperX = primData.PathTaperX; | 4236 | Utils.UInt16ToBytes(Utils.FloatToUInt16(acceleration.Z, -64.0f, 64.0f), data, pos); pos += 2; |
4579 | objectData.PathTaperY = primData.PathTaperY; | 4237 | |
4580 | objectData.PathTwist = primData.PathTwist; | 4238 | // Rotation |
4581 | objectData.PathTwistBegin = primData.PathTwistBegin; | 4239 | Utils.UInt16ToBytes(Utils.FloatToUInt16(rotation.X, -1.0f, 1.0f), data, pos); pos += 2; |
4582 | objectData.ExtraParams = primData.ExtraParams; | 4240 | Utils.UInt16ToBytes(Utils.FloatToUInt16(rotation.Y, -1.0f, 1.0f), data, pos); pos += 2; |
4241 | Utils.UInt16ToBytes(Utils.FloatToUInt16(rotation.Z, -1.0f, 1.0f), data, pos); pos += 2; | ||
4242 | Utils.UInt16ToBytes(Utils.FloatToUInt16(rotation.W, -1.0f, 1.0f), data, pos); pos += 2; | ||
4243 | |||
4244 | // Angular Velocity | ||
4245 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.X, -64.0f, 64.0f), data, pos); pos += 2; | ||
4246 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Y, -64.0f, 64.0f), data, pos); pos += 2; | ||
4247 | Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Z, -64.0f, 64.0f), data, pos); pos += 2; | ||
4248 | |||
4249 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
4250 | block.Data = data; | ||
4251 | |||
4252 | if (textureEntry != null && textureEntry.Length > 0) | ||
4253 | { | ||
4254 | byte[] teBytesFinal = new byte[textureEntry.Length + 4]; | ||
4255 | |||
4256 | // Texture Length | ||
4257 | Utils.IntToBytes(textureEntry.Length, textureEntry, 0); | ||
4258 | // Texture | ||
4259 | Buffer.BlockCopy(textureEntry, 0, teBytesFinal, 4, textureEntry.Length); | ||
4260 | |||
4261 | block.TextureEntry = teBytesFinal; | ||
4262 | } | ||
4263 | else | ||
4264 | { | ||
4265 | block.TextureEntry = Utils.EmptyBytes; | ||
4266 | } | ||
4267 | |||
4268 | return block; | ||
4583 | } | 4269 | } |
4584 | 4270 | ||
4585 | /// <summary> | 4271 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(SendAvatarData data) |
4586 | /// Set some default values in a ObjectUpdatePacket | 4272 | { |
4587 | /// </summary> | 4273 | byte[] objectData = new byte[60]; |
4588 | /// <param name="objdata"></param> | 4274 | data.Position.ToBytes(objectData, 0); |
4589 | protected void SetDefaultPrimPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) | 4275 | //data.Velocity.ToBytes(objectData, 12); |
4590 | { | 4276 | //data.Acceleration.ToBytes(objectData, 24); |
4591 | objdata.PSBlock = new byte[0]; | 4277 | data.Rotation.ToBytes(objectData, 36); |
4592 | objdata.ExtraParams = new byte[1]; | 4278 | //data.AngularVelocity.ToBytes(objectData, 48); |
4593 | objdata.MediaURL = new byte[0]; | 4279 | |
4594 | objdata.NameValue = new byte[0]; | 4280 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
4595 | objdata.Text = new byte[0]; | 4281 | |
4596 | objdata.TextColor = new byte[4]; | 4282 | update.Data = Utils.EmptyBytes; |
4597 | objdata.JointAxisOrAnchor = new Vector3(0, 0, 0); | 4283 | update.ExtraParams = new byte[1]; |
4598 | objdata.JointPivot = new Vector3(0, 0, 0); | 4284 | update.FullID = data.AvatarID; |
4599 | objdata.Material = 3; | 4285 | update.ID = data.AvatarLocalID; |
4600 | objdata.TextureAnim = new byte[0]; | 4286 | update.Material = (byte)Material.Flesh; |
4601 | objdata.Sound = UUID.Zero; | 4287 | update.MediaURL = Utils.EmptyBytes; |
4602 | objdata.State = 0; | 4288 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.FirstName + "\nLastName STRING RW SV " + |
4603 | objdata.Data = new byte[0]; | 4289 | data.LastName + "\nTitle STRING RW SV " + data.GroupTitle); |
4604 | 4290 | update.ObjectData = objectData; | |
4605 | objdata.ObjectData = new byte[60]; | 4291 | update.ParentID = data.ParentID; |
4606 | objdata.ObjectData[46] = 128; | 4292 | update.PathCurve = 16; |
4607 | objdata.ObjectData[47] = 63; | 4293 | update.PathScaleX = 100; |
4294 | update.PathScaleY = 100; | ||
4295 | update.PCode = (byte)PCode.Avatar; | ||
4296 | update.ProfileCurve = 1; | ||
4297 | update.PSBlock = Utils.EmptyBytes; | ||
4298 | update.Scale = Vector3.One; | ||
4299 | update.Text = Utils.EmptyBytes; | ||
4300 | update.TextColor = new byte[4]; | ||
4301 | update.TextureAnim = Utils.EmptyBytes; | ||
4302 | update.TextureEntry = data.TextureEntry ?? Utils.EmptyBytes; | ||
4303 | update.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); // TODO: Replace these numbers with PrimFlags | ||
4304 | |||
4305 | return update; | ||
4608 | } | 4306 | } |
4609 | 4307 | ||
4610 | /// <summary> | 4308 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SendPrimitiveData data) |
4611 | /// | ||
4612 | /// </summary> | ||
4613 | /// <returns></returns> | ||
4614 | public ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) | ||
4615 | { | 4309 | { |
4616 | ObjectUpdatePacket.ObjectDataBlock objdata = PacketPool.GetDataBlock<ObjectUpdatePacket.ObjectDataBlock>(); | 4310 | byte[] objectData = new byte[60]; |
4617 | // new OpenMetaverse.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | 4311 | data.pos.ToBytes(objectData, 0); |
4312 | data.vel.ToBytes(objectData, 12); | ||
4313 | data.acc.ToBytes(objectData, 24); | ||
4314 | data.rotation.ToBytes(objectData, 36); | ||
4315 | data.rvel.ToBytes(objectData, 48); | ||
4618 | 4316 | ||
4619 | SetDefaultAvatarPacketValues(ref objdata); | 4317 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
4620 | objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); | 4318 | update.ClickAction = (byte)data.clickAction; |
4621 | objdata.PathCurve = 16; | 4319 | update.CRC = 0; |
4622 | objdata.ProfileCurve = 1; | 4320 | update.ExtraParams = data.primShape.ExtraParams ?? Utils.EmptyBytes; |
4623 | objdata.PathScaleX = 100; | 4321 | update.FullID = data.objectID; |
4624 | objdata.PathScaleY = 100; | 4322 | update.ID = data.localID; |
4625 | objdata.ParentID = 0; | 4323 | //update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated |
4626 | objdata.OwnerID = UUID.Zero; | 4324 | //update.JointPivot = Vector3.Zero; |
4627 | objdata.Scale = new Vector3(1, 1, 1); | 4325 | //update.JointType = 0; |
4628 | objdata.PCode = (byte)PCode.Avatar; | 4326 | update.Material = data.material; |
4629 | if (textureEntry != null) | 4327 | update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim |
4328 | if (data.attachment) | ||
4630 | { | 4329 | { |
4631 | objdata.TextureEntry = textureEntry; | 4330 | update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.AssetId); |
4331 | update.State = (byte)((data.AttachPoint % 16) * 16 + (data.AttachPoint / 16)); | ||
4332 | } | ||
4333 | else | ||
4334 | { | ||
4335 | update.NameValue = Utils.EmptyBytes; | ||
4336 | update.State = data.primShape.State; | ||
4337 | } | ||
4338 | update.ObjectData = objectData; | ||
4339 | update.ParentID = data.parentID; | ||
4340 | update.PathBegin = data.primShape.PathBegin; | ||
4341 | update.PathCurve = data.primShape.PathCurve; | ||
4342 | update.PathEnd = data.primShape.PathEnd; | ||
4343 | update.PathRadiusOffset = data.primShape.PathRadiusOffset; | ||
4344 | update.PathRevolutions = data.primShape.PathRevolutions; | ||
4345 | update.PathScaleX = data.primShape.PathScaleX; | ||
4346 | update.PathScaleY = data.primShape.PathScaleY; | ||
4347 | update.PathShearX = data.primShape.PathShearX; | ||
4348 | update.PathShearY = data.primShape.PathShearY; | ||
4349 | update.PathSkew = data.primShape.PathSkew; | ||
4350 | update.PathTaperX = data.primShape.PathTaperX; | ||
4351 | update.PathTaperY = data.primShape.PathTaperY; | ||
4352 | update.PathTwist = data.primShape.PathTwist; | ||
4353 | update.PathTwistBegin = data.primShape.PathTwistBegin; | ||
4354 | update.PCode = data.primShape.PCode; | ||
4355 | update.ProfileBegin = data.primShape.ProfileBegin; | ||
4356 | update.ProfileCurve = data.primShape.ProfileCurve; | ||
4357 | update.ProfileEnd = data.primShape.ProfileEnd; | ||
4358 | update.ProfileHollow = data.primShape.ProfileHollow; | ||
4359 | update.PSBlock = data.particleSystem ?? Utils.EmptyBytes; | ||
4360 | update.TextColor = data.color ?? Color4.Black.GetBytes(true); | ||
4361 | update.TextureAnim = data.textureanim ?? Utils.EmptyBytes; | ||
4362 | update.TextureEntry = data.primShape.TextureEntry ?? Utils.EmptyBytes; | ||
4363 | update.Scale = data.primShape.Scale; | ||
4364 | update.Text = Util.StringToBytes256(data.text); | ||
4365 | update.UpdateFlags = (uint)data.flags; | ||
4366 | |||
4367 | if (data.SoundId != UUID.Zero) | ||
4368 | { | ||
4369 | update.Sound = data.SoundId; | ||
4370 | update.OwnerID = data.ownerID; | ||
4371 | update.Gain = (float)data.SoundVolume; | ||
4372 | update.Radius = (float)data.SoundRadius; | ||
4373 | update.Flags = data.SoundFlags; | ||
4374 | } | ||
4375 | |||
4376 | switch ((PCode)data.primShape.PCode) | ||
4377 | { | ||
4378 | case PCode.Grass: | ||
4379 | case PCode.Tree: | ||
4380 | case PCode.NewTree: | ||
4381 | update.Data = new byte[] { data.primShape.State }; | ||
4382 | break; | ||
4383 | default: | ||
4384 | // TODO: Support ScratchPad | ||
4385 | //if (prim.ScratchPad != null) | ||
4386 | //{ | ||
4387 | // update.Data = new byte[prim.ScratchPad.Length]; | ||
4388 | // Buffer.BlockCopy(prim.ScratchPad, 0, update.Data, 0, update.Data.Length); | ||
4389 | //} | ||
4390 | //else | ||
4391 | //{ | ||
4392 | // update.Data = Utils.EmptyBytes; | ||
4393 | //} | ||
4394 | update.Data = Utils.EmptyBytes; | ||
4395 | break; | ||
4632 | } | 4396 | } |
4633 | Vector3 pos = new Vector3(objdata.ObjectData, 16); | ||
4634 | pos.X = 100f; | ||
4635 | objdata.ID = 8880000; | ||
4636 | objdata.NameValue = Utils.StringToBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User "); | ||
4637 | //Vector3 pos2 = new Vector3(100f, 100f, 23f); | ||
4638 | //objdata.FullID=user.AgentId; | ||
4639 | byte[] pb = pos.GetBytes(); | ||
4640 | Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); | ||
4641 | |||
4642 | return objdata; | ||
4643 | } | ||
4644 | 4397 | ||
4645 | /// <summary> | 4398 | return update; |
4646 | /// | ||
4647 | /// </summary> | ||
4648 | /// <param name="objdata"></param> | ||
4649 | protected void SetDefaultAvatarPacketValues(ref ObjectUpdatePacket.ObjectDataBlock objdata) | ||
4650 | { | ||
4651 | objdata.PSBlock = new byte[0]; | ||
4652 | objdata.ExtraParams = new byte[1]; | ||
4653 | objdata.MediaURL = new byte[0]; | ||
4654 | objdata.NameValue = new byte[0]; | ||
4655 | objdata.Text = new byte[0]; | ||
4656 | objdata.TextColor = new byte[4]; | ||
4657 | objdata.JointAxisOrAnchor = new Vector3(0, 0, 0); | ||
4658 | objdata.JointPivot = new Vector3(0, 0, 0); | ||
4659 | objdata.Material = 4; | ||
4660 | objdata.TextureAnim = new byte[0]; | ||
4661 | objdata.Sound = UUID.Zero; | ||
4662 | Primitive.TextureEntry ntex = new Primitive.TextureEntry(new UUID("00000000-0000-0000-5005-000000000005")); | ||
4663 | objdata.TextureEntry = ntex.GetBytes(); | ||
4664 | |||
4665 | objdata.State = 0; | ||
4666 | objdata.Data = new byte[0]; | ||
4667 | |||
4668 | objdata.ObjectData = new byte[76]; | ||
4669 | objdata.ObjectData[15] = 128; | ||
4670 | objdata.ObjectData[16] = 63; | ||
4671 | objdata.ObjectData[56] = 128; | ||
4672 | objdata.ObjectData[61] = 102; | ||
4673 | objdata.ObjectData[62] = 40; | ||
4674 | objdata.ObjectData[63] = 61; | ||
4675 | objdata.ObjectData[64] = 189; | ||
4676 | } | 4399 | } |
4677 | 4400 | ||
4678 | public void SendNameReply(UUID profileId, string firstname, string lastname) | 4401 | public void SendNameReply(UUID profileId, string firstname, string lastname) |
@@ -4682,8 +4405,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4682 | packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; | 4405 | packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; |
4683 | packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); | 4406 | packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); |
4684 | packet.UUIDNameBlock[0].ID = profileId; | 4407 | packet.UUIDNameBlock[0].ID = profileId; |
4685 | packet.UUIDNameBlock[0].FirstName = Utils.StringToBytes(firstname); | 4408 | packet.UUIDNameBlock[0].FirstName = Util.StringToBytes256(firstname); |
4686 | packet.UUIDNameBlock[0].LastName = Utils.StringToBytes(lastname); | 4409 | packet.UUIDNameBlock[0].LastName = Util.StringToBytes256(lastname); |
4687 | 4410 | ||
4688 | OutPacket(packet, ThrottleOutPacketType.Task); | 4411 | OutPacket(packet, ThrottleOutPacketType.Task); |
4689 | } | 4412 | } |
@@ -4879,8 +4602,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4879 | scriptQuestion.Data.TaskID = taskID; | 4602 | scriptQuestion.Data.TaskID = taskID; |
4880 | scriptQuestion.Data.ItemID = itemID; | 4603 | scriptQuestion.Data.ItemID = itemID; |
4881 | scriptQuestion.Data.Questions = question; | 4604 | scriptQuestion.Data.Questions = question; |
4882 | scriptQuestion.Data.ObjectName = Utils.StringToBytes(taskName); | 4605 | scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName); |
4883 | scriptQuestion.Data.ObjectOwner = Utils.StringToBytes(ownerName); | 4606 | scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName); |
4884 | 4607 | ||
4885 | OutPacket(scriptQuestion, ThrottleOutPacketType.Task); | 4608 | OutPacket(scriptQuestion, ThrottleOutPacketType.Task); |
4886 | } | 4609 | } |
@@ -5274,7 +4997,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5274 | if (m_moneyBalance + debit >= 0) | 4997 | if (m_moneyBalance + debit >= 0) |
5275 | { | 4998 | { |
5276 | m_moneyBalance += debit; | 4999 | m_moneyBalance += debit; |
5277 | SendMoneyBalance(UUID.Zero, true, Utils.StringToBytes("Poof Poof!"), m_moneyBalance); | 5000 | SendMoneyBalance(UUID.Zero, true, Util.StringToBytes256("Poof Poof!"), m_moneyBalance); |
5278 | return true; | 5001 | return true; |
5279 | } | 5002 | } |
5280 | return false; | 5003 | return false; |
@@ -9218,7 +8941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9218 | new GroupTitlesReplyPacket.GroupDataBlock(); | 8941 | new GroupTitlesReplyPacket.GroupDataBlock(); |
9219 | 8942 | ||
9220 | groupTitlesReply.GroupData[i].Title = | 8943 | groupTitlesReply.GroupData[i].Title = |
9221 | Utils.StringToBytes(d.Name); | 8944 | Util.StringToBytes256(d.Name); |
9222 | groupTitlesReply.GroupData[i].RoleID = | 8945 | groupTitlesReply.GroupData[i].RoleID = |
9223 | d.UUID; | 8946 | d.UUID; |
9224 | groupTitlesReply.GroupData[i].Selected = | 8947 | groupTitlesReply.GroupData[i].Selected = |
@@ -9255,10 +8978,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9255 | groupProfileRequest.GroupData.GroupID); | 8978 | groupProfileRequest.GroupData.GroupID); |
9256 | 8979 | ||
9257 | groupProfileReply.GroupData.GroupID = d.GroupID; | 8980 | groupProfileReply.GroupData.GroupID = d.GroupID; |
9258 | groupProfileReply.GroupData.Name = Utils.StringToBytes(d.Name); | 8981 | groupProfileReply.GroupData.Name = Util.StringToBytes256(d.Name); |
9259 | groupProfileReply.GroupData.Charter = Utils.StringToBytes(d.Charter); | 8982 | groupProfileReply.GroupData.Charter = Util.StringToBytes1024(d.Charter); |
9260 | groupProfileReply.GroupData.ShowInList = d.ShowInList; | 8983 | groupProfileReply.GroupData.ShowInList = d.ShowInList; |
9261 | groupProfileReply.GroupData.MemberTitle = Utils.StringToBytes(d.MemberTitle); | 8984 | groupProfileReply.GroupData.MemberTitle = Util.StringToBytes256(d.MemberTitle); |
9262 | groupProfileReply.GroupData.PowersMask = d.PowersMask; | 8985 | groupProfileReply.GroupData.PowersMask = d.PowersMask; |
9263 | groupProfileReply.GroupData.InsigniaID = d.InsigniaID; | 8986 | groupProfileReply.GroupData.InsigniaID = d.InsigniaID; |
9264 | groupProfileReply.GroupData.FounderID = d.FounderID; | 8987 | groupProfileReply.GroupData.FounderID = d.FounderID; |
@@ -9330,11 +9053,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9330 | groupMembersReply.MemberData[i].Contribution = | 9053 | groupMembersReply.MemberData[i].Contribution = |
9331 | m.Contribution; | 9054 | m.Contribution; |
9332 | groupMembersReply.MemberData[i].OnlineStatus = | 9055 | groupMembersReply.MemberData[i].OnlineStatus = |
9333 | Utils.StringToBytes(m.OnlineStatus); | 9056 | Util.StringToBytes256(m.OnlineStatus); |
9334 | groupMembersReply.MemberData[i].AgentPowers = | 9057 | groupMembersReply.MemberData[i].AgentPowers = |
9335 | m.AgentPowers; | 9058 | m.AgentPowers; |
9336 | groupMembersReply.MemberData[i].Title = | 9059 | groupMembersReply.MemberData[i].Title = |
9337 | Utils.StringToBytes(m.Title); | 9060 | Util.StringToBytes256(m.Title); |
9338 | groupMembersReply.MemberData[i].IsOwner = | 9061 | groupMembersReply.MemberData[i].IsOwner = |
9339 | m.IsOwner; | 9062 | m.IsOwner; |
9340 | } | 9063 | } |
@@ -9395,11 +9118,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9395 | groupRolesReply.RoleData[i].RoleID = | 9118 | groupRolesReply.RoleData[i].RoleID = |
9396 | d.RoleID; | 9119 | d.RoleID; |
9397 | groupRolesReply.RoleData[i].Name = | 9120 | groupRolesReply.RoleData[i].Name = |
9398 | Utils.StringToBytes(d.Name); | 9121 | Util.StringToBytes256(d.Name); |
9399 | groupRolesReply.RoleData[i].Title = | 9122 | groupRolesReply.RoleData[i].Title = |
9400 | Utils.StringToBytes(d.Title); | 9123 | Util.StringToBytes256(d.Title); |
9401 | groupRolesReply.RoleData[i].Description = | 9124 | groupRolesReply.RoleData[i].Description = |
9402 | Utils.StringToBytes(d.Description); | 9125 | Util.StringToBytes1024(d.Description); |
9403 | groupRolesReply.RoleData[i].Powers = | 9126 | groupRolesReply.RoleData[i].Powers = |
9404 | d.Powers; | 9127 | d.Powers; |
9405 | groupRolesReply.RoleData[i].Members = | 9128 | groupRolesReply.RoleData[i].Members = |
@@ -9626,9 +9349,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9626 | groupNoticesListReply.Data[i].Timestamp = | 9349 | groupNoticesListReply.Data[i].Timestamp = |
9627 | g.Timestamp; | 9350 | g.Timestamp; |
9628 | groupNoticesListReply.Data[i].FromName = | 9351 | groupNoticesListReply.Data[i].FromName = |
9629 | Utils.StringToBytes(g.FromName); | 9352 | Util.StringToBytes256(g.FromName); |
9630 | groupNoticesListReply.Data[i].Subject = | 9353 | groupNoticesListReply.Data[i].Subject = |
9631 | Utils.StringToBytes(g.Subject); | 9354 | Util.StringToBytes256(g.Subject); |
9632 | groupNoticesListReply.Data[i].HasAttachment = | 9355 | groupNoticesListReply.Data[i].HasAttachment = |
9633 | g.HasAttachment; | 9356 | g.HasAttachment; |
9634 | groupNoticesListReply.Data[i].AssetType = | 9357 | groupNoticesListReply.Data[i].AssetType = |
@@ -10227,12 +9950,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10227 | byte mediaLoop) | 9950 | byte mediaLoop) |
10228 | { | 9951 | { |
10229 | ParcelMediaUpdatePacket updatePacket = new ParcelMediaUpdatePacket(); | 9952 | ParcelMediaUpdatePacket updatePacket = new ParcelMediaUpdatePacket(); |
10230 | updatePacket.DataBlock.MediaURL = Utils.StringToBytes(mediaUrl); | 9953 | updatePacket.DataBlock.MediaURL = Util.StringToBytes256(mediaUrl); |
10231 | updatePacket.DataBlock.MediaID = mediaTextureID; | 9954 | updatePacket.DataBlock.MediaID = mediaTextureID; |
10232 | updatePacket.DataBlock.MediaAutoScale = autoScale; | 9955 | updatePacket.DataBlock.MediaAutoScale = autoScale; |
10233 | 9956 | ||
10234 | updatePacket.DataBlockExtended.MediaType = Utils.StringToBytes(mediaType); | 9957 | updatePacket.DataBlockExtended.MediaType = Util.StringToBytes256(mediaType); |
10235 | updatePacket.DataBlockExtended.MediaDesc = Utils.StringToBytes(mediaDesc); | 9958 | updatePacket.DataBlockExtended.MediaDesc = Util.StringToBytes256(mediaDesc); |
10236 | updatePacket.DataBlockExtended.MediaWidth = mediaWidth; | 9959 | updatePacket.DataBlockExtended.MediaWidth = mediaWidth; |
10237 | updatePacket.DataBlockExtended.MediaHeight = mediaHeight; | 9960 | updatePacket.DataBlockExtended.MediaHeight = mediaHeight; |
10238 | updatePacket.DataBlockExtended.MediaLoop = mediaLoop; | 9961 | updatePacket.DataBlockExtended.MediaLoop = mediaLoop; |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 4f3478b..66e1468 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -733,10 +733,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
733 | // on to en-US to avoid number parsing issues | 733 | // on to en-US to avoid number parsing issues |
734 | Culture.SetCurrentCulture(); | 734 | Culture.SetCurrentCulture(); |
735 | 735 | ||
736 | IncomingPacket incomingPacket = null; | ||
737 | |||
738 | while (base.IsRunning) | 736 | while (base.IsRunning) |
739 | { | 737 | { |
738 | IncomingPacket incomingPacket = null; | ||
739 | |||
740 | try | 740 | try |
741 | { | 741 | { |
742 | if (packetInbox.Dequeue(100, ref incomingPacket)) | 742 | if (packetInbox.Dequeue(100, ref incomingPacket)) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 30fe976..70b11c3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -357,13 +357,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
357 | get { return m_defaultScriptEngine; } | 357 | get { return m_defaultScriptEngine; } |
358 | } | 358 | } |
359 | 359 | ||
360 | // Reference to all of the agents in the scene (root and child) | ||
361 | protected Dictionary<UUID, ScenePresence> m_scenePresences | ||
362 | { | ||
363 | get { return m_sceneGraph.ScenePresences; } | ||
364 | set { m_sceneGraph.ScenePresences = value; } | ||
365 | } | ||
366 | |||
367 | public EntityManager Entities | 360 | public EntityManager Entities |
368 | { | 361 | { |
369 | get { return m_sceneGraph.Entities; } | 362 | get { return m_sceneGraph.Entities; } |
@@ -1183,14 +1176,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1183 | /// <param name="stats">Stats on the Simulator's performance</param> | 1176 | /// <param name="stats">Stats on the Simulator's performance</param> |
1184 | private void SendSimStatsPackets(SimStats stats) | 1177 | private void SendSimStatsPackets(SimStats stats) |
1185 | { | 1178 | { |
1186 | List<ScenePresence> StatSendAgents = GetScenePresences(); | 1179 | ForEachScenePresence( |
1187 | foreach (ScenePresence agent in StatSendAgents) | 1180 | delegate(ScenePresence agent) |
1188 | { | ||
1189 | if (!agent.IsChildAgent) | ||
1190 | { | 1181 | { |
1191 | agent.ControllingClient.SendSimStats(stats); | 1182 | if (!agent.IsChildAgent) |
1183 | agent.ControllingClient.SendSimStats(stats); | ||
1192 | } | 1184 | } |
1193 | } | 1185 | ); |
1194 | } | 1186 | } |
1195 | 1187 | ||
1196 | /// <summary> | 1188 | /// <summary> |
@@ -3501,10 +3493,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3501 | { | 3493 | { |
3502 | ScenePresence presence; | 3494 | ScenePresence presence; |
3503 | 3495 | ||
3504 | lock (m_scenePresences) | 3496 | lock (m_sceneGraph.ScenePresences) |
3505 | { | 3497 | m_sceneGraph.ScenePresences.TryGetValue(agentID, out presence); |
3506 | m_scenePresences.TryGetValue(agentID, out presence); | ||
3507 | } | ||
3508 | 3498 | ||
3509 | if (presence != null) | 3499 | if (presence != null) |
3510 | { | 3500 | { |
@@ -3714,12 +3704,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3714 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, | 3704 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, |
3715 | Vector3 lookAt, uint teleportFlags) | 3705 | Vector3 lookAt, uint teleportFlags) |
3716 | { | 3706 | { |
3717 | ScenePresence sp = null; | 3707 | ScenePresence sp; |
3718 | lock (m_scenePresences) | 3708 | lock (m_sceneGraph.ScenePresences) |
3719 | { | 3709 | m_sceneGraph.ScenePresences.TryGetValue(remoteClient.AgentId, out sp); |
3720 | if (m_scenePresences.ContainsKey(remoteClient.AgentId)) | ||
3721 | sp = m_scenePresences[remoteClient.AgentId]; | ||
3722 | } | ||
3723 | 3710 | ||
3724 | if (sp != null) | 3711 | if (sp != null) |
3725 | { | 3712 | { |
@@ -4168,7 +4155,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4168 | public void ForEachScenePresence(Action<ScenePresence> action) | 4155 | public void ForEachScenePresence(Action<ScenePresence> action) |
4169 | { | 4156 | { |
4170 | // We don't want to try to send messages if there are no avatars. | 4157 | // We don't want to try to send messages if there are no avatars. |
4171 | if (m_scenePresences != null) | 4158 | if (m_sceneGraph != null && m_sceneGraph.ScenePresences != null) |
4172 | { | 4159 | { |
4173 | try | 4160 | try |
4174 | { | 4161 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 79f6366..a078b3d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3791,15 +3791,15 @@ if (m_shape != null) { | |||
3791 | if (ParentGroup.RootPart == this) | 3791 | if (ParentGroup.RootPart == this) |
3792 | lPos = AbsolutePosition; | 3792 | lPos = AbsolutePosition; |
3793 | } | 3793 | } |
3794 | 3794 | ||
3795 | // Causes this thread to dig into the Client Thread Data. | 3795 | // Causes this thread to dig into the Client Thread Data. |
3796 | // Remember your locking here! | 3796 | // Remember your locking here! |
3797 | remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle, | 3797 | remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle, |
3798 | (ushort)(m_parentGroup.GetTimeDilation() * | 3798 | (ushort)(m_parentGroup.GetTimeDilation() * |
3799 | (float)ushort.MaxValue), LocalId, lPos, | 3799 | (float)ushort.MaxValue), LocalId, lPos, |
3800 | RotationOffset, Velocity, | 3800 | RotationOffset, Velocity, Acceleration, |
3801 | RotationalVelocity, state, FromItemID, | 3801 | RotationalVelocity, state, FromItemID, |
3802 | OwnerID, (int)AttachmentPoint, ParentGroup.GetUpdatePriority(remoteClient))); | 3802 | OwnerID, (int)AttachmentPoint, null, ParentGroup.GetUpdatePriority(remoteClient))); |
3803 | } | 3803 | } |
3804 | 3804 | ||
3805 | public void AddScriptLPS(int count) | 3805 | public void AddScriptLPS(int count) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f05c3d8..bdd80c6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1160,15 +1160,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1160 | /// </summary> | 1160 | /// </summary> |
1161 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 1161 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
1162 | { | 1162 | { |
1163 | lock (m_agentUpdates) | 1163 | const int AGENT_UPDATE_TIMEOUT_MS = 1000 * 3; |
1164 | |||
1165 | if (System.Threading.Monitor.TryEnter(m_agentUpdates, AGENT_UPDATE_TIMEOUT_MS)) | ||
1164 | { | 1166 | { |
1165 | if (m_updatesAllowed) | 1167 | try |
1166 | { | 1168 | { |
1167 | RealHandleAgentUpdate(remoteClient, agentData); | 1169 | if (m_updatesAllowed) |
1168 | return; | 1170 | { |
1171 | RealHandleAgentUpdate(remoteClient, agentData); | ||
1172 | return; | ||
1173 | } | ||
1174 | |||
1175 | m_agentUpdates.Add(agentData); | ||
1169 | } | 1176 | } |
1170 | 1177 | finally { System.Threading.Monitor.Exit(m_agentUpdates); } | |
1171 | m_agentUpdates.Add(agentData); | ||
1172 | } | 1178 | } |
1173 | } | 1179 | } |
1174 | 1180 | ||
@@ -2471,7 +2477,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2471 | pos.Z -= m_appearance.HipOffset; | 2477 | pos.Z -= m_appearance.HipOffset; |
2472 | 2478 | ||
2473 | remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, | 2479 | remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, |
2474 | pos, m_velocity, m_rotation, m_uuid, GetUpdatePriority(remoteClient))); | 2480 | pos, m_velocity, Vector3.Zero, m_rotation, Vector4.Zero, m_uuid, null, GetUpdatePriority(remoteClient))); |
2475 | 2481 | ||
2476 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2482 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2477 | m_scene.StatsReporter.AddAgentUpdates(1); | 2483 | m_scene.StatsReporter.AddAgentUpdates(1); |
@@ -3504,7 +3510,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3504 | 3510 | ||
3505 | public void Close() | 3511 | public void Close() |
3506 | { | 3512 | { |
3507 | |||
3508 | lock (m_attachments) | 3513 | lock (m_attachments) |
3509 | { | 3514 | { |
3510 | // Delete attachments from scene | 3515 | // Delete attachments from scene |
@@ -3535,7 +3540,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3535 | m_sceneViewer.Close(); | 3540 | m_sceneViewer.Close(); |
3536 | 3541 | ||
3537 | RemoveFromPhysicalScene(); | 3542 | RemoveFromPhysicalScene(); |
3538 | GC.Collect(); | ||
3539 | } | 3543 | } |
3540 | 3544 | ||
3541 | public ScenePresence() | 3545 | public ScenePresence() |