aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorAdam Frisby2009-02-23 06:55:42 +0000
committerAdam Frisby2009-02-23 06:55:42 +0000
commitc2f3ff872dd88b4382b41844a4faa632129d1760 (patch)
tree5a0b731bcdcff54b4a5dcaa65acc7a60310a0116 /OpenSim
parentLoad default assets when AssetInventory starts. (diff)
downloadopensim-SC_OLD-c2f3ff872dd88b4382b41844a4faa632129d1760.zip
opensim-SC_OLD-c2f3ff872dd88b4382b41844a4faa632129d1760.tar.gz
opensim-SC_OLD-c2f3ff872dd88b4382b41844a4faa632129d1760.tar.bz2
opensim-SC_OLD-c2f3ff872dd88b4382b41844a4faa632129d1760.tar.xz
* Performance Changes:
* Moves Entity Updates into a seperate thread, allowing for OpenSim to utilize a computers CPU more effectively in return for potentially greater user and prim capacity. * Removes an expensive Sqrt call performed during Update on each object. This should lower CPU requirements for high-prim regions with physics enabled. * MXP Changes: Centers the region around 0,0 for primitives instead of 128,128. Prim display should now look more correct for MXP viewers.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs4
-rw-r--r--OpenSim/Framework/Util.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs4
4 files changed, 35 insertions, 4 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
index 27bf078..d9c4077 100644
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
@@ -577,7 +577,9 @@ namespace OpenSim.Client.MXP.ClientStack
577 pe.ObjectFragment.AngularAcceleration = new float[4]; 577 pe.ObjectFragment.AngularAcceleration = new float[4];
578 pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f }; 578 pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f };
579 pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length()/2.0f; 579 pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length()/2.0f;
580 pe.ObjectFragment.Location = new float[] { pos.X, pos.Y, pos.Z }; 580
581 pe.ObjectFragment.Location = new float[] { pos.X - 120.0f, pos.Z, pos.Y - 128.0f };
582
581 pe.ObjectFragment.Mass = 1.0f; 583 pe.ObjectFragment.Mass = 1.0f;
582 pe.ObjectFragment.ObjectId = objectID.Guid; 584 pe.ObjectFragment.ObjectId = objectID.Guid;
583 pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; 585 pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 2718072..4fce4ac 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -89,6 +89,21 @@ namespace OpenSim.Framework
89 } 89 }
90 90
91 /// <summary> 91 /// <summary>
92 /// Returns true if the distance beween A and B is less than amount. Significantly faster than GetDistanceTo since it eliminates the Sqrt.
93 /// </summary>
94 /// <param name="a"></param>
95 /// <param name="b"></param>
96 /// <param name="amount"></param>
97 /// <returns></returns>
98 public static bool DistanceLessThan(Vector3 a, Vector3 b, double amount)
99 {
100 float dx = a.X - b.X;
101 float dy = a.Y - b.Y;
102 float dz = a.Z - b.Z;
103 return (dx*dx + dy*dy + dz*dz) < (amount*amount);
104 }
105
106 /// <summary>
92 /// Get the magnitude of a 3d vector 107 /// Get the magnitude of a 3d vector
93 /// </summary> 108 /// </summary>
94 /// <param name="a">A 3d vector</param> 109 /// <param name="a">A 3d vector</param>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2a3f068..8d81812 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -64,6 +64,8 @@ namespace OpenSim.Region.Framework.Scenes
64 64
65 protected Timer m_restartWaitTimer = new Timer(); 65 protected Timer m_restartWaitTimer = new Timer();
66 66
67 protected Thread m_updateEntitiesThread;
68
67 public SimStatsReporter StatsReporter; 69 public SimStatsReporter StatsReporter;
68 70
69 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); 71 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
@@ -852,7 +854,19 @@ namespace OpenSim.Region.Framework.Scenes
852 otherMS = Environment.TickCount; 854 otherMS = Environment.TickCount;
853 // run through all entities looking for updates (slow) 855 // run through all entities looking for updates (slow)
854 if (m_frame % m_update_entities == 0) 856 if (m_frame % m_update_entities == 0)
855 m_sceneGraph.UpdateEntities(); 857 {
858 if (m_updateEntitiesThread == null)
859 {
860 m_updateEntitiesThread = new Thread(m_sceneGraph.UpdateEntities);
861 ThreadTracker.Add(m_updateEntitiesThread);
862 }
863
864 if(!m_updateEntitiesThread.IsAlive)
865 m_updateEntitiesThread.Start();
866
867 //m_sceneGraph.UpdateEntities();
868 }
869
856 870
857 // run through entities that have scheduled themselves for 871 // run through entities that have scheduled themselves for
858 // updates looking for updates(faster) 872 // updates looking for updates(faster)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index d1aef1c..2ca0342 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1733,12 +1733,12 @@ namespace OpenSim.Region.Framework.Scenes
1733 //return; 1733 //return;
1734 //} 1734 //}
1735 1735
1736 if ((Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) && UsePhysics) 1736 if (Util.DistanceLessThan(lastPhysGroupPos, AbsolutePosition, 0.02) && UsePhysics)
1737 { 1737 {
1738 m_rootPart.UpdateFlag = 1; 1738 m_rootPart.UpdateFlag = 1;
1739 lastPhysGroupPos = AbsolutePosition; 1739 lastPhysGroupPos = AbsolutePosition;
1740 } 1740 }
1741 //foreach (SceneObjectPart part in m_parts.Values) 1741 //foreach (SceneObjectPart part in m_parts.Values)
1742 //{ 1742 //{
1743 //if (part.UpdateFlag == 0) part.UpdateFlag = 1; 1743 //if (part.UpdateFlag == 0) part.UpdateFlag = 1;
1744 //} 1744 //}