diff options
author | UbitUmarov | 2016-07-06 16:10:44 +0100 |
---|---|---|
committer | UbitUmarov | 2016-07-06 16:13:27 +0100 |
commit | c02fe98b7da0ef62fe67fb45652878181e4a297d (patch) | |
tree | ff2423ad3d7acd614528ed24873613b48869866c /OpenSim/Region/Framework/Scenes | |
parent | add EngineName also to the others (diff) | |
download | opensim-SC-c02fe98b7da0ef62fe67fb45652878181e4a297d.zip opensim-SC-c02fe98b7da0ef62fe67fb45652878181e4a297d.tar.gz opensim-SC-c02fe98b7da0ef62fe67fb45652878181e4a297d.tar.bz2 opensim-SC-c02fe98b7da0ef62fe67fb45652878181e4a297d.tar.xz |
add test option ObjectsCullingByDistance. In future, if true, it may
prevent sending objects outside view range to viewers. DO NOT SET TRUE
unless testing it. Code still not completei!!!
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 62 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 20 |
3 files changed, 56 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0d19e94..3c5630e 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -803,9 +803,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
803 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get; set; } | 803 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get; set; } |
804 | public bool IsReprioritizationEnabled { get; set; } | 804 | public bool IsReprioritizationEnabled { get; set; } |
805 | public float ReprioritizationInterval { get; set; } | 805 | public float ReprioritizationInterval { get; set; } |
806 | public float RootReprioritizationDistance { get; set; } | 806 | public float ReprioritizationDistance { get; set; } |
807 | public float ChildReprioritizationDistance { get; set; } | ||
808 | private float m_minReprioritizationDistance = 32f; | 807 | private float m_minReprioritizationDistance = 32f; |
808 | public bool ObjectsCullingByDistance = false; | ||
809 | 809 | ||
810 | public AgentCircuitManager AuthenticateHandler | 810 | public AgentCircuitManager AuthenticateHandler |
811 | { | 811 | { |
@@ -1185,15 +1185,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1185 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); | 1185 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); |
1186 | ReprioritizationInterval | 1186 | ReprioritizationInterval |
1187 | = interestConfig.GetFloat("ReprioritizationInterval", ReprioritizationInterval); | 1187 | = interestConfig.GetFloat("ReprioritizationInterval", ReprioritizationInterval); |
1188 | RootReprioritizationDistance | 1188 | ReprioritizationDistance |
1189 | = interestConfig.GetFloat("RootReprioritizationDistance", RootReprioritizationDistance); | 1189 | = interestConfig.GetFloat("RootReprioritizationDistance", ReprioritizationDistance); |
1190 | ChildReprioritizationDistance | 1190 | |
1191 | = interestConfig.GetFloat("ChildReprioritizationDistance", ChildReprioritizationDistance); | 1191 | if(ReprioritizationDistance < m_minReprioritizationDistance) |
1192 | ReprioritizationDistance = m_minReprioritizationDistance; | ||
1193 | |||
1194 | ObjectsCullingByDistance | ||
1195 | = interestConfig.GetBoolean("ObjectsCullingByDistance", ObjectsCullingByDistance); | ||
1192 | 1196 | ||
1193 | if(RootReprioritizationDistance < m_minReprioritizationDistance) | ||
1194 | RootReprioritizationDistance = m_minReprioritizationDistance; | ||
1195 | if(ChildReprioritizationDistance < m_minReprioritizationDistance) | ||
1196 | ChildReprioritizationDistance = m_minReprioritizationDistance; | ||
1197 | 1197 | ||
1198 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); | 1198 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); |
1199 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); | 1199 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); |
@@ -1252,8 +1252,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1252 | RootRotationUpdateTolerance = 0.1f; | 1252 | RootRotationUpdateTolerance = 0.1f; |
1253 | RootVelocityUpdateTolerance = 0.001f; | 1253 | RootVelocityUpdateTolerance = 0.001f; |
1254 | RootPositionUpdateTolerance = 0.05f; | 1254 | RootPositionUpdateTolerance = 0.05f; |
1255 | RootReprioritizationDistance = m_minReprioritizationDistance; | 1255 | ReprioritizationDistance = m_minReprioritizationDistance; |
1256 | ChildReprioritizationDistance = m_minReprioritizationDistance; | ||
1257 | 1256 | ||
1258 | m_eventManager = new EventManager(); | 1257 | m_eventManager = new EventManager(); |
1259 | 1258 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index cb1bf55..4e87014 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1567,6 +1567,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
1567 | 1567 | ||
1568 | #endregion | 1568 | #endregion |
1569 | 1569 | ||
1570 | private float? m_boundsRadius = null; | ||
1571 | |||
1572 | public float GetBoundsRadius() | ||
1573 | { | ||
1574 | // this may need more threading work | ||
1575 | if(m_boundsRadius == null) | ||
1576 | { | ||
1577 | float res = 0; | ||
1578 | SceneObjectPart p; | ||
1579 | SceneObjectPart[] parts; | ||
1580 | float partR; | ||
1581 | lock (m_parts) | ||
1582 | { | ||
1583 | parts = m_parts.GetArray(); | ||
1584 | } | ||
1585 | |||
1586 | int nparts = parts.Length; | ||
1587 | for (int i = 0; i < nparts; i++) | ||
1588 | { | ||
1589 | p = parts[i]; | ||
1590 | partR = p.Scale.Length(); | ||
1591 | if(p != RootPart) | ||
1592 | partR += p.OffsetPosition.Length(); | ||
1593 | if(partR > res) | ||
1594 | res = partR; | ||
1595 | } | ||
1596 | m_boundsRadius = res; | ||
1597 | return res; | ||
1598 | } | ||
1599 | |||
1600 | return m_boundsRadius.Value; | ||
1601 | } | ||
1602 | |||
1570 | public void GetResourcesCosts(SceneObjectPart apart, | 1603 | public void GetResourcesCosts(SceneObjectPart apart, |
1571 | out float linksetResCost, out float linksetPhysCost, out float partCost, out float partPhysCost) | 1604 | out float linksetResCost, out float linksetPhysCost, out float partCost, out float partPhysCost) |
1572 | { | 1605 | { |
@@ -4596,14 +4629,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4596 | if (nparts <= 1) | 4629 | if (nparts <= 1) |
4597 | return gc; | 4630 | return gc; |
4598 | 4631 | ||
4599 | Quaternion parentRot = RootPart.RotationOffset; | ||
4600 | Vector3 pPos; | 4632 | Vector3 pPos; |
4601 | 4633 | ||
4602 | // average all parts positions | 4634 | // average all parts positions |
4603 | for (int i = 0; i < nparts; i++) | 4635 | for (int i = 0; i < nparts; i++) |
4604 | { | 4636 | { |
4605 | // do it directly | ||
4606 | // gc += parts[i].GetWorldPosition(); | ||
4607 | if (parts[i] != RootPart) | 4637 | if (parts[i] != RootPart) |
4608 | { | 4638 | { |
4609 | pPos = parts[i].OffsetPosition; | 4639 | pPos = parts[i].OffsetPosition; |
@@ -4613,8 +4643,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4613 | } | 4643 | } |
4614 | gc /= nparts; | 4644 | gc /= nparts; |
4615 | 4645 | ||
4616 | // relative to root: | ||
4617 | // gc -= AbsolutePosition; | ||
4618 | return gc; | 4646 | return gc; |
4619 | } | 4647 | } |
4620 | 4648 | ||
@@ -4662,30 +4690,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4662 | } | 4690 | } |
4663 | 4691 | ||
4664 | /// <summary> | 4692 | /// <summary> |
4665 | /// If the object is a sculpt/mesh, retrieve the mesh data for each part and reinsert it into each shape so that | ||
4666 | /// the physics engine can use it. | ||
4667 | /// </summary> | ||
4668 | /// <remarks> | ||
4669 | /// When the physics engine has finished with it, the sculpt data is discarded to save memory. | ||
4670 | /// </remarks> | ||
4671 | /* | ||
4672 | public void CheckSculptAndLoad() | ||
4673 | { | ||
4674 | if (IsDeleted) | ||
4675 | return; | ||
4676 | |||
4677 | if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) | ||
4678 | return; | ||
4679 | |||
4680 | // m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); | ||
4681 | |||
4682 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4683 | |||
4684 | for (int i = 0; i < parts.Length; i++) | ||
4685 | parts[i].CheckSculptAndLoad(); | ||
4686 | } | ||
4687 | */ | ||
4688 | /// <summary> | ||
4689 | /// Set the user group to which this scene object belongs. | 4693 | /// Set the user group to which this scene object belongs. |
4690 | /// </summary> | 4694 | /// </summary> |
4691 | /// <param name="GroupID"></param> | 4695 | /// <param name="GroupID"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4775b1f..817ed43 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -350,6 +350,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
350 | protected int m_reprioritizationLastTime; | 350 | protected int m_reprioritizationLastTime; |
351 | protected bool m_reprioritizationBusy; | 351 | protected bool m_reprioritizationBusy; |
352 | protected Vector3 m_reprioritizationLastPosition; | 352 | protected Vector3 m_reprioritizationLastPosition; |
353 | protected float m_reprioritizationLastDrawDistance; | ||
353 | 354 | ||
354 | private Quaternion m_headrotation = Quaternion.Identity; | 355 | private Quaternion m_headrotation = Quaternion.Identity; |
355 | 356 | ||
@@ -1047,6 +1048,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1047 | AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = | 1048 | AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = |
1048 | m_reprioritizationLastPosition = ControllingClient.StartPos; | 1049 | m_reprioritizationLastPosition = ControllingClient.StartPos; |
1049 | 1050 | ||
1051 | m_reprioritizationLastDrawDistance = DrawDistance; | ||
1052 | |||
1050 | // disable updates workjobs for now | 1053 | // disable updates workjobs for now |
1051 | childUpdatesBusy = true; | 1054 | childUpdatesBusy = true; |
1052 | m_reprioritizationBusy = true; | 1055 | m_reprioritizationBusy = true; |
@@ -2130,6 +2133,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2130 | 2133 | ||
2131 | // priority uses avatar position only | 2134 | // priority uses avatar position only |
2132 | m_reprioritizationLastPosition = AbsolutePosition; | 2135 | m_reprioritizationLastPosition = AbsolutePosition; |
2136 | m_reprioritizationLastDrawDistance = DrawDistance; | ||
2133 | m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it | 2137 | m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it |
2134 | m_reprioritizationBusy = false; | 2138 | m_reprioritizationBusy = false; |
2135 | 2139 | ||
@@ -3986,24 +3990,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3986 | if(m_reprioritizationBusy) | 3990 | if(m_reprioritizationBusy) |
3987 | return; | 3991 | return; |
3988 | 3992 | ||
3993 | float limit = Scene.ReprioritizationDistance; | ||
3994 | bool byDrawdistance = Scene.ObjectsCullingByDistance; | ||
3995 | if(byDrawdistance) | ||
3996 | byDrawdistance = (Math.Abs(DrawDistance-m_reprioritizationLastDrawDistance) > 0.5f * limit); | ||
3997 | |||
3989 | int tdiff = Util.EnvironmentTickCountSubtract(m_reprioritizationLastTime); | 3998 | int tdiff = Util.EnvironmentTickCountSubtract(m_reprioritizationLastTime); |
3990 | if(tdiff < Scene.ReprioritizationInterval) | 3999 | if(!byDrawdistance && tdiff < Scene.ReprioritizationInterval) |
3991 | return; | 4000 | return; |
3992 | // priority uses avatar position | 4001 | // priority uses avatar position |
3993 | Vector3 pos = AbsolutePosition; | 4002 | Vector3 pos = AbsolutePosition; |
3994 | Vector3 diff = pos - m_reprioritizationLastPosition; | 4003 | Vector3 diff = pos - m_reprioritizationLastPosition; |
3995 | float limit; | ||
3996 | if(IsChildAgent) | ||
3997 | limit = (float)Scene.ChildReprioritizationDistance; | ||
3998 | else | ||
3999 | limit = (float)Scene.RootReprioritizationDistance; | ||
4000 | |||
4001 | limit *= limit; | 4004 | limit *= limit; |
4002 | if (diff.LengthSquared() < limit) | 4005 | if (!byDrawdistance && diff.LengthSquared() < limit) |
4003 | return; | 4006 | return; |
4004 | 4007 | ||
4005 | m_reprioritizationBusy = true; | 4008 | m_reprioritizationBusy = true; |
4006 | m_reprioritizationLastPosition = pos; | 4009 | m_reprioritizationLastPosition = pos; |
4010 | m_reprioritizationLastDrawDistance = DrawDistance; | ||
4007 | 4011 | ||
4008 | Util.FireAndForget( | 4012 | Util.FireAndForget( |
4009 | o => | 4013 | o => |