reduce some locks on culling checks

LSLKeyTest
UbitUmarov 2016-07-12 22:15:39 +01:00
parent bc6c342d01
commit 3507566692
1 changed files with 38 additions and 36 deletions

View File

@ -4080,9 +4080,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if(doCulling && !part.ParentGroup.IsAttachment)
{
bool inview = false;
lock(GroupsInView)
{
if(!GroupsInView.Contains(part.ParentGroup))
inview = GroupsInView.Contains(part.ParentGroup);
if(!inview)
{
Vector3 partpos = part.ParentGroup.AbsolutePosition;
float dcam = (partpos - mycamera).LengthSquared();
@ -4098,7 +4100,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
continue;
}
}
}
if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
{
@ -4363,8 +4364,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>();
// will this take for ever ?
lock(GroupsInView)
{
EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase e in entities)
{
@ -4377,9 +4376,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if(dcam < dpos)
dpos = dcam;
dpos = (float)Math.Sqrt(dpos) - grp.GetBoundsRadius();
bool inview;
lock(GroupsInView)
inview = GroupsInView.Contains(grp);
if(dpos > cullingrange)
{
if(GroupsInView.Contains(grp))
if(inview)
{
GroupsInView.Remove(grp);
if (!m_killRecord.Contains(grp.LocalId))
@ -4388,14 +4390,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
if(!GroupsInView.Contains(grp) && !GroupsNeedFullUpdate.Contains(grp))
if(!inview && !GroupsNeedFullUpdate.Contains(grp))
GroupsNeedFullUpdate.Add(grp);
NewGroupsInView.Add(grp);
}
}
}
}
lock(GroupsInView)
GroupsInView = NewGroupsInView;
if (m_killRecord.Count > 0)