From 2220ceb5227c33b497c44f0b63c29aa16083ef41 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 13 Jul 2016 02:07:07 +0100 Subject: [PATCH] a few changes to culling --- .../ClientStack/Linden/UDP/LLClientView.cs | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fc6aeb4432..9136f2d956 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4011,23 +4011,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (update.Entity is SceneObjectPart) { SceneObjectPart part = (SceneObjectPart)update.Entity; - - if (part.ParentGroup.inTransit) + SceneObjectGroup grp = part.ParentGroup; + if (grp.inTransit) continue; - if (part.ParentGroup.IsDeleted) + if (grp.IsDeleted) { // Don't send updates for objects that have been marked deleted. // Instead send another kill object, because the first one may have gotten // into a race condition - if (!m_killRecord.Contains(part.ParentGroup.LocalId)) - m_killRecord.Add(part.ParentGroup.LocalId); + if (!m_killRecord.Contains(grp.LocalId)) + m_killRecord.Add(grp.LocalId); continue; } - if (part.ParentGroup.IsAttachment) + if (grp.IsAttachment) { // Someone else's HUD, why are we getting these? - if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint) + if (grp.OwnerID != AgentId && grp.HasPrivateAttachmentPoint) continue; ScenePresence sp; // Owner is not in the sim, don't update it to @@ -4039,7 +4039,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bool found = false; foreach (SceneObjectGroup att in atts) { - if (att == part.ParentGroup) + if (att == grp) { found = true; break; @@ -4061,10 +4061,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } - if (part.ParentGroup.IsAttachment && m_disableFacelights) + if (grp.IsAttachment && m_disableFacelights) { - if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && - part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) + if (grp.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && + grp.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) { part.Shape.LightEntry = false; } @@ -4078,26 +4078,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - if(doCulling && !part.ParentGroup.IsAttachment) + if(doCulling && !grp.IsAttachment) { + if(GroupsNeedFullUpdate.Contains(grp)) + continue; + bool inview = false; lock(GroupsInView) - inview = GroupsInView.Contains(part.ParentGroup); + inview = GroupsInView.Contains(grp); if(!inview) { - Vector3 partpos = part.ParentGroup.AbsolutePosition; + Vector3 partpos = grp.AbsolutePosition; float dcam = (partpos - mycamera).LengthSquared(); float dpos = (partpos - mypos).LengthSquared(); if(dcam < dpos) dpos = dcam; - dpos = (float)Math.Sqrt(dpos) - part.ParentGroup.GetBoundsRadius(); + dpos = (float)Math.Sqrt(dpos) - grp.GetBoundsRadius(); if(dpos > cullingrange) continue; - if(!GroupsNeedFullUpdate.Contains(part.ParentGroup)) - GroupsNeedFullUpdate.Add(part.ParentGroup); - continue; + GroupsNeedFullUpdate.Add(grp); + continue; } } @@ -4362,7 +4364,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP HashSet NewGroupsInView = new HashSet(); HashSet GroupsNeedFullUpdate = new HashSet(); - + List kills = new List(); // will this take for ever ? EntityBase[] entities = m_scene.Entities.GetEntities(); foreach (EntityBase e in entities) @@ -4383,14 +4385,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if(inview) { - GroupsInView.Remove(grp); - if (!m_killRecord.Contains(grp.LocalId)) - m_killRecord.Add(grp.LocalId); +// GroupsInView.Remove(grp); + if (!kills.Contains(grp.LocalId)) + kills.Add(grp.LocalId); } } else { - if(!inview && !GroupsNeedFullUpdate.Contains(grp)) + if(!inview) GroupsNeedFullUpdate.Add(grp); NewGroupsInView.Add(grp); } @@ -4400,10 +4402,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock(GroupsInView) GroupsInView = NewGroupsInView; - if (m_killRecord.Count > 0) + if (kills.Count > 0) { - SendKillObject(m_killRecord); - m_killRecord.Clear(); + SendKillObject(kills); + kills.Clear(); } if(GroupsNeedFullUpdate.Count > 0)