aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs114
2 files changed, 52 insertions, 68 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index b37249d..bbd445d 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -443,5 +443,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
443 443
444 SendAnimPack(animIDs, sequenceNums, objectIDs); 444 SendAnimPack(animIDs, sequenceNums, objectIDs);
445 } 445 }
446
447 public void Close()
448 {
449 m_animations = null;
450 m_scenePresence = null;
451 }
446 } 452 }
447} \ No newline at end of file 453} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index bcad335..46a9ad1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -754,38 +754,14 @@ namespace OpenSim.Region.Framework.Scenes
754 /// timestamp has already been sent. 754 /// timestamp has already been sent.
755 /// </summary> 755 /// </summary>
756 public void SendPrimUpdates() 756 public void SendPrimUpdates()
757 { 757 {
758 m_perfMonMS = EnvironmentTickCount(); 758 m_perfMonMS = Util.EnvironmentTickCount();
759
760 m_sceneViewer.SendPrimUpdates();
761
762 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
763 }
764
765 /// <summary>
766 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
767 /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
768 /// for the callers.
769 /// This trims it to a 12 day interval so don't let your frame time get too long.
770 /// </summary>
771 /// <returns></returns>
772 const Int32 EnvironmentTickCountMask = 0x3fffffff;
773 private static Int32 EnvironmentTickCount() {
774 return Environment.TickCount & EnvironmentTickCountMask;
775 }
776 759
777 /// <summary> 760 m_sceneViewer.SendPrimUpdates();
778 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive 761
779 /// and negative every 24.9 days. Subtracts the passed value (previously fetched by 762 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
780 /// 'EnvironmentTickCount()') and accounts for any wrapping.
781 /// </summary>
782 /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
783 private static Int32 EnvironmentTickCountSubtract(Int32 prevValue) {
784 Int32 diff = EnvironmentTickCount() - prevValue;
785 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
786 } 763 }
787 764
788
789 #region Status Methods 765 #region Status Methods
790 766
791 /// <summary> 767 /// <summary>
@@ -1172,7 +1148,7 @@ namespace OpenSim.Region.Framework.Scenes
1172 // return; 1148 // return;
1173 //} 1149 //}
1174 1150
1175 m_perfMonMS = EnvironmentTickCount(); 1151 m_perfMonMS = Util.EnvironmentTickCount();
1176 1152
1177 ++m_movementUpdateCount; 1153 ++m_movementUpdateCount;
1178 if (m_movementUpdateCount < 1) 1154 if (m_movementUpdateCount < 1)
@@ -1486,9 +1462,9 @@ namespace OpenSim.Region.Framework.Scenes
1486 } 1462 }
1487 } 1463 }
1488 1464
1489 m_scene.EventManager.TriggerOnClientMovement(this); 1465 m_scene.EventManager.TriggerOnClientMovement(this);
1490 1466
1491 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); 1467 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
1492 } 1468 }
1493 1469
1494 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) 1470 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
@@ -1946,9 +1922,9 @@ namespace OpenSim.Region.Framework.Scenes
1946 } 1922 }
1947 1923
1948 return; 1924 return;
1949 } 1925 }
1950 1926
1951 m_perfMonMS = EnvironmentTickCount(); 1927 m_perfMonMS = Util.EnvironmentTickCount();
1952 1928
1953 Rotation = rotation; 1929 Rotation = rotation;
1954 Vector3 direc = vec * rotation; 1930 Vector3 direc = vec * rotation;
@@ -1988,9 +1964,9 @@ namespace OpenSim.Region.Framework.Scenes
1988 } 1964 }
1989 1965
1990 // TODO: Add the force instead of only setting it to support multiple forces per frame? 1966 // TODO: Add the force instead of only setting it to support multiple forces per frame?
1991 m_forceToApply = direc; 1967 m_forceToApply = direc;
1992 1968
1993 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); 1969 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
1994 } 1970 }
1995 1971
1996 #endregion 1972 #endregion
@@ -2055,8 +2031,8 @@ namespace OpenSim.Region.Framework.Scenes
2055 // If the client is inactive, it's getting its updates from another 2031 // If the client is inactive, it's getting its updates from another
2056 // server. 2032 // server.
2057 if (remoteClient.IsActive) 2033 if (remoteClient.IsActive)
2058 { 2034 {
2059 m_perfMonMS = EnvironmentTickCount(); 2035 m_perfMonMS = Util.EnvironmentTickCount();
2060 2036
2061 PhysicsActor actor = m_physicsActor; 2037 PhysicsActor actor = m_physicsActor;
2062 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; 2038 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
@@ -2067,9 +2043,9 @@ namespace OpenSim.Region.Framework.Scenes
2067 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); 2043 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
2068 2044
2069 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, 2045 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
2070 pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient))); 2046 pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient)));
2071 2047
2072 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); 2048 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2073 m_scene.StatsReporter.AddAgentUpdates(1); 2049 m_scene.StatsReporter.AddAgentUpdates(1);
2074 } 2050 }
2075 } 2051 }
@@ -2078,12 +2054,12 @@ namespace OpenSim.Region.Framework.Scenes
2078 /// Send a location/velocity/accelleration update to all agents in scene 2054 /// Send a location/velocity/accelleration update to all agents in scene
2079 /// </summary> 2055 /// </summary>
2080 public void SendTerseUpdateToAllClients() 2056 public void SendTerseUpdateToAllClients()
2081 { 2057 {
2082 m_perfMonMS = EnvironmentTickCount(); 2058 m_perfMonMS = Util.EnvironmentTickCount();
2083 2059
2084 m_scene.ForEachClient(SendTerseUpdateToClient); 2060 m_scene.ForEachClient(SendTerseUpdateToClient);
2085 2061
2086 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); 2062 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2087 } 2063 }
2088 2064
2089 public void SendCoarseLocations() 2065 public void SendCoarseLocations()
@@ -2102,8 +2078,8 @@ namespace OpenSim.Region.Framework.Scenes
2102 } 2078 }
2103 2079
2104 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) 2080 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
2105 { 2081 {
2106 m_perfMonMS = EnvironmentTickCount(); 2082 m_perfMonMS = Util.EnvironmentTickCount();
2107 2083
2108 List<Vector3> CoarseLocations = new List<Vector3>(); 2084 List<Vector3> CoarseLocations = new List<Vector3>();
2109 List<UUID> AvatarUUIDs = new List<UUID>(); 2085 List<UUID> AvatarUUIDs = new List<UUID>();
@@ -2137,9 +2113,9 @@ namespace OpenSim.Region.Framework.Scenes
2137 //} 2113 //}
2138 } 2114 }
2139 2115
2140 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); 2116 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
2141 2117
2142 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); 2118 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2143 } 2119 }
2144 2120
2145 public void CoarseLocationChange() 2121 public void CoarseLocationChange()
@@ -2175,8 +2151,8 @@ namespace OpenSim.Region.Framework.Scenes
2175 /// Tell *ALL* agents about this agent 2151 /// Tell *ALL* agents about this agent
2176 /// </summary> 2152 /// </summary>
2177 public void SendInitialFullUpdateToAllClients() 2153 public void SendInitialFullUpdateToAllClients()
2178 { 2154 {
2179 m_perfMonMS = EnvironmentTickCount(); 2155 m_perfMonMS = Util.EnvironmentTickCount();
2180 2156
2181 ScenePresence[] avatars = m_scene.GetScenePresences(); 2157 ScenePresence[] avatars = m_scene.GetScenePresences();
2182 2158
@@ -2201,15 +2177,15 @@ namespace OpenSim.Region.Framework.Scenes
2201 } 2177 }
2202 } 2178 }
2203 2179
2204 m_scene.StatsReporter.AddAgentUpdates(avatars.Length); 2180 m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
2205 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); 2181 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2206 2182
2207 //Animator.SendAnimPack(); 2183 //Animator.SendAnimPack();
2208 } 2184 }
2209 2185
2210 public void SendFullUpdateToAllClients() 2186 public void SendFullUpdateToAllClients()
2211 { 2187 {
2212 m_perfMonMS = EnvironmentTickCount(); 2188 m_perfMonMS = Util.EnvironmentTickCount();
2213 2189
2214 // only send update from root agents to other clients; children are only "listening posts" 2190 // only send update from root agents to other clients; children are only "listening posts"
2215 List<ScenePresence> avatars = m_scene.GetAvatars(); 2191 List<ScenePresence> avatars = m_scene.GetAvatars();
@@ -2218,8 +2194,8 @@ namespace OpenSim.Region.Framework.Scenes
2218 SendFullUpdateToOtherClient(avatar); 2194 SendFullUpdateToOtherClient(avatar);
2219 2195
2220 } 2196 }
2221 m_scene.StatsReporter.AddAgentUpdates(avatars.Count); 2197 m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
2222 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); 2198 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2223 2199
2224 Animator.SendAnimPack(); 2200 Animator.SendAnimPack();
2225 } 2201 }
@@ -2260,8 +2236,8 @@ namespace OpenSim.Region.Framework.Scenes
2260 /// 2236 ///
2261 /// </summary> 2237 /// </summary>
2262 public void SendAppearanceToAllOtherAgents() 2238 public void SendAppearanceToAllOtherAgents()
2263 { 2239 {
2264 m_perfMonMS = EnvironmentTickCount(); 2240 m_perfMonMS = Util.EnvironmentTickCount();
2265 2241
2266 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2242 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2267 { 2243 {
@@ -2269,9 +2245,9 @@ namespace OpenSim.Region.Framework.Scenes
2269 { 2245 {
2270 SendAppearanceToOtherAgent(scenePresence); 2246 SendAppearanceToOtherAgent(scenePresence);
2271 } 2247 }
2272 }); 2248 });
2273 2249
2274 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); 2250 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2275 } 2251 }
2276 2252
2277 /// <summary> 2253 /// <summary>
@@ -3071,7 +3047,9 @@ namespace OpenSim.Region.Framework.Scenes
3071 3047
3072 m_sceneViewer.Close(); 3048 m_sceneViewer.Close();
3073 3049
3074 RemoveFromPhysicalScene(); 3050 RemoveFromPhysicalScene();
3051 m_animator.Close();
3052 m_animator = null;
3075 } 3053 }
3076 3054
3077 public ScenePresence() 3055 public ScenePresence()