changes on updates

0.9.1.0-post-fixes
UbitUmarov 2018-12-29 16:52:16 +00:00
parent 7679617d52
commit 333aa0d67c
1 changed files with 92 additions and 131 deletions

View File

@ -3999,13 +3999,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
ScenePresence presence = ent as ScenePresence; ScenePresence presence = ent as ScenePresence;
objupdate.RegionData.RegionHandle = presence.RegionHandle; objupdate.RegionData.RegionHandle = presence.RegionHandle;
objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false); objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent);
} }
else if(ent is SceneObjectPart) else if(ent is SceneObjectPart)
{ {
SceneObjectPart part = ent as SceneObjectPart; SceneObjectPart part = ent as SceneObjectPart;
objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false); objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent);
} }
OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
@ -4246,28 +4246,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ // Someone else's HUD, why are we getting these? { // Someone else's HUD, why are we getting these?
if (grp.OwnerID != AgentId && grp.HasPrivateAttachmentPoint) if (grp.OwnerID != AgentId && grp.HasPrivateAttachmentPoint)
continue; continue;
// if owner gone don't update it to anyone
ScenePresence sp; ScenePresence sp;
// Owner is not in the sim, don't update it to
// anyone
if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
continue; continue;
List<SceneObjectGroup> atts = sp.GetAttachments();
bool found = false;
foreach (SceneObjectGroup att in atts)
{
if (att == grp)
{
found = true;
break;
}
}
// It's an attachment of a valid avatar, but
// doesn't seem to be attached, skip
if (!found)
continue;
// On vehicle crossing, the attachments are received // On vehicle crossing, the attachments are received
// while the avatar is still a child. Don't send // while the avatar is still a child. Don't send
// updates here because the LocalId has not yet // updates here because the LocalId has not yet
@ -4276,9 +4260,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (sp.IsChildAgent) if (sp.IsChildAgent)
continue; continue;
// It's an attachment of a valid avatar, but
// doesn't seem to be attached, skip
List<SceneObjectGroup> atts = sp.GetAttachments();
bool found = false;
foreach (SceneObjectGroup att in atts)
{
if (att == grp)
{
found = true;
break;
} }
}
if (!found)
continue;
if (grp.IsAttachment && m_disableFacelights) if (m_disableFacelights)
{ {
if (grp.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && if (grp.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
grp.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) grp.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
@ -4286,8 +4283,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
part.Shape.LightEntry = false; part.Shape.LightEntry = false;
} }
} }
}
if(doCulling && !grp.IsAttachment) else if (doCulling)
{ {
if(GroupsNeedFullUpdate.Contains(grp)) if(GroupsNeedFullUpdate.Contains(grp))
continue; continue;
@ -4326,73 +4324,92 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0) if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0)
continue; continue;
} }
else // what is this update ?
continue;
#region UpdateFlags to packet type conversion #region UpdateFlags to packet type conversion
bool canUseCompressed = true; // bool canUseCompressed = true;
bool canUseImproved = true;
// Compressed object updates only make sense for LL primitives if (update.Entity is SceneObjectPart)
if (!(update.Entity is SceneObjectPart))
{ {
canUseCompressed = false; if (updateFlags.HasFlag(PrimUpdateFlags.Animations))
}
else
{ {
if(updateFlags.HasFlag(PrimUpdateFlags.Animations))
{
updateFlags &= ~PrimUpdateFlags.Animations;
SceneObjectPart sop = (SceneObjectPart)update.Entity; SceneObjectPart sop = (SceneObjectPart)update.Entity;
if(sop.Animations != null) if (sop.Animations != null)
{ {
ObjectAnimationUpdates.Value.Add(sop); ObjectAnimationUpdates.Value.Add(sop);
maxUpdatesBytes -= 32 * sop.Animations.Count + 16; maxUpdatesBytes -= 32 * sop.Animations.Count + 16;
} }
} }
} }
if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
{
canUseCompressed = false;
canUseImproved = false;
}
else else
{ {
if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || // canUseCompressed = false;
updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || }
updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
updateFlags.HasFlag(PrimUpdateFlags.Joint)) updateFlags &= PrimUpdateFlags.FullUpdate; // clear other control bits already handled
if(updateFlags == PrimUpdateFlags.None)
continue;
/*
const PrimUpdateFlags canNotUseCompressedMask =
PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration |
PrimUpdateFlags.CollisionPlane | PrimUpdateFlags.Joint;
if ((updateFlags & canNotUseCompressedMask) != 0)
{ {
canUseCompressed = false; canUseCompressed = false;
} }
*/
if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || const PrimUpdateFlags canNotUseImprovedMask = ~(
updateFlags.HasFlag(PrimUpdateFlags.ParentID) || PrimUpdateFlags.AttachmentPoint |
updateFlags.HasFlag(PrimUpdateFlags.Scale) || PrimUpdateFlags.Position |
updateFlags.HasFlag(PrimUpdateFlags.PrimData) || PrimUpdateFlags.Rotation |
updateFlags.HasFlag(PrimUpdateFlags.Text) || PrimUpdateFlags.Velocity |
updateFlags.HasFlag(PrimUpdateFlags.NameValue) || PrimUpdateFlags.Acceleration |
updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || PrimUpdateFlags.AngularVelocity |
updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || PrimUpdateFlags.CollisionPlane
updateFlags.HasFlag(PrimUpdateFlags.Sound) || );
updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
updateFlags.HasFlag(PrimUpdateFlags.Material) ||
updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
updateFlags.HasFlag(PrimUpdateFlags.Joint))
{
canUseImproved = false;
}
}
#endregion UpdateFlags to packet type conversion #endregion UpdateFlags to packet type conversion
#region Block Construction #region Block Construction
// TODO: Remove this once we can build compressed updates // TODO: Remove this once we can build compressed updates
canUseCompressed = false; /*
if (canUseCompressed)
{
ObjectUpdateCompressedPacket.ObjectDataBlock ablock =
CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags);
compressedUpdateBlocks.Add(ablock);
compressedUpdates.Value.Add(update);
maxUpdatesBytes -= ablock.Length;
}
else if (canUseImproved)
*/
if (!canUseImproved && !canUseCompressed) if ((updateFlags & canNotUseImprovedMask) == 0)
{
ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock =
CreateImprovedTerseBlock(update.Entity);
if (update.Entity is ScenePresence)
{
// ALL presence updates go into a special list
terseAgentUpdateBlocks.Add(ablock);
terseAgentUpdates.Value.Add(update);
}
else
{
// Everything else goes here
terseUpdateBlocks.Add(ablock);
terseUpdates.Value.Add(update);
}
maxUpdatesBytes -= ablock.Length;
}
else
{ {
ObjectUpdatePacket.ObjectDataBlock ablock; ObjectUpdatePacket.ObjectDataBlock ablock;
if (update.Entity is ScenePresence) if (update.Entity is ScenePresence)
@ -4402,34 +4419,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objectUpdateBlocks.Add(ablock); objectUpdateBlocks.Add(ablock);
objectUpdates.Value.Add(update); objectUpdates.Value.Add(update);
maxUpdatesBytes -= ablock.Length; maxUpdatesBytes -= ablock.Length;
}
else if (!canUseImproved)
{
ObjectUpdateCompressedPacket.ObjectDataBlock ablock =
CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags);
compressedUpdateBlocks.Add(ablock);
compressedUpdates.Value.Add(update);
maxUpdatesBytes -= ablock.Length;
}
else
{
ImprovedTerseObjectUpdatePacket.ObjectDataBlock ablock;
if (update.Entity is ScenePresence)
{
// ALL presence updates go into a special list
ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
terseAgentUpdateBlocks.Add(ablock);
terseAgentUpdates.Value.Add(update);
}
else
{
// Everything else goes here
ablock = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
terseUpdateBlocks.Add(ablock);
terseUpdates.Value.Add(update);
}
maxUpdatesBytes -= ablock.Length;
} }
#endregion Block Construction #endregion Block Construction
@ -5636,7 +5625,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity, bool sendTexture) protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedTerseBlock(ISceneEntity entity)
{ {
#region ScenePresence/SOP Handling #region ScenePresence/SOP Handling
@ -5646,7 +5635,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Vector4 collisionPlane; Vector4 collisionPlane;
Vector3 position, velocity, acceleration, angularVelocity; Vector3 position, velocity, acceleration, angularVelocity;
Quaternion rotation; Quaternion rotation;
byte[] textureEntry;
if (avatar) if (avatar)
{ {
@ -5670,13 +5658,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
attachPoint = presence.State; attachPoint = presence.State;
collisionPlane = presence.CollisionPlane; collisionPlane = presence.CollisionPlane;
if (sendTexture)
{
textureEntry = presence.Appearance.Texture.GetBytes();
}
else
textureEntry = null;
} }
else else
{ {
@ -5694,11 +5675,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
acceleration = part.Acceleration; acceleration = part.Acceleration;
angularVelocity = part.AngularVelocity; angularVelocity = part.AngularVelocity;
rotation = part.RotationOffset; rotation = part.RotationOffset;
if (sendTexture)
textureEntry = part.Shape.TextureEntry;
else
textureEntry = null;
} }
#endregion ScenePresence/SOP Handling #endregion ScenePresence/SOP Handling
@ -5759,22 +5735,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
= PacketPool.Instance.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); = PacketPool.Instance.GetDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
block.Data = data; block.Data = data;
if (textureEntry != null && textureEntry.Length > 0)
{
byte[] teBytesFinal = new byte[textureEntry.Length + 4];
// Texture Length
Utils.IntToBytes(textureEntry.Length, textureEntry, 0);
// Texture
Buffer.BlockCopy(textureEntry, 0, teBytesFinal, 4, textureEntry.Length);
block.TextureEntry = teBytesFinal;
}
else
{
block.TextureEntry = Utils.EmptyBytes; block.TextureEntry = Utils.EmptyBytes;
}
return block; return block;
} }
@ -13290,7 +13251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// when the avatar stands up // when the avatar stands up
ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = ImprovedTerseObjectUpdatePacket.ObjectDataBlock block =
CreateImprovedTerseBlock(p, false); CreateImprovedTerseBlock(p);
// const float TIME_DILATION = 1.0f; // const float TIME_DILATION = 1.0f;
ushort timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);; ushort timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);;