diff options
author | UbitUmarov | 2019-03-02 18:23:29 +0000 |
---|---|---|
committer | UbitUmarov | 2019-03-02 18:23:29 +0000 |
commit | ca1993c72d53d5052cea4fef56481c9a54645fca (patch) | |
tree | e48fdc0248bcfd3efa6f2b0bc819fe3523d843c7 | |
parent | ll rez objects: silent ginore null object id; remove redundante llSetColor code (diff) | |
download | opensim-SC-ca1993c72d53d5052cea4fef56481c9a54645fca.zip opensim-SC-ca1993c72d53d5052cea4fef56481c9a54645fca.tar.gz opensim-SC-ca1993c72d53d5052cea4fef56481c9a54645fca.tar.bz2 opensim-SC-ca1993c72d53d5052cea4fef56481c9a54645fca.tar.xz |
direct encode lludp terse object update, let contain texture entry
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 93 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 25 |
3 files changed, 78 insertions, 41 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index e660dce..d63136e 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -671,7 +671,6 @@ namespace OpenSim.Framework | |||
671 | Particles = 1 << 19, | 671 | Particles = 1 << 19, |
672 | ExtraData = 1 << 20, | 672 | ExtraData = 1 << 20, |
673 | Sound = 1 << 21, | 673 | Sound = 1 << 21, |
674 | Joint = 1 << 22, | ||
675 | 674 | ||
676 | TerseUpdate = Position | Rotation | Velocity | Acceleration | AngularVelocity, | 675 | TerseUpdate = Position | Rotation | Velocity | Acceleration | AngularVelocity, |
677 | FullUpdate = 0x00ffffff, | 676 | FullUpdate = 0x00ffffff, |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a9edf08..da4c1fb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4120,10 +4120,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4120 | float cullingrange = 64.0f; | 4120 | float cullingrange = 64.0f; |
4121 | Vector3 mypos = Vector3.Zero; | 4121 | Vector3 mypos = Vector3.Zero; |
4122 | 4122 | ||
4123 | bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance; | 4123 | //bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance; |
4124 | bool orderedDequeue = false; // temporary off | ||
4124 | 4125 | ||
4125 | HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); | 4126 | HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); |
4126 | 4127 | ||
4128 | |||
4127 | if (doCulling) | 4129 | if (doCulling) |
4128 | { | 4130 | { |
4129 | cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f; | 4131 | cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f; |
@@ -4304,7 +4306,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4304 | PrimUpdateFlags.Velocity | | 4306 | PrimUpdateFlags.Velocity | |
4305 | PrimUpdateFlags.Acceleration | | 4307 | PrimUpdateFlags.Acceleration | |
4306 | PrimUpdateFlags.AngularVelocity | | 4308 | PrimUpdateFlags.AngularVelocity | |
4307 | PrimUpdateFlags.CollisionPlane | 4309 | PrimUpdateFlags.CollisionPlane | |
4310 | PrimUpdateFlags.Textures | ||
4308 | ); | 4311 | ); |
4309 | 4312 | ||
4310 | #endregion UpdateFlags to packet type conversion | 4313 | #endregion UpdateFlags to packet type conversion |
@@ -4347,7 +4350,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4347 | maxUpdatesBytes -= 18; | 4350 | maxUpdatesBytes -= 18; |
4348 | } | 4351 | } |
4349 | terseUpdates.Add(update); | 4352 | terseUpdates.Add(update); |
4350 | maxUpdatesBytes -= 47; // no texture entry | 4353 | maxUpdatesBytes -= 47; |
4354 | if ((updateFlags & PrimUpdateFlags.Textures) != 0) | ||
4355 | maxUpdatesBytes -= 100; // aprox | ||
4351 | } | 4356 | } |
4352 | } | 4357 | } |
4353 | else | 4358 | else |
@@ -4390,7 +4395,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4390 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | 4395 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
4391 | 4396 | ||
4392 | //setup header and regioninfo block | 4397 | //setup header and regioninfo block |
4393 | Array.Copy(terseUpdateHeader, buf.Data, 7); | 4398 | Buffer.BlockCopy(terseUpdateHeader, 0, buf.Data, 0, 7); |
4394 | Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, buf.Data, 7); | 4399 | Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, buf.Data, 7); |
4395 | Utils.UInt16ToBytes(timeDilation, buf.Data, 15); | 4400 | Utils.UInt16ToBytes(timeDilation, buf.Data, 15); |
4396 | buf.Data[17] = (byte)curNBlocks; | 4401 | buf.Data[17] = (byte)curNBlocks; |
@@ -4399,7 +4404,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4399 | int count = 0; | 4404 | int count = 0; |
4400 | foreach (EntityUpdate eu in terseAgentUpdates) | 4405 | foreach (EntityUpdate eu in terseAgentUpdates) |
4401 | { | 4406 | { |
4402 | CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos); | 4407 | CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos, false); |
4403 | tau.Add(eu); | 4408 | tau.Add(eu); |
4404 | ++count; | 4409 | ++count; |
4405 | --blocks; | 4410 | --blocks; |
@@ -4407,7 +4412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4407 | { | 4412 | { |
4408 | // we need more packets | 4413 | // we need more packets |
4409 | UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | 4414 | UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
4410 | Array.Copy(buf.Data, newbuf.Data, 17); // start is the same | 4415 | Buffer.BlockCopy(buf.Data, 0, newbuf.Data, 0, 17); // start is the same |
4411 | 4416 | ||
4412 | buf.DataLength = pos; | 4417 | buf.DataLength = pos; |
4413 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, | 4418 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, |
@@ -4455,49 +4460,57 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4455 | */ | 4460 | */ |
4456 | if (terseUpdates != null) | 4461 | if (terseUpdates != null) |
4457 | { | 4462 | { |
4458 | const int maxNBlocks = (LLUDPServer.MTU - 18) / 47; // no texture entry | ||
4459 | int blocks = terseUpdates.Count; | 4463 | int blocks = terseUpdates.Count; |
4460 | int curNBlocks = blocks > maxNBlocks ? maxNBlocks : blocks; | 4464 | List<EntityUpdate> tau = new List<EntityUpdate>(30); |
4461 | List<EntityUpdate> tau = new List<EntityUpdate>(curNBlocks); | ||
4462 | 4465 | ||
4463 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | 4466 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
4464 | 4467 | ||
4465 | //setup header and regioninfo block | 4468 | //setup header and regioninfo block |
4466 | Array.Copy(terseUpdateHeader, buf.Data, 7); | 4469 | Buffer.BlockCopy(terseUpdateHeader, 0, buf.Data, 0, 7); |
4467 | Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, buf.Data, 7); | 4470 | Utils.UInt64ToBytesSafepos(m_scene.RegionInfo.RegionHandle, buf.Data, 7); |
4468 | Utils.UInt16ToBytes(timeDilation, buf.Data, 15); | 4471 | Utils.UInt16ToBytes(timeDilation, buf.Data, 15); |
4469 | buf.Data[17] = (byte)curNBlocks; | ||
4470 | int pos = 18; | 4472 | int pos = 18; |
4473 | int lastpos = 0; | ||
4471 | 4474 | ||
4472 | int count = 0; | 4475 | int count = 0; |
4473 | foreach (EntityUpdate eu in terseUpdates) | 4476 | foreach (EntityUpdate eu in terseUpdates) |
4474 | { | 4477 | { |
4475 | CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos); | 4478 | lastpos = pos; |
4476 | tau.Add(eu); | 4479 | CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos, (eu.Flags & PrimUpdateFlags.Textures) != 0); |
4477 | ++count; | 4480 | if (pos <= LLUDPServer.MTU) |
4478 | --blocks; | 4481 | { |
4479 | if (count == curNBlocks && blocks > 0) | 4482 | tau.Add(eu); |
4483 | ++count; | ||
4484 | --blocks; | ||
4485 | } | ||
4486 | else if (blocks > 0) | ||
4480 | { | 4487 | { |
4481 | // we need more packets | 4488 | // we need more packets |
4482 | UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | 4489 | UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
4483 | Array.Copy(buf.Data, newbuf.Data, 17); // start is the same | 4490 | Buffer.BlockCopy(buf.Data, 0, newbuf.Data, 0, 17); // start is the same |
4491 | // copy what we done in excess | ||
4492 | int extralen = pos - lastpos; | ||
4493 | if(extralen > 0) | ||
4494 | Buffer.BlockCopy(newbuf.Data, 18, buf.Data, lastpos, extralen); | ||
4484 | 4495 | ||
4485 | buf.DataLength = pos; | 4496 | pos = 18 + extralen; |
4497 | |||
4498 | buf.Data[17] = (byte)count; | ||
4499 | buf.DataLength = lastpos; | ||
4486 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, | 4500 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, |
4487 | delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false); | 4501 | delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false); |
4488 | 4502 | ||
4489 | curNBlocks = blocks > maxNBlocks ? maxNBlocks : blocks; | 4503 | tau = new List<EntityUpdate>(30); |
4490 | tau = new List<EntityUpdate>(curNBlocks); | 4504 | tau.Add(eu); |
4491 | count = 0; | 4505 | count = 1; |
4492 | 4506 | --blocks; | |
4493 | buf = newbuf; | 4507 | buf = newbuf; |
4494 | buf.Data[17] = (byte)curNBlocks; | ||
4495 | pos = 18; | ||
4496 | } | 4508 | } |
4497 | } | 4509 | } |
4498 | 4510 | ||
4499 | if (count > 0) | 4511 | if (count > 0) |
4500 | { | 4512 | { |
4513 | buf.Data[17] = (byte)count; | ||
4501 | buf.DataLength = pos; | 4514 | buf.DataLength = pos; |
4502 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, | 4515 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, |
4503 | delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false); | 4516 | delegate (OutgoingPacket oPacket) { ResendPrimUpdates(tau, oPacket); }, false); |
@@ -5720,7 +5733,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5720 | } | 5733 | } |
5721 | 5734 | ||
5722 | 5735 | ||
5723 | protected void CreateImprovedTerseBlock(ISceneEntity entity, byte[] data, ref int pos) | 5736 | protected void CreateImprovedTerseBlock(ISceneEntity entity, byte[] data, ref int pos, bool includeTexture) |
5724 | { | 5737 | { |
5725 | #region ScenePresence/SOP Handling | 5738 | #region ScenePresence/SOP Handling |
5726 | 5739 | ||
@@ -5731,6 +5744,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5731 | Vector3 position, velocity, acceleration, angularVelocity; | 5744 | Vector3 position, velocity, acceleration, angularVelocity; |
5732 | Quaternion rotation; | 5745 | Quaternion rotation; |
5733 | byte datasize; | 5746 | byte datasize; |
5747 | byte[] te = null; | ||
5734 | 5748 | ||
5735 | if (avatar) | 5749 | if (avatar) |
5736 | { | 5750 | { |
@@ -5775,6 +5789,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5775 | rotation = part.RotationOffset; | 5789 | rotation = part.RotationOffset; |
5776 | 5790 | ||
5777 | datasize = 44; | 5791 | datasize = 44; |
5792 | if(includeTexture) | ||
5793 | te = part.Shape.TextureEntry; | ||
5778 | } | 5794 | } |
5779 | 5795 | ||
5780 | #endregion ScenePresence/SOP Handling | 5796 | #endregion ScenePresence/SOP Handling |
@@ -5785,8 +5801,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5785 | Utils.UIntToBytes(localID, data, pos); | 5801 | Utils.UIntToBytes(localID, data, pos); |
5786 | pos += 4; | 5802 | pos += 4; |
5787 | 5803 | ||
5788 | // Avatar/CollisionPlane | ||
5789 | data[pos++] = (byte)attachPoint; | 5804 | data[pos++] = (byte)attachPoint; |
5805 | |||
5806 | // Avatar/CollisionPlane | ||
5790 | if (avatar) | 5807 | if (avatar) |
5791 | { | 5808 | { |
5792 | data[pos++] = 1; | 5809 | data[pos++] = 1; |
@@ -5829,11 +5846,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5829 | Utils.FloatToUInt16Bytes(angularVelocity.X, 64.0f, data, pos); pos += 2; | 5846 | Utils.FloatToUInt16Bytes(angularVelocity.X, 64.0f, data, pos); pos += 2; |
5830 | Utils.FloatToUInt16Bytes(angularVelocity.Y, 64.0f, data, pos); pos += 2; | 5847 | Utils.FloatToUInt16Bytes(angularVelocity.Y, 64.0f, data, pos); pos += 2; |
5831 | Utils.FloatToUInt16Bytes(angularVelocity.Z, 64.0f, data, pos); pos += 2; | 5848 | Utils.FloatToUInt16Bytes(angularVelocity.Z, 64.0f, data, pos); pos += 2; |
5832 | 5849 | ||
5833 | // texture entry block size | 5850 | // texture entry block size |
5834 | data[pos++] = 0; | 5851 | if(te == null) |
5835 | data[pos++] = 0; | 5852 | { |
5836 | // total size 63 or 47 | 5853 | data[pos++] = 0; |
5854 | data[pos++] = 0; | ||
5855 | } | ||
5856 | else | ||
5857 | { | ||
5858 | int len = te.Length & 0x7fff; | ||
5859 | int totlen = len + 4; | ||
5860 | data[pos++] = (byte)totlen; | ||
5861 | data[pos++] = (byte)(totlen >> 8); | ||
5862 | data[pos++] = (byte)len; // wtf ??? | ||
5863 | data[pos++] = (byte)(len >> 8); | ||
5864 | data[pos++] = 0; | ||
5865 | data[pos++] = 0; | ||
5866 | Buffer.BlockCopy(te, 0, data, pos, len); | ||
5867 | pos += len; | ||
5868 | } | ||
5869 | // total size 63 or 47 + (texture size + 4) | ||
5837 | } | 5870 | } |
5838 | 5871 | ||
5839 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | 5872 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 23bef74..a1296ba 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3242,8 +3242,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3242 | if (ParentGroup.Scene.GetNumberOfClients() == 0) | 3242 | if (ParentGroup.Scene.GetNumberOfClients() == 0) |
3243 | return; | 3243 | return; |
3244 | 3244 | ||
3245 | ParentGroup.QueueForUpdateCheck(); | ||
3246 | |||
3247 | bool isfull = false; | 3245 | bool isfull = false; |
3248 | if (ParentGroup.IsAttachment) | 3246 | if (ParentGroup.IsAttachment) |
3249 | { | 3247 | { |
@@ -3254,6 +3252,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3254 | lock (UpdateFlagLock) | 3252 | lock (UpdateFlagLock) |
3255 | UpdateFlag |= update; | 3253 | UpdateFlag |= update; |
3256 | 3254 | ||
3255 | ParentGroup.QueueForUpdateCheck(); | ||
3256 | |||
3257 | ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, isfull); | 3257 | ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, isfull); |
3258 | } | 3258 | } |
3259 | 3259 | ||
@@ -5133,8 +5133,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5133 | m_shape.TextureEntry = newTex.GetBytes(); | 5133 | m_shape.TextureEntry = newTex.GetBytes(); |
5134 | TriggerScriptChangedEvent(changeFlags); | 5134 | TriggerScriptChangedEvent(changeFlags); |
5135 | ParentGroup.HasGroupChanged = true; | 5135 | ParentGroup.HasGroupChanged = true; |
5136 | ScheduleFullUpdate(); | 5136 | ScheduleUpdate(PrimUpdateFlags.Textures); |
5137 | |||
5138 | } | 5137 | } |
5139 | 5138 | ||
5140 | /// <summary> | 5139 | /// <summary> |
@@ -5163,7 +5162,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5163 | m_shape.TextureEntry = newTex.GetBytes(); | 5162 | m_shape.TextureEntry = newTex.GetBytes(); |
5164 | TriggerScriptChangedEvent(changeFlags); | 5163 | TriggerScriptChangedEvent(changeFlags); |
5165 | ParentGroup.HasGroupChanged = true; | 5164 | ParentGroup.HasGroupChanged = true; |
5166 | ScheduleFullUpdate(); | 5165 | ScheduleUpdate(PrimUpdateFlags.Textures); |
5167 | } | 5166 | } |
5168 | 5167 | ||
5169 | internal void UpdatePhysicsSubscribedEvents() | 5168 | internal void UpdatePhysicsSubscribedEvents() |
@@ -5575,20 +5574,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
5575 | // handle osVolumeDetect | 5574 | // handle osVolumeDetect |
5576 | public void ScriptSetVolumeDetect(bool makeVolumeDetect) | 5575 | public void ScriptSetVolumeDetect(bool makeVolumeDetect) |
5577 | { | 5576 | { |
5577 | if(ParentGroup.IsDeleted) | ||
5578 | return; | ||
5579 | |||
5578 | if(_parentID == 0) | 5580 | if(_parentID == 0) |
5579 | { | 5581 | { |
5580 | // if root prim do it via SOG | 5582 | // if root prim do it is like llVolumeDetect |
5581 | ParentGroup.ScriptSetVolumeDetect(makeVolumeDetect); | 5583 | ParentGroup.ScriptSetVolumeDetect(makeVolumeDetect); |
5582 | return; | 5584 | return; |
5583 | } | 5585 | } |
5584 | 5586 | ||
5585 | bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); | 5587 | if(ParentGroup.IsVolumeDetect) |
5586 | bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); | 5588 | return; // entire linkset is phantom already |
5587 | bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); | 5589 | |
5590 | bool wasUsingPhysics = ParentGroup.UsesPhysics; | ||
5591 | bool wasTemporary = ParentGroup.IsTemporary; | ||
5592 | bool wasPhantom = ParentGroup.IsPhantom; | ||
5588 | 5593 | ||
5589 | if(PhysActor != null) | 5594 | if(PhysActor != null) |
5590 | PhysActor.Building = true; | 5595 | PhysActor.Building = true; |
5591 | UpdatePrimFlags(wasUsingPhysics,wasTemporary,wasPhantom,makeVolumeDetect,false); | 5596 | UpdatePrimFlags(wasUsingPhysics, wasTemporary, wasPhantom, makeVolumeDetect, false); |
5592 | } | 5597 | } |
5593 | 5598 | ||
5594 | protected static int m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0x5fffafL); | 5599 | protected static int m_animationSequenceNumber = (int)(Util.GetTimeStampTicks() & 0x5fffafL); |