aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2009-06-28 11:07:26 +0000
committerMW2009-06-28 11:07:26 +0000
commit706286b7fb58e2b5779044084fa64f8358d151aa (patch)
tree88833847b1eeaa5e7a36d9b0f9fa1573414a2098
parentMake cleartext authentication case sensitive. Thanks jhurliman for spotting t... (diff)
downloadopensim-SC-706286b7fb58e2b5779044084fa64f8358d151aa.zip
opensim-SC-706286b7fb58e2b5779044084fa64f8358d151aa.tar.gz
opensim-SC-706286b7fb58e2b5779044084fa64f8358d151aa.tar.bz2
opensim-SC-706286b7fb58e2b5779044084fa64f8358d151aa.tar.xz
Removed the List<NewForce> m_forceList from ScenePresence, as there wasn't any need for a list, as only the last entry in it was acted on. So it now has a single NewForce m_nextVelocity , which is updated (rather than a NewForce object being created every AgentUpdate). So as well as cutting out all the adds and clearing of the list, it also removes the creation of upto 100+ new objects per second per avatar.
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs38
1 files changed, 18 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1bee3c0..01facd1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -89,7 +89,8 @@ namespace OpenSim.Region.Framework.Scenes
89 89
90 private bool m_updateflag; 90 private bool m_updateflag;
91 private byte m_movementflag; 91 private byte m_movementflag;
92 private readonly List<NewForce> m_forcesList = new List<NewForce>(); 92 //private readonly List<NewForce> m_forcesList = new List<NewForce>();
93 private NewForce m_nextVelocity = new NewForce();
93 private short m_updateCount; 94 private short m_updateCount;
94 private uint m_requestedSitTargetID; 95 private uint m_requestedSitTargetID;
95 private UUID m_requestedSitTargetUUID = UUID.Zero; 96 private UUID m_requestedSitTargetUUID = UUID.Zero;
@@ -138,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes
138 public string JID = string.Empty; 139 public string JID = string.Empty;
139 140
140 // Agent moves with a PID controller causing a force to be exerted. 141 // Agent moves with a PID controller causing a force to be exerted.
141 private bool m_newForce; 142 private bool m_newMovement;
142 private bool m_newCoarseLocations = true; 143 private bool m_newCoarseLocations = true;
143 private float m_health = 100f; 144 private float m_health = 100f;
144 145
@@ -2217,7 +2218,6 @@ namespace OpenSim.Region.Framework.Scenes
2217 m_perfMonMS = Environment.TickCount; 2218 m_perfMonMS = Environment.TickCount;
2218 2219
2219 m_rotation = rotation; 2220 m_rotation = rotation;
2220 NewForce newVelocity = new NewForce();
2221 Vector3 direc = vec * rotation; 2221 Vector3 direc = vec * rotation;
2222 direc.Normalize(); 2222 direc.Normalize();
2223 2223
@@ -2252,10 +2252,12 @@ namespace OpenSim.Region.Framework.Scenes
2252 } 2252 }
2253 } 2253 }
2254 2254
2255 newVelocity.X = direc.X; 2255 lock (m_nextVelocity)
2256 newVelocity.Y = direc.Y; 2256 {
2257 newVelocity.Z = direc.Z; 2257 m_nextVelocity.X = direc.X;
2258 m_forcesList.Add(newVelocity); 2258 m_nextVelocity.Y = direc.Y;
2259 m_nextVelocity.Z = direc.Z;
2260 }
2259 2261
2260 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2262 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2261 } 2263 }
@@ -2276,10 +2278,11 @@ namespace OpenSim.Region.Framework.Scenes
2276 2278
2277 if (m_isChildAgent == false) 2279 if (m_isChildAgent == false)
2278 { 2280 {
2279 if (m_newForce) // user movement 'forces' (ie commands to move) 2281 if (m_newMovement) // user movement 'forces' (ie commands to move)
2280 { 2282 {
2281 SendTerseUpdateToAllClients(); 2283 SendTerseUpdateToAllClients();
2282 m_updateCount = 0; 2284 m_updateCount = 0;
2285 m_newMovement = false;
2283 } 2286 }
2284 else if (m_movementflag != 0) // scripted movement (?) 2287 else if (m_movementflag != 0) // scripted movement (?)
2285 { 2288 {
@@ -3127,20 +3130,17 @@ namespace OpenSim.Region.Framework.Scenes
3127 /// </summary> 3130 /// </summary>
3128 public override void UpdateMovement() 3131 public override void UpdateMovement()
3129 { 3132 {
3130 m_newForce = false; 3133 // m_newMovement = false;
3131 lock (m_forcesList) 3134 if ((m_nextVelocity.X != movementvector.X) || (m_nextVelocity.Y != movementvector.Y) || (m_nextVelocity.Z != movementvector.Z))
3132 { 3135 {
3133 if (m_forcesList.Count > 0) 3136 lock (m_nextVelocity)
3134 { 3137 {
3135 //we are only interested in the last velocity added to the list [Although they are called forces, they are actually velocities]
3136 NewForce force = m_forcesList[m_forcesList.Count - 1];
3137
3138 m_updateflag = true; 3138 m_updateflag = true;
3139 try 3139 try
3140 { 3140 {
3141 movementvector.X = force.X; 3141 movementvector.X = m_nextVelocity.X;
3142 movementvector.Y = force.Y; 3142 movementvector.Y = m_nextVelocity.Y;
3143 movementvector.Z = force.Z; 3143 movementvector.Z = m_nextVelocity.Z;
3144 Velocity = movementvector; 3144 Velocity = movementvector;
3145 } 3145 }
3146 catch (NullReferenceException) 3146 catch (NullReferenceException)
@@ -3149,9 +3149,7 @@ namespace OpenSim.Region.Framework.Scenes
3149 // Ignoring this causes no movement to be sent to the physics engine... 3149 // Ignoring this causes no movement to be sent to the physics engine...
3150 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter! 3150 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
3151 } 3151 }
3152 m_newForce = true; 3152 m_newMovement = true;
3153
3154 m_forcesList.Clear();
3155 } 3153 }
3156 } 3154 }
3157 } 3155 }