aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-08-07 14:30:27 +0100
committerUbitUmarov2016-08-07 21:13:01 +0100
commitff0ccf9c67e3840c39729e1ce9677b96e0cfd472 (patch)
tree6288879780f7df9bd5198c13e71f753df56af1af /OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
parent if a viewer overloads region capability to process RequestMapBlocks, ignore ... (diff)
downloadopensim-SC-ff0ccf9c67e3840c39729e1ce9677b96e0cfd472.zip
opensim-SC-ff0ccf9c67e3840c39729e1ce9677b96e0cfd472.tar.gz
opensim-SC-ff0ccf9c67e3840c39729e1ce9677b96e0cfd472.tar.bz2
opensim-SC-ff0ccf9c67e3840c39729e1ce9677b96e0cfd472.tar.xz
several changes related to culling option
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs188
1 files changed, 90 insertions, 98 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index e3b2fd1..b823abe 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3937,7 +3937,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3937 uint priority = m_prioritizer.GetUpdatePriority(this, entity); 3937 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
3938 3938
3939 lock (m_entityUpdates.SyncRoot) 3939 lock (m_entityUpdates.SyncRoot)
3940 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); 3940 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags));
3941 } 3941 }
3942 3942
3943 /// <summary> 3943 /// <summary>
@@ -4006,12 +4006,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4006 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race 4006 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
4007 // condition where a kill can be processed before an out-of-date update for the same object. 4007 // condition where a kill can be processed before an out-of-date update for the same object.
4008// float avgTimeDilation = 0.0f; 4008// float avgTimeDilation = 0.0f;
4009 IEntityUpdate iupdate; 4009 EntityUpdate update;
4010 Int32 timeinqueue; // this is just debugging code & can be dropped later 4010 Int32 timeinqueue; // this is just debugging code & can be dropped later
4011 4011
4012 bool doCulling = m_scene.ObjectsCullingByDistance; 4012 bool doCulling = m_scene.ObjectsCullingByDistance;
4013 float cullingrange = 64.0f; 4013 float cullingrange = 64.0f;
4014 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); 4014 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>();
4015 List<SceneObjectGroup> kills = new List<SceneObjectGroup>();
4015// Vector3 mycamera = Vector3.Zero; 4016// Vector3 mycamera = Vector3.Zero;
4016 Vector3 mypos = Vector3.Zero; 4017 Vector3 mypos = Vector3.Zero;
4017 ScenePresence mysp = (ScenePresence)SceneAgent; 4018 ScenePresence mysp = (ScenePresence)SceneAgent;
@@ -4027,12 +4028,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4027 while (updatesThisCall < maxUpdates) 4028 while (updatesThisCall < maxUpdates)
4028 { 4029 {
4029 lock (m_entityUpdates.SyncRoot) 4030 lock (m_entityUpdates.SyncRoot)
4030 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) 4031 if (!m_entityUpdates.TryDequeue(out update, out timeinqueue))
4031 break; 4032 break;
4032 4033
4033 EntityUpdate update = (EntityUpdate)iupdate;
4034
4035// avgTimeDilation += update.TimeDilation; 4034// avgTimeDilation += update.TimeDilation;
4035 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
4036
4037 if(updateFlags.HasFlag(PrimUpdateFlags.Kill))
4038 {
4039 m_killRecord.Add(update.Entity.LocalId);
4040 continue;
4041 }
4036 4042
4037 if (update.Entity is SceneObjectPart) 4043 if (update.Entity is SceneObjectPart)
4038 { 4044 {
@@ -4156,11 +4162,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4156 4162
4157 #region UpdateFlags to packet type conversion 4163 #region UpdateFlags to packet type conversion
4158 4164
4159 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
4160
4161 bool canUseCompressed = true; 4165 bool canUseCompressed = true;
4162 bool canUseImproved = true; 4166 bool canUseImproved = true;
4163 4167
4168
4164 // Compressed object updates only make sense for LL primitives 4169 // Compressed object updates only make sense for LL primitives
4165 if (!(update.Entity is SceneObjectPart)) 4170 if (!(update.Entity is SceneObjectPart))
4166 { 4171 {
@@ -4319,17 +4324,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4319 m_killRecord.Clear(); 4324 m_killRecord.Clear();
4320 } 4325 }
4321 4326
4327 if (kills.Count > 0)
4328 {
4329 foreach(SceneObjectGroup grp in kills)
4330 {
4331 foreach(SceneObjectPart p in grp.Parts)
4332 SendEntityUpdate(p,PrimUpdateFlags.Kill);
4333 }
4334 kills.Clear();
4335 }
4336
4322 if(GroupsNeedFullUpdate.Count > 0) 4337 if(GroupsNeedFullUpdate.Count > 0)
4323 { 4338 {
4324 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate) 4339 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate)
4325 { 4340 {
4326 grp.ScheduleGroupForFullUpdate(); 4341 foreach(SceneObjectPart p in grp.Parts)
4342 SendEntityUpdate(p,PrimUpdateFlags.CancelKill);
4327 lock(GroupsInView) 4343 lock(GroupsInView)
4328 GroupsInView.Add(grp); 4344 GroupsInView.Add(grp);
4329 } 4345 }
4330 } 4346 }
4331 #endregion 4347 #endregion
4332
4333 } 4348 }
4334 4349
4335 // hack.. dont use 4350 // hack.. dont use
@@ -4368,7 +4383,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4368 } 4383 }
4369 4384
4370 private bool CheckGroupsInViewBusy = false; 4385 private bool CheckGroupsInViewBusy = false;
4371 private bool CheckGroupsInViewOverRun = false;
4372 4386
4373 public void CheckGroupsInView() 4387 public void CheckGroupsInView()
4374 { 4388 {
@@ -4377,112 +4391,90 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4377 return; 4391 return;
4378 4392
4379 if(CheckGroupsInViewBusy) 4393 if(CheckGroupsInViewBusy)
4380 {
4381 CheckGroupsInViewOverRun = true;
4382 return; 4394 return;
4383 } 4395
4384 CheckGroupsInViewBusy = true; 4396 CheckGroupsInViewBusy = true;
4385 do
4386 {
4387 CheckGroupsInViewOverRun = false;
4388 4397
4389 float cullingrange = 64.0f; 4398 float cullingrange = 64.0f;
4390// Vector3 mycamera = Vector3.Zero; 4399// Vector3 mycamera = Vector3.Zero;
4391 Vector3 mypos = Vector3.Zero; 4400 Vector3 mypos = Vector3.Zero;
4392 ScenePresence mysp = (ScenePresence)SceneAgent; 4401 ScenePresence mysp = (ScenePresence)SceneAgent;
4393 if(mysp != null && !mysp.IsDeleted) 4402 if(mysp != null && !mysp.IsDeleted)
4394 { 4403 {
4395 cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f; 4404 cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
4396// mycamera = mysp.CameraPosition; 4405// mycamera = mysp.CameraPosition;
4397 mypos = mysp.AbsolutePosition; 4406 mypos = mysp.AbsolutePosition;
4398 } 4407 }
4399 else 4408 else
4400 { 4409 {
4401 CheckGroupsInViewBusy= false; 4410 CheckGroupsInViewBusy= false;
4402 return; 4411 return;
4403 } 4412 }
4404 4413
4405 HashSet<SceneObjectGroup> NewGroupsInView = new HashSet<SceneObjectGroup>(); 4414 HashSet<SceneObjectGroup> NewGroupsInView = new HashSet<SceneObjectGroup>();
4406 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); 4415 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>();
4407 List<uint> kills = new List<uint>(); 4416 List<SceneObjectGroup> kills = new List<SceneObjectGroup>();
4408 int killedParst = 0;
4409 4417
4410 EntityBase[] entities = m_scene.Entities.GetEntities(); 4418 EntityBase[] entities = m_scene.Entities.GetEntities();
4411 foreach (EntityBase e in entities) 4419 foreach (EntityBase e in entities)
4412 { 4420 {
4413 if(!IsActive) 4421 if(!IsActive)
4414 return; 4422 return;
4415 4423
4416 if (e != null && e is SceneObjectGroup) 4424 if (e != null && e is SceneObjectGroup)
4417 { 4425 {
4418 SceneObjectGroup grp = (SceneObjectGroup)e; 4426 SceneObjectGroup grp = (SceneObjectGroup)e;
4419 if(grp.IsDeleted || grp.IsAttachment) 4427 if(grp.IsDeleted || grp.IsAttachment)
4420 continue; 4428 continue;
4421 4429
4422 float bradius = grp.GetBoundsRadius(); 4430 float bradius = grp.GetBoundsRadius();
4423 Vector3 grppos = grp.AbsolutePosition + grp.getBoundsCenter(); 4431 Vector3 grppos = grp.AbsolutePosition + grp.getBoundsCenter();
4424// float dcam = (grppos - mycamera).LengthSquared(); 4432// float dcam = (grppos - mycamera).LengthSquared();
4425 float dpos = (grppos - mypos).LengthSquared(); 4433 float dpos = (grppos - mypos).LengthSquared();
4426// if(dcam < dpos) 4434// if(dcam < dpos)
4427// dpos = dcam; 4435// dpos = dcam;
4428 4436
4429 dpos = (float)Math.Sqrt(dpos) - bradius; 4437 dpos = (float)Math.Sqrt(dpos) - bradius;
4430 4438
4431 bool inview; 4439 bool inview;
4432 lock(GroupsInView) 4440 lock(GroupsInView)
4433 inview = GroupsInView.Contains(grp); 4441 inview = GroupsInView.Contains(grp);
4434
4435 if(dpos > cullingrange)
4436 {
4437 if(inview)
4438 {
4439 kills.Add(grp.LocalId);
4440 killedParst += grp.PrimCount;
4441 4442
4442 if (killedParst > 199 ) 4443 if(dpos > cullingrange)
4443 { 4444 {
4444 SendKillObject(kills); 4445 if(inview)
4445 kills.Clear(); 4446 kills.Add(grp);
4446 killedParst = 0; 4447 }
4447 Thread.Sleep(50); 4448 else
4448 if(mysp != null && !mysp.IsDeleted) 4449 {
4449 { 4450 if(!inview)
4450 cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f; 4451 GroupsNeedFullUpdate.Add(grp);
4451// mycamera = mysp.CameraPosition; 4452 NewGroupsInView.Add(grp);
4452 mypos = mysp.AbsolutePosition;
4453 }
4454 else
4455 {
4456 CheckGroupsInViewBusy= false;
4457 return;
4458 }
4459 }
4460 }
4461 }
4462 else
4463 {
4464 if(!inview)
4465 GroupsNeedFullUpdate.Add(grp);
4466 NewGroupsInView.Add(grp);
4467 }
4468 } 4453 }
4469 } 4454 }
4455 }
4470 4456
4471 lock(GroupsInView) 4457 lock(GroupsInView)
4472 GroupsInView = NewGroupsInView; 4458 GroupsInView = NewGroupsInView;
4473 4459
4474 if (kills.Count > 0) 4460 if (kills.Count > 0)
4461 {
4462 foreach(SceneObjectGroup grp in kills)
4475 { 4463 {
4476 SendKillObject(kills); 4464 foreach(SceneObjectPart p in grp.Parts)
4477 kills.Clear(); 4465 SendEntityUpdate(p,PrimUpdateFlags.Kill);
4478 } 4466 }
4467 kills.Clear();
4468 }
4479 4469
4480 if(GroupsNeedFullUpdate.Count > 0) 4470 if(GroupsNeedFullUpdate.Count > 0)
4471 {
4472 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate)
4481 { 4473 {
4482 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate) 4474 foreach(SceneObjectPart p in grp.Parts)
4483 grp.ScheduleGroupForFullUpdate(); 4475 SendEntityUpdate(p,PrimUpdateFlags.CancelKill);
4484 } 4476 }
4485 } while(CheckGroupsInViewOverRun); 4477 }
4486 4478
4487 CheckGroupsInViewBusy = false; 4479 CheckGroupsInViewBusy = false;
4488 } 4480 }
@@ -4670,13 +4662,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4670 OutPacket(pack, ThrottleOutPacketType.Task); 4662 OutPacket(pack, ThrottleOutPacketType.Task);
4671 } 4663 }
4672 4664
4673 private class ObjectPropertyUpdate : IEntityUpdate 4665 private class ObjectPropertyUpdate : EntityUpdate
4674 { 4666 {
4675 internal bool SendFamilyProps; 4667 internal bool SendFamilyProps;
4676 internal bool SendObjectProps; 4668 internal bool SendObjectProps;
4677 4669
4678 public ObjectPropertyUpdate(ISceneEntity entity, uint flags, bool sendfam, bool sendobj) 4670 public ObjectPropertyUpdate(ISceneEntity entity, uint flags, bool sendfam, bool sendobj)
4679 : base(entity,flags) 4671 : base(entity,(PrimUpdateFlags)flags)
4680 { 4672 {
4681 SendFamilyProps = sendfam; 4673 SendFamilyProps = sendfam;
4682 SendObjectProps = sendobj; 4674 SendObjectProps = sendobj;
@@ -4745,7 +4737,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4745 OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates = 4737 OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates =
4746 new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>(); 4738 new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>();
4747 4739
4748 IEntityUpdate iupdate; 4740 EntityUpdate iupdate;
4749 Int32 timeinqueue; // this is just debugging code & can be dropped later 4741 Int32 timeinqueue; // this is just debugging code & can be dropped later
4750 4742
4751 int updatesThisCall = 0; 4743 int updatesThisCall = 0;
@@ -4849,11 +4841,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4849 // m_log.WarnFormat("[PACKETCOUNTS] queued {0} family property packets with {1} blocks",fpcnt,fbcnt); 4841 // m_log.WarnFormat("[PACKETCOUNTS] queued {0} family property packets with {1} blocks",fpcnt,fbcnt);
4850 } 4842 }
4851 4843
4852 private ObjectPropertiesFamilyPacket.ObjectDataBlock CreateObjectPropertiesFamilyBlock(SceneObjectPart sop, uint requestFlags) 4844 private ObjectPropertiesFamilyPacket.ObjectDataBlock CreateObjectPropertiesFamilyBlock(SceneObjectPart sop, PrimUpdateFlags requestFlags)
4853 { 4845 {
4854 ObjectPropertiesFamilyPacket.ObjectDataBlock block = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); 4846 ObjectPropertiesFamilyPacket.ObjectDataBlock block = new ObjectPropertiesFamilyPacket.ObjectDataBlock();
4855 4847
4856 block.RequestFlags = requestFlags; 4848 block.RequestFlags = (uint)requestFlags;
4857 block.ObjectID = sop.UUID; 4849 block.ObjectID = sop.UUID;
4858 if (sop.OwnerID == sop.GroupID) 4850 if (sop.OwnerID == sop.GroupID)
4859 block.OwnerID = UUID.Zero; 4851 block.OwnerID = UUID.Zero;