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