aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-07-13 22:29:09 +0100
committerUbitUmarov2016-07-13 22:29:09 +0100
commit00687d5b0fef803bfebed5da2b1841890b589900 (patch)
tree5d95ca7d3c16d61c21042cd82ca27db0c3419dc8 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentOops that was not slower (diff)
downloadopensim-SC-00687d5b0fef803bfebed5da2b1841890b589900.zip
opensim-SC-00687d5b0fef803bfebed5da2b1841890b589900.tar.gz
opensim-SC-00687d5b0fef803bfebed5da2b1841890b589900.tar.bz2
opensim-SC-00687d5b0fef803bfebed5da2b1841890b589900.tar.xz
use geometric center and not sog root position in culling
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs32
1 files changed, 19 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 1a40ed9..722905f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1573,6 +1573,12 @@ namespace OpenSim.Region.Framework.Scenes
1573 m_boundsRadius = null; 1573 m_boundsRadius = null;
1574 } 1574 }
1575 1575
1576 private Vector3 m_boundsCenter;
1577 public Vector3 getBoundsCenter()
1578 {
1579 // this needs to be called after GetBoundsRadius() so its updated
1580 return m_boundsCenter;
1581 }
1576 public float GetBoundsRadius() 1582 public float GetBoundsRadius()
1577 { 1583 {
1578 // this may need more threading work 1584 // this may need more threading work
@@ -1582,6 +1588,7 @@ namespace OpenSim.Region.Framework.Scenes
1582 SceneObjectPart p; 1588 SceneObjectPart p;
1583 SceneObjectPart[] parts; 1589 SceneObjectPart[] parts;
1584 float partR; 1590 float partR;
1591 Vector3 offset = Vector3.Zero;
1585 lock (m_parts) 1592 lock (m_parts)
1586 { 1593 {
1587 parts = m_parts.GetArray(); 1594 parts = m_parts.GetArray();
@@ -1593,10 +1600,19 @@ namespace OpenSim.Region.Framework.Scenes
1593 p = parts[i]; 1600 p = parts[i];
1594 partR = 0.5f * p.Scale.Length(); 1601 partR = 0.5f * p.Scale.Length();
1595 if(p != RootPart) 1602 if(p != RootPart)
1603 {
1596 partR += p.OffsetPosition.Length(); 1604 partR += p.OffsetPosition.Length();
1605 offset += p.OffsetPosition;
1606 }
1597 if(partR > res) 1607 if(partR > res)
1598 res = partR; 1608 res = partR;
1599 } 1609 }
1610 if(parts.Length > 1)
1611 {
1612 offset /= parts.Length; // basicly geometric center
1613 offset = offset * RootPart.RotationOffset;
1614 }
1615 m_boundsCenter = offset;
1600 m_boundsRadius = res; 1616 m_boundsRadius = res;
1601 return res; 1617 return res;
1602 } 1618 }
@@ -4646,26 +4662,16 @@ namespace OpenSim.Region.Framework.Scenes
4646 4662
4647 Vector3 gc = Vector3.Zero; 4663 Vector3 gc = Vector3.Zero;
4648 4664
4649 int nparts = m_parts.Count;
4650 if (nparts <= 1)
4651 return gc;
4652
4653 SceneObjectPart[] parts = m_parts.GetArray(); 4665 SceneObjectPart[] parts = m_parts.GetArray();
4654 nparts = parts.Length; // just in case it changed 4666 int nparts = parts.Length;
4655 if (nparts <= 1) 4667 if (nparts < 2)
4656 return gc; 4668 return gc;
4657 4669
4658 Vector3 pPos;
4659
4660 // average all parts positions 4670 // average all parts positions
4661 for (int i = 0; i < nparts; i++) 4671 for (int i = 0; i < nparts; i++)
4662 { 4672 {
4663 if (parts[i] != RootPart) 4673 if (parts[i] != RootPart)
4664 { 4674 gc += parts[i].OffsetPosition;
4665 pPos = parts[i].OffsetPosition;
4666 gc += pPos;
4667 }
4668
4669 } 4675 }
4670 gc /= nparts; 4676 gc /= nparts;
4671 4677