diff options
author | UbitUmarov | 2019-03-16 15:40:01 +0000 |
---|---|---|
committer | UbitUmarov | 2019-03-16 15:40:01 +0000 |
commit | 5428b4799df0851d3091cf12f80bed6672bb09b3 (patch) | |
tree | 356e435612b7928e7a68f243d539b832a5355819 /OpenSim/Region/ClientStack | |
parent | bug fix on mapblockreply; direct encode mapitemreply just because.. (diff) | |
download | opensim-SC-5428b4799df0851d3091cf12f80bed6672bb09b3.zip opensim-SC-5428b4799df0851d3091cf12f80bed6672bb09b3.tar.gz opensim-SC-5428b4799df0851d3091cf12f80bed6672bb09b3.tar.bz2 opensim-SC-5428b4799df0851d3091cf12f80bed6672bb09b3.tar.xz |
lludp: direct encode rest of send terseupdates
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 251 |
1 files changed, 23 insertions, 228 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 83128d2..2b7a7ed 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4027,65 +4027,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4027 | OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); | 4027 | OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
4028 | } | 4028 | } |
4029 | 4029 | ||
4030 | /* | ||
4031 | public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) | ||
4032 | { | ||
4033 | // m_log.DebugFormat("[LLCLIENTVIEW]: Sending animations for {0} to {1}", sourceAgentId, Name); | ||
4034 | |||
4035 | AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); | ||
4036 | // TODO: don't create new blocks if recycling an old packet | ||
4037 | ani.Sender = new AvatarAnimationPacket.SenderBlock(); | ||
4038 | ani.Sender.ID = sourceAgentId; | ||
4039 | ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[animations.Length]; | ||
4040 | ani.PhysicalAvatarEventList = new AvatarAnimationPacket.PhysicalAvatarEventListBlock[0]; | ||
4041 | |||
4042 | //self animations | ||
4043 | if (sourceAgentId == AgentId) | ||
4044 | { | ||
4045 | List<int> withobjects = new List<int>(animations.Length); | ||
4046 | List<int> noobjects = new List<int>(animations.Length); | ||
4047 | for(int i = 0; i < animations.Length; ++i) | ||
4048 | { | ||
4049 | if(objectIDs[i] == sourceAgentId || objectIDs[i] == UUID.Zero) | ||
4050 | noobjects.Add(i); | ||
4051 | else | ||
4052 | withobjects.Add(i); | ||
4053 | } | ||
4054 | |||
4055 | ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[withobjects.Count]; | ||
4056 | int k = 0; | ||
4057 | foreach (int i in withobjects) | ||
4058 | { | ||
4059 | ani.AnimationList[k] = new AvatarAnimationPacket.AnimationListBlock(); | ||
4060 | ani.AnimationList[k].AnimID = animations[i]; | ||
4061 | ani.AnimationList[k].AnimSequenceID = seqs[i]; | ||
4062 | ani.AnimationSourceList[k] = new AvatarAnimationPacket.AnimationSourceListBlock(); | ||
4063 | ani.AnimationSourceList[k].ObjectID = objectIDs[i]; | ||
4064 | k++; | ||
4065 | } | ||
4066 | foreach (int i in noobjects) | ||
4067 | { | ||
4068 | ani.AnimationList[k] = new AvatarAnimationPacket.AnimationListBlock(); | ||
4069 | ani.AnimationList[k].AnimID = animations[i]; | ||
4070 | ani.AnimationList[k].AnimSequenceID = seqs[i]; | ||
4071 | k++; | ||
4072 | } | ||
4073 | } | ||
4074 | else | ||
4075 | { | ||
4076 | ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[0]; | ||
4077 | for (int i = 0; i < animations.Length; ++i) | ||
4078 | { | ||
4079 | ani.AnimationList[i] = new AvatarAnimationPacket.AnimationListBlock(); | ||
4080 | ani.AnimationList[i].AnimID = animations[i]; | ||
4081 | ani.AnimationList[i].AnimSequenceID = seqs[i]; | ||
4082 | } | ||
4083 | } | ||
4084 | |||
4085 | OutPacket(ani, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); | ||
4086 | } | ||
4087 | */ | ||
4088 | |||
4089 | static private readonly byte[] AvatarAnimationHeader = new byte[] { | 4030 | static private readonly byte[] AvatarAnimationHeader = new byte[] { |
4090 | Helpers.MSG_RELIABLE, | 4031 | Helpers.MSG_RELIABLE, |
4091 | 0, 0, 0, 0, // sequence number | 4032 | 0, 0, 0, 0, // sequence number |
@@ -4217,37 +4158,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4217 | 4158 | ||
4218 | public void SendEntityTerseUpdateImmediate(ISceneEntity ent) | 4159 | public void SendEntityTerseUpdateImmediate(ISceneEntity ent) |
4219 | { | 4160 | { |
4220 | // m_log.DebugFormat( | ||
4221 | // "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}", | ||
4222 | // avatar.Name, avatar.UUID, Name, AgentId); | ||
4223 | |||
4224 | if (ent == null) | 4161 | if (ent == null) |
4225 | return; | 4162 | return; |
4226 | 4163 | ||
4227 | ImprovedTerseObjectUpdatePacket objupdate = | 4164 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
4228 | (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | ||
4229 | objupdate.Header.Zerocoded = true; | ||
4230 | 4165 | ||
4231 | objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); | 4166 | //setup header and regioninfo block |
4232 | objupdate.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 4167 | Buffer.BlockCopy(terseUpdateHeader, 0, buf.Data, 0, 7); |
4168 | if (ent is ScenePresence) | ||
4169 | Utils.UInt64ToBytesSafepos(((ScenePresence)ent).RegionHandle, buf.Data, 7); | ||
4170 | else | ||
4171 | Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, buf.Data, 7); | ||
4233 | 4172 | ||
4234 | if(ent is ScenePresence) | 4173 | Utils.UInt16ToBytes(Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f), buf.Data, 15); |
4235 | { | 4174 | buf.Data[17] = 1; |
4236 | ScenePresence presence = ent as ScenePresence; | ||
4237 | objupdate.RegionData.RegionHandle = presence.RegionHandle; | ||
4238 | objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent); | ||
4239 | } | ||
4240 | else if(ent is SceneObjectPart) | ||
4241 | { | ||
4242 | SceneObjectPart part = ent as SceneObjectPart; | ||
4243 | objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4244 | objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent); | ||
4245 | } | ||
4246 | 4175 | ||
4247 | OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); | 4176 | int pos = 18; |
4177 | CreateImprovedTerseBlock(ent, buf.Data, ref pos, false); | ||
4248 | 4178 | ||
4249 | // We need to record the avatar local id since the root prim of an attachment points to this. | 4179 | buf.DataLength = pos; |
4250 | // m_attachmentsSent.Add(avatar.LocalId); | 4180 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); |
4251 | } | 4181 | } |
4252 | 4182 | ||
4253 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) | 4183 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) |
@@ -5991,121 +5921,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5991 | } | 5921 | } |
5992 | } | 5922 | } |
5993 | 5923 | ||
5994 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity) | ||
5995 | { | ||
5996 | #region ScenePresence/SOP Handling | ||
5997 | |||
5998 | bool avatar = (entity is ScenePresence); | ||
5999 | uint localID = entity.LocalId; | ||
6000 | uint attachPoint; | ||
6001 | Vector4 collisionPlane; | ||
6002 | Vector3 position, velocity, acceleration, angularVelocity; | ||
6003 | Quaternion rotation; | ||
6004 | |||
6005 | if (avatar) | ||
6006 | { | ||
6007 | ScenePresence presence = (ScenePresence)entity; | ||
6008 | |||
6009 | position = presence.OffsetPosition; | ||
6010 | velocity = presence.Velocity; | ||
6011 | acceleration = Vector3.Zero; | ||
6012 | rotation = presence.Rotation; | ||
6013 | // tpvs can only see rotations around Z in some cases | ||
6014 | if(!presence.Flying && !presence.IsSatOnObject) | ||
6015 | { | ||
6016 | rotation.X = 0f; | ||
6017 | rotation.Y = 0f; | ||
6018 | } | ||
6019 | rotation.Normalize(); | ||
6020 | angularVelocity = presence.AngularVelocity; | ||
6021 | |||
6022 | // m_log.DebugFormat( | ||
6023 | // "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); | ||
6024 | |||
6025 | attachPoint = presence.State; | ||
6026 | collisionPlane = presence.CollisionPlane; | ||
6027 | } | ||
6028 | else | ||
6029 | { | ||
6030 | SceneObjectPart part = (SceneObjectPart)entity; | ||
6031 | |||
6032 | attachPoint = part.ParentGroup.AttachmentPoint; | ||
6033 | attachPoint = ((attachPoint % 16) * 16 + (attachPoint / 16)); | ||
6034 | // m_log.DebugFormat( | ||
6035 | // "[LLCLIENTVIEW]: Sending attachPoint {0} for {1} {2} to {3}", | ||
6036 | // attachPoint, part.Name, part.LocalId, Name); | ||
6037 | |||
6038 | collisionPlane = Vector4.Zero; | ||
6039 | position = part.RelativePosition; | ||
6040 | velocity = part.Velocity; | ||
6041 | acceleration = part.Acceleration; | ||
6042 | angularVelocity = part.AngularVelocity; | ||
6043 | rotation = part.RotationOffset; | ||
6044 | } | ||
6045 | |||
6046 | #endregion ScenePresence/SOP Handling | ||
6047 | |||
6048 | int pos = 0; | ||
6049 | byte[] data = new byte[(avatar ? 60 : 44)]; | ||
6050 | |||
6051 | // LocalID | ||
6052 | Utils.UIntToBytes(localID, data, pos); | ||
6053 | pos += 4; | ||
6054 | |||
6055 | // Avatar/CollisionPlane | ||
6056 | data[pos++] = (byte) attachPoint; | ||
6057 | if (avatar) | ||
6058 | { | ||
6059 | data[pos++] = 1; | ||
6060 | |||
6061 | if (collisionPlane == Vector4.Zero) | ||
6062 | collisionPlane = Vector4.UnitW; | ||
6063 | //m_log.DebugFormat("CollisionPlane: {0}",collisionPlane); | ||
6064 | collisionPlane.ToBytes(data, pos); | ||
6065 | pos += 16; | ||
6066 | } | ||
6067 | else | ||
6068 | { | ||
6069 | ++pos; | ||
6070 | } | ||
6071 | |||
6072 | // Position | ||
6073 | position.ToBytes(data, pos); | ||
6074 | pos += 12; | ||
6075 | |||
6076 | // Velocity | ||
6077 | ClampVectorForUint(ref velocity, 128f); | ||
6078 | Utils.FloatToUInt16Bytes(velocity.X, 128.0f, data, pos); pos += 2; | ||
6079 | Utils.FloatToUInt16Bytes(velocity.Y, 128.0f, data, pos); pos += 2; | ||
6080 | Utils.FloatToUInt16Bytes(velocity.Z, 128.0f, data, pos); pos += 2; | ||
6081 | |||
6082 | // Acceleration | ||
6083 | ClampVectorForUint(ref acceleration, 64f); | ||
6084 | Utils.FloatToUInt16Bytes(acceleration.X, 64.0f, data, pos); pos += 2; | ||
6085 | Utils.FloatToUInt16Bytes(acceleration.Y, 64.0f, data, pos); pos += 2; | ||
6086 | Utils.FloatToUInt16Bytes(acceleration.Z, 64.0f, data, pos); pos += 2; | ||
6087 | |||
6088 | // Rotation | ||
6089 | Utils.FloatToUInt16Bytes(rotation.X, 1.0f, data, pos); pos += 2; | ||
6090 | Utils.FloatToUInt16Bytes(rotation.Y, 1.0f, data, pos); pos += 2; | ||
6091 | Utils.FloatToUInt16Bytes(rotation.Z, 1.0f, data, pos); pos += 2; | ||
6092 | Utils.FloatToUInt16Bytes(rotation.W, 1.0f, data, pos); pos += 2; | ||
6093 | |||
6094 | // Angular Velocity | ||
6095 | ClampVectorForUint(ref angularVelocity, 64f); | ||
6096 | Utils.FloatToUInt16Bytes(angularVelocity.X, 64.0f, data, pos); pos += 2; | ||
6097 | Utils.FloatToUInt16Bytes(angularVelocity.Y, 64.0f, data, pos); pos += 2; | ||
6098 | Utils.FloatToUInt16Bytes(angularVelocity.Z, 64.0f, data, pos); pos += 2; | ||
6099 | |||
6100 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock block | ||
6101 | = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
6102 | |||
6103 | block.Data = data; | ||
6104 | block.TextureEntry = Utils.EmptyBytes; | ||
6105 | |||
6106 | return block; | ||
6107 | } | ||
6108 | |||
6109 | protected void CreateImprovedTerseBlock(ISceneEntity entity, byte[] data, ref int pos, bool includeTexture) | 5924 | protected void CreateImprovedTerseBlock(ISceneEntity entity, byte[] data, ref int pos, bool includeTexture) |
6110 | { | 5925 | { |
6111 | #region ScenePresence/SOP Handling | 5926 | #region ScenePresence/SOP Handling |
@@ -14027,38 +13842,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
14027 | { | 13842 | { |
14028 | if (p is ScenePresence) | 13843 | if (p is ScenePresence) |
14029 | { | 13844 | { |
14030 | // m_log.DebugFormat( | 13845 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
14031 | // "[LLCLIENTVIEW]: Immediately sending terse agent update for {0} to {1} in {2}", | ||
14032 | // p.Name, Name, Scene.Name); | ||
14033 | |||
14034 | // It turns out to get the agent to stop flying, you have to feed it stop flying velocities | ||
14035 | // There's no explicit message to send the client to tell it to stop flying.. it relies on the | ||
14036 | // velocity, collision plane and avatar height | ||
14037 | |||
14038 | // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air | ||
14039 | // when the avatar stands up | ||
14040 | |||
14041 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = | ||
14042 | CreateImprovedTerseBlock(p); | ||
14043 | |||
14044 | // const float TIME_DILATION = 1.0f; | ||
14045 | ushort timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);; | ||
14046 | |||
14047 | ImprovedTerseObjectUpdatePacket packet | ||
14048 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
14049 | PacketType.ImprovedTerseObjectUpdate); | ||
14050 | |||
14051 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
14052 | packet.RegionData.TimeDilation = timeDilation; | ||
14053 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
14054 | |||
14055 | packet.ObjectData[0] = block; | ||
14056 | 13846 | ||
14057 | OutPacket(packet, ThrottleOutPacketType.Task, true); | 13847 | //setup header and regioninfo block |
13848 | Buffer.BlockCopy(terseUpdateHeader, 0, buf.Data, 0, 7); | ||
13849 | Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, buf.Data, 7); | ||
13850 | Utils.UInt16ToBytes(Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f), buf.Data, 15); | ||
13851 | buf.Data[17] = 1; | ||
13852 | int pos = 18; | ||
13853 | CreateImprovedTerseBlock(p, buf.Data, ref pos, false); | ||
13854 | buf.DataLength = pos; | ||
13855 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); | ||
14058 | } | 13856 | } |
14059 | |||
14060 | //ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, | ||
14061 | // AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); | ||
14062 | } | 13857 | } |
14063 | 13858 | ||
14064 | public void SendPlacesReply(UUID queryID, UUID transactionID, | 13859 | public void SendPlacesReply(UUID queryID, UUID transactionID, |