diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9d5a7ba..4f4bb61 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -3995,36 +3995,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3995 | OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); | 3995 | OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
3996 | } | 3996 | } |
3997 | 3997 | ||
3998 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) | 3998 | static private readonly byte[] AvatarAppearanceHeader = new byte[] { |
3999 | Helpers.MSG_RELIABLE | Helpers.MSG_ZEROCODED, | ||
4000 | 0, 0, 0, 0, // sequence number | ||
4001 | 0, // extra | ||
4002 | 0xff, 0xff, 0, 158 // ID 158 (low frequency bigendian) not zeroencoded | ||
4003 | //0xff, 0xff, 0, 1, 158 // ID 158 (low frequency bigendian) zeroencoded | ||
4004 | }; | ||
4005 | |||
4006 | public void SendAppearance(UUID targetID, byte[] visualParams, byte[] textureEntry) | ||
3999 | { | 4007 | { |
4000 | // m_log.DebugFormat( | 4008 | // doing post zero encode, because odds of beeing bad are not that low |
4001 | // "[LLCLIENTVIEW]: Sending avatar appearance for {0} with {1} bytes to {2} {3}", | 4009 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
4002 | // agentID, textureEntry.Length, Name, AgentId); | 4010 | Buffer.BlockCopy(AvatarAppearanceHeader, 0, buf.Data, 0, 10); |
4011 | byte[] data = buf.Data; | ||
4012 | int pos = 10; | ||
4003 | 4013 | ||
4004 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); | 4014 | //sender block |
4005 | // TODO: don't create new blocks if recycling an old packet | 4015 | targetID.ToBytes(data, pos); pos += 16; |
4006 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; | 4016 | data[pos++] = 0;// is trial = false |
4007 | avp.ObjectData.TextureEntry = textureEntry; | ||
4008 | 4017 | ||
4009 | AvatarAppearancePacket.VisualParamBlock avblock = null; | 4018 | // objectdata block ie texture |
4010 | for (int i = 0; i < visualParams.Length; i++) | 4019 | int len = textureEntry.Length; |
4020 | if (len == 0) | ||
4021 | { | ||
4022 | data[pos++] = 0; | ||
4023 | data[pos++] = 0; | ||
4024 | } | ||
4025 | else | ||
4011 | { | 4026 | { |
4012 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | 4027 | data[pos++] = (byte)len; |
4013 | avblock.ParamValue = visualParams[i]; | 4028 | data[pos++] = (byte)(len >> 8); |
4014 | avp.VisualParam[i] = avblock; | 4029 | Buffer.BlockCopy(textureEntry, 0, data, pos, len); pos += len; |
4015 | } | 4030 | } |
4016 | 4031 | ||
4017 | avp.Sender.IsTrial = false; | 4032 | // visual parameters |
4018 | avp.Sender.ID = agentID; | 4033 | len = visualParams.Length; |
4019 | avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; | 4034 | data[pos++] = (byte)len; |
4020 | avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0]; | 4035 | if(len > 0) |
4036 | Buffer.BlockCopy(visualParams, 0, data, pos, len); pos += len; | ||
4021 | 4037 | ||
4022 | // this need be use in future ? | 4038 | // no AppearanceData |
4023 | // avp.AppearanceData[0].AppearanceVersion = 0; | 4039 | data[pos++] = 0; |
4024 | // avp.AppearanceData[0].CofVersion = 0; | 4040 | // no AppearanceHover |
4041 | data[pos++] = 0; | ||
4025 | 4042 | ||
4026 | //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); | 4043 | buf.DataLength = pos; |
4027 | OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); | 4044 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority, null, false, true); |
4028 | } | 4045 | } |
4029 | 4046 | ||
4030 | static private readonly byte[] AvatarAnimationHeader = new byte[] { | 4047 | static private readonly byte[] AvatarAnimationHeader = new byte[] { |