aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs122
1 files changed, 50 insertions, 72 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 8103eac..cbb1075 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47 47
48
48using AssetLandmark = OpenSim.Framework.AssetLandmark; 49using AssetLandmark = OpenSim.Framework.AssetLandmark;
49using Caps = OpenSim.Framework.Capabilities.Caps; 50using Caps = OpenSim.Framework.Capabilities.Caps;
50using PermissionMask = OpenSim.Framework.PermissionMask; 51using PermissionMask = OpenSim.Framework.PermissionMask;
@@ -4097,6 +4098,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4097 if (!IsActive) 4098 if (!IsActive)
4098 return; 4099 return;
4099 4100
4101 ScenePresence mysp = (ScenePresence)SceneAgent;
4102 if (mysp == null)
4103 return;
4104
4100 List<ObjectUpdatePacket.ObjectDataBlock> objectUpdateBlocks = null; 4105 List<ObjectUpdatePacket.ObjectDataBlock> objectUpdateBlocks = null;
4101 List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = null; 4106 List<ObjectUpdateCompressedPacket.ObjectDataBlock> compressedUpdateBlocks = null;
4102 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseUpdateBlocks = null; 4107 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> terseUpdateBlocks = null;
@@ -4114,39 +4119,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4114 } 4119 }
4115 4120
4116 EntityUpdate update; 4121 EntityUpdate update;
4117 Int32 timeinqueue; // this is just debugging code & can be dropped later
4118 4122
4119 bool doCulling = m_scene.ObjectsCullingByDistance; 4123 bool doCulling = m_scene.ObjectsCullingByDistance;
4120 float cullingrange = 64.0f; 4124 float cullingrange = 64.0f;
4121 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>();
4122// Vector3 mycamera = Vector3.Zero;
4123 Vector3 mypos = Vector3.Zero; 4125 Vector3 mypos = Vector3.Zero;
4124 ScenePresence mysp = (ScenePresence)SceneAgent;
4125 4126
4126 bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance; 4127 bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance;
4127 // we should have a presence
4128 if(mysp == null)
4129 return;
4130 4128
4131 if(doCulling) 4129 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>();
4130
4131 if (doCulling)
4132 { 4132 {
4133 cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f; 4133 cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
4134// mycamera = mysp.CameraPosition;
4135 mypos = mysp.AbsolutePosition; 4134 mypos = mysp.AbsolutePosition;
4136 } 4135 }
4137 4136
4138 while (maxUpdatesBytes > 0) 4137 while (maxUpdatesBytes > 0)
4139 { 4138 {
4139 if (!IsActive)
4140 return;
4141
4140 lock (m_entityUpdates.SyncRoot) 4142 lock (m_entityUpdates.SyncRoot)
4141 { 4143 {
4142 if(orderedDequeue) 4144 if(orderedDequeue)
4143 { 4145 {
4144 if (!m_entityUpdates.TryOrderedDequeue(out update, out timeinqueue)) 4146 if (!m_entityUpdates.TryOrderedDequeue(out update))
4145 break; 4147 break;
4146 } 4148 }
4147 else 4149 else
4148 { 4150 {
4149 if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) 4151 if (!m_entityUpdates.TryDequeue(out update))
4150 break; 4152 break;
4151 } 4153 }
4152 } 4154 }
@@ -4166,13 +4168,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4166 SceneObjectGroup grp = part.ParentGroup; 4168 SceneObjectGroup grp = part.ParentGroup;
4167 if (grp.inTransit && !update.Flags.HasFlag(PrimUpdateFlags.SendInTransit)) 4169 if (grp.inTransit && !update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
4168 continue; 4170 continue;
4169/* debug
4170 if (update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
4171 {
4172
4173 4171
4174 }
4175*/
4176 if (grp.IsDeleted) 4172 if (grp.IsDeleted)
4177 { 4173 {
4178 // Don't send updates for objects that have been marked deleted. 4174 // Don't send updates for objects that have been marked deleted.
@@ -4234,20 +4230,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4234 if(GroupsNeedFullUpdate.Contains(grp)) 4230 if(GroupsNeedFullUpdate.Contains(grp))
4235 continue; 4231 continue;
4236 4232
4237 bool inview = false; 4233 bool inViewGroups = false;
4238 lock(GroupsInView) 4234 lock(GroupsInView)
4239 inview = GroupsInView.Contains(grp); 4235 inViewGroups = GroupsInView.Contains(grp);
4240 4236
4241 if(!inview) 4237 if(!inViewGroups)
4242 { 4238 {
4243 float bradius = grp.GetBoundsRadius(); 4239 Vector3 partpos = grp.getCenterOffset();
4244 Vector3 partpos = grp.AbsolutePosition + grp.getBoundsCenter();
4245// float dcam = (partpos - mycamera).LengthSquared();
4246 float dpos = (partpos - mypos).LengthSquared(); 4240 float dpos = (partpos - mypos).LengthSquared();
4247// if(dcam < dpos) 4241 float maxview = grp.GetBoundsRadius() + cullingrange;
4248// dpos = dcam; 4242 if (dpos > maxview * maxview)
4249 dpos = (float)Math.Sqrt(dpos) - bradius;
4250 if(dpos > cullingrange)
4251 continue; 4243 continue;
4252 4244
4253 GroupsNeedFullUpdate.Add(grp); 4245 GroupsNeedFullUpdate.Add(grp);
@@ -4488,10 +4480,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4488 { 4480 {
4489 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate) 4481 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate)
4490 { 4482 {
4491 foreach(SceneObjectPart p in grp.Parts) 4483 lock (GroupsInView)
4492 SendEntityUpdate(p,PrimUpdateFlags.CancelKill);
4493 lock(GroupsInView)
4494 GroupsInView.Add(grp); 4484 GroupsInView.Add(grp);
4485 foreach (SceneObjectPart p in grp.Parts)
4486 SendEntityUpdate(p, PrimUpdateFlags.CancelKill);
4495 } 4487 }
4496 } 4488 }
4497 4489
@@ -4542,26 +4534,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4542 if(!doCulling) 4534 if(!doCulling)
4543 return; 4535 return;
4544 4536
4545 if(CheckGroupsInViewBusy) 4537 if (!IsActive)
4546 return; 4538 return;
4547 4539
4548 CheckGroupsInViewBusy = true; 4540 if (CheckGroupsInViewBusy)
4541 return;
4549 4542
4550 float cullingrange = 64.0f;
4551// Vector3 mycamera = Vector3.Zero;
4552 Vector3 mypos = Vector3.Zero;
4553 ScenePresence mysp = (ScenePresence)SceneAgent; 4543 ScenePresence mysp = (ScenePresence)SceneAgent;
4554 if(mysp != null && !mysp.IsDeleted) 4544 if (mysp == null || mysp.IsDeleted)
4555 {
4556 cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
4557// mycamera = mysp.CameraPosition;
4558 mypos = mysp.AbsolutePosition;
4559 }
4560 else
4561 {
4562 CheckGroupsInViewBusy= false;
4563 return; 4545 return;
4564 } 4546
4547 CheckGroupsInViewBusy = true;
4548
4549 float cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
4550 Vector3 mypos = mysp.AbsolutePosition;
4565 4551
4566 HashSet<SceneObjectGroup> NewGroupsInView = new HashSet<SceneObjectGroup>(); 4552 HashSet<SceneObjectGroup> NewGroupsInView = new HashSet<SceneObjectGroup>();
4567 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); 4553 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>();
@@ -4570,7 +4556,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4570 EntityBase[] entities = m_scene.Entities.GetEntities(); 4556 EntityBase[] entities = m_scene.Entities.GetEntities();
4571 foreach (EntityBase e in entities) 4557 foreach (EntityBase e in entities)
4572 { 4558 {
4573 if(!IsActive) 4559 if (!IsActive)
4574 return; 4560 return;
4575 4561
4576 if (e != null && e is SceneObjectGroup) 4562 if (e != null && e is SceneObjectGroup)
@@ -4579,27 +4565,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4579 if(grp.IsDeleted || grp.IsAttachment) 4565 if(grp.IsDeleted || grp.IsAttachment)
4580 continue; 4566 continue;
4581 4567
4582 float bradius = grp.GetBoundsRadius(); 4568 bool inviewgroups;
4583 Vector3 grppos = grp.AbsolutePosition + grp.getBoundsCenter(); 4569 lock (GroupsInView)
4584// float dcam = (grppos - mycamera).LengthSquared(); 4570 inviewgroups = GroupsInView.Contains(grp);
4585 float dpos = (grppos - mypos).LengthSquared();
4586// if(dcam < dpos)
4587// dpos = dcam;
4588
4589 dpos = (float)Math.Sqrt(dpos) - bradius;
4590 4571
4591 bool inview; 4572 Vector3 grppos = grp.getCenterOffset();
4592 lock(GroupsInView) 4573 float dpos = (grppos - mypos).LengthSquared();
4593 inview = GroupsInView.Contains(grp);
4594 4574
4595 if(dpos > cullingrange) 4575 float maxview = grp.GetBoundsRadius() + cullingrange;
4576 if (dpos > maxview * maxview)
4596 { 4577 {
4597 if(inview) 4578 if(inviewgroups)
4598 kills.Add(grp); 4579 kills.Add(grp);
4599 } 4580 }
4600 else 4581 else
4601 { 4582 {
4602 if(!inview) 4583 if(!inviewgroups)
4603 GroupsNeedFullUpdate.Add(grp); 4584 GroupsNeedFullUpdate.Add(grp);
4604 NewGroupsInView.Add(grp); 4585 NewGroupsInView.Add(grp);
4605 } 4586 }
@@ -4614,7 +4595,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4614 List<uint> partIDs = new List<uint>(); 4595 List<uint> partIDs = new List<uint>();
4615 foreach(SceneObjectGroup grp in kills) 4596 foreach(SceneObjectGroup grp in kills)
4616 { 4597 {
4617 SendEntityUpdate(grp.RootPart,PrimUpdateFlags.Kill); 4598 SendEntityUpdate(grp.RootPart, PrimUpdateFlags.Kill);
4618 foreach(SceneObjectPart p in grp.Parts) 4599 foreach(SceneObjectPart p in grp.Parts)
4619 { 4600 {
4620 if(p != grp.RootPart) 4601 if(p != grp.RootPart)
@@ -4636,7 +4617,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4636 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate) 4617 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate)
4637 { 4618 {
4638 foreach(SceneObjectPart p in grp.Parts) 4619 foreach(SceneObjectPart p in grp.Parts)
4639 SendEntityUpdate(p,PrimUpdateFlags.CancelKill); 4620 SendEntityUpdate(p, PrimUpdateFlags.CancelKill);
4640 } 4621 }
4641 } 4622 }
4642 4623
@@ -4645,13 +4626,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4645 4626
4646 private bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity) 4627 private bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity)
4647 { 4628 {
4648 if (entity != null) 4629 if (entity == null)
4649 { 4630 return false;
4650 priority = m_prioritizer.GetUpdatePriority(this, entity);
4651 return true;
4652 }
4653 4631
4654 return false; 4632 priority = m_prioritizer.GetUpdatePriority(this, entity);
4633 return true;
4655 } 4634 }
4656 4635
4657 public void FlushPrimUpdates() 4636 public void FlushPrimUpdates()
@@ -4831,7 +4810,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4831 { 4810 {
4832 uint priority = 0; // time based ordering only 4811 uint priority = 0; // time based ordering only
4833 lock (m_entityProps.SyncRoot) 4812 lock (m_entityProps.SyncRoot)
4834 m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity,requestFlags,true,false)); 4813 m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity, requestFlags, true, false));
4835 } 4814 }
4836 4815
4837 private void ResendPropertyUpdate(ObjectPropertyUpdate update) 4816 private void ResendPropertyUpdate(ObjectPropertyUpdate update)
@@ -4885,7 +4864,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4885 bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance; 4864 bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance;
4886 4865
4887 EntityUpdate iupdate; 4866 EntityUpdate iupdate;
4888 Int32 timeinqueue; // this is just debugging code & can be dropped later
4889 4867
4890 while (maxUpdateBytes > 0) 4868 while (maxUpdateBytes > 0)
4891 { 4869 {
@@ -4893,12 +4871,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4893 { 4871 {
4894 if(orderedDequeue) 4872 if(orderedDequeue)
4895 { 4873 {
4896 if (!m_entityProps.TryOrderedDequeue(out iupdate, out timeinqueue)) 4874 if (!m_entityProps.TryOrderedDequeue(out iupdate))
4897 break; 4875 break;
4898 } 4876 }
4899 else 4877 else
4900 { 4878 {
4901 if (!m_entityProps.TryDequeue(out iupdate, out timeinqueue)) 4879 if (!m_entityProps.TryDequeue(out iupdate))
4902 break; 4880 break;
4903 } 4881 }
4904 } 4882 }