diff options
author | UbitUmarov | 2016-07-13 02:07:07 +0100 |
---|---|---|
committer | UbitUmarov | 2016-07-13 02:07:07 +0100 |
commit | 2220ceb5227c33b497c44f0b63c29aa16083ef41 (patch) | |
tree | 27da74174121d11349d237c020062bcb30fae4c0 | |
parent | be nicer to PIs (actually linux) (diff) | |
download | opensim-SC-2220ceb5227c33b497c44f0b63c29aa16083ef41.zip opensim-SC-2220ceb5227c33b497c44f0b63c29aa16083ef41.tar.gz opensim-SC-2220ceb5227c33b497c44f0b63c29aa16083ef41.tar.bz2 opensim-SC-2220ceb5227c33b497c44f0b63c29aa16083ef41.tar.xz |
a few changes to culling
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fc6aeb4..9136f2d 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 | |||
4011 | if (update.Entity is SceneObjectPart) | 4011 | if (update.Entity is SceneObjectPart) |
4012 | { | 4012 | { |
4013 | SceneObjectPart part = (SceneObjectPart)update.Entity; | 4013 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
4014 | 4014 | SceneObjectGroup grp = part.ParentGroup; | |
4015 | if (part.ParentGroup.inTransit) | 4015 | if (grp.inTransit) |
4016 | continue; | 4016 | continue; |
4017 | 4017 | ||
4018 | if (part.ParentGroup.IsDeleted) | 4018 | if (grp.IsDeleted) |
4019 | { | 4019 | { |
4020 | // Don't send updates for objects that have been marked deleted. | 4020 | // Don't send updates for objects that have been marked deleted. |
4021 | // Instead send another kill object, because the first one may have gotten | 4021 | // Instead send another kill object, because the first one may have gotten |
4022 | // into a race condition | 4022 | // into a race condition |
4023 | if (!m_killRecord.Contains(part.ParentGroup.LocalId)) | 4023 | if (!m_killRecord.Contains(grp.LocalId)) |
4024 | m_killRecord.Add(part.ParentGroup.LocalId); | 4024 | m_killRecord.Add(grp.LocalId); |
4025 | continue; | 4025 | continue; |
4026 | } | 4026 | } |
4027 | 4027 | ||
4028 | if (part.ParentGroup.IsAttachment) | 4028 | if (grp.IsAttachment) |
4029 | { // Someone else's HUD, why are we getting these? | 4029 | { // Someone else's HUD, why are we getting these? |
4030 | if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint) | 4030 | if (grp.OwnerID != AgentId && grp.HasPrivateAttachmentPoint) |
4031 | continue; | 4031 | continue; |
4032 | ScenePresence sp; | 4032 | ScenePresence sp; |
4033 | // Owner is not in the sim, don't update it to | 4033 | // Owner is not in the sim, don't update it to |
@@ -4039,7 +4039,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4039 | bool found = false; | 4039 | bool found = false; |
4040 | foreach (SceneObjectGroup att in atts) | 4040 | foreach (SceneObjectGroup att in atts) |
4041 | { | 4041 | { |
4042 | if (att == part.ParentGroup) | 4042 | if (att == grp) |
4043 | { | 4043 | { |
4044 | found = true; | 4044 | found = true; |
4045 | break; | 4045 | break; |
@@ -4061,10 +4061,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4061 | 4061 | ||
4062 | } | 4062 | } |
4063 | 4063 | ||
4064 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 4064 | if (grp.IsAttachment && m_disableFacelights) |
4065 | { | 4065 | { |
4066 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 4066 | if (grp.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && |
4067 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | 4067 | grp.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) |
4068 | { | 4068 | { |
4069 | part.Shape.LightEntry = false; | 4069 | part.Shape.LightEntry = false; |
4070 | } | 4070 | } |
@@ -4078,26 +4078,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4078 | } | 4078 | } |
4079 | } | 4079 | } |
4080 | 4080 | ||
4081 | if(doCulling && !part.ParentGroup.IsAttachment) | 4081 | if(doCulling && !grp.IsAttachment) |
4082 | { | 4082 | { |
4083 | if(GroupsNeedFullUpdate.Contains(grp)) | ||
4084 | continue; | ||
4085 | |||
4083 | bool inview = false; | 4086 | bool inview = false; |
4084 | lock(GroupsInView) | 4087 | lock(GroupsInView) |
4085 | inview = GroupsInView.Contains(part.ParentGroup); | 4088 | inview = GroupsInView.Contains(grp); |
4086 | 4089 | ||
4087 | if(!inview) | 4090 | if(!inview) |
4088 | { | 4091 | { |
4089 | Vector3 partpos = part.ParentGroup.AbsolutePosition; | 4092 | Vector3 partpos = grp.AbsolutePosition; |
4090 | float dcam = (partpos - mycamera).LengthSquared(); | 4093 | float dcam = (partpos - mycamera).LengthSquared(); |
4091 | float dpos = (partpos - mypos).LengthSquared(); | 4094 | float dpos = (partpos - mypos).LengthSquared(); |
4092 | if(dcam < dpos) | 4095 | if(dcam < dpos) |
4093 | dpos = dcam; | 4096 | dpos = dcam; |
4094 | dpos = (float)Math.Sqrt(dpos) - part.ParentGroup.GetBoundsRadius(); | 4097 | dpos = (float)Math.Sqrt(dpos) - grp.GetBoundsRadius(); |
4095 | if(dpos > cullingrange) | 4098 | if(dpos > cullingrange) |
4096 | continue; | 4099 | continue; |
4097 | 4100 | ||
4098 | if(!GroupsNeedFullUpdate.Contains(part.ParentGroup)) | 4101 | GroupsNeedFullUpdate.Add(grp); |
4099 | GroupsNeedFullUpdate.Add(part.ParentGroup); | 4102 | continue; |
4100 | continue; | ||
4101 | } | 4103 | } |
4102 | } | 4104 | } |
4103 | 4105 | ||
@@ -4362,7 +4364,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4362 | 4364 | ||
4363 | HashSet<SceneObjectGroup> NewGroupsInView = new HashSet<SceneObjectGroup>(); | 4365 | HashSet<SceneObjectGroup> NewGroupsInView = new HashSet<SceneObjectGroup>(); |
4364 | HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); | 4366 | HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); |
4365 | 4367 | List<uint> kills = new List<uint>(); | |
4366 | // will this take for ever ? | 4368 | // will this take for ever ? |
4367 | EntityBase[] entities = m_scene.Entities.GetEntities(); | 4369 | EntityBase[] entities = m_scene.Entities.GetEntities(); |
4368 | foreach (EntityBase e in entities) | 4370 | foreach (EntityBase e in entities) |
@@ -4383,14 +4385,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4383 | { | 4385 | { |
4384 | if(inview) | 4386 | if(inview) |
4385 | { | 4387 | { |
4386 | GroupsInView.Remove(grp); | 4388 | // GroupsInView.Remove(grp); |
4387 | if (!m_killRecord.Contains(grp.LocalId)) | 4389 | if (!kills.Contains(grp.LocalId)) |
4388 | m_killRecord.Add(grp.LocalId); | 4390 | kills.Add(grp.LocalId); |
4389 | } | 4391 | } |
4390 | } | 4392 | } |
4391 | else | 4393 | else |
4392 | { | 4394 | { |
4393 | if(!inview && !GroupsNeedFullUpdate.Contains(grp)) | 4395 | if(!inview) |
4394 | GroupsNeedFullUpdate.Add(grp); | 4396 | GroupsNeedFullUpdate.Add(grp); |
4395 | NewGroupsInView.Add(grp); | 4397 | NewGroupsInView.Add(grp); |
4396 | } | 4398 | } |
@@ -4400,10 +4402,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4400 | lock(GroupsInView) | 4402 | lock(GroupsInView) |
4401 | GroupsInView = NewGroupsInView; | 4403 | GroupsInView = NewGroupsInView; |
4402 | 4404 | ||
4403 | if (m_killRecord.Count > 0) | 4405 | if (kills.Count > 0) |
4404 | { | 4406 | { |
4405 | SendKillObject(m_killRecord); | 4407 | SendKillObject(kills); |
4406 | m_killRecord.Clear(); | 4408 | kills.Clear(); |
4407 | } | 4409 | } |
4408 | 4410 | ||
4409 | if(GroupsNeedFullUpdate.Count > 0) | 4411 | if(GroupsNeedFullUpdate.Count > 0) |