diff options
author | Melanie | 2013-06-23 01:49:45 +0100 |
---|---|---|
committer | Melanie | 2013-06-23 01:49:45 +0100 |
commit | 936700bda3969bc54166f0d6a3ca81e3d5c42935 (patch) | |
tree | 6bb97abf25f4a3f22ccb40e3b4be20c551327b09 /OpenSim/Region | |
parent | Fix prim locking to behave like SL (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-936700bda3969bc54166f0d6a3ca81e3d5c42935.zip opensim-SC_OLD-936700bda3969bc54166f0d6a3ca81e3d5c42935.tar.gz opensim-SC_OLD-936700bda3969bc54166f0d6a3ca81e3d5c42935.tar.bz2 opensim-SC_OLD-936700bda3969bc54166f0d6a3ca81e3d5c42935.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to '')
14 files changed, 145 insertions, 392 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index c3e7ec2..e451aa8 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -124,6 +124,7 @@ namespace OpenSim | |||
124 | workerThreads = workerThreadsMax; | 124 | workerThreads = workerThreadsMax; |
125 | m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads); | 125 | m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads); |
126 | } | 126 | } |
127 | |||
127 | // Increase the number of IOCP threads available. | 128 | // Increase the number of IOCP threads available. |
128 | // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) | 129 | // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) |
129 | if (iocpThreads < iocpThreadsMin) | 130 | if (iocpThreads < iocpThreadsMin) |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 11dd052..9325b12 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -372,7 +372,7 @@ namespace OpenSim | |||
372 | "Unload a module", HandleModules); | 372 | "Unload a module", HandleModules); |
373 | } | 373 | } |
374 | 374 | ||
375 | public override void ShutdownSpecific() | 375 | protected override void ShutdownSpecific() |
376 | { | 376 | { |
377 | if (m_shutdownCommandsFile != String.Empty) | 377 | if (m_shutdownCommandsFile != String.Empty) |
378 | { | 378 | { |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f9e0cf1..7ca87a3 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -231,10 +231,7 @@ namespace OpenSim | |||
231 | } | 231 | } |
232 | 232 | ||
233 | if (m_console != null) | 233 | if (m_console != null) |
234 | { | ||
235 | StatsManager.RegisterConsoleCommands(m_console); | ||
236 | AddPluginCommands(m_console); | 234 | AddPluginCommands(m_console); |
237 | } | ||
238 | } | 235 | } |
239 | 236 | ||
240 | protected virtual void AddPluginCommands(ICommandConsole console) | 237 | protected virtual void AddPluginCommands(ICommandConsole console) |
@@ -880,7 +877,7 @@ namespace OpenSim | |||
880 | /// <summary> | 877 | /// <summary> |
881 | /// Performs any last-minute sanity checking and shuts down the region server | 878 | /// Performs any last-minute sanity checking and shuts down the region server |
882 | /// </summary> | 879 | /// </summary> |
883 | public override void ShutdownSpecific() | 880 | protected override void ShutdownSpecific() |
884 | { | 881 | { |
885 | if (proxyUrl.Length > 0) | 882 | if (proxyUrl.Length > 0) |
886 | { | 883 | { |
@@ -900,6 +897,8 @@ namespace OpenSim | |||
900 | { | 897 | { |
901 | m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e); | 898 | m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e); |
902 | } | 899 | } |
900 | |||
901 | base.ShutdownSpecific(); | ||
903 | } | 902 | } |
904 | 903 | ||
905 | /// <summary> | 904 | /// <summary> |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 2024018..0e3cd6b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -34,6 +34,7 @@ using log4net; | |||
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using Mono.Addins; | 35 | using Mono.Addins; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | ||
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Monitoring; | 39 | using OpenSim.Framework.Monitoring; |
39 | using OpenSim.Framework.Servers; | 40 | using OpenSim.Framework.Servers; |
@@ -44,8 +45,6 @@ using OpenSim.Framework.Capabilities; | |||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using Caps = OpenSim.Framework.Capabilities.Caps; | 46 | using Caps = OpenSim.Framework.Capabilities.Caps; |
46 | using OpenSim.Capabilities.Handlers; | 47 | using OpenSim.Capabilities.Handlers; |
47 | using OpenMetaverse; | ||
48 | using OpenMetaverse.StructuredData; | ||
49 | 48 | ||
50 | namespace OpenSim.Region.ClientStack.Linden | 49 | namespace OpenSim.Region.ClientStack.Linden |
51 | { | 50 | { |
@@ -64,7 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
64 | public List<UUID> folders; | 63 | public List<UUID> folders; |
65 | } | 64 | } |
66 | 65 | ||
67 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 66 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
68 | 67 | ||
69 | private Scene m_scene; | 68 | private Scene m_scene; |
70 | 69 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index 556df30..b47ff54 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs | |||
@@ -33,6 +33,7 @@ using NUnit.Framework; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenMetaverse.Packets; | 34 | using OpenMetaverse.Packets; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Monitoring; | ||
36 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
38 | using OpenSim.Tests.Common.Mock; | 39 | using OpenSim.Tests.Common.Mock; |
@@ -69,6 +70,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
69 | { | 70 | { |
70 | base.SetUp(); | 71 | base.SetUp(); |
71 | m_scene = new SceneHelpers().SetupScene(); | 72 | m_scene = new SceneHelpers().SetupScene(); |
73 | StatsManager.SimExtraStats = new SimExtraStatsCollector(); | ||
72 | } | 74 | } |
73 | 75 | ||
74 | /// <summary> | 76 | /// <summary> |
@@ -210,8 +212,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
210 | 212 | ||
211 | ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID); | 213 | ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID); |
212 | Assert.That(spAfterAckTimeout, Is.Null); | 214 | Assert.That(spAfterAckTimeout, Is.Null); |
213 | |||
214 | // TestHelpers.DisableLogging(); | ||
215 | } | 215 | } |
216 | 216 | ||
217 | // /// <summary> | 217 | // /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 7d763fa..7f3d0a2 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -182,7 +182,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
182 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 182 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
183 | 183 | ||
184 | if (msglist == null) | 184 | if (msglist == null) |
185 | { | ||
185 | m_log.WarnFormat("[OFFLINE MESSAGING]: WARNING null message list."); | 186 | m_log.WarnFormat("[OFFLINE MESSAGING]: WARNING null message list."); |
187 | return; | ||
188 | } | ||
186 | 189 | ||
187 | foreach (GridInstantMessage im in msglist) | 190 | foreach (GridInstantMessage im in msglist) |
188 | { | 191 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 02ed1a0..630d1c3 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -53,8 +53,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | private int m_levelHGTeleport = 0; | 55 | private int m_levelHGTeleport = 0; |
56 | private string m_ThisHomeURI; | ||
56 | 57 | ||
57 | private GatekeeperServiceConnector m_GatekeeperConnector; | 58 | private GatekeeperServiceConnector m_GatekeeperConnector; |
59 | private IUserAgentService m_UAS; | ||
58 | 60 | ||
59 | protected bool m_RestrictAppearanceAbroad; | 61 | protected bool m_RestrictAppearanceAbroad; |
60 | protected string m_AccountName; | 62 | protected string m_AccountName; |
@@ -143,6 +145,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
143 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 145 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
144 | } | 146 | } |
145 | } | 147 | } |
148 | |||
149 | moduleConfig = source.Configs["Hypergrid"]; | ||
150 | if (moduleConfig != null) | ||
151 | { | ||
152 | m_ThisHomeURI = moduleConfig.GetString("HomeURI", string.Empty); | ||
153 | if (m_ThisHomeURI != string.Empty && !m_ThisHomeURI.EndsWith("/")) | ||
154 | m_ThisHomeURI += '/'; | ||
155 | } | ||
146 | } | 156 | } |
147 | 157 | ||
148 | public override void AddRegion(Scene scene) | 158 | public override void AddRegion(Scene scene) |
@@ -194,7 +204,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
194 | base.RegionLoaded(scene); | 204 | base.RegionLoaded(scene); |
195 | 205 | ||
196 | if (m_Enabled) | 206 | if (m_Enabled) |
207 | { | ||
197 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); | 208 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); |
209 | m_UAS = scene.RequestModuleInterface<IUserAgentService>(); | ||
210 | } | ||
198 | } | 211 | } |
199 | 212 | ||
200 | public override void RemoveRegion(Scene scene) | 213 | public override void RemoveRegion(Scene scene) |
@@ -272,8 +285,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
272 | if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) | 285 | if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) |
273 | { | 286 | { |
274 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); | 287 | string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); |
275 | IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); | 288 | IUserAgentService connector; |
276 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); | 289 | |
290 | if (userAgentDriver.Equals(m_ThisHomeURI) && m_UAS != null) | ||
291 | connector = m_UAS; | ||
292 | else | ||
293 | connector = new UserAgentServiceConnector(userAgentDriver); | ||
294 | |||
295 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, false, out reason); | ||
277 | logout = success; // flag for later logout from this grid; this is an HG TP | 296 | logout = success; // flag for later logout from this grid; this is an HG TP |
278 | 297 | ||
279 | if (success) | 298 | if (success) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index b2a1b23..d120e11 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -194,7 +194,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
194 | return false; | 194 | return false; |
195 | 195 | ||
196 | // Try local first | 196 | // Try local first |
197 | if (m_localBackend.IsLocalRegion(destination.RegionHandle)) | 197 | if (m_localBackend.IsLocalRegion(destination.RegionID)) |
198 | return m_localBackend.UpdateAgent(destination, cAgentData); | 198 | return m_localBackend.UpdateAgent(destination, cAgentData); |
199 | 199 | ||
200 | return m_remoteConnector.UpdateAgent(destination, cAgentData); | 200 | return m_remoteConnector.UpdateAgent(destination, cAgentData); |
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
206 | return false; | 206 | return false; |
207 | 207 | ||
208 | // Try local first | 208 | // Try local first |
209 | if (m_localBackend.IsLocalRegion(destination.RegionHandle)) | 209 | if (m_localBackend.IsLocalRegion(destination.RegionID)) |
210 | return m_localBackend.UpdateAgent(destination, cAgentData); | 210 | return m_localBackend.UpdateAgent(destination, cAgentData); |
211 | 211 | ||
212 | return m_remoteConnector.UpdateAgent(destination, cAgentData); | 212 | return m_remoteConnector.UpdateAgent(destination, cAgentData); |
@@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
224 | return true; | 224 | return true; |
225 | 225 | ||
226 | // else do the remote thing | 226 | // else do the remote thing |
227 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | 227 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
228 | return m_remoteConnector.RetrieveAgent(destination, id, out agent); | 228 | return m_remoteConnector.RetrieveAgent(destination, id, out agent); |
229 | 229 | ||
230 | return false; | 230 | return false; |
@@ -273,7 +273,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
273 | return true; | 273 | return true; |
274 | 274 | ||
275 | // else do the remote thing | 275 | // else do the remote thing |
276 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | 276 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
277 | return m_remoteConnector.CloseAgent(destination, id); | 277 | return m_remoteConnector.CloseAgent(destination, id); |
278 | 278 | ||
279 | return false; | 279 | return false; |
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
296 | } | 296 | } |
297 | 297 | ||
298 | // else do the remote thing | 298 | // else do the remote thing |
299 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | 299 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
300 | return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall); | 300 | return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall); |
301 | 301 | ||
302 | return false; | 302 | return false; |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 8406442..e55c9ed 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -81,14 +81,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
81 | 81 | ||
82 | set { m_landData = value; } | 82 | set { m_landData = value; } |
83 | } | 83 | } |
84 | 84 | ||
85 | public IPrimCounts PrimCounts { get; set; } | 85 | public IPrimCounts PrimCounts { get; set; } |
86 | 86 | ||
87 | public UUID RegionUUID | 87 | public UUID RegionUUID |
88 | { | 88 | { |
89 | get { return m_scene.RegionInfo.RegionID; } | 89 | get { return m_scene.RegionInfo.RegionID; } |
90 | } | 90 | } |
91 | 91 | ||
92 | public Vector3 StartPoint | 92 | public Vector3 StartPoint |
93 | { | 93 | { |
94 | get | 94 | get |
@@ -101,11 +101,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
101 | return new Vector3(x * 4, y * 4, 0); | 101 | return new Vector3(x * 4, y * 4, 0); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | return new Vector3(-1, -1, -1); | 105 | return new Vector3(-1, -1, -1); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | public Vector3 EndPoint | 109 | public Vector3 EndPoint |
110 | { | 110 | { |
111 | get | 111 | get |
@@ -116,15 +116,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
116 | { | 116 | { |
117 | if (LandBitmap[x, y]) | 117 | if (LandBitmap[x, y]) |
118 | { | 118 | { |
119 | return new Vector3(x * 4, y * 4, 0); | 119 | return new Vector3(x * 4 + 4, y * 4 + 4, 0); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | return new Vector3(-1, -1, -1); | 124 | return new Vector3(-1, -1, -1); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | #region Constructors | 128 | #region Constructors |
129 | 129 | ||
130 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) | 130 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6c79b13..1e4d558 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -326,7 +326,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
326 | // Update item with new asset | 326 | // Update item with new asset |
327 | item.AssetID = asset.FullID; | 327 | item.AssetID = asset.FullID; |
328 | if (group.UpdateInventoryItem(item)) | 328 | if (group.UpdateInventoryItem(item)) |
329 | remoteClient.SendAgentAlertMessage("Script saved", false); | 329 | remoteClient.SendAlertMessage("Script saved"); |
330 | 330 | ||
331 | part.SendPropertiesToClient(remoteClient); | 331 | part.SendPropertiesToClient(remoteClient); |
332 | 332 | ||
@@ -342,7 +342,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
342 | } | 342 | } |
343 | else | 343 | else |
344 | { | 344 | { |
345 | remoteClient.SendAgentAlertMessage("Script saved", false); | 345 | remoteClient.SendAlertMessage("Script saved"); |
346 | } | 346 | } |
347 | 347 | ||
348 | // Tell anyone managing scripts that a script has been reloaded/changed | 348 | // Tell anyone managing scripts that a script has been reloaded/changed |
@@ -1616,11 +1616,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1616 | remoteClient, part, transactionID, currentItem); | 1616 | remoteClient, part, transactionID, currentItem); |
1617 | 1617 | ||
1618 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | 1618 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) |
1619 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1619 | remoteClient.SendAlertMessage("Notecard saved"); |
1620 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | 1620 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) |
1621 | remoteClient.SendAgentAlertMessage("Script saved", false); | 1621 | remoteClient.SendAlertMessage("Script saved"); |
1622 | else | 1622 | else |
1623 | remoteClient.SendAgentAlertMessage("Item saved", false); | 1623 | remoteClient.SendAlertMessage("Item saved"); |
1624 | } | 1624 | } |
1625 | 1625 | ||
1626 | // Base ALWAYS has move | 1626 | // Base ALWAYS has move |
diff --git a/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs b/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs deleted file mode 100644 index 6e74ce0..0000000 --- a/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs +++ /dev/null | |||
@@ -1,339 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Diagnostics; | ||
31 | using System.Linq; | ||
32 | using System.Net.NetworkInformation; | ||
33 | using System.Text; | ||
34 | using System.Threading; | ||
35 | |||
36 | using log4net; | ||
37 | using Mono.Addins; | ||
38 | using Nini.Config; | ||
39 | |||
40 | using OpenSim.Framework; | ||
41 | using OpenSim.Framework.Console; | ||
42 | using OpenSim.Framework.Monitoring; | ||
43 | using OpenSim.Region.Framework.Interfaces; | ||
44 | using OpenSim.Region.Framework.Scenes; | ||
45 | |||
46 | using OpenMetaverse.StructuredData; | ||
47 | |||
48 | namespace OpenSim.Region.OptionalModules.Framework.Monitoring | ||
49 | { | ||
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ServerStatistics")] | ||
51 | public class ServerStats : ISharedRegionModule | ||
52 | { | ||
53 | private readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
54 | private readonly string LogHeader = "[SERVER STATS]"; | ||
55 | |||
56 | public bool Enabled = false; | ||
57 | private static Dictionary<string, Stat> RegisteredStats = new Dictionary<string, Stat>(); | ||
58 | |||
59 | public readonly string CategoryServer = "server"; | ||
60 | |||
61 | public readonly string ContainerProcessor = "processor"; | ||
62 | public readonly string ContainerMemory = "memory"; | ||
63 | public readonly string ContainerNetwork = "network"; | ||
64 | public readonly string ContainerProcess = "process"; | ||
65 | |||
66 | public string NetworkInterfaceTypes = "Ethernet"; | ||
67 | |||
68 | readonly int performanceCounterSampleInterval = 500; | ||
69 | int lastperformanceCounterSampleTime = 0; | ||
70 | |||
71 | private class PerfCounterControl | ||
72 | { | ||
73 | public PerformanceCounter perfCounter; | ||
74 | public int lastFetch; | ||
75 | public string name; | ||
76 | public PerfCounterControl(PerformanceCounter pPc) | ||
77 | : this(pPc, String.Empty) | ||
78 | { | ||
79 | } | ||
80 | public PerfCounterControl(PerformanceCounter pPc, string pName) | ||
81 | { | ||
82 | perfCounter = pPc; | ||
83 | lastFetch = 0; | ||
84 | name = pName; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | PerfCounterControl processorPercentPerfCounter = null; | ||
89 | |||
90 | #region ISharedRegionModule | ||
91 | // IRegionModuleBase.Name | ||
92 | public string Name { get { return "Server Stats"; } } | ||
93 | // IRegionModuleBase.ReplaceableInterface | ||
94 | public Type ReplaceableInterface { get { return null; } } | ||
95 | // IRegionModuleBase.Initialize | ||
96 | public void Initialise(IConfigSource source) | ||
97 | { | ||
98 | IConfig cfg = source.Configs["Monitoring"]; | ||
99 | |||
100 | if (cfg != null) | ||
101 | Enabled = cfg.GetBoolean("ServerStatsEnabled", true); | ||
102 | |||
103 | if (Enabled) | ||
104 | { | ||
105 | NetworkInterfaceTypes = cfg.GetString("NetworkInterfaceTypes", "Ethernet"); | ||
106 | } | ||
107 | } | ||
108 | // IRegionModuleBase.Close | ||
109 | public void Close() | ||
110 | { | ||
111 | if (RegisteredStats.Count > 0) | ||
112 | { | ||
113 | foreach (Stat stat in RegisteredStats.Values) | ||
114 | { | ||
115 | StatsManager.DeregisterStat(stat); | ||
116 | stat.Dispose(); | ||
117 | } | ||
118 | RegisteredStats.Clear(); | ||
119 | } | ||
120 | } | ||
121 | // IRegionModuleBase.AddRegion | ||
122 | public void AddRegion(Scene scene) | ||
123 | { | ||
124 | } | ||
125 | // IRegionModuleBase.RemoveRegion | ||
126 | public void RemoveRegion(Scene scene) | ||
127 | { | ||
128 | } | ||
129 | // IRegionModuleBase.RegionLoaded | ||
130 | public void RegionLoaded(Scene scene) | ||
131 | { | ||
132 | } | ||
133 | // ISharedRegionModule.PostInitialize | ||
134 | public void PostInitialise() | ||
135 | { | ||
136 | if (RegisteredStats.Count == 0) | ||
137 | { | ||
138 | RegisterServerStats(); | ||
139 | } | ||
140 | } | ||
141 | #endregion ISharedRegionModule | ||
142 | |||
143 | private void MakeStat(string pName, string pDesc, string pUnit, string pContainer, Action<Stat> act) | ||
144 | { | ||
145 | string desc = pDesc; | ||
146 | if (desc == null) | ||
147 | desc = pName; | ||
148 | Stat stat = new Stat(pName, pName, desc, pUnit, CategoryServer, pContainer, StatType.Pull, act, StatVerbosity.Info); | ||
149 | StatsManager.RegisterStat(stat); | ||
150 | RegisteredStats.Add(pName, stat); | ||
151 | } | ||
152 | |||
153 | public void RegisterServerStats() | ||
154 | { | ||
155 | lastperformanceCounterSampleTime = Util.EnvironmentTickCount(); | ||
156 | PerformanceCounter tempPC; | ||
157 | Stat tempStat; | ||
158 | string tempName; | ||
159 | |||
160 | try | ||
161 | { | ||
162 | tempName = "CPUPercent"; | ||
163 | tempPC = new PerformanceCounter("Processor", "% Processor Time", "_Total"); | ||
164 | processorPercentPerfCounter = new PerfCounterControl(tempPC); | ||
165 | // A long time bug in mono is that CPU percent is reported as CPU percent idle. Windows reports CPU percent busy. | ||
166 | tempStat = new Stat(tempName, tempName, "", "percent", CategoryServer, ContainerProcessor, | ||
167 | StatType.Pull, (s) => { GetNextValue(s, processorPercentPerfCounter, Util.IsWindows() ? 1 : -1); }, | ||
168 | StatVerbosity.Info); | ||
169 | StatsManager.RegisterStat(tempStat); | ||
170 | RegisteredStats.Add(tempName, tempStat); | ||
171 | |||
172 | MakeStat("TotalProcessorTime", null, "sec", ContainerProcessor, | ||
173 | (s) => { s.Value = Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds; }); | ||
174 | |||
175 | MakeStat("UserProcessorTime", null, "sec", ContainerProcessor, | ||
176 | (s) => { s.Value = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds; }); | ||
177 | |||
178 | MakeStat("PrivilegedProcessorTime", null, "sec", ContainerProcessor, | ||
179 | (s) => { s.Value = Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds; }); | ||
180 | |||
181 | MakeStat("Threads", null, "threads", ContainerProcessor, | ||
182 | (s) => { s.Value = Process.GetCurrentProcess().Threads.Count; }); | ||
183 | } | ||
184 | catch (Exception e) | ||
185 | { | ||
186 | m_log.ErrorFormat("{0} Exception creating 'Process': {1}", LogHeader, e); | ||
187 | } | ||
188 | |||
189 | try | ||
190 | { | ||
191 | List<string> okInterfaceTypes = new List<string>(NetworkInterfaceTypes.Split(',')); | ||
192 | |||
193 | IEnumerable<NetworkInterface> nics = NetworkInterface.GetAllNetworkInterfaces(); | ||
194 | foreach (NetworkInterface nic in nics) | ||
195 | { | ||
196 | if (nic.OperationalStatus != OperationalStatus.Up) | ||
197 | continue; | ||
198 | |||
199 | string nicInterfaceType = nic.NetworkInterfaceType.ToString(); | ||
200 | if (!okInterfaceTypes.Contains(nicInterfaceType)) | ||
201 | { | ||
202 | m_log.DebugFormat("{0} Not including stats for network interface '{1}' of type '{2}'.", | ||
203 | LogHeader, nic.Name, nicInterfaceType); | ||
204 | m_log.DebugFormat("{0} To include, add to comma separated list in [Monitoring]NetworkInterfaceTypes={1}", | ||
205 | LogHeader, NetworkInterfaceTypes); | ||
206 | continue; | ||
207 | } | ||
208 | |||
209 | if (nic.Supports(NetworkInterfaceComponent.IPv4)) | ||
210 | { | ||
211 | IPv4InterfaceStatistics nicStats = nic.GetIPv4Statistics(); | ||
212 | if (nicStats != null) | ||
213 | { | ||
214 | MakeStat("BytesRcvd/" + nic.Name, nic.Name, "KB", ContainerNetwork, | ||
215 | (s) => { LookupNic(s, (ns) => { return ns.BytesReceived; }, 1024.0); }); | ||
216 | MakeStat("BytesSent/" + nic.Name, nic.Name, "KB", ContainerNetwork, | ||
217 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent; }, 1024.0); }); | ||
218 | MakeStat("TotalBytes/" + nic.Name, nic.Name, "KB", ContainerNetwork, | ||
219 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent + ns.BytesReceived; }, 1024.0); }); | ||
220 | } | ||
221 | } | ||
222 | // TODO: add IPv6 (it may actually happen someday) | ||
223 | } | ||
224 | } | ||
225 | catch (Exception e) | ||
226 | { | ||
227 | m_log.ErrorFormat("{0} Exception creating 'Network Interface': {1}", LogHeader, e); | ||
228 | } | ||
229 | |||
230 | MakeStat("ProcessMemory", null, "MB", ContainerMemory, | ||
231 | (s) => { s.Value = Process.GetCurrentProcess().WorkingSet64 / 1024d / 1024d; }); | ||
232 | MakeStat("ObjectMemory", null, "MB", ContainerMemory, | ||
233 | (s) => { s.Value = GC.GetTotalMemory(false) / 1024d / 1024d; }); | ||
234 | MakeStat("LastMemoryChurn", null, "MB/sec", ContainerMemory, | ||
235 | (s) => { s.Value = Math.Round(MemoryWatchdog.LastMemoryChurn * 1000d / 1024d / 1024d, 3); }); | ||
236 | MakeStat("AverageMemoryChurn", null, "MB/sec", ContainerMemory, | ||
237 | (s) => { s.Value = Math.Round(MemoryWatchdog.AverageMemoryChurn * 1000d / 1024d / 1024d, 3); }); | ||
238 | } | ||
239 | |||
240 | // Notes on performance counters: | ||
241 | // "How To Read Performance Counters": http://blogs.msdn.com/b/bclteam/archive/2006/06/02/618156.aspx | ||
242 | // "How to get the CPU Usage in C#": http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c | ||
243 | // "Mono Performance Counters": http://www.mono-project.com/Mono_Performance_Counters | ||
244 | private delegate double PerfCounterNextValue(); | ||
245 | private void GetNextValue(Stat stat, PerfCounterControl perfControl) | ||
246 | { | ||
247 | GetNextValue(stat, perfControl, 1.0); | ||
248 | } | ||
249 | private void GetNextValue(Stat stat, PerfCounterControl perfControl, double factor) | ||
250 | { | ||
251 | if (Util.EnvironmentTickCountSubtract(perfControl.lastFetch) > performanceCounterSampleInterval) | ||
252 | { | ||
253 | if (perfControl != null && perfControl.perfCounter != null) | ||
254 | { | ||
255 | try | ||
256 | { | ||
257 | // Kludge for factor to run double duty. If -1, subtract the value from one | ||
258 | if (factor == -1) | ||
259 | stat.Value = 1 - perfControl.perfCounter.NextValue(); | ||
260 | else | ||
261 | stat.Value = perfControl.perfCounter.NextValue() / factor; | ||
262 | } | ||
263 | catch (Exception e) | ||
264 | { | ||
265 | m_log.ErrorFormat("{0} Exception on NextValue fetching {1}: {2}", LogHeader, stat.Name, e); | ||
266 | } | ||
267 | perfControl.lastFetch = Util.EnvironmentTickCount(); | ||
268 | } | ||
269 | } | ||
270 | } | ||
271 | |||
272 | // Lookup the nic that goes with this stat and set the value by using a fetch action. | ||
273 | // Not sure about closure with delegates inside delegates. | ||
274 | private delegate double GetIPv4StatValue(IPv4InterfaceStatistics interfaceStat); | ||
275 | private void LookupNic(Stat stat, GetIPv4StatValue getter, double factor) | ||
276 | { | ||
277 | // Get the one nic that has the name of this stat | ||
278 | IEnumerable<NetworkInterface> nics = NetworkInterface.GetAllNetworkInterfaces().Where( | ||
279 | (network) => network.Name == stat.Description); | ||
280 | try | ||
281 | { | ||
282 | foreach (NetworkInterface nic in nics) | ||
283 | { | ||
284 | IPv4InterfaceStatistics intrStats = nic.GetIPv4Statistics(); | ||
285 | if (intrStats != null) | ||
286 | { | ||
287 | double newVal = Math.Round(getter(intrStats) / factor, 3); | ||
288 | stat.Value = newVal; | ||
289 | } | ||
290 | break; | ||
291 | } | ||
292 | } | ||
293 | catch | ||
294 | { | ||
295 | // There are times interfaces go away so we just won't update the stat for this | ||
296 | m_log.ErrorFormat("{0} Exception fetching stat on interface '{1}'", LogHeader, stat.Description); | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | |||
301 | public class ServerStatsAggregator : Stat | ||
302 | { | ||
303 | public ServerStatsAggregator( | ||
304 | string shortName, | ||
305 | string name, | ||
306 | string description, | ||
307 | string unitName, | ||
308 | string category, | ||
309 | string container | ||
310 | ) | ||
311 | : base( | ||
312 | shortName, | ||
313 | name, | ||
314 | description, | ||
315 | unitName, | ||
316 | category, | ||
317 | container, | ||
318 | StatType.Push, | ||
319 | MeasuresOfInterest.None, | ||
320 | null, | ||
321 | StatVerbosity.Info) | ||
322 | { | ||
323 | } | ||
324 | public override string ToConsoleString() | ||
325 | { | ||
326 | StringBuilder sb = new StringBuilder(); | ||
327 | |||
328 | return sb.ToString(); | ||
329 | } | ||
330 | |||
331 | public override OSDMap ToOSDMap() | ||
332 | { | ||
333 | OSDMap ret = new OSDMap(); | ||
334 | |||
335 | return ret; | ||
336 | } | ||
337 | } | ||
338 | |||
339 | } | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index ac8c30c..928b350 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |||
@@ -43,8 +43,14 @@ public class BSActorAvatarMove : BSActor | |||
43 | // Set to true if we think we're going up stairs. | 43 | // Set to true if we think we're going up stairs. |
44 | // This state is remembered because collisions will turn on and off as we go up stairs. | 44 | // This state is remembered because collisions will turn on and off as we go up stairs. |
45 | int m_walkingUpStairs; | 45 | int m_walkingUpStairs; |
46 | // The amount the step up is applying. Used to smooth stair walking. | ||
46 | float m_lastStepUp; | 47 | float m_lastStepUp; |
47 | 48 | ||
49 | // Jumping happens over several frames. If use applies up force while colliding, start the | ||
50 | // jump and allow the jump to continue for this number of frames. | ||
51 | int m_jumpFrames = 0; | ||
52 | float m_jumpVelocity = 0f; | ||
53 | |||
48 | public BSActorAvatarMove(BSScene physicsScene, BSPhysObject pObj, string actorName) | 54 | public BSActorAvatarMove(BSScene physicsScene, BSPhysObject pObj, string actorName) |
49 | : base(physicsScene, pObj, actorName) | 55 | : base(physicsScene, pObj, actorName) |
50 | { | 56 | { |
@@ -206,17 +212,45 @@ public class BSActorAvatarMove : BSActor | |||
206 | 212 | ||
207 | if (m_controllingPrim.Friction != BSParam.AvatarFriction) | 213 | if (m_controllingPrim.Friction != BSParam.AvatarFriction) |
208 | { | 214 | { |
209 | // Probably starting up walking. Set friction to moving friction. | 215 | // Probably starting to walk. Set friction to moving friction. |
210 | m_controllingPrim.Friction = BSParam.AvatarFriction; | 216 | m_controllingPrim.Friction = BSParam.AvatarFriction; |
211 | m_physicsScene.PE.SetFriction(m_controllingPrim.PhysBody, m_controllingPrim.Friction); | 217 | m_physicsScene.PE.SetFriction(m_controllingPrim.PhysBody, m_controllingPrim.Friction); |
212 | } | 218 | } |
213 | 219 | ||
214 | // If falling, we keep the world's downward vector no matter what the other axis specify. | ||
215 | // The check for RawVelocity.Z < 0 makes jumping work (temporary upward force). | ||
216 | if (!m_controllingPrim.Flying && !m_controllingPrim.IsColliding) | 220 | if (!m_controllingPrim.Flying && !m_controllingPrim.IsColliding) |
217 | { | 221 | { |
218 | if (m_controllingPrim.RawVelocity.Z < 0) | 222 | stepVelocity.Z = m_controllingPrim.RawVelocity.Z; |
223 | } | ||
224 | |||
225 | |||
226 | // Colliding and not flying with an upward force. The avatar must be trying to jump. | ||
227 | if (!m_controllingPrim.Flying && m_controllingPrim.IsColliding && stepVelocity.Z > 0) | ||
228 | { | ||
229 | // We allow the upward force to happen for this many frames. | ||
230 | m_jumpFrames = BSParam.AvatarJumpFrames; | ||
231 | m_jumpVelocity = stepVelocity.Z; | ||
232 | } | ||
233 | |||
234 | // The case where the avatar is not colliding and is not flying is special. | ||
235 | // The avatar is either falling or jumping and the user can be applying force to the avatar | ||
236 | // (force in some direction or force up or down). | ||
237 | // If the avatar has negative Z velocity and is not colliding, presume we're falling and keep the velocity. | ||
238 | // If the user is trying to apply upward force but we're not colliding, assume the avatar | ||
239 | // is trying to jump and don't apply the upward force if not touching the ground any more. | ||
240 | if (!m_controllingPrim.Flying && !m_controllingPrim.IsColliding) | ||
241 | { | ||
242 | // If upward velocity is being applied, this must be a jump and only allow that to go on so long | ||
243 | if (m_jumpFrames > 0) | ||
244 | { | ||
245 | // Since not touching the ground, only apply upward force for so long. | ||
246 | m_jumpFrames--; | ||
247 | stepVelocity.Z = m_jumpVelocity; | ||
248 | } | ||
249 | else | ||
250 | { | ||
251 | // Since we're not affected by anything, whatever vertical motion the avatar has, continue that. | ||
219 | stepVelocity.Z = m_controllingPrim.RawVelocity.Z; | 252 | stepVelocity.Z = m_controllingPrim.RawVelocity.Z; |
253 | } | ||
220 | // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); | 254 | // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); |
221 | } | 255 | } |
222 | 256 | ||
@@ -241,7 +275,7 @@ public class BSActorAvatarMove : BSActor | |||
241 | m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs,IsColliding={1},flying={2},targSpeed={3},collisions={4},avHeight={5}", | 275 | m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs,IsColliding={1},flying={2},targSpeed={3},collisions={4},avHeight={5}", |
242 | m_controllingPrim.LocalID, m_controllingPrim.IsColliding, m_controllingPrim.Flying, | 276 | m_controllingPrim.LocalID, m_controllingPrim.IsColliding, m_controllingPrim.Flying, |
243 | m_controllingPrim.TargetVelocitySpeed, m_controllingPrim.CollisionsLastTick.Count, m_controllingPrim.Size.Z); | 277 | m_controllingPrim.TargetVelocitySpeed, m_controllingPrim.CollisionsLastTick.Count, m_controllingPrim.Size.Z); |
244 | // This test is done if moving forward, not flying and is colliding with something. | 278 | |
245 | // Check for stairs climbing if colliding, not flying and moving forward | 279 | // Check for stairs climbing if colliding, not flying and moving forward |
246 | if ( m_controllingPrim.IsColliding | 280 | if ( m_controllingPrim.IsColliding |
247 | && !m_controllingPrim.Flying | 281 | && !m_controllingPrim.Flying |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 311cf4f..07e87d1 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -209,7 +209,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
209 | m_VhoverTimescale = Math.Max(pValue, 0.01f); | 209 | m_VhoverTimescale = Math.Max(pValue, 0.01f); |
210 | break; | 210 | break; |
211 | case Vehicle.LINEAR_DEFLECTION_EFFICIENCY: | 211 | case Vehicle.LINEAR_DEFLECTION_EFFICIENCY: |
212 | m_linearDeflectionEfficiency = Math.Max(pValue, 0.01f); | 212 | m_linearDeflectionEfficiency = ClampInRange(0f, pValue, 1f); |
213 | break; | 213 | break; |
214 | case Vehicle.LINEAR_DEFLECTION_TIMESCALE: | 214 | case Vehicle.LINEAR_DEFLECTION_TIMESCALE: |
215 | m_linearDeflectionTimescale = Math.Max(pValue, 0.01f); | 215 | m_linearDeflectionTimescale = Math.Max(pValue, 0.01f); |
@@ -707,7 +707,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
707 | private Vector3 m_knownRotationalVelocity; | 707 | private Vector3 m_knownRotationalVelocity; |
708 | private Vector3 m_knownRotationalForce; | 708 | private Vector3 m_knownRotationalForce; |
709 | private Vector3 m_knownRotationalImpulse; | 709 | private Vector3 m_knownRotationalImpulse; |
710 | private Vector3 m_knownForwardVelocity; // vehicle relative forward speed | ||
711 | 710 | ||
712 | private const int m_knownChangedPosition = 1 << 0; | 711 | private const int m_knownChangedPosition = 1 << 0; |
713 | private const int m_knownChangedVelocity = 1 << 1; | 712 | private const int m_knownChangedVelocity = 1 << 1; |
@@ -719,7 +718,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
719 | private const int m_knownChangedRotationalImpulse = 1 << 7; | 718 | private const int m_knownChangedRotationalImpulse = 1 << 7; |
720 | private const int m_knownChangedTerrainHeight = 1 << 8; | 719 | private const int m_knownChangedTerrainHeight = 1 << 8; |
721 | private const int m_knownChangedWaterLevel = 1 << 9; | 720 | private const int m_knownChangedWaterLevel = 1 << 9; |
722 | private const int m_knownChangedForwardVelocity = 1 <<10; | ||
723 | 721 | ||
724 | public void ForgetKnownVehicleProperties() | 722 | public void ForgetKnownVehicleProperties() |
725 | { | 723 | { |
@@ -923,12 +921,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
923 | { | 921 | { |
924 | get | 922 | get |
925 | { | 923 | { |
926 | if ((m_knownHas & m_knownChangedForwardVelocity) == 0) | 924 | return VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation)); |
927 | { | ||
928 | m_knownForwardVelocity = VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation)); | ||
929 | m_knownHas |= m_knownChangedForwardVelocity; | ||
930 | } | ||
931 | return m_knownForwardVelocity; | ||
932 | } | 925 | } |
933 | } | 926 | } |
934 | private float VehicleForwardSpeed | 927 | private float VehicleForwardSpeed |
@@ -981,6 +974,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
981 | { | 974 | { |
982 | ComputeLinearVelocity(pTimestep); | 975 | ComputeLinearVelocity(pTimestep); |
983 | 976 | ||
977 | ComputeLinearDeflection(pTimestep); | ||
978 | |||
984 | ComputeLinearTerrainHeightCorrection(pTimestep); | 979 | ComputeLinearTerrainHeightCorrection(pTimestep); |
985 | 980 | ||
986 | ComputeLinearHover(pTimestep); | 981 | ComputeLinearHover(pTimestep); |
@@ -1026,12 +1021,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1026 | { | 1021 | { |
1027 | // Step the motor from the current value. Get the correction needed this step. | 1022 | // Step the motor from the current value. Get the correction needed this step. |
1028 | Vector3 origVelW = VehicleVelocity; // DEBUG | 1023 | Vector3 origVelW = VehicleVelocity; // DEBUG |
1029 | Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); | 1024 | Vector3 currentVelV = VehicleForwardVelocity; |
1030 | Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV); | 1025 | Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV); |
1031 | 1026 | ||
1032 | // Friction reduces vehicle motion | 1027 | // Friction reduces vehicle motion based on absolute speed. Slow vehicle down by friction. |
1033 | Vector3 frictionFactorW = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep); | 1028 | Vector3 frictionFactorV = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep); |
1034 | linearMotorCorrectionV -= (currentVelV * frictionFactorW); | 1029 | linearMotorCorrectionV -= (currentVelV * frictionFactorV); |
1035 | 1030 | ||
1036 | // Motor is vehicle coordinates. Rotate it to world coordinates | 1031 | // Motor is vehicle coordinates. Rotate it to world coordinates |
1037 | Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; | 1032 | Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; |
@@ -1046,11 +1041,38 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1046 | // Add this correction to the velocity to make it faster/slower. | 1041 | // Add this correction to the velocity to make it faster/slower. |
1047 | VehicleVelocity += linearMotorVelocityW; | 1042 | VehicleVelocity += linearMotorVelocityW; |
1048 | 1043 | ||
1049 | |||
1050 | |||
1051 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}", | 1044 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}", |
1052 | ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, | 1045 | ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, |
1053 | linearMotorVelocityW, VehicleVelocity, frictionFactorW); | 1046 | linearMotorVelocityW, VehicleVelocity, frictionFactorV); |
1047 | } | ||
1048 | |||
1049 | //Given a Deflection Effiency and a Velocity, Returns a Velocity that is Partially Deflected onto the X Axis | ||
1050 | //Clamped so that a DeflectionTimescale of less then 1 does not increase force over original velocity | ||
1051 | private void ComputeLinearDeflection(float pTimestep) | ||
1052 | { | ||
1053 | Vector3 linearDeflectionV = Vector3.Zero; | ||
1054 | Vector3 velocityV = VehicleForwardVelocity; | ||
1055 | |||
1056 | // Velocity in Y and Z dimensions is movement to the side or turning. | ||
1057 | // Compute deflection factor from the to the side and rotational velocity | ||
1058 | linearDeflectionV.Y = SortedClampInRange(0, (velocityV.Y * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Y); | ||
1059 | linearDeflectionV.Z = SortedClampInRange(0, (velocityV.Z * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Z); | ||
1060 | |||
1061 | // Velocity to the side and around is corrected and moved into the forward direction | ||
1062 | linearDeflectionV.X += Math.Abs(linearDeflectionV.Y); | ||
1063 | linearDeflectionV.X += Math.Abs(linearDeflectionV.Z); | ||
1064 | |||
1065 | // Scale the deflection to the fractional simulation time | ||
1066 | linearDeflectionV *= pTimestep; | ||
1067 | |||
1068 | // Subtract the sideways and rotational velocity deflection factors while adding the correction forward | ||
1069 | linearDeflectionV *= new Vector3(1,-1,-1); | ||
1070 | |||
1071 | // Correciont is vehicle relative. Convert to world coordinates and add to the velocity | ||
1072 | VehicleVelocity += linearDeflectionV * VehicleOrientation; | ||
1073 | |||
1074 | VDetailLog("{0}, MoveLinear,LinearDeflection,linDefEff={1},linDefTS={2},linDeflectionV={3}", | ||
1075 | ControllingPrim.LocalID, m_linearDeflectionEfficiency, m_linearDeflectionTimescale, linearDeflectionV); | ||
1054 | } | 1076 | } |
1055 | 1077 | ||
1056 | public void ComputeLinearTerrainHeightCorrection(float pTimestep) | 1078 | public void ComputeLinearTerrainHeightCorrection(float pTimestep) |
@@ -1652,6 +1674,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1652 | return frictionFactor; | 1674 | return frictionFactor; |
1653 | } | 1675 | } |
1654 | 1676 | ||
1677 | private float SortedClampInRange(float clampa, float val, float clampb) | ||
1678 | { | ||
1679 | if (clampa > clampb) | ||
1680 | { | ||
1681 | float temp = clampa; | ||
1682 | clampa = clampb; | ||
1683 | clampb = temp; | ||
1684 | } | ||
1685 | return ClampInRange(clampa, val, clampb); | ||
1686 | |||
1687 | } | ||
1688 | |||
1655 | private float ClampInRange(float low, float val, float high) | 1689 | private float ClampInRange(float low, float val, float high) |
1656 | { | 1690 | { |
1657 | return Math.Max(low, Math.Min(val, high)); | 1691 | return Math.Max(low, Math.Min(val, high)); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index aad1108..6437b04 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -134,6 +134,7 @@ public static class BSParam | |||
134 | public static float AvatarHeightMidFudge { get; private set; } | 134 | public static float AvatarHeightMidFudge { get; private set; } |
135 | public static float AvatarHeightHighFudge { get; private set; } | 135 | public static float AvatarHeightHighFudge { get; private set; } |
136 | public static float AvatarContactProcessingThreshold { get; private set; } | 136 | public static float AvatarContactProcessingThreshold { get; private set; } |
137 | public static int AvatarJumpFrames { get; private set; } | ||
137 | public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } | 138 | public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } |
138 | public static float AvatarStepHeight { get; private set; } | 139 | public static float AvatarStepHeight { get; private set; } |
139 | public static float AvatarStepApproachFactor { get; private set; } | 140 | public static float AvatarStepApproachFactor { get; private set; } |
@@ -567,6 +568,8 @@ public static class BSParam | |||
567 | 0.1f ), | 568 | 0.1f ), |
568 | new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", | 569 | new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", |
569 | 1.0f ), | 570 | 1.0f ), |
571 | new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.", | ||
572 | 4 ), | ||
570 | new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", | 573 | new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", |
571 | 0.6f ) , | 574 | 0.6f ) , |
572 | new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", | 575 | new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", |