aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs189
1 files changed, 75 insertions, 114 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 882f22f..afc317e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3999,13 +3999,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3999 { 3999 {
4000 ScenePresence presence = ent as ScenePresence; 4000 ScenePresence presence = ent as ScenePresence;
4001 objupdate.RegionData.RegionHandle = presence.RegionHandle; 4001 objupdate.RegionData.RegionHandle = presence.RegionHandle;
4002 objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false); 4002 objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent);
4003 } 4003 }
4004 else if(ent is SceneObjectPart) 4004 else if(ent is SceneObjectPart)
4005 { 4005 {
4006 SceneObjectPart part = ent as SceneObjectPart; 4006 SceneObjectPart part = ent as SceneObjectPart;
4007 objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4007 objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4008 objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false); 4008 objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent);
4009 } 4009 }
4010 4010
4011 OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); 4011 OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
@@ -4246,12 +4246,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4246 { // Someone else's HUD, why are we getting these? 4246 { // Someone else's HUD, why are we getting these?
4247 if (grp.OwnerID != AgentId && grp.HasPrivateAttachmentPoint) 4247 if (grp.OwnerID != AgentId && grp.HasPrivateAttachmentPoint)
4248 continue; 4248 continue;
4249
4250 // if owner gone don't update it to anyone
4249 ScenePresence sp; 4251 ScenePresence sp;
4250 // Owner is not in the sim, don't update it to
4251 // anyone
4252 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) 4252 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
4253 continue; 4253 continue;
4254 4254
4255 // On vehicle crossing, the attachments are received
4256 // while the avatar is still a child. Don't send
4257 // updates here because the LocalId has not yet
4258 // been updated and the viewer will derender the
4259 // attachments until the avatar becomes root.
4260 if (sp.IsChildAgent)
4261 continue;
4262
4263 // It's an attachment of a valid avatar, but
4264 // doesn't seem to be attached, skip
4255 List<SceneObjectGroup> atts = sp.GetAttachments(); 4265 List<SceneObjectGroup> atts = sp.GetAttachments();
4256 bool found = false; 4266 bool found = false;
4257 foreach (SceneObjectGroup att in atts) 4267 foreach (SceneObjectGroup att in atts)
@@ -4262,32 +4272,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4262 break; 4272 break;
4263 } 4273 }
4264 } 4274 }
4265
4266 // It's an attachment of a valid avatar, but
4267 // doesn't seem to be attached, skip
4268 if (!found) 4275 if (!found)
4269 continue; 4276 continue;
4270 4277
4271 // On vehicle crossing, the attachments are received 4278 if (m_disableFacelights)
4272 // while the avatar is still a child. Don't send
4273 // updates here because the LocalId has not yet
4274 // been updated and the viewer will derender the
4275 // attachments until the avatar becomes root.
4276 if (sp.IsChildAgent)
4277 continue;
4278
4279 }
4280
4281 if (grp.IsAttachment && m_disableFacelights)
4282 {
4283 if (grp.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
4284 grp.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
4285 { 4279 {
4286 part.Shape.LightEntry = false; 4280 if (grp.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
4281 grp.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
4282 {
4283 part.Shape.LightEntry = false;
4284 }
4287 } 4285 }
4288 } 4286 }
4289 4287
4290 if(doCulling && !grp.IsAttachment) 4288 else if (doCulling)
4291 { 4289 {
4292 if(GroupsNeedFullUpdate.Contains(grp)) 4290 if(GroupsNeedFullUpdate.Contains(grp))
4293 continue; 4291 continue;
@@ -4326,111 +4324,102 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4326 if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0) 4324 if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0)
4327 continue; 4325 continue;
4328 } 4326 }
4327 else // what is this update ?
4328 continue;
4329 4329
4330 #region UpdateFlags to packet type conversion 4330 #region UpdateFlags to packet type conversion
4331 4331
4332 bool canUseCompressed = true; 4332 // bool canUseCompressed = true;
4333 bool canUseImproved = true;
4334 4333
4335 // Compressed object updates only make sense for LL primitives 4334 if (update.Entity is SceneObjectPart)
4336 if (!(update.Entity is SceneObjectPart))
4337 {
4338 canUseCompressed = false;
4339 }
4340 else
4341 { 4335 {
4342 if(updateFlags.HasFlag(PrimUpdateFlags.Animations)) 4336 if (updateFlags.HasFlag(PrimUpdateFlags.Animations))
4343 { 4337 {
4344 updateFlags &= ~PrimUpdateFlags.Animations;
4345 SceneObjectPart sop = (SceneObjectPart)update.Entity; 4338 SceneObjectPart sop = (SceneObjectPart)update.Entity;
4346 if(sop.Animations != null) 4339 if (sop.Animations != null)
4347 { 4340 {
4348 ObjectAnimationUpdates.Value.Add(sop); 4341 ObjectAnimationUpdates.Value.Add(sop);
4349 maxUpdatesBytes -= 32 * sop.Animations.Count + 16; 4342 maxUpdatesBytes -= 32 * sop.Animations.Count + 16;
4350 } 4343 }
4351 } 4344 }
4352 } 4345 }
4346 else
4347 {
4348 // canUseCompressed = false;
4349 }
4353 4350
4354 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) 4351 updateFlags &= PrimUpdateFlags.FullUpdate; // clear other control bits already handled
4352 if(updateFlags == PrimUpdateFlags.None)
4353 continue;
4354
4355 /*
4356 const PrimUpdateFlags canNotUseCompressedMask =
4357 PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration |
4358 PrimUpdateFlags.CollisionPlane | PrimUpdateFlags.Joint;
4359
4360 if ((updateFlags & canNotUseCompressedMask) != 0)
4355 { 4361 {
4356 canUseCompressed = false; 4362 canUseCompressed = false;
4357 canUseImproved = false;
4358 } 4363 }
4359 else 4364 */
4360 {
4361 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
4362 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
4363 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
4364 updateFlags.HasFlag(PrimUpdateFlags.Joint))
4365 {
4366 canUseCompressed = false;
4367 }
4368 4365
4369 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || 4366 const PrimUpdateFlags canNotUseImprovedMask = ~(
4370 updateFlags.HasFlag(PrimUpdateFlags.ParentID) || 4367 PrimUpdateFlags.AttachmentPoint |
4371 updateFlags.HasFlag(PrimUpdateFlags.Scale) || 4368 PrimUpdateFlags.Position |
4372 updateFlags.HasFlag(PrimUpdateFlags.PrimData) || 4369 PrimUpdateFlags.Rotation |
4373 updateFlags.HasFlag(PrimUpdateFlags.Text) || 4370 PrimUpdateFlags.Velocity |
4374 updateFlags.HasFlag(PrimUpdateFlags.NameValue) || 4371 PrimUpdateFlags.Acceleration |
4375 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || 4372 PrimUpdateFlags.AngularVelocity |
4376 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || 4373 PrimUpdateFlags.CollisionPlane
4377 updateFlags.HasFlag(PrimUpdateFlags.Sound) || 4374 );
4378 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
4379 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
4380 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
4381 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
4382 updateFlags.HasFlag(PrimUpdateFlags.Joint))
4383 {
4384 canUseImproved = false;
4385 }
4386 }
4387 4375
4388 #endregion UpdateFlags to packet type conversion 4376 #endregion UpdateFlags to packet type conversion
4389 4377
4390 #region Block Construction 4378 #region Block Construction
4391 4379
4392 // TODO: Remove this once we can build compressed updates 4380 // TODO: Remove this once we can build compressed updates
4393 canUseCompressed = false; 4381 /*
4394 4382 if (canUseCompressed)
4395 if (!canUseImproved && !canUseCompressed)
4396 {
4397 ObjectUpdatePacket.ObjectDataBlock ablock;
4398 if (update.Entity is ScenePresence)
4399 ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
4400 else
4401 ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp);
4402 objectUpdateBlocks.Add(ablock);
4403 objectUpdates.Value.Add(update);
4404 maxUpdatesBytes -= ablock.Length;
4405
4406 }
4407 else if (!canUseImproved)
4408 { 4383 {
4409 ObjectUpdateCompressedPacket.ObjectDataBlock ablock = 4384 ObjectUpdateCompressedPacket.ObjectDataBlock ablock =
4410 CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags); 4385 CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags);
4411 compressedUpdateBlocks.Add(ablock); 4386 compressedUpdateBlocks.Add(ablock);
4412 compressedUpdates.Value.Add(update); 4387 compressedUpdates.Value.Add(update);
4413 maxUpdatesBytes -= ablock.Length; 4388 maxUpdatesBytes -= ablock.Length;
4414 } 4389 }
4415 else 4390 else if (canUseImproved)
4391 */
4392
4393 if ((updateFlags & canNotUseImprovedMask) == 0)
4416 { 4394 {
4417 ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock; 4395 ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock =
4396 CreateImprovedTerseBlock(update.Entity);
4397
4418 if (update.Entity is ScenePresence) 4398 if (update.Entity is ScenePresence)
4419 { 4399 {
4420 // ALL presence updates go into a special list 4400 // ALL presence updates go into a special list
4421 ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
4422 terseAgentUpdateBlocks.Add(ablock); 4401 terseAgentUpdateBlocks.Add(ablock);
4423 terseAgentUpdates.Value.Add(update); 4402 terseAgentUpdates.Value.Add(update);
4424 } 4403 }
4425 else 4404 else
4426 { 4405 {
4427 // Everything else goes here 4406 // Everything else goes here
4428 ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
4429 terseUpdateBlocks.Add(ablock); 4407 terseUpdateBlocks.Add(ablock);
4430 terseUpdates.Value.Add(update); 4408 terseUpdates.Value.Add(update);
4431 } 4409 }
4432 maxUpdatesBytes -= ablock.Length; 4410 maxUpdatesBytes -= ablock.Length;
4433 } 4411 }
4412 else
4413 {
4414 ObjectUpdatePacket.ObjectDataBlock ablock;
4415 if (update.Entity is ScenePresence)
4416 ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
4417 else
4418 ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp);
4419 objectUpdateBlocks.Add(ablock);
4420 objectUpdates.Value.Add(update);
4421 maxUpdatesBytes -= ablock.Length;
4422 }
4434 4423
4435 #endregion Block Construction 4424 #endregion Block Construction
4436 } 4425 }
@@ -5636,7 +5625,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5636 } 5625 }
5637 } 5626 }
5638 5627
5639 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity, bool sendTexture) 5628 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity)
5640 { 5629 {
5641 #region ScenePresence/SOP Handling 5630 #region ScenePresence/SOP Handling
5642 5631
@@ -5646,7 +5635,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5646 Vector4 collisionPlane; 5635 Vector4 collisionPlane;
5647 Vector3 position, velocity, acceleration, angularVelocity; 5636 Vector3 position, velocity, acceleration, angularVelocity;
5648 Quaternion rotation; 5637 Quaternion rotation;
5649 byte[] textureEntry;
5650 5638
5651 if (avatar) 5639 if (avatar)
5652 { 5640 {
@@ -5670,13 +5658,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5670 5658
5671 attachPoint = presence.State; 5659 attachPoint = presence.State;
5672 collisionPlane = presence.CollisionPlane; 5660 collisionPlane = presence.CollisionPlane;
5673
5674 if (sendTexture)
5675 {
5676 textureEntry = presence.Appearance.Texture.GetBytes();
5677 }
5678 else
5679 textureEntry = null;
5680 } 5661 }
5681 else 5662 else
5682 { 5663 {
@@ -5694,11 +5675,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5694 acceleration = part.Acceleration; 5675 acceleration = part.Acceleration;
5695 angularVelocity = part.AngularVelocity; 5676 angularVelocity = part.AngularVelocity;
5696 rotation = part.RotationOffset; 5677 rotation = part.RotationOffset;
5697
5698 if (sendTexture)
5699 textureEntry = part.Shape.TextureEntry;
5700 else
5701 textureEntry = null;
5702 } 5678 }
5703 5679
5704 #endregion ScenePresence/SOP Handling 5680 #endregion ScenePresence/SOP Handling
@@ -5759,22 +5735,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5759 = PacketPool.Instance.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 5735 = PacketPool.Instance.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
5760 5736
5761 block.Data = data; 5737 block.Data = data;
5762 5738 block.TextureEntry = Utils.EmptyBytes;
5763 if (textureEntry != null && textureEntry.Length > 0)
5764 {
5765 byte[] teBytesFinal = new byte[textureEntry.Length + 4];
5766
5767 // Texture Length
5768 Utils.IntToBytes(textureEntry.Length, textureEntry, 0);
5769 // Texture
5770 Buffer.BlockCopy(textureEntry, 0, teBytesFinal, 4, textureEntry.Length);
5771
5772 block.TextureEntry = teBytesFinal;
5773 }
5774 else
5775 {
5776 block.TextureEntry = Utils.EmptyBytes;
5777 }
5778 5739
5779 return block; 5740 return block;
5780 } 5741 }
@@ -13290,7 +13251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13290 // when the avatar stands up 13251 // when the avatar stands up
13291 13252
13292 ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = 13253 ImprovedTerseObjectUpdatePacket.ObjectDataBlock block =
13293 CreateImprovedTerseBlock(p, false); 13254 CreateImprovedTerseBlock(p);
13294 13255
13295// const float TIME_DILATION = 1.0f; 13256// const float TIME_DILATION = 1.0f;
13296 ushort timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);; 13257 ushort timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);;