Merge branch 'master' into careminster

Conflicts:
	OpenSim/Framework/Monitoring/BaseStatsCollector.cs
	OpenSim/Region/Application/OpenSim.cs
	OpenSim/Region/Application/OpenSimBase.cs
	OpenSim/Region/Framework/Scenes/SceneManager.cs
	bin/OpenMetaverse.Rendering.Meshmerizer.dll
	bin/OpenMetaverse.StructuredData.dll
	bin/OpenMetaverse.dll
	bin/OpenMetaverseTypes.dll
	prebuild.xml
avinationmerge
Melanie 2012-07-28 00:39:36 +01:00
commit 771d79e83e
70 changed files with 1735 additions and 653 deletions

2
.gitignore vendored
View File

@ -44,6 +44,8 @@ bin/Physics*
bin/Terrain* bin/Terrain*
bin/Regions/* bin/Regions/*
bin/UserAssets bin/UserAssets
bin/assetcache
bin/maptiles
bin/estate_settings.xml bin/estate_settings.xml
bin/config-include/CenomeCache.ini bin/config-include/CenomeCache.ini
bin/config-include/FlotsamCache.ini bin/config-include/FlotsamCache.ini

View File

@ -71,6 +71,14 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
bool LoginsEnabled { get; set; } bool LoginsEnabled { get; set; }
/// <summary>
/// Is this region ready for use?
/// </summary>
/// <remarks>
/// This does not mean that logins are enabled, merely that they can be.
/// </remarks>
bool Ready { get; set; }
float TimeDilation { get; } float TimeDilation { get; }
bool AllowScriptCrossings { get; } bool AllowScriptCrossings { get; }

View File

@ -28,7 +28,7 @@
using System; using System;
using System.Timers; using System.Timers;
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Monitoring
{ {
/// <summary> /// <summary>
/// Asset service statistics collection /// Asset service statistics collection

View File

@ -31,8 +31,7 @@ using System.Text;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
namespace OpenSim.Framework.Monitoring
namespace OpenSim.Framework.Statistics
{ {
/// <summary> /// <summary>
/// Statistics which all collectors are interested in reporting /// Statistics which all collectors are interested in reporting

View File

@ -25,7 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
namespace OpenSim.Framework.Statistics.Interfaces namespace OpenSim.Framework.Monitoring.Interfaces
{ {
/// <summary> /// <summary>
/// Implemented by objects which allow statistical information to be pulled from them. /// Implemented by objects which allow statistical information to be pulled from them.

View File

@ -25,7 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Monitoring
{ {
/// <summary> /// <summary>
/// Implemented by classes which collect up non-viewer statistical information /// Implemented by classes which collect up non-viewer statistical information

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using log4net;
namespace OpenSim.Framework.Monitoring
{
/// <summary>
/// Experimental watchdog for memory usage.
/// </summary>
public static class MemoryWatchdog
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Is this watchdog active?
/// </summary>
public static bool Enabled
{
get { return m_enabled; }
set
{
// m_log.DebugFormat("[MEMORY WATCHDOG]: Setting MemoryWatchdog.Enabled to {0}", value);
if (value && !m_enabled)
UpdateLastRecord(GC.GetTotalMemory(false), Util.EnvironmentTickCount());
m_enabled = value;
}
}
private static bool m_enabled;
/// <summary>
/// Average memory churn in bytes per millisecond.
/// </summary>
public static double AverageMemoryChurn
{
get { if (m_samples.Count > 0) return m_samples.Average(); else return 0; }
}
/// <summary>
/// Maximum number of statistical samples.
/// </summary>
/// <remarks>
/// At the moment this corresponds to 1 minute since the sampling rate is every 2.5 seconds as triggered from
/// the main Watchdog.
/// </remarks>
private static int m_maxSamples = 24;
/// <summary>
/// Time when the watchdog was last updated.
/// </summary>
private static int m_lastUpdateTick;
/// <summary>
/// Memory used at time of last watchdog update.
/// </summary>
private static long m_lastUpdateMemory;
/// <summary>
/// Memory churn rate per millisecond.
/// </summary>
// private static double m_churnRatePerMillisecond;
/// <summary>
/// Historical samples for calculating moving average.
/// </summary>
private static Queue<double> m_samples = new Queue<double>(m_maxSamples);
public static void Update()
{
int now = Util.EnvironmentTickCount();
long memoryNow = GC.GetTotalMemory(false);
long memoryDiff = memoryNow - m_lastUpdateMemory;
if (memoryDiff >= 0)
{
if (m_samples.Count >= m_maxSamples)
m_samples.Dequeue();
double elapsed = Util.EnvironmentTickCountSubtract(now, m_lastUpdateTick);
// This should never happen since it's not useful for updates to occur with no time elapsed, but
// protect ourselves from a divide-by-zero just in case.
if (elapsed == 0)
return;
m_samples.Enqueue(memoryDiff / (double)elapsed);
}
UpdateLastRecord(memoryNow, now);
}
private static void UpdateLastRecord(long memoryNow, int timeNow)
{
m_lastUpdateMemory = memoryNow;
m_lastUpdateTick = timeNow;
}
}
}

View File

@ -28,12 +28,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework.Statistics.Interfaces;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework.Monitoring.Interfaces;
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Monitoring
{ {
/// <summary> /// <summary>
/// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane

View File

@ -25,7 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Monitoring
{ {
/// <summary> /// <summary>
/// Singleton used to provide access to statistics reporters /// Singleton used to provide access to statistics reporters

View File

@ -27,7 +27,7 @@
using System.Timers; using System.Timers;
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Monitoring
{ {
/// <summary> /// <summary>
/// Collects user service statistics /// Collects user service statistics

View File

@ -31,7 +31,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using log4net; using log4net;
namespace OpenSim.Framework namespace OpenSim.Framework.Monitoring
{ {
/// <summary> /// <summary>
/// Manages launching threads and keeping watch over them for timeouts /// Manages launching threads and keeping watch over them for timeouts
@ -325,6 +325,9 @@ namespace OpenSim.Framework
callback(callbackInfo); callback(callbackInfo);
} }
if (MemoryWatchdog.Enabled)
MemoryWatchdog.Update();
m_watchdogTimer.Start(); m_watchdogTimer.Start();
} }
} }

View File

@ -482,9 +482,16 @@ namespace OpenSim.Framework
MainConsole.Instance.Output("=====================================\n"); MainConsole.Instance.Output("=====================================\n");
if (name == String.Empty) if (name == String.Empty)
{
while (name.Trim() == string.Empty)
{
name = MainConsole.Instance.CmdPrompt("New region name", name); name = MainConsole.Instance.CmdPrompt("New region name", name);
if (name == String.Empty) if (name.Trim() == string.Empty)
throw new Exception("Cannot interactively create region with no name"); {
MainConsole.Instance.Output("Cannot interactively create region with no name");
}
}
}
source.AddConfig(name); source.AddConfig(name);
@ -515,15 +522,20 @@ namespace OpenSim.Framework
// //
allKeys.Remove("RegionUUID"); allKeys.Remove("RegionUUID");
string regionUUID = config.GetString("RegionUUID", string.Empty); string regionUUID = config.GetString("RegionUUID", string.Empty);
if (regionUUID == String.Empty) if (!UUID.TryParse(regionUUID.Trim(), out RegionID))
{ {
UUID newID = UUID.Random(); UUID newID = UUID.Random();
while (RegionID == UUID.Zero)
{
regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString()); regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString());
if (!UUID.TryParse(regionUUID.Trim(), out RegionID))
{
MainConsole.Instance.Output("RegionUUID must be a valid UUID");
}
}
config.Set("RegionUUID", regionUUID); config.Set("RegionUUID", regionUUID);
} }
RegionID = new UUID(regionUUID);
originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?) originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?)
// Location // Location

View File

@ -40,9 +40,9 @@ using log4net.Core;
using log4net.Repository; using log4net.Repository;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Monitoring;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.Statistics;
using Timer=System.Timers.Timer; using Timer=System.Timers.Timer;
using OpenMetaverse; using OpenMetaverse;

View File

@ -45,6 +45,7 @@ using OpenMetaverse.StructuredData;
using CoolHTTPListener = HttpServer.HttpListener; using CoolHTTPListener = HttpServer.HttpListener;
using HttpListener=System.Net.HttpListener; using HttpListener=System.Net.HttpListener;
using LogPrio=HttpServer.LogPrio; using LogPrio=HttpServer.LogPrio;
using OpenSim.Framework.Monitoring;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
{ {

View File

@ -32,6 +32,7 @@ using System.Reflection;
using log4net; using log4net;
using HttpServer; using HttpServer;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
/* /*

View File

@ -36,6 +36,7 @@ using HttpServer;
using OpenMetaverse; using OpenMetaverse;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using OpenSim.Framework.Monitoring;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
{ {

View File

@ -40,7 +40,7 @@ using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -200,9 +200,9 @@ namespace OpenSim
PrintFileToConsole("startuplogo.txt"); PrintFileToConsole("startuplogo.txt");
// For now, start at the 'root' level by default // For now, start at the 'root' level by default
if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it if (SceneManager.Scenes.Count == 1) // If there is only one region, select it
ChangeSelectedRegion("region", ChangeSelectedRegion("region",
new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName}); new string[] {"change", "region", SceneManager.Scenes[0].RegionInfo.RegionName});
else else
ChangeSelectedRegion("region", new string[] {"change", "region", "root"}); ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
@ -461,7 +461,7 @@ namespace OpenSim
if (cmdparams.Length > 4) if (cmdparams.Length > 4)
alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4)); alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
IList agents = m_sceneManager.GetCurrentSceneAvatars(); IList agents = SceneManager.GetCurrentSceneAvatars();
foreach (ScenePresence presence in agents) foreach (ScenePresence presence in agents)
{ {
@ -542,7 +542,7 @@ namespace OpenSim
private void HandleForceUpdate(string module, string[] args) private void HandleForceUpdate(string module, string[] args)
{ {
MainConsole.Instance.Output("Updating all clients"); MainConsole.Instance.Output("Updating all clients");
m_sceneManager.ForceCurrentSceneClientUpdate(); SceneManager.ForceCurrentSceneClientUpdate();
} }
/// <summary> /// <summary>
@ -554,7 +554,7 @@ namespace OpenSim
{ {
if (args.Length == 6) if (args.Length == 6)
{ {
m_sceneManager.HandleEditCommandOnCurrentScene(args); SceneManager.HandleEditCommandOnCurrentScene(args);
} }
else else
{ {
@ -765,7 +765,7 @@ namespace OpenSim
case "load": case "load":
if (cmdparams.Length > 1) if (cmdparams.Length > 1)
{ {
foreach (Scene s in new ArrayList(m_sceneManager.Scenes)) foreach (Scene s in new ArrayList(SceneManager.Scenes))
{ {
MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1])); MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1]));
m_moduleLoader.LoadRegionModules(cmdparams[1], s); m_moduleLoader.LoadRegionModules(cmdparams[1], s);
@ -803,14 +803,14 @@ namespace OpenSim
case "backup": case "backup":
MainConsole.Instance.Output("Triggering save of pending object updates to persistent store"); MainConsole.Instance.Output("Triggering save of pending object updates to persistent store");
m_sceneManager.BackupCurrentScene(); SceneManager.BackupCurrentScene();
break; break;
case "remove-region": case "remove-region":
string regRemoveName = CombineParams(cmdparams, 0); string regRemoveName = CombineParams(cmdparams, 0);
Scene removeScene; Scene removeScene;
if (m_sceneManager.TryGetScene(regRemoveName, out removeScene)) if (SceneManager.TryGetScene(regRemoveName, out removeScene))
RemoveRegion(removeScene, false); RemoveRegion(removeScene, false);
else else
MainConsole.Instance.Output("No region with that name"); MainConsole.Instance.Output("No region with that name");
@ -820,14 +820,14 @@ namespace OpenSim
string regDeleteName = CombineParams(cmdparams, 0); string regDeleteName = CombineParams(cmdparams, 0);
Scene killScene; Scene killScene;
if (m_sceneManager.TryGetScene(regDeleteName, out killScene)) if (SceneManager.TryGetScene(regDeleteName, out killScene))
RemoveRegion(killScene, true); RemoveRegion(killScene, true);
else else
MainConsole.Instance.Output("no region with that name"); MainConsole.Instance.Output("no region with that name");
break; break;
case "restart": case "restart":
m_sceneManager.RestartCurrentScene(); SceneManager.RestartCurrentScene();
break; break;
} }
} }
@ -842,7 +842,7 @@ namespace OpenSim
{ {
string newRegionName = CombineParams(cmdparams, 2); string newRegionName = CombineParams(cmdparams, 2);
if (!m_sceneManager.TrySetCurrentScene(newRegionName)) if (!SceneManager.TrySetCurrentScene(newRegionName))
MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName)); MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName));
} }
else else
@ -850,7 +850,7 @@ namespace OpenSim
MainConsole.Instance.Output("Usage: change region <region name>"); MainConsole.Instance.Output("Usage: change region <region name>");
} }
string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName); string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName);
MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName)); MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName));
// m_log.DebugFormat("Original prompt is {0}", m_consolePrompt); // m_log.DebugFormat("Original prompt is {0}", m_consolePrompt);
@ -868,7 +868,7 @@ namespace OpenSim
}); });
m_console.DefaultPrompt = prompt; m_console.DefaultPrompt = prompt;
m_console.ConsoleScene = m_sceneManager.CurrentScene; m_console.ConsoleScene = SceneManager.CurrentScene;
} }
/// <summary> /// <summary>
@ -892,7 +892,7 @@ namespace OpenSim
int newDebug; int newDebug;
if (int.TryParse(args[2], out newDebug)) if (int.TryParse(args[2], out newDebug))
{ {
m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name); SceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name);
// We provide user information elsewhere if any clients had their debug level set. // We provide user information elsewhere if any clients had their debug level set.
// MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug); // MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug);
} }
@ -907,7 +907,7 @@ namespace OpenSim
case "scene": case "scene":
if (args.Length == 4) if (args.Length == 4)
{ {
if (m_sceneManager.CurrentScene == null) if (SceneManager.CurrentScene == null)
{ {
MainConsole.Instance.Output("Please use 'change region <regioname>' first"); MainConsole.Instance.Output("Please use 'change region <regioname>' first");
} }
@ -915,7 +915,7 @@ namespace OpenSim
{ {
string key = args[2]; string key = args[2];
string value = args[3]; string value = args[3];
m_sceneManager.CurrentScene.SetSceneCoreDebug( SceneManager.CurrentScene.SetSceneCoreDebug(
new Dictionary<string, string>() { { key, value } }); new Dictionary<string, string>() { { key, value } });
MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value); MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value);
@ -954,10 +954,10 @@ namespace OpenSim
IList agents; IList agents;
if (showParams.Length > 1 && showParams[1] == "full") if (showParams.Length > 1 && showParams[1] == "full")
{ {
agents = m_sceneManager.GetCurrentScenePresences(); agents = SceneManager.GetCurrentScenePresences();
} else } else
{ {
agents = m_sceneManager.GetCurrentSceneAvatars(); agents = SceneManager.GetCurrentSceneAvatars();
} }
MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count));
@ -1037,7 +1037,7 @@ namespace OpenSim
MainConsole.Instance.Output("Shared Module: " + module.Name); MainConsole.Instance.Output("Shared Module: " + module.Name);
} }
m_sceneManager.ForEachScene( SceneManager.ForEachScene(
delegate(Scene scene) { delegate(Scene scene) {
m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:");
foreach (IRegionModule module in scene.Modules.Values) foreach (IRegionModule module in scene.Modules.Values)
@ -1050,7 +1050,7 @@ namespace OpenSim
} }
); );
m_sceneManager.ForEachScene( SceneManager.ForEachScene(
delegate(Scene scene) { delegate(Scene scene) {
MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:"); MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:");
foreach (IRegionModuleBase module in scene.RegionModules.Values) foreach (IRegionModuleBase module in scene.RegionModules.Values)
@ -1066,7 +1066,7 @@ namespace OpenSim
break; break;
case "regions": case "regions":
m_sceneManager.ForEachScene( SceneManager.ForEachScene(
delegate(Scene scene) delegate(Scene scene)
{ {
MainConsole.Instance.Output(String.Format( MainConsole.Instance.Output(String.Format(
@ -1080,7 +1080,7 @@ namespace OpenSim
break; break;
case "ratings": case "ratings":
m_sceneManager.ForEachScene( SceneManager.ForEachScene(
delegate(Scene scene) delegate(Scene scene)
{ {
string rating = ""; string rating = "";
@ -1115,7 +1115,7 @@ namespace OpenSim
cdt.AddColumn("IP", 16); cdt.AddColumn("IP", 16);
cdt.AddColumn("Viewer Name", 24); cdt.AddColumn("Viewer Name", 24);
m_sceneManager.ForEachScene( SceneManager.ForEachScene(
s => s =>
{ {
foreach (AgentCircuitData aCircuit in s.AuthenticateHandler.GetAgentCircuits().Values) foreach (AgentCircuitData aCircuit in s.AuthenticateHandler.GetAgentCircuits().Values)
@ -1140,7 +1140,7 @@ namespace OpenSim
cdt.AddColumn("Endpoint", 23); cdt.AddColumn("Endpoint", 23);
cdt.AddColumn("Active?", 7); cdt.AddColumn("Active?", 7);
m_sceneManager.ForEachScene( SceneManager.ForEachScene(
s => s.ForEachClient( s => s.ForEachClient(
c => cdt.AddRow( c => cdt.AddRow(
s.Name, s.Name,
@ -1161,11 +1161,11 @@ namespace OpenSim
{ {
if (cmdparams.Length > 5) if (cmdparams.Length > 5)
{ {
m_sceneManager.SaveNamedPrimsToXml2(cmdparams[3], cmdparams[4]); SceneManager.SaveNamedPrimsToXml2(cmdparams[3], cmdparams[4]);
} }
else else
{ {
m_sceneManager.SaveNamedPrimsToXml2("Primitive", DEFAULT_PRIM_BACKUP_FILENAME); SceneManager.SaveNamedPrimsToXml2("Primitive", DEFAULT_PRIM_BACKUP_FILENAME);
} }
} }
@ -1180,11 +1180,11 @@ namespace OpenSim
if (cmdparams.Length > 0) if (cmdparams.Length > 0)
{ {
m_sceneManager.SaveCurrentSceneToXml(cmdparams[2]); SceneManager.SaveCurrentSceneToXml(cmdparams[2]);
} }
else else
{ {
m_sceneManager.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME); SceneManager.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME);
} }
} }
@ -1221,13 +1221,13 @@ namespace OpenSim
MainConsole.Instance.Output(String.Format("loadOffsets <X,Y,Z> = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z)); MainConsole.Instance.Output(String.Format("loadOffsets <X,Y,Z> = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z));
} }
} }
m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset); SceneManager.LoadCurrentSceneFromXml(cmdparams[2], generateNewIDS, loadOffset);
} }
else else
{ {
try try
{ {
m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset); SceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset);
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
@ -1244,11 +1244,11 @@ namespace OpenSim
{ {
if (cmdparams.Length > 2) if (cmdparams.Length > 2)
{ {
m_sceneManager.SaveCurrentSceneToXml2(cmdparams[2]); SceneManager.SaveCurrentSceneToXml2(cmdparams[2]);
} }
else else
{ {
m_sceneManager.SaveCurrentSceneToXml2(DEFAULT_PRIM_BACKUP_FILENAME); SceneManager.SaveCurrentSceneToXml2(DEFAULT_PRIM_BACKUP_FILENAME);
} }
} }
@ -1263,7 +1263,7 @@ namespace OpenSim
{ {
try try
{ {
m_sceneManager.LoadCurrentSceneFromXml2(cmdparams[2]); SceneManager.LoadCurrentSceneFromXml2(cmdparams[2]);
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
@ -1274,7 +1274,7 @@ namespace OpenSim
{ {
try try
{ {
m_sceneManager.LoadCurrentSceneFromXml2(DEFAULT_PRIM_BACKUP_FILENAME); SceneManager.LoadCurrentSceneFromXml2(DEFAULT_PRIM_BACKUP_FILENAME);
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
@ -1291,7 +1291,7 @@ namespace OpenSim
{ {
try try
{ {
m_sceneManager.LoadArchiveToCurrentScene(cmdparams); SceneManager.LoadArchiveToCurrentScene(cmdparams);
} }
catch (Exception e) catch (Exception e)
{ {
@ -1305,7 +1305,7 @@ namespace OpenSim
/// <param name="cmdparams"></param> /// <param name="cmdparams"></param>
protected void SaveOar(string module, string[] cmdparams) protected void SaveOar(string module, string[] cmdparams)
{ {
m_sceneManager.SaveCurrentSceneToArchive(cmdparams); SceneManager.SaveCurrentSceneToArchive(cmdparams);
} }
private static string CombineParams(string[] commandParams, int pos) private static string CombineParams(string[] commandParams, int pos)

View File

@ -40,7 +40,7 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.ClientStack; using OpenSim.Region.ClientStack;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
@ -300,7 +300,7 @@ namespace OpenSim
private void HandleCommanderCommand(string module, string[] cmd) private void HandleCommanderCommand(string module, string[] cmd)
{ {
m_sceneManager.SendCommandToPluginModules(cmd); SceneManager.SendCommandToPluginModules(cmd);
} }
private void HandleCommanderHelp(string module, string[] cmd) private void HandleCommanderHelp(string module, string[] cmd)
@ -318,7 +318,10 @@ namespace OpenSim
// Called from base.StartUp() // Called from base.StartUp()
m_httpServerPort = m_networkServersInfo.HttpListenerPort; m_httpServerPort = m_networkServersInfo.HttpListenerPort;
m_sceneManager.OnRestartSim += handleRestartRegion; SceneManager.OnRestartSim += handleRestartRegion;
// Only start the memory watchdog once all regions are ready
SceneManager.OnRegionsReadyStatusChange += sm => MemoryWatchdog.Enabled = sm.AllRegionsReady;
} }
/// <summary> /// <summary>
@ -480,7 +483,7 @@ namespace OpenSim
scene.SnmpService.BootInfo("ScriptEngine started", scene); scene.SnmpService.BootInfo("ScriptEngine started", scene);
} }
m_sceneManager.Add(scene); SceneManager.Add(scene);
if (m_autoCreateClientStack) if (m_autoCreateClientStack)
{ {
@ -510,7 +513,6 @@ namespace OpenSim
} }
scene.Start(); scene.Start();
scene.StartScripts(); scene.StartScripts();
return clientServer; return clientServer;
@ -644,14 +646,14 @@ namespace OpenSim
{ {
// only need to check this if we are not at the // only need to check this if we are not at the
// root level // root level
if ((m_sceneManager.CurrentScene != null) && if ((SceneManager.CurrentScene != null) &&
(m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID)) (SceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID))
{ {
m_sceneManager.TrySetCurrentScene(".."); SceneManager.TrySetCurrentScene("..");
} }
scene.DeleteAllSceneObjects(); scene.DeleteAllSceneObjects();
m_sceneManager.CloseScene(scene); SceneManager.CloseScene(scene);
ShutdownClientServer(scene.RegionInfo); ShutdownClientServer(scene.RegionInfo);
if (!cleanup) if (!cleanup)
@ -693,7 +695,7 @@ namespace OpenSim
public void RemoveRegion(string name, bool cleanUp) public void RemoveRegion(string name, bool cleanUp)
{ {
Scene target; Scene target;
if (m_sceneManager.TryGetScene(name, out target)) if (SceneManager.TryGetScene(name, out target))
RemoveRegion(target, cleanUp); RemoveRegion(target, cleanUp);
} }
@ -706,13 +708,13 @@ namespace OpenSim
{ {
// only need to check this if we are not at the // only need to check this if we are not at the
// root level // root level
if ((m_sceneManager.CurrentScene != null) && if ((SceneManager.CurrentScene != null) &&
(m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID)) (SceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID))
{ {
m_sceneManager.TrySetCurrentScene(".."); SceneManager.TrySetCurrentScene("..");
} }
m_sceneManager.CloseScene(scene); SceneManager.CloseScene(scene);
ShutdownClientServer(scene.RegionInfo); ShutdownClientServer(scene.RegionInfo);
} }
@ -724,7 +726,7 @@ namespace OpenSim
public void CloseRegion(string name) public void CloseRegion(string name)
{ {
Scene target; Scene target;
if (m_sceneManager.TryGetScene(name, out target)) if (SceneManager.TryGetScene(name, out target))
CloseRegion(target); CloseRegion(target);
} }
@ -980,7 +982,7 @@ namespace OpenSim
try try
{ {
m_sceneManager.Close(); SceneManager.Close();
} }
catch (Exception e) catch (Exception e)
{ {
@ -1005,7 +1007,7 @@ namespace OpenSim
/// <param name="usernum">The first out parameter describing the number of all the avatars in the Region server</param> /// <param name="usernum">The first out parameter describing the number of all the avatars in the Region server</param>
public void GetAvatarNumber(out int usernum) public void GetAvatarNumber(out int usernum)
{ {
usernum = m_sceneManager.GetCurrentSceneAvatars().Count; usernum = SceneManager.GetCurrentSceneAvatars().Count;
} }
/// <summary> /// <summary>
@ -1014,7 +1016,7 @@ namespace OpenSim
/// <param name="regionnum">The first out parameter describing the number of regions</param> /// <param name="regionnum">The first out parameter describing the number of regions</param>
public void GetRegionNumber(out int regionnum) public void GetRegionNumber(out int regionnum)
{ {
regionnum = m_sceneManager.Scenes.Count; regionnum = SceneManager.Scenes.Count;
} }
/// <summary> /// <summary>

View File

@ -41,7 +41,7 @@ using OpenMetaverse.Messages.Linden;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Client; using OpenSim.Framework.Client;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;

View File

@ -37,7 +37,7 @@ using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenMetaverse; using OpenMetaverse;

View File

@ -53,9 +53,8 @@ namespace OpenSim.Region.ClientStack
protected ISimulationDataService m_simulationDataService; protected ISimulationDataService m_simulationDataService;
protected IEstateDataService m_estateDataService; protected IEstateDataService m_estateDataService;
protected ClientStackManager m_clientStackManager; protected ClientStackManager m_clientStackManager;
protected SceneManager m_sceneManager = new SceneManager();
public SceneManager SceneManager { get { return m_sceneManager; } } public SceneManager SceneManager { get; protected set; }
public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } }
public IEstateDataService EstateDataService { get { return m_estateDataService; } } public IEstateDataService EstateDataService { get { return m_estateDataService; } }
@ -77,6 +76,7 @@ namespace OpenSim.Region.ClientStack
protected override void StartupSpecific() protected override void StartupSpecific()
{ {
SceneManager = new SceneManager();
m_clientStackManager = CreateClientStackManager(); m_clientStackManager = CreateClientStackManager();
Initialize(); Initialize();

View File

@ -37,7 +37,7 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -204,8 +204,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
m_Scene.AssetService.Store(asset); m_Scene.AssetService.Store(asset);
m_Scene.CreateNewInventoryItem(
m_Scene.CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
} }
else else
{ {

View File

@ -40,6 +40,7 @@ using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Capabilities; using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Monitoring;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -31,7 +31,7 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Services.Connectors; using OpenSim.Services.Connectors;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -131,11 +131,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
m_enabled = true; m_enabled = true;
} }
///<summary>
///
///</summary>
///<summary> ///<summary>
/// ///
///</summary> ///</summary>
@ -149,7 +144,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
lock (m_scenes) lock (m_scenes)
m_scenes[scene.RegionInfo.RegionID] = scene; m_scenes[scene.RegionInfo.RegionID] = scene;
scene.EventManager.OnRegionReady += s => UploadMapTile(s); scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); };
} }
///<summary> ///<summary>

View File

@ -37,7 +37,7 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -37,7 +37,7 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -42,6 +42,7 @@ using OpenMetaverse.Imaging;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Capabilities; using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Monitoring;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;

View File

@ -40,8 +40,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// </remarks> /// </remarks>
public interface IScenePresence : ISceneAgent public interface IScenePresence : ISceneAgent
{ {
PresenceType PresenceType { get; }
/// <summary> /// <summary>
/// Copy of the script states while the agent is in transit. This state may /// Copy of the script states while the agent is in transit. This state may
/// need to be placed back in case of transfer fail. /// need to be placed back in case of transfer fail.

View File

@ -517,8 +517,7 @@ namespace OpenSim.Region.Framework.Scenes
/// A region is considered ready when startup operations such as loading of scripts already on the region /// A region is considered ready when startup operations such as loading of scripts already on the region
/// have been completed. /// have been completed.
/// </remarks> /// </remarks>
public event RegionReady OnRegionReady; public event Action<IScene> OnRegionReadyStatusChange;
public delegate void RegionReady(IScene scene);
public delegate void PrimsLoaded(Scene s); public delegate void PrimsLoaded(Scene s);
public event PrimsLoaded OnPrimsLoaded; public event PrimsLoaded OnPrimsLoaded;
@ -2533,13 +2532,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void TriggerRegionReady(IScene scene) public void TriggerRegionReadyStatusChange(IScene scene)
{ {
RegionReady handler = OnRegionReady; Action<IScene> handler = OnRegionReadyStatusChange;
if (handler != null) if (handler != null)
{ {
foreach (RegionReady d in handler.GetInvocationList()) foreach (Action<IScene> d in handler.GetInvocationList())
{ {
try try
{ {
@ -2547,7 +2546,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}", m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}",
e.Message, e.StackTrace); e.Message, e.StackTrace);
} }
} }

View File

@ -39,7 +39,7 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -811,16 +811,20 @@ namespace OpenSim.Region.Framework.Scenes
&& oldAgentID == LibraryService.LibraryRootFolder.Owner)) && oldAgentID == LibraryService.LibraryRootFolder.Owner))
{ {
CreateNewInventoryItem( CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, remoteClient, item.CreatorId, item.CreatorData, newFolderID,
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType,
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
} }
else else
{ {
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) && (m_permissions.BypassPermissions() || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
&& (m_permissions.BypassPermissions()
|| m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
{ {
CreateNewInventoryItem( CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
asset, (sbyte) item.InvType, asset, (sbyte) item.InvType,
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
@ -885,32 +889,50 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Create a new inventory item. /// Create a new inventory item.
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient">Client creating this inventory item.</param>
/// <param name="folderID"></param> /// <param name="creatorID"></param>
/// <param name="callbackID"></param> /// <param name="creatorData"></param>
/// <param name="asset"></param> /// <param name="folderID">UUID of folder in which this item should be placed.</param>
/// <param name="invType"></param> /// <param name="name">Item name.</para>
/// <param name="nextOwnerMask"></param> /// <param name="description">Item description.</param>
public void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, /// <param name="flags">Item flags</param>
/// <param name="callbackID">Generated by the client.</para>
/// <param name="asset">Asset to which this item refers.</param>
/// <param name="invType">Type of inventory item.</param>
/// <param name="nextOwnerMask">Next owner pemrissions mask.</param>
/// <param name="creationDate">Unix timestamp at which this item was created.</param>
public void CreateNewInventoryItem(
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
string name, string description, uint flags, uint callbackID,
AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate)
{ {
CreateNewInventoryItem( CreateNewInventoryItem(
remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType, remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate);
} }
/// <summary> /// <summary>
/// Create a new Inventory Item /// Create a new Inventory Item
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient">Client creating this inventory item.</param>
/// <param name="folderID"></param> /// <param name="creatorID"></param>
/// <param name="callbackID"></param> /// <param name="creatorData"></param>
/// <param name="asset"></param> /// <param name="folderID">UUID of folder in which this item should be placed.</param>
/// <param name="invType"></param> /// <param name="name">Item name.</para>
/// <param name="nextOwnerMask"></param> /// <param name="description">Item description.</param>
/// <param name="creationDate"></param> /// <param name="flags">Item flags</param>
/// <param name="callbackID">Generated by the client.</para>
/// <param name="asset">Asset to which this item refers.</param>
/// <param name="invType">Type of inventory item.</param>
/// <param name="baseMask">Base permissions mask.</param>
/// <param name="currentMask">Current permissions mask.</param>
/// <param name="everyoneMask">Everyone permissions mask.</param>
/// <param name="nextOwnerMask">Next owner pemrissions mask.</param>
/// <param name="groupMask">Group permissions mask.</param>
/// <param name="creationDate">Unix timestamp at which this item was created.</param>
private void CreateNewInventoryItem( private void CreateNewInventoryItem(
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
@ -919,8 +941,8 @@ namespace OpenSim.Region.Framework.Scenes
item.CreatorData = creatorData; item.CreatorData = creatorData;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = name; item.Name = name;
item.Description = description;
item.Flags = flags; item.Flags = flags;
item.AssetType = asset.Type; item.AssetType = asset.Type;
item.InvType = invType; item.InvType = invType;
@ -1002,7 +1024,8 @@ namespace OpenSim.Region.Framework.Scenes
asset.Description = description; asset.Description = description;
CreateNewInventoryItem( CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, 0, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
} }

View File

@ -40,6 +40,7 @@ using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenMetaverse.Imaging; using OpenMetaverse.Imaging;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
@ -1232,15 +1233,17 @@ namespace OpenSim.Region.Framework.Scenes
avatar.ControllingClient.SendShutdownConnectionNotice(); avatar.ControllingClient.SendShutdownConnectionNotice();
}); });
// Stop updating the scene objects and agents.
m_shuttingDown = true;
// Wait here, or the kick messages won't actually get to the agents before the scene terminates. // Wait here, or the kick messages won't actually get to the agents before the scene terminates.
// We also need to wait to avoid a race condition with the scene update loop which might not yet
// have checked ShuttingDown.
Thread.Sleep(500); Thread.Sleep(500);
// Stop all client threads. // Stop all client threads.
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
// Stop updating the scene objects and agents.
m_shuttingDown = true;
m_log.Debug("[SCENE]: Persisting changed objects"); m_log.Debug("[SCENE]: Persisting changed objects");
EventManager.TriggerSceneShuttingDown(this); EventManager.TriggerSceneShuttingDown(this);
@ -1255,6 +1258,15 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.Close(); m_sceneGraph.Close();
if (PhysicsScene != null)
{
PhysicsScene phys = PhysicsScene;
// remove the physics engine from both Scene and SceneGraph
PhysicsScene = null;
phys.Dispose();
phys = null;
}
if (!GridService.DeregisterRegion(RegionInfo.RegionID)) if (!GridService.DeregisterRegion(RegionInfo.RegionID))
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
@ -1553,8 +1565,8 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.InformNeighborsThatRegionisUp( m_sceneGridService.InformNeighborsThatRegionisUp(
RequestModuleInterface<INeighbourService>(), RegionInfo); RequestModuleInterface<INeighbourService>(), RegionInfo);
// Region ready should always be triggered whether logins are immediately enabled or not. // Region ready should always be set
EventManager.TriggerRegionReady(this); Ready = true;
} }
else else
{ {

View File

@ -124,6 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
} }
private bool m_loginsEnabled; private bool m_loginsEnabled;
public bool Ready
{
get
{
return m_ready;
}
set
{
if (m_ready != value)
{
m_ready = value;
EventManager.TriggerRegionReadyStatusChange(this);
}
}
}
private bool m_ready;
public float TimeDilation public float TimeDilation
{ {
get { return 1.0f; } get { return 1.0f; }

View File

@ -47,6 +47,48 @@ namespace OpenSim.Region.Framework.Scenes
public event RestartSim OnRestartSim; public event RestartSim OnRestartSim;
/// <summary>
/// Fired when either all regions are ready for use or at least one region has become unready for use where
/// previously all regions were ready.
/// </summary>
public event Action<SceneManager> OnRegionsReadyStatusChange;
/// <summary>
/// Are all regions ready for use?
/// </summary>
public bool AllRegionsReady
{
get
{
return m_allRegionsReady;
}
private set
{
if (m_allRegionsReady != value)
{
m_allRegionsReady = value;
Action<SceneManager> handler = OnRegionsReadyStatusChange;
if (handler != null)
{
foreach (Action<SceneManager> d in handler.GetInvocationList())
{
try
{
d(this);
}
catch (Exception e)
{
m_log.ErrorFormat("[SCENE MANAGER]: Delegate for OnRegionsReadyStatusChange failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}
}
}
}
}
private bool m_allRegionsReady;
private static SceneManager m_instance = null; private static SceneManager m_instance = null;
public static SceneManager Instance public static SceneManager Instance
{ {
@ -128,9 +170,11 @@ namespace OpenSim.Region.Framework.Scenes
public void Add(Scene scene) public void Add(Scene scene)
{ {
scene.OnRestart += HandleRestart; lock (m_localScenes)
m_localScenes.Add(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene); m_localScenes.Add(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene);
scene.OnRestart += HandleRestart;
scene.EventManager.OnRegionReadyStatusChange += HandleRegionReadyStatusChange;
} }
public void HandleRestart(RegionInfo rdata) public void HandleRestart(RegionInfo rdata)
@ -138,12 +182,19 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main");
int RegionSceneElement = -1; int RegionSceneElement = -1;
lock (m_localScenes)
m_localScenes.Remove(rdata.RegionID); m_localScenes.Remove(rdata.RegionID);
// Send signal to main that we're restarting this sim. // Send signal to main that we're restarting this sim.
OnRestartSim(rdata); OnRestartSim(rdata);
} }
private void HandleRegionReadyStatusChange(IScene scene)
{
lock (m_localScenes)
AllRegionsReady = m_localScenes.TrueForAll(s => s.Ready);
}
public void SendSimOnlineNotification(ulong regionHandle) public void SendSimOnlineNotification(ulong regionHandle)
{ {
RegionInfo Result = null; RegionInfo Result = null;
@ -483,6 +534,7 @@ namespace OpenSim.Region.Framework.Scenes
public void CloseScene(Scene scene) public void CloseScene(Scene scene)
{ {
lock (m_localScenes)
m_localScenes.Remove(scene.RegionInfo.RegionID); m_localScenes.Remove(scene.RegionInfo.RegionID);
scene.Close(); scene.Close();

View File

@ -30,7 +30,7 @@ using System.Collections.Generic;
using System.Timers; using System.Timers;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes namespace OpenSim.Region.Framework.Scenes

View File

@ -38,6 +38,7 @@ using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Client; using OpenSim.Framework.Client;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server

View File

@ -34,6 +34,7 @@ using System.Text;
using System.Threading; using System.Threading;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server

View File

@ -35,7 +35,7 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.ClientStack.LindenUDP; using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -36,7 +36,7 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.ClientStack.LindenUDP; using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -36,7 +36,7 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.ClientStack.LindenUDP; using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -37,6 +37,7 @@ using OpenMetaverse;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;

View File

@ -37,7 +37,7 @@ using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
using OpenSim.Region.ClientStack.LindenUDP; using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.CoreModules.Avatar.Friends; using OpenSim.Region.CoreModules.Avatar.Friends;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;

View File

@ -225,7 +225,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
RRAlert("enabled"); RRAlert("enabled");
} }
m_scene.EventManager.TriggerRegionReady(m_scene); m_scene.Ready = true;
} }
public void OarLoadingAlert(string msg) public void OarLoadingAlert(string msg)

View File

@ -0,0 +1,115 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyrightD
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenSim.Region.Physics.BulletSPlugin
{
public class BSConstraint : IDisposable
{
private BulletSim m_world;
private BulletBody m_body1;
private BulletBody m_body2;
private BulletConstraint m_constraint;
private bool m_enabled = false;
public BSConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
Vector3 frame1, Quaternion frame1rot,
Vector3 frame2, Quaternion frame2rot
)
{
m_world = world;
m_body1 = obj1;
m_body2 = obj2;
m_constraint = new BulletConstraint(BulletSimAPI.CreateConstraint2(m_world.Ptr, m_body1.Ptr, m_body2.Ptr,
frame1, frame1rot,
frame2, frame2rot));
m_enabled = true;
}
public void Dispose()
{
if (m_enabled)
{
// BulletSimAPI.RemoveConstraint(m_world.ID, m_body1.ID, m_body2.ID);
BulletSimAPI.DestroyConstraint2(m_world.Ptr, m_constraint.Ptr);
m_enabled = false;
}
}
public BulletBody Body1 { get { return m_body1; } }
public BulletBody Body2 { get { return m_body2; } }
public bool SetLinearLimits(Vector3 low, Vector3 high)
{
bool ret = false;
if (m_enabled)
ret = BulletSimAPI.SetLinearLimits2(m_constraint.Ptr, low, high);
return ret;
}
public bool SetAngularLimits(Vector3 low, Vector3 high)
{
bool ret = false;
if (m_enabled)
ret = BulletSimAPI.SetAngularLimits2(m_constraint.Ptr, low, high);
return ret;
}
public bool UseFrameOffset(bool useOffset)
{
bool ret = false;
float onOff = useOffset ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse;
if (m_enabled)
ret = BulletSimAPI.UseFrameOffset2(m_constraint.Ptr, onOff);
return ret;
}
public bool TranslationalLimitMotor(bool enable, float targetVelocity, float maxMotorForce)
{
bool ret = false;
float onOff = enable ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse;
if (m_enabled)
ret = BulletSimAPI.TranslationalLimitMotor2(m_constraint.Ptr, onOff, targetVelocity, maxMotorForce);
return ret;
}
public bool CalculateTransforms()
{
bool ret = false;
if (m_enabled)
{
BulletSimAPI.CalculateTransforms2(m_constraint.Ptr);
ret = true;
}
return ret;
}
}
}

View File

@ -0,0 +1,178 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyrightD
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using log4net;
using OpenMetaverse;
namespace OpenSim.Region.Physics.BulletSPlugin
{
public class BSConstraintCollection : IDisposable
{
// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly string LogHeader = "[CONSTRAINT COLLECTION]";
delegate bool ConstraintAction(BSConstraint constrain);
private List<BSConstraint> m_constraints;
private BulletSim m_world;
public BSConstraintCollection(BulletSim world)
{
m_world = world;
m_constraints = new List<BSConstraint>();
}
public void Dispose()
{
this.Clear();
}
public void Clear()
{
foreach (BSConstraint cons in m_constraints)
{
cons.Dispose();
}
m_constraints.Clear();
}
public BSConstraint CreateConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
Vector3 frame1, Quaternion frame1rot,
Vector3 frame2, Quaternion frame2rot)
{
BSConstraint constrain = new BSConstraint(world, obj1, obj2, frame1, frame1rot, frame2, frame2rot);
this.AddConstraint(constrain);
return constrain;
}
public bool AddConstraint(BSConstraint cons)
{
// There is only one constraint between any bodies. Remove any old just to make sure.
RemoveAndDestroyConstraint(cons.Body1, cons.Body2);
m_constraints.Add(cons);
return true;
}
// Get the constraint between two bodies. There can be only one the way we're using them.
public bool TryGetConstraint(BulletBody body1, BulletBody body2, out BSConstraint returnConstraint)
{
bool found = false;
BSConstraint foundConstraint = null;
uint lookingID1 = body1.ID;
uint lookingID2 = body2.ID;
ForEachConstraint(delegate(BSConstraint constrain)
{
if ((constrain.Body1.ID == lookingID1 && constrain.Body2.ID == lookingID2)
|| (constrain.Body1.ID == lookingID2 && constrain.Body2.ID == lookingID1))
{
foundConstraint = constrain;
found = true;
}
return found;
});
returnConstraint = foundConstraint;
return found;
}
public bool RemoveAndDestroyConstraint(BulletBody body1, BulletBody body2)
{
// return BulletSimAPI.RemoveConstraint(m_world.ID, obj1.ID, obj2.ID);
bool ret = false;
BSConstraint constrain;
if (this.TryGetConstraint(body1, body2, out constrain))
{
// remove the constraint from our collection
m_constraints.Remove(constrain);
// tell the engine that all its structures need to be freed
constrain.Dispose();
// we destroyed something
ret = true;
}
return ret;
}
public bool RemoveAndDestroyConstraint(BulletBody body1)
{
// return BulletSimAPI.RemoveConstraintByID(m_world.ID, obj.ID);
List<BSConstraint> toRemove = new List<BSConstraint>();
uint lookingID = body1.ID;
ForEachConstraint(delegate(BSConstraint constrain)
{
if (constrain.Body1.ID == lookingID || constrain.Body2.ID == lookingID)
{
toRemove.Add(constrain);
}
return false;
});
lock (m_constraints)
{
foreach (BSConstraint constrain in toRemove)
{
m_constraints.Remove(constrain);
constrain.Dispose();
}
}
return (toRemove.Count > 0);
}
public bool RecalculateAllConstraints()
{
foreach (BSConstraint constrain in m_constraints)
{
constrain.CalculateTransforms();
}
return true;
}
// Lock the constraint list and loop through it.
// The constraint action returns 'true' if it wants the loop aborted.
private void ForEachConstraint(ConstraintAction action)
{
lock (m_constraints)
{
foreach (BSConstraint constrain in m_constraints)
{
if (action(constrain))
break;
}
}
}
}
}

View File

@ -0,0 +1,308 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyrightD
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using OMV = OpenMetaverse;
namespace OpenSim.Region.Physics.BulletSPlugin
{
public class BSLinkset
{
private static string LogHeader = "[BULLETSIM LINKSET]";
private BSPrim m_linksetRoot;
public BSPrim Root { get { return m_linksetRoot; } }
private BSScene m_scene;
private List<BSPrim> m_children;
// We lock the diddling of linkset classes to prevent any badness.
// This locks the modification of the instances of this class. Changes
// to the physical representation is done via the tainting mechenism.
private object m_linksetActivityLock = new Object();
// We keep the prim's mass in the linkset structure since it could be dependent on other prims
private float m_mass;
public float LinksetMass
{
get
{
m_mass = ComputeLinksetMass();
return m_mass;
}
}
public OMV.Vector3 CenterOfMass
{
get { return ComputeLinksetCenterOfMass(); }
}
public OMV.Vector3 GeometricCenter
{
get { return ComputeLinksetGeometricCenter(); }
}
public BSLinkset(BSScene scene, BSPrim parent)
{
// A simple linkset of one (no children)
m_scene = scene;
m_linksetRoot = parent;
m_children = new List<BSPrim>();
m_mass = parent.MassRaw;
}
// Link to a linkset where the child knows the parent.
// Parent changing should not happen so do some sanity checking.
// We return the parent's linkset so the child can track it's membership.
public BSLinkset AddMeToLinkset(BSPrim child, BSPrim parent)
{
lock (m_linksetActivityLock)
{
parent.Linkset.AddChildToLinkset(child);
}
return parent.Linkset;
}
public BSLinkset RemoveMeFromLinkset(BSPrim child)
{
lock (m_linksetActivityLock)
{
if (IsRoot(child))
{
// if root of linkset, take the linkset apart
while (m_children.Count > 0)
{
// Note that we don't do a foreach because the remove routine
// takes it out of the list.
RemoveChildFromLinkset(m_children[0]);
}
m_children.Clear(); // just to make sure
}
else
{
// Just removing a child from an existing linkset
RemoveChildFromLinkset(child);
}
}
// The child is down to a linkset of just itself
return new BSLinkset(m_scene, child);
}
// An existing linkset had one of its members rebuilt or something.
// Undo all the physical linking and rebuild the physical linkset.
public bool RefreshLinkset(BSPrim requestor)
{
return true;
}
// Return 'true' if the passed object is the root object of this linkset
public bool IsRoot(BSPrim requestor)
{
return (requestor.LocalID == m_linksetRoot.LocalID);
}
// Return 'true' if this linkset has any children (more than the root member)
public bool HasAnyChildren { get { return (m_children.Count > 0); } }
// Return 'true' if this child is in this linkset
public bool HasChild(BSPrim child)
{
bool ret = false;
foreach (BSPrim bp in m_children)
{
if (child.LocalID == bp.LocalID)
{
ret = true;
break;
}
}
return ret;
}
private float ComputeLinksetMass()
{
float mass = m_linksetRoot.MassRaw;
foreach (BSPrim bp in m_children)
{
mass += bp.MassRaw;
}
return mass;
}
private OMV.Vector3 ComputeLinksetCenterOfMass()
{
OMV.Vector3 com = m_linksetRoot.Position * m_linksetRoot.MassRaw;
float totalMass = m_linksetRoot.MassRaw;
foreach (BSPrim bp in m_children)
{
com += bp.Position * bp.MassRaw;
totalMass += bp.MassRaw;
}
com /= totalMass;
return com;
}
private OMV.Vector3 ComputeLinksetGeometricCenter()
{
OMV.Vector3 com = m_linksetRoot.Position;
foreach (BSPrim bp in m_children)
{
com += bp.Position * bp.MassRaw;
}
com /= m_children.Count + 1;
return com;
}
// I am the root of a linkset and a new child is being added
public void AddChildToLinkset(BSPrim pchild)
{
BSPrim child = pchild;
if (!HasChild(child))
{
m_children.Add(child);
m_scene.TaintedObject(delegate()
{
DebugLog("{0}: AddChildToLinkset: adding child {1} to {2}", LogHeader, child.LocalID, m_linksetRoot.LocalID);
DetailLog("{0},AddChildToLinkset,child={1}", m_linksetRoot.LocalID, pchild.LocalID);
PhysicallyLinkAChildToRoot(pchild); // build the physical binding between me and the child
});
}
return;
}
// I am the root of a linkset and one of my children is being removed.
// Safe to call even if the child is not really in my linkset.
public void RemoveChildFromLinkset(BSPrim pchild)
{
BSPrim child = pchild;
if (m_children.Remove(child))
{
m_scene.TaintedObject(delegate()
{
DebugLog("{0}: RemoveChildFromLinkset: Removing constraint to {1}", LogHeader, child.LocalID);
DetailLog("{0},RemoveChildFromLinkset,child={1}", m_linksetRoot.LocalID, pchild.LocalID);
if (m_children.Count == 0)
{
// if the linkset is empty, make sure all linkages have been removed
PhysicallyUnlinkAllChildrenFromRoot();
}
else
{
PhysicallyUnlinkAChildFromRoot(pchild);
}
});
}
else
{
// This will happen if we remove the root of the linkset first. Non-fatal occurance.
// m_scene.Logger.ErrorFormat("{0}: Asked to remove child from linkset that was not in linkset", LogHeader);
}
return;
}
// Create a constraint between me (root of linkset) and the passed prim (the child).
// Called at taint time!
private void PhysicallyLinkAChildToRoot(BSPrim childPrim)
{
// Zero motion for children so they don't interpolate
childPrim.ZeroMotion();
// relative position normalized to the root prim
OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(m_linksetRoot.Orientation);
OMV.Vector3 childRelativePosition = (childPrim.Position - m_linksetRoot.Position) * invThisOrientation;
// relative rotation of the child to the parent
OMV.Quaternion childRelativeRotation = invThisOrientation * childPrim.Orientation;
// create a constraint that allows no freedom of movement between the two objects
// http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
// DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID);
DetailLog("{0},LinkAChildToMe,taint,root={1},child={2}", m_linksetRoot.LocalID, m_linksetRoot.LocalID, childPrim.LocalID);
BSConstraint constrain = m_scene.Constraints.CreateConstraint(
m_scene.World, m_linksetRoot.Body, childPrim.Body,
childRelativePosition,
childRelativeRotation,
OMV.Vector3.Zero,
OMV.Quaternion.Identity);
constrain.SetLinearLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);
constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);
// tweek the constraint to increase stability
constrain.UseFrameOffset(m_scene.BoolNumeric(m_scene.Params.linkConstraintUseFrameOffset));
constrain.TranslationalLimitMotor(m_scene.BoolNumeric(m_scene.Params.linkConstraintEnableTransMotor),
m_scene.Params.linkConstraintTransMotorMaxVel,
m_scene.Params.linkConstraintTransMotorMaxForce);
}
// Remove linkage between myself and a particular child
// Called at taint time!
private void PhysicallyUnlinkAChildFromRoot(BSPrim childPrim)
{
DebugLog("{0}: PhysicallyUnlinkAChildFromRoot: RemoveConstraint between root prim {1} and child prim {2}",
LogHeader, m_linksetRoot.LocalID, childPrim.LocalID);
DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", m_linksetRoot.LocalID, m_linksetRoot.LocalID, childPrim.LocalID);
// BulletSimAPI.RemoveConstraint(_scene.WorldID, LocalID, childPrim.LocalID);
m_scene.Constraints.RemoveAndDestroyConstraint(m_linksetRoot.Body, childPrim.Body);
}
// Remove linkage between myself and any possible children I might have
// Called at taint time!
private void PhysicallyUnlinkAllChildrenFromRoot()
{
// DebugLog("{0}: PhysicallyUnlinkAllChildren:", LogHeader);
DetailLog("{0},PhysicallyUnlinkAllChildren,taint", m_linksetRoot.LocalID);
m_scene.Constraints.RemoveAndDestroyConstraint(m_linksetRoot.Body);
// BulletSimAPI.RemoveConstraintByID(_scene.WorldID, LocalID);
}
// Invoke the detailed logger and output something if it's enabled.
private void DebugLog(string msg, params Object[] args)
{
m_scene.Logger.DebugFormat(msg, args);
}
// Invoke the detailed logger and output something if it's enabled.
private void DetailLog(string msg, params Object[] args)
{
m_scene.PhysicsLogging.Write(msg, args);
}
}
}

View File

@ -66,7 +66,7 @@ public sealed class BSPrim : PhysicsActor
private bool _isSelected; private bool _isSelected;
private bool _isVolumeDetect; private bool _isVolumeDetect;
private OMV.Vector3 _position; private OMV.Vector3 _position;
private float _mass; private float _mass; // the mass of this object
private float _density; private float _density;
private OMV.Vector3 _force; private OMV.Vector3 _force;
private OMV.Vector3 _velocity; private OMV.Vector3 _velocity;
@ -89,14 +89,22 @@ public sealed class BSPrim : PhysicsActor
private bool _kinematic; private bool _kinematic;
private float _buoyancy; private float _buoyancy;
private BSPrim _parentPrim; // Membership in a linkset is controlled by this class.
private List<BSPrim> _childrenPrims; private BSLinkset _linkset;
public BSLinkset Linkset
{
get { return _linkset; }
set { _linkset = value; }
}
private int _subscribedEventsMs = 0; private int _subscribedEventsMs = 0;
private int _nextCollisionOkTime = 0; private int _nextCollisionOkTime = 0;
long _collidingStep; long _collidingStep;
long _collidingGroundStep; long _collidingGroundStep;
private BulletBody m_body;
public BulletBody Body { get { return m_body; } }
private BSDynamics _vehicle; private BSDynamics _vehicle;
private OMV.Vector3 _PIDTarget; private OMV.Vector3 _PIDTarget;
@ -130,14 +138,18 @@ public sealed class BSPrim : PhysicsActor
_friction = _scene.Params.defaultFriction; // TODO: compute based on object material _friction = _scene.Params.defaultFriction; // TODO: compute based on object material
_density = _scene.Params.defaultDensity; // TODO: compute based on object material _density = _scene.Params.defaultDensity; // TODO: compute based on object material
_restitution = _scene.Params.defaultRestitution; _restitution = _scene.Params.defaultRestitution;
_parentPrim = null; // not a child or a parent _linkset = new BSLinkset(_scene, this); // a linkset of one
_vehicle = new BSDynamics(this); // add vehicleness _vehicle = new BSDynamics(this); // add vehicleness
_childrenPrims = new List<BSPrim>();
_mass = CalculateMass(); _mass = CalculateMass();
// do the actual object creation at taint time // do the actual object creation at taint time
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
RecreateGeomAndObject(); RecreateGeomAndObject();
// Get the pointer to the physical body for this object.
// At the moment, we're still letting BulletSim manage the creation and destruction
// of the object. Someday we'll move that into the C# code.
m_body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID));
}); });
} }
@ -153,16 +165,8 @@ public sealed class BSPrim : PhysicsActor
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
// undo any dependance with/on other objects // Undo any links between me and any other object
if (_parentPrim != null) _linkset = _linkset.RemoveMeFromLinkset(this);
{
// If I'm someone's child, tell them to forget about me.
_parentPrim.RemoveChildFromLinkset(this);
_parentPrim = null;
}
// make sure there are no possible children depending on me
UnlinkAllChildren();
// everything in the C# world will get garbage collected. Tell the C++ world to free stuff. // everything in the C# world will get garbage collected. Tell the C++ world to free stuff.
BulletSimAPI.DestroyObject(_scene.WorldID, LocalID); BulletSimAPI.DestroyObject(_scene.WorldID, LocalID);
@ -179,7 +183,7 @@ public sealed class BSPrim : PhysicsActor
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
_mass = CalculateMass(); // changing size changes the mass _mass = CalculateMass(); // changing size changes the mass
BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, Mass, IsPhysical); BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical);
RecreateGeomAndObject(); RecreateGeomAndObject();
}); });
} }
@ -218,32 +222,8 @@ public sealed class BSPrim : PhysicsActor
BSPrim parent = obj as BSPrim; BSPrim parent = obj as BSPrim;
DebugLog("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, obj.LocalID); DebugLog("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, obj.LocalID);
DetailLog("{0},link,parent={1}", LocalID, obj.LocalID); DetailLog("{0},link,parent={1}", LocalID, obj.LocalID);
// TODO: decide if this parent checking needs to happen at taint time
if (_parentPrim == null) _linkset = _linkset.AddMeToLinkset(this, parent);
{
if (parent != null)
{
// I don't have a parent so I am joining a linkset
parent.AddChildToLinkset(this);
}
}
else
{
// I already have a parent, is parenting changing?
if (parent != _parentPrim)
{
if (parent == null)
{
// we are being removed from a linkset
_parentPrim.RemoveChildFromLinkset(this);
}
else
{
// asking to reparent a prim should not happen
m_log.ErrorFormat("{0}: link(): Reparenting a prim. ", LogHeader);
}
}
}
return; return;
} }
@ -252,92 +232,28 @@ public sealed class BSPrim : PhysicsActor
// TODO: decide if this parent checking needs to happen at taint time // TODO: decide if this parent checking needs to happen at taint time
// Race condition here: if link() and delink() in same simulation tick, the delink will not happen // Race condition here: if link() and delink() in same simulation tick, the delink will not happen
DebugLog("{0}: delink {1}/{2}. Parent={3}", LogHeader, _avName, _localID, DebugLog("{0}: delink {1}/{2}. Parent={3}", LogHeader, _avName, _localID,
(_parentPrim==null ? "NULL" : _parentPrim._avName+"/"+_parentPrim.LocalID.ToString())); _linkset.Root._avName+"/"+_linkset.Root.LocalID.ToString());
DetailLog("{0},delink,parent={1}", LocalID, (_parentPrim==null ? "NULL" : _parentPrim.LocalID.ToString())); DetailLog("{0},delink,parent={1}", LocalID, _linkset.Root.LocalID.ToString());
if (_parentPrim != null)
{ _linkset.RemoveMeFromLinkset(this);
_parentPrim.RemoveChildFromLinkset(this);
}
return; return;
} }
// I am the root of a linkset and a new child is being added
public void AddChildToLinkset(BSPrim pchild)
{
BSPrim child = pchild;
_scene.TaintedObject(delegate()
{
if (!_childrenPrims.Contains(child))
{
DebugLog("{0}: AddChildToLinkset: adding child {1} to {2}", LogHeader, child.LocalID, this.LocalID);
DetailLog("{0},AddChildToLinkset,child={1}", LocalID, pchild.LocalID);
_childrenPrims.Add(child);
child._parentPrim = this; // the child has gained a parent
// RecreateGeomAndObject(); // rebuild my shape with the new child added
LinkAChildToMe(pchild); // build the physical binding between me and the child
_mass = CalculateMass();
}
});
return;
}
// I am the root of a linkset and one of my children is being removed.
// Safe to call even if the child is not really in my linkset.
public void RemoveChildFromLinkset(BSPrim pchild)
{
BSPrim child = pchild;
_scene.TaintedObject(delegate()
{
if (_childrenPrims.Contains(child))
{
DebugLog("{0}: RemoveChildFromLinkset: Removing constraint to {1}", LogHeader, child.LocalID);
DetailLog("{0},RemoveChildFromLinkset,child={1}", LocalID, pchild.LocalID);
_childrenPrims.Remove(child);
child._parentPrim = null; // the child has lost its parent
if (_childrenPrims.Count == 0)
{
// if the linkset is empty, make sure all linkages have been removed
UnlinkAllChildren();
}
else
{
// RecreateGeomAndObject(); // rebuild my shape with the child removed
UnlinkAChildFromMe(pchild);
}
_mass = CalculateMass();
}
else
{
m_log.ErrorFormat("{0}: Asked to remove child from linkset that was not in linkset");
}
});
return;
}
// return true if we are the root of a linkset (there are children to manage)
public bool IsRootOfLinkset
{
get { return (_parentPrim == null && _childrenPrims.Count != 0); }
}
// Set motion values to zero. // Set motion values to zero.
// Do it to the properties so the values get set in the physics engine. // Do it to the properties so the values get set in the physics engine.
// Push the setting of the values to the viewer. // Push the setting of the values to the viewer.
// Called at taint time! // Called at taint time!
private void ZeroMotion() public void ZeroMotion()
{ {
_velocity = OMV.Vector3.Zero; _velocity = OMV.Vector3.Zero;
_acceleration = OMV.Vector3.Zero; _acceleration = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero; _rotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties directly into the physics engine // Zero some other properties directly into the physics engine
IntPtr obj = BulletSimAPI.GetBodyHandleWorldID2(_scene.WorldID, LocalID); BulletSimAPI.SetVelocity2(Body.Ptr, OMV.Vector3.Zero);
BulletSimAPI.SetVelocity2(obj, OMV.Vector3.Zero); BulletSimAPI.SetAngularVelocity2(Body.Ptr, OMV.Vector3.Zero);
BulletSimAPI.SetAngularVelocity2(obj, OMV.Vector3.Zero); BulletSimAPI.SetInterpolation2(Body.Ptr, OMV.Vector3.Zero, OMV.Vector3.Zero);
BulletSimAPI.SetInterpolation2(obj, OMV.Vector3.Zero, OMV.Vector3.Zero); BulletSimAPI.ClearForces2(Body.Ptr);
BulletSimAPI.ClearForces2(obj);
} }
public override void LockAngularMotion(OMV.Vector3 axis) public override void LockAngularMotion(OMV.Vector3 axis)
@ -348,9 +264,10 @@ public sealed class BSPrim : PhysicsActor
public override OMV.Vector3 Position { public override OMV.Vector3 Position {
get { get {
if (!_linkset.IsRoot(this))
// child prims move around based on their parent. Need to get the latest location // child prims move around based on their parent. Need to get the latest location
if (_parentPrim != null)
_position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID);
// don't do the GetObjectPosition for root elements because this function is called a zillion times // don't do the GetObjectPosition for root elements because this function is called a zillion times
// _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID);
return _position; return _position;
@ -366,16 +283,31 @@ public sealed class BSPrim : PhysicsActor
} }
} }
// Return the effective mass of the object. Non-physical objects do not have mass. // Return the effective mass of the object.
public override float Mass { // If there are multiple items in the linkset, add them together for the root
get { public override float Mass
if (IsPhysical) {
return _mass; get
else {
return 0f; return _linkset.LinksetMass;
} }
} }
// used when we only want this prim's mass and not the linkset thing
public float MassRaw { get { return _mass; } }
// Is this used?
public override OMV.Vector3 CenterOfMass
{
get { return _linkset.CenterOfMass; }
}
// Is this used?
public override OMV.Vector3 GeometricCenter
{
get { return _linkset.GeometricCenter; }
}
public override OMV.Vector3 Force { public override OMV.Vector3 Force {
get { return _force; } get { return _force; }
set { set {
@ -383,7 +315,8 @@ public sealed class BSPrim : PhysicsActor
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
DetailLog("{0},SetForce,taint,force={1}", LocalID, _force); DetailLog("{0},SetForce,taint,force={1}", LocalID, _force);
BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force);
BulletSimAPI.SetObjectForce2(Body.Ptr, _force);
}); });
} }
} }
@ -407,8 +340,7 @@ public sealed class BSPrim : PhysicsActor
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
// Tell the physics engine to clear state // Tell the physics engine to clear state
IntPtr obj = BulletSimAPI.GetBodyHandleWorldID2(_scene.WorldID, LocalID); BulletSimAPI.ClearForces2(this.Body.Ptr);
BulletSimAPI.ClearForces2(obj);
}); });
// make it so the scene will call us each tick to do vehicle things // make it so the scene will call us each tick to do vehicle things
@ -420,7 +352,6 @@ public sealed class BSPrim : PhysicsActor
} }
public override void VehicleFloatParam(int param, float value) public override void VehicleFloatParam(int param, float value)
{ {
m_log.DebugFormat("{0} VehicleFloatParam. {1} <= {2}", LogHeader, param, value);
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
_vehicle.ProcessFloatVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep); _vehicle.ProcessFloatVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep);
@ -428,7 +359,6 @@ public sealed class BSPrim : PhysicsActor
} }
public override void VehicleVectorParam(int param, OMV.Vector3 value) public override void VehicleVectorParam(int param, OMV.Vector3 value)
{ {
m_log.DebugFormat("{0} VehicleVectorParam. {1} <= {2}", LogHeader, param, value);
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
_vehicle.ProcessVectorVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep); _vehicle.ProcessVectorVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep);
@ -436,7 +366,6 @@ public sealed class BSPrim : PhysicsActor
} }
public override void VehicleRotationParam(int param, OMV.Quaternion rotation) public override void VehicleRotationParam(int param, OMV.Quaternion rotation)
{ {
m_log.DebugFormat("{0} VehicleRotationParam. {1} <= {2}", LogHeader, param, rotation);
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation);
@ -444,7 +373,6 @@ public sealed class BSPrim : PhysicsActor
} }
public override void VehicleFlags(int param, bool remove) public override void VehicleFlags(int param, bool remove)
{ {
m_log.DebugFormat("{0} VehicleFlags. {1}. Remove={2}", LogHeader, param, remove);
_scene.TaintedObject(delegate() _scene.TaintedObject(delegate()
{ {
_vehicle.ProcessVehicleFlags(param, remove); _vehicle.ProcessVehicleFlags(param, remove);
@ -470,8 +398,6 @@ public sealed class BSPrim : PhysicsActor
return; return;
} }
public override OMV.Vector3 GeometricCenter { get { return OMV.Vector3.Zero; } }
public override OMV.Vector3 CenterOfMass { get { return OMV.Vector3.Zero; } }
public override OMV.Vector3 Velocity { public override OMV.Vector3 Velocity {
get { return _velocity; } get { return _velocity; }
set { set {
@ -500,9 +426,9 @@ public sealed class BSPrim : PhysicsActor
} }
public override OMV.Quaternion Orientation { public override OMV.Quaternion Orientation {
get { get {
if (_parentPrim != null) if (!_linkset.IsRoot(this))
{ {
// children move around because tied to parent. Get a fresh value. // Children move around because tied to parent. Get a fresh value.
_orientation = BulletSimAPI.GetObjectOrientation(_scene.WorldID, LocalID); _orientation = BulletSimAPI.GetObjectOrientation(_scene.WorldID, LocalID);
} }
return _orientation; return _orientation;
@ -552,14 +478,16 @@ public sealed class BSPrim : PhysicsActor
private void SetObjectDynamic() private void SetObjectDynamic()
{ {
// m_log.DebugFormat("{0}: ID={1}, SetObjectDynamic: IsStatic={2}, IsSolid={3}", LogHeader, _localID, IsStatic, IsSolid); // m_log.DebugFormat("{0}: ID={1}, SetObjectDynamic: IsStatic={2}, IsSolid={3}", LogHeader, _localID, IsStatic, IsSolid);
// non-physical things work best with a mass of zero
if (!IsStatic)
{
_mass = CalculateMass();
RecreateGeomAndObject(); RecreateGeomAndObject();
}
DetailLog("{0},SetObjectDynamic,taint,static={1},solid={2},mass={3}", LocalID, IsStatic, IsSolid, Mass); float mass = _mass;
BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), Mass); // Bullet wants static objects have a mass of zero
if (IsStatic)
mass = 0f;
DetailLog("{0},SetObjectDynamic,taint,static={1},solid={2},mass={3}", LocalID, IsStatic, IsSolid, mass);
BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass);
} }
// prims don't fly // prims don't fly
@ -1001,6 +929,9 @@ public sealed class BSPrim : PhysicsActor
returnMass = _density * volume; returnMass = _density * volume;
/*
* This change means each object keeps its own mass and the Mass property
* will return the sum if we're part of a linkset.
if (IsRootOfLinkset) if (IsRootOfLinkset)
{ {
foreach (BSPrim prim in _childrenPrims) foreach (BSPrim prim in _childrenPrims)
@ -1008,6 +939,7 @@ public sealed class BSPrim : PhysicsActor
returnMass += prim.CalculateMass(); returnMass += prim.CalculateMass();
} }
} }
*/
if (returnMass <= 0) if (returnMass <= 0)
returnMass = 0.0001f; returnMass = 0.0001f;
@ -1023,9 +955,11 @@ public sealed class BSPrim : PhysicsActor
// The objects needs a hull if it's physical otherwise a mesh is enough // The objects needs a hull if it's physical otherwise a mesh is enough
// No locking here because this is done when we know physics is not simulating // No locking here because this is done when we know physics is not simulating
// if 'forceRebuild' is true, the geometry is rebuilt. Otherwise a previously built version is used // if 'forceRebuild' is true, the geometry is rebuilt. Otherwise a previously built version is used
private void CreateGeom(bool forceRebuild) // Returns 'true' if the geometry was rebuilt
private bool CreateGeom(bool forceRebuild)
{ {
// the mesher thought this was too simple to mesh. Use a native Bullet collision shape. // the mesher thought this was too simple to mesh. Use a native Bullet collision shape.
bool ret = false;
if (!_scene.NeedsMeshing(_pbs)) if (!_scene.NeedsMeshing(_pbs))
{ {
if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1) if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1)
@ -1033,20 +967,28 @@ public sealed class BSPrim : PhysicsActor
if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
{ {
// m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size);
_shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)
{
DetailLog("{0},CreateGeom,sphere", LocalID); DetailLog("{0},CreateGeom,sphere", LocalID);
_shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE;
ret = true;
// Bullet native objects are scaled by the Bullet engine so pass the size in // Bullet native objects are scaled by the Bullet engine so pass the size in
_scale = _size; _scale = _size;
} }
} }
}
else else
{ {
// m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, size={2}", LogHeader, LocalID, _size); // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, size={2}", LogHeader, LocalID, _size);
if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)
{
DetailLog("{0},CreateGeom,box", LocalID); DetailLog("{0},CreateGeom,box", LocalID);
_shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX;
ret = true;
_scale = _size; _scale = _size;
} }
} }
}
else else
{ {
if (IsPhysical) if (IsPhysical)
@ -1056,6 +998,7 @@ public sealed class BSPrim : PhysicsActor
// physical objects require a hull for interaction. // physical objects require a hull for interaction.
// This will create the mesh if it doesn't already exist // This will create the mesh if it doesn't already exist
CreateGeomHull(); CreateGeomHull();
ret = true;
} }
} }
else else
@ -1064,9 +1007,11 @@ public sealed class BSPrim : PhysicsActor
{ {
// Static (non-physical) objects only need a mesh for bumping into // Static (non-physical) objects only need a mesh for bumping into
CreateGeomMesh(); CreateGeomMesh();
ret = true;
} }
} }
} }
return ret;
} }
// No locking here because this is done when we know physics is not simulating // No locking here because this is done when we know physics is not simulating
@ -1251,20 +1196,18 @@ public sealed class BSPrim : PhysicsActor
// No locking here because this is done when the physics engine is not simulating // No locking here because this is done when the physics engine is not simulating
private void CreateObject() private void CreateObject()
{ {
if (IsRootOfLinkset) // this routine is called when objects are rebuilt.
{
// Create a linkset around this object
CreateLinkset();
}
else
{
// simple object
// the mesh or hull must have already been created in Bullet // the mesh or hull must have already been created in Bullet
ShapeData shape; ShapeData shape;
FillShapeInfo(out shape); FillShapeInfo(out shape);
// m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type); // m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type);
BulletSimAPI.CreateObject(_scene.WorldID, shape); BulletSimAPI.CreateObject(_scene.WorldID, shape);
} // the CreateObject() may have recreated the rigid body. Make sure we have the latest.
m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID);
// The root object could have been recreated. Make sure everything linksety is up to date.
_linkset.RefreshLinkset(this);
} }
// Copy prim's info into the BulletSim shape description structure // Copy prim's info into the BulletSim shape description structure
@ -1276,7 +1219,7 @@ public sealed class BSPrim : PhysicsActor
shape.Rotation = _orientation; shape.Rotation = _orientation;
shape.Velocity = _velocity; shape.Velocity = _velocity;
shape.Scale = _scale; shape.Scale = _scale;
shape.Mass = Mass; shape.Mass = _isPhysical ? _mass : 0f;
shape.Buoyancy = _buoyancy; shape.Buoyancy = _buoyancy;
shape.HullKey = _hullKey; shape.HullKey = _hullKey;
shape.MeshKey = _meshKey; shape.MeshKey = _meshKey;
@ -1286,72 +1229,6 @@ public sealed class BSPrim : PhysicsActor
shape.Static = _isPhysical ? ShapeData.numericFalse : ShapeData.numericTrue; shape.Static = _isPhysical ? ShapeData.numericFalse : ShapeData.numericTrue;
} }
#region Linkset creation and destruction
// Create the linkset by putting constraints between the objects of the set so they cannot move
// relative to each other.
void CreateLinkset()
{
DebugLog("{0}: CreateLinkset. Root prim={1}, prims={2}", LogHeader, LocalID, _childrenPrims.Count+1);
// remove any constraints that might be in place
DebugLog("{0}: CreateLinkset: RemoveConstraints between me and any children", LogHeader, LocalID);
BulletSimAPI.RemoveConstraintByID(_scene.WorldID, LocalID);
// create constraints between the root prim and each of the children
foreach (BSPrim prim in _childrenPrims)
{
LinkAChildToMe(prim);
}
}
// Create a constraint between me (root of linkset) and the passed prim (the child).
// Called at taint time!
private void LinkAChildToMe(BSPrim childPrim)
{
// Zero motion for children so they don't interpolate
childPrim.ZeroMotion();
// relative position normalized to the root prim
OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(this._orientation);
OMV.Vector3 childRelativePosition = (childPrim._position - this._position) * invThisOrientation;
// relative rotation of the child to the parent
OMV.Quaternion childRelativeRotation = invThisOrientation * childPrim._orientation;
// create a constraint that allows no freedom of movement between the two objects
// http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID);
DetailLog("{0},LinkAChildToMe,taint,root={1},child={2}", LocalID, LocalID, childPrim.LocalID);
BulletSimAPI.AddConstraint(_scene.WorldID, LocalID, childPrim.LocalID,
childRelativePosition,
childRelativeRotation,
OMV.Vector3.Zero,
OMV.Quaternion.Identity,
OMV.Vector3.Zero, OMV.Vector3.Zero,
OMV.Vector3.Zero, OMV.Vector3.Zero);
}
// Remove linkage between myself and a particular child
// Called at taint time!
private void UnlinkAChildFromMe(BSPrim childPrim)
{
DebugLog("{0}: UnlinkAChildFromMe: RemoveConstraint between root prim {1} and child prim {2}",
LogHeader, LocalID, childPrim.LocalID);
DetailLog("{0},UnlinkAChildFromMe,taint,root={1},child={2}", LocalID, LocalID, childPrim.LocalID);
BulletSimAPI.RemoveConstraint(_scene.WorldID, LocalID, childPrim.LocalID);
}
// Remove linkage between myself and any possible children I might have
// Called at taint time!
private void UnlinkAllChildren()
{
DebugLog("{0}: UnlinkAllChildren:", LogHeader);
DetailLog("{0},UnlinkAllChildren,taint", LocalID);
BulletSimAPI.RemoveConstraintByID(_scene.WorldID, LocalID);
}
#endregion // Linkset creation and destruction
// Rebuild the geometry and object. // Rebuild the geometry and object.
// This is called when the shape changes so we need to recreate the mesh/hull. // This is called when the shape changes so we need to recreate the mesh/hull.
@ -1429,7 +1306,7 @@ public sealed class BSPrim : PhysicsActor
// Don't check for damping here -- it's done in BulletSim and SceneObjectPart. // Don't check for damping here -- it's done in BulletSim and SceneObjectPart.
// Updates only for individual prims and for the root object of a linkset. // Updates only for individual prims and for the root object of a linkset.
if (_parentPrim == null) if (_linkset.IsRoot(this))
{ {
// Assign to the local variables so the normal set action does not happen // Assign to the local variables so the normal set action does not happen
_position = entprop.Position; _position = entprop.Position;

View File

@ -73,7 +73,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[BULLETS SCENE]"; private static readonly string LogHeader = "[BULLETS SCENE]";
private void DebugLog(string mm, params Object[] xx) { if (shouldDebugLog) m_log.DebugFormat(mm, xx); } public void DebugLog(string mm, params Object[] xx) { if (shouldDebugLog) m_log.DebugFormat(mm, xx); }
public string BulletSimVersion = "?"; public string BulletSimVersion = "?";
@ -87,6 +87,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
private uint m_worldID; private uint m_worldID;
public uint WorldID { get { return m_worldID; } } public uint WorldID { get { return m_worldID; } }
// let my minuions use my logger
public ILog Logger { get { return m_log; } }
private bool m_initialized = false; private bool m_initialized = false;
private int m_detailedStatsStep = 0; private int m_detailedStatsStep = 0;
@ -103,6 +106,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters
get { return m_sculptLOD; } get { return m_sculptLOD; }
} }
private BulletSim m_worldSim;
public BulletSim World
{
get { return m_worldSim; }
}
private BSConstraintCollection m_constraintCollection;
public BSConstraintCollection Constraints
{
get { return m_constraintCollection; }
}
private int m_maxSubSteps; private int m_maxSubSteps;
private float m_fixedTimeStep; private float m_fixedTimeStep;
private long m_simulationStep = 0; private long m_simulationStep = 0;
@ -229,6 +243,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters
m_maxCollisionsPerFrame, m_collisionArrayPinnedHandle.AddrOfPinnedObject(), m_maxCollisionsPerFrame, m_collisionArrayPinnedHandle.AddrOfPinnedObject(),
m_maxUpdatesPerFrame, m_updateArrayPinnedHandle.AddrOfPinnedObject()); m_maxUpdatesPerFrame, m_updateArrayPinnedHandle.AddrOfPinnedObject());
// Initialization to support the transition to a new API which puts most of the logic
// into the C# code so it is easier to modify and add to.
m_worldSim = new BulletSim(m_worldID, BulletSimAPI.GetSimHandle2(m_worldID));
m_constraintCollection = new BSConstraintCollection(World);
m_initialized = true; m_initialized = true;
} }
@ -237,116 +256,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters
private void GetInitialParameterValues(IConfigSource config) private void GetInitialParameterValues(IConfigSource config)
{ {
ConfigurationParameters parms = new ConfigurationParameters(); ConfigurationParameters parms = new ConfigurationParameters();
m_params[0] = parms;
_meshSculptedPrim = true; // mesh sculpted prims SetParameterDefaultValues();
_forceSimplePrimMeshing = false; // use complex meshing if called for
m_meshLOD = 8f;
m_sculptLOD = 32f;
shouldDebugLog = false;
m_detailedStatsStep = 0; // disabled
m_maxSubSteps = 10;
m_fixedTimeStep = 1f / 60f;
m_maxCollisionsPerFrame = 2048;
m_maxUpdatesPerFrame = 2048;
m_maximumObjectMass = 10000.01f;
PID_D = 2200f;
PID_P = 900f;
parms.defaultFriction = 0.5f;
parms.defaultDensity = 10.000006836f; // Aluminum g/cm3
parms.defaultRestitution = 0f;
parms.collisionMargin = 0.0f;
parms.gravity = -9.80665f;
parms.linearDamping = 0.0f;
parms.angularDamping = 0.0f;
parms.deactivationTime = 0.2f;
parms.linearSleepingThreshold = 0.8f;
parms.angularSleepingThreshold = 1.0f;
parms.ccdMotionThreshold = 0.0f; // set to zero to disable
parms.ccdSweptSphereRadius = 0.0f;
parms.contactProcessingThreshold = 0.1f;
parms.terrainFriction = 0.5f;
parms.terrainHitFraction = 0.8f;
parms.terrainRestitution = 0f;
parms.avatarFriction = 0.5f;
parms.avatarRestitution = 0.0f;
parms.avatarDensity = 60f;
parms.avatarCapsuleRadius = 0.37f;
parms.avatarCapsuleHeight = 1.5f; // 2.140599f
parms.avatarContactProcessingThreshold = 0.1f;
parms.maxPersistantManifoldPoolSize = 0f;
parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericTrue;
parms.shouldForceUpdateAllAabbs = ConfigurationParameters.numericFalse;
parms.shouldRandomizeSolverOrder = ConfigurationParameters.numericFalse;
parms.shouldSplitSimulationIslands = ConfigurationParameters.numericFalse;
parms.shouldEnableFrictionCaching = ConfigurationParameters.numericFalse;
parms.numberOfSolverIterations = 0f; // means use default
if (config != null) if (config != null)
{ {
// If there are specifications in the ini file, use those values // If there are specifications in the ini file, use those values
// WHEN ADDING OR UPDATING THIS SECTION, BE SURE TO UPDATE OpenSimDefaults.ini
// ALSO REMEMBER TO UPDATE THE RUNTIME SETTING OF THE PARAMETERS.
IConfig pConfig = config.Configs["BulletSim"]; IConfig pConfig = config.Configs["BulletSim"];
if (pConfig != null) if (pConfig != null)
{ {
_meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim); SetParameterConfigurationValues(pConfig);
_forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing);
shouldDebugLog = pConfig.GetBoolean("ShouldDebugLog", shouldDebugLog);
m_detailedStatsStep = pConfig.GetInt("DetailedStatsStep", m_detailedStatsStep);
m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD);
m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD);
m_maxSubSteps = pConfig.GetInt("MaxSubSteps", m_maxSubSteps);
m_fixedTimeStep = pConfig.GetFloat("FixedTimeStep", m_fixedTimeStep);
m_maxCollisionsPerFrame = pConfig.GetInt("MaxCollisionsPerFrame", m_maxCollisionsPerFrame);
m_maxUpdatesPerFrame = pConfig.GetInt("MaxUpdatesPerFrame", m_maxUpdatesPerFrame);
m_maximumObjectMass = pConfig.GetFloat("MaxObjectMass", m_maximumObjectMass);
PID_D = pConfig.GetFloat("PIDDerivative", PID_D);
PID_P = pConfig.GetFloat("PIDProportional", PID_P);
parms.defaultFriction = pConfig.GetFloat("DefaultFriction", parms.defaultFriction);
parms.defaultDensity = pConfig.GetFloat("DefaultDensity", parms.defaultDensity);
parms.defaultRestitution = pConfig.GetFloat("DefaultRestitution", parms.defaultRestitution);
parms.collisionMargin = pConfig.GetFloat("CollisionMargin", parms.collisionMargin);
parms.gravity = pConfig.GetFloat("Gravity", parms.gravity);
parms.linearDamping = pConfig.GetFloat("LinearDamping", parms.linearDamping);
parms.angularDamping = pConfig.GetFloat("AngularDamping", parms.angularDamping);
parms.deactivationTime = pConfig.GetFloat("DeactivationTime", parms.deactivationTime);
parms.linearSleepingThreshold = pConfig.GetFloat("LinearSleepingThreshold", parms.linearSleepingThreshold);
parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold", parms.angularSleepingThreshold);
parms.ccdMotionThreshold = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold);
parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius);
parms.contactProcessingThreshold = pConfig.GetFloat("ContactProcessingThreshold", parms.contactProcessingThreshold);
parms.terrainFriction = pConfig.GetFloat("TerrainFriction", parms.terrainFriction);
parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction);
parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution);
parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction);
parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution);
parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity);
parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius);
parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight);
parms.avatarContactProcessingThreshold = pConfig.GetFloat("AvatarContactProcessingThreshold", parms.avatarContactProcessingThreshold);
parms.maxPersistantManifoldPoolSize = pConfig.GetFloat("MaxPersistantManifoldPoolSize", parms.maxPersistantManifoldPoolSize);
parms.shouldDisableContactPoolDynamicAllocation = ParamBoolean(pConfig, "ShouldDisableContactPoolDynamicAllocation", parms.shouldDisableContactPoolDynamicAllocation);
parms.shouldForceUpdateAllAabbs = ParamBoolean(pConfig, "ShouldForceUpdateAllAabbs", parms.shouldForceUpdateAllAabbs);
parms.shouldRandomizeSolverOrder = ParamBoolean(pConfig, "ShouldRandomizeSolverOrder", parms.shouldRandomizeSolverOrder);
parms.shouldSplitSimulationIslands = ParamBoolean(pConfig, "ShouldSplitSimulationIslands", parms.shouldSplitSimulationIslands);
parms.shouldEnableFrictionCaching = ParamBoolean(pConfig, "ShouldEnableFrictionCaching", parms.shouldEnableFrictionCaching);
parms.numberOfSolverIterations = pConfig.GetFloat("NumberOfSolverIterations", parms.numberOfSolverIterations);
// Very detailed logging for physics debugging // Very detailed logging for physics debugging
m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
@ -357,7 +277,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
m_vehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); m_vehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
} }
} }
m_params[0] = parms;
} }
// A helper function that handles a true/false parameter and returns the proper float number encoding // A helper function that handles a true/false parameter and returns the proper float number encoding
@ -634,6 +553,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters
// make sure no stepping happens while we're deleting stuff // make sure no stepping happens while we're deleting stuff
m_initialized = false; m_initialized = false;
if (m_constraintCollection != null)
{
m_constraintCollection.Dispose();
m_constraintCollection = null;
}
foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars) foreach (KeyValuePair<uint, BSCharacter> kvp in m_avatars)
{ {
kvp.Value.Destroy(); kvp.Value.Destroy();
@ -776,10 +701,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters
} }
// The calls to the PhysicsActors can't directly call into the physics engine // The calls to the PhysicsActors can't directly call into the physics engine
// because it might be busy. We we delay changes to a known time. // because it might be busy. We delay changes to a known time.
// We rely on C#'s closure to save and restore the context for the delegate. // We rely on C#'s closure to save and restore the context for the delegate.
public void TaintedObject(TaintCallback callback) public void TaintedObject(TaintCallback callback)
{ {
if (!m_initialized) return;
lock (_taintLock) lock (_taintLock)
_taintedObjects.Add(callback); _taintedObjects.Add(callback);
return; return;
@ -853,61 +780,371 @@ public class BSScene : PhysicsScene, IPhysicsParameters
} }
#endregion Vehicles #endregion Vehicles
#region Runtime settable parameters #region Parameters
public static PhysParameterEntry[] SettableParameters = new PhysParameterEntry[]
delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val);
delegate float ParamGet(BSScene scene);
delegate void ParamSet(BSScene scene, string paramName, uint localID, float val);
private struct ParameterDefn
{ {
new PhysParameterEntry("MeshLOD", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)"), public string name;
new PhysParameterEntry("SculptLOD", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)"), public string desc;
new PhysParameterEntry("MaxSubStep", "In simulation step, maximum number of substeps"), public float defaultValue;
new PhysParameterEntry("FixedTimeStep", "In simulation step, seconds of one substep (1/60)"), public ParamUser userParam;
new PhysParameterEntry("MaxObjectMass", "Maximum object mass (10000.01)"), public ParamGet getter;
new PhysParameterEntry("DetailedStats", "Frames between outputting detailed phys stats. Zero is off"), public ParamSet setter;
public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s)
{
name = n;
desc = d;
defaultValue = v;
userParam = u;
getter = g;
setter = s;
}
}
new PhysParameterEntry("DefaultFriction", "Friction factor used on new objects"), // List of all of the externally visible parameters.
new PhysParameterEntry("DefaultDensity", "Density for new objects" ), // For each parameter, this table maps a text name to getter and setters.
new PhysParameterEntry("DefaultRestitution", "Bouncyness of an object" ), // A ParameterDefn() takes the following parameters:
// new PhysParameterEntry("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!!)" ), // -- the text name of the parameter. This is used for console input and ini file.
new PhysParameterEntry("Gravity", "Vertical force of gravity (negative means down)" ), // -- a short text description of the parameter. This shows up in the console listing.
// -- a delegate for fetching the parameter from the ini file.
// Should handle fetching the right type from the ini file and converting it.
// -- a delegate for getting the value as a float
// -- a delegate for setting the value from a float
//
// To add a new variable, it is best to find an existing definition and copy it.
private ParameterDefn[] ParameterDefinitions =
{
new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties",
ConfigurationParameters.numericTrue,
(s,cf,p,v) => { s._meshSculptedPrim = cf.GetBoolean(p, s.BoolNumeric(v)); },
(s) => { return s.NumericBool(s._meshSculptedPrim); },
(s,p,l,v) => { s._meshSculptedPrim = s.BoolNumeric(v); } ),
new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { s._forceSimplePrimMeshing = cf.GetBoolean(p, s.BoolNumeric(v)); },
(s) => { return s.NumericBool(s._forceSimplePrimMeshing); },
(s,p,l,v) => { s._forceSimplePrimMeshing = s.BoolNumeric(v); } ),
new PhysParameterEntry("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)" ), new ParameterDefn("MeshLOD", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
new PhysParameterEntry("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)" ), 8f,
new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ), (s,cf,p,v) => { s.m_meshLOD = cf.GetInt(p, (int)v); },
new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ), (s) => { return (float)s.m_meshLOD; },
new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), (s,p,l,v) => { s.m_meshLOD = (int)v; } ),
new PhysParameterEntry("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ), new ParameterDefn("SculptLOD", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)",
new PhysParameterEntry("CcdSweptSphereRadius", "Continuious collision detection test radius" ), 32,
new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), (s,cf,p,v) => { s.m_sculptLOD = cf.GetInt(p, (int)v); },
// Can only change the following at initialization time. Change the INI file and reboot. (s) => { return (float)s.m_sculptLOD; },
new PhysParameterEntry("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)"), (s,p,l,v) => { s.m_sculptLOD = (int)v; } ),
new PhysParameterEntry("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count"),
new PhysParameterEntry("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step"),
new PhysParameterEntry("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction"),
new PhysParameterEntry("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands"),
new PhysParameterEntry("ShouldEnableFrictionCaching", "Enable friction computation caching"),
new PhysParameterEntry("NumberOfSolverIterations", "Number of internal iterations (0 means default)"),
new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps",
new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), 10f,
(s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); },
(s) => { return (float)s.m_maxSubSteps; },
(s,p,l,v) => { s.m_maxSubSteps = (int)v; } ),
new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)",
1f / 60f,
(s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); },
(s) => { return (float)s.m_fixedTimeStep; },
(s,p,l,v) => { s.m_fixedTimeStep = v; } ),
new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame",
2048f,
(s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); },
(s) => { return (float)s.m_maxCollisionsPerFrame; },
(s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ),
new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame",
8000f,
(s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); },
(s) => { return (float)s.m_maxUpdatesPerFrame; },
(s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ),
new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)",
10000.01f,
(s,cf,p,v) => { s.m_maximumObjectMass = cf.GetFloat(p, v); },
(s) => { return (float)s.m_maximumObjectMass; },
(s,p,l,v) => { s.m_maximumObjectMass = v; } ),
new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), new ParameterDefn("PID_D", "Derivitive factor for motion smoothing",
new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), 2200f,
(s,cf,p,v) => { s.PID_D = cf.GetFloat(p, v); },
(s) => { return (float)s.PID_D; },
(s,p,l,v) => { s.PID_D = v; } ),
new ParameterDefn("PID_P", "Parameteric factor for motion smoothing",
900f,
(s,cf,p,v) => { s.PID_P = cf.GetFloat(p, v); },
(s) => { return (float)s.PID_P; },
(s,p,l,v) => { s.PID_P = v; } ),
new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), new ParameterDefn("DefaultFriction", "Friction factor used on new objects",
new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), 0.5f,
new PhysParameterEntry("TerrainRestitution", "Bouncyness" ), (s,cf,p,v) => { s.m_params[0].defaultFriction = cf.GetFloat(p, v); },
new PhysParameterEntry("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation." ), (s) => { return s.m_params[0].defaultFriction; },
new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ), (s,p,l,v) => { s.m_params[0].defaultFriction = v; } ),
new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ), new ParameterDefn("DefaultDensity", "Density for new objects" ,
new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ), 10.000006836f, // Aluminum g/cm3
new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ), (s,cf,p,v) => { s.m_params[0].defaultDensity = cf.GetFloat(p, v); },
new PhysParameterEntry("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions") (s) => { return s.m_params[0].defaultDensity; },
(s,p,l,v) => { s.m_params[0].defaultDensity = v; } ),
new ParameterDefn("DefaultRestitution", "Bouncyness of an object" ,
0f,
(s,cf,p,v) => { s.m_params[0].defaultRestitution = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].defaultRestitution; },
(s,p,l,v) => { s.m_params[0].defaultRestitution = v; } ),
new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)",
0f,
(s,cf,p,v) => { s.m_params[0].collisionMargin = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].collisionMargin; },
(s,p,l,v) => { s.m_params[0].collisionMargin = v; } ),
new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)",
-9.80665f,
(s,cf,p,v) => { s.m_params[0].gravity = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].gravity; },
(s,p,l,v) => { s.m_params[0].gravity = v; s.TaintedUpdateParameter(p,l,v); } ),
new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)",
0f,
(s,cf,p,v) => { s.m_params[0].linearDamping = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].linearDamping; },
(s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].linearDamping, p, l, v); } ),
new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)",
0f,
(s,cf,p,v) => { s.m_params[0].angularDamping = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].angularDamping; },
(s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].angularDamping, p, l, v); } ),
new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static",
0.2f,
(s,cf,p,v) => { s.m_params[0].deactivationTime = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].deactivationTime; },
(s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].deactivationTime, p, l, v); } ),
new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static",
0.8f,
(s,cf,p,v) => { s.m_params[0].linearSleepingThreshold = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].linearSleepingThreshold; },
(s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].linearSleepingThreshold, p, l, v); } ),
new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static",
1.0f,
(s,cf,p,v) => { s.m_params[0].angularSleepingThreshold = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].angularSleepingThreshold; },
(s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].angularSleepingThreshold, p, l, v); } ),
new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ,
0f, // set to zero to disable
(s,cf,p,v) => { s.m_params[0].ccdMotionThreshold = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].ccdMotionThreshold; },
(s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].ccdMotionThreshold, p, l, v); } ),
new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
0f,
(s,cf,p,v) => { s.m_params[0].ccdSweptSphereRadius = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].ccdSweptSphereRadius; },
(s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].ccdSweptSphereRadius, p, l, v); } ),
new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" ,
0.1f,
(s,cf,p,v) => { s.m_params[0].contactProcessingThreshold = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].contactProcessingThreshold; },
(s,p,l,v) => { s.UpdateParameterPrims(ref s.m_params[0].contactProcessingThreshold, p, l, v); } ),
new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" ,
0.5f,
(s,cf,p,v) => { s.m_params[0].terrainFriction = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].terrainFriction; },
(s,p,l,v) => { s.m_params[0].terrainFriction = v; s.TaintedUpdateParameter(p,l,v); } ),
new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" ,
0.8f,
(s,cf,p,v) => { s.m_params[0].terrainHitFraction = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].terrainHitFraction; },
(s,p,l,v) => { s.m_params[0].terrainHitFraction = v; s.TaintedUpdateParameter(p,l,v); } ),
new ParameterDefn("TerrainRestitution", "Bouncyness" ,
0f,
(s,cf,p,v) => { s.m_params[0].terrainRestitution = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].terrainRestitution; },
(s,p,l,v) => { s.m_params[0].terrainRestitution = v; s.TaintedUpdateParameter(p,l,v); } ),
new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.",
0.5f,
(s,cf,p,v) => { s.m_params[0].avatarFriction = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].avatarFriction; },
(s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarFriction, p, l, v); } ),
new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.",
60f,
(s,cf,p,v) => { s.m_params[0].avatarDensity = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].avatarDensity; },
(s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarDensity, p, l, v); } ),
new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
0f,
(s,cf,p,v) => { s.m_params[0].avatarRestitution = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].avatarRestitution; },
(s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarRestitution, p, l, v); } ),
new ParameterDefn("AvatarCapsuleRadius", "Radius of space around an avatar",
0.37f,
(s,cf,p,v) => { s.m_params[0].avatarCapsuleRadius = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].avatarCapsuleRadius; },
(s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarCapsuleRadius, p, l, v); } ),
new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar",
1.5f,
(s,cf,p,v) => { s.m_params[0].avatarCapsuleHeight = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].avatarCapsuleHeight; },
(s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarCapsuleHeight, p, l, v); } ),
new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
0.1f,
(s,cf,p,v) => { s.m_params[0].avatarContactProcessingThreshold = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].avatarContactProcessingThreshold; },
(s,p,l,v) => { s.UpdateParameterAvatars(ref s.m_params[0].avatarContactProcessingThreshold, p, l, v); } ),
new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)",
0f, // zero to disable
(s,cf,p,v) => { s.m_params[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].maxPersistantManifoldPoolSize; },
(s,p,l,v) => { s.m_params[0].maxPersistantManifoldPoolSize = v; } ),
new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
ConfigurationParameters.numericTrue,
(s,cf,p,v) => { s.m_params[0].maxPersistantManifoldPoolSize = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
(s) => { return s.m_params[0].shouldDisableContactPoolDynamicAllocation; },
(s,p,l,v) => { s.m_params[0].shouldDisableContactPoolDynamicAllocation = v; } ),
new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { s.m_params[0].shouldForceUpdateAllAabbs = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
(s) => { return s.m_params[0].shouldForceUpdateAllAabbs; },
(s,p,l,v) => { s.m_params[0].shouldForceUpdateAllAabbs = v; } ),
new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { s.m_params[0].shouldRandomizeSolverOrder = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
(s) => { return s.m_params[0].shouldRandomizeSolverOrder; },
(s,p,l,v) => { s.m_params[0].shouldRandomizeSolverOrder = v; } ),
new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { s.m_params[0].shouldSplitSimulationIslands = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
(s) => { return s.m_params[0].shouldSplitSimulationIslands; },
(s,p,l,v) => { s.m_params[0].shouldSplitSimulationIslands = v; } ),
new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { s.m_params[0].shouldEnableFrictionCaching = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
(s) => { return s.m_params[0].shouldEnableFrictionCaching; },
(s,p,l,v) => { s.m_params[0].shouldEnableFrictionCaching = v; } ),
new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)",
0f, // zero says use Bullet default
(s,cf,p,v) => { s.m_params[0].numberOfSolverIterations = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].numberOfSolverIterations; },
(s,p,l,v) => { s.m_params[0].numberOfSolverIterations = v; } ),
new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { s.m_params[0].linkConstraintUseFrameOffset = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
(s) => { return s.m_params[0].linkConstraintUseFrameOffset; },
(s,p,l,v) => { s.m_params[0].linkConstraintUseFrameOffset = v; } ),
new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints",
ConfigurationParameters.numericTrue,
(s,cf,p,v) => { s.m_params[0].linkConstraintEnableTransMotor = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
(s) => { return s.m_params[0].linkConstraintEnableTransMotor; },
(s,p,l,v) => { s.m_params[0].linkConstraintEnableTransMotor = v; } ),
new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints",
5.0f,
(s,cf,p,v) => { s.m_params[0].linkConstraintTransMotorMaxVel = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].linkConstraintTransMotorMaxVel; },
(s,p,l,v) => { s.m_params[0].linkConstraintTransMotorMaxVel = v; } ),
new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints",
0.1f,
(s,cf,p,v) => { s.m_params[0].linkConstraintTransMotorMaxForce = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].linkConstraintTransMotorMaxForce; },
(s,p,l,v) => { s.m_params[0].linkConstraintTransMotorMaxForce = v; } ),
new ParameterDefn("DetailedStats", "Frames between outputting detailed phys stats. (0 is off)",
0f,
(s,cf,p,v) => { s.m_detailedStatsStep = cf.GetInt(p, (int)v); },
(s) => { return (float)s.m_detailedStatsStep; },
(s,p,l,v) => { s.m_detailedStatsStep = (int)v; } ),
new ParameterDefn("ShouldDebugLog", "Enables detailed DEBUG log statements",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { s.shouldDebugLog = cf.GetBoolean(p, s.BoolNumeric(v)); },
(s) => { return s.NumericBool(s.shouldDebugLog); },
(s,p,l,v) => { s.shouldDebugLog = s.BoolNumeric(v); } ),
}; };
// Convert a boolean to our numeric true and false values
public float NumericBool(bool b)
{
return (b ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse);
}
// Convert numeric true and false values to a boolean
public bool BoolNumeric(float b)
{
return (b == ConfigurationParameters.numericTrue ? true : false);
}
// Search through the parameter definitions and return the matching
// ParameterDefn structure.
// Case does not matter as names are compared after converting to lower case.
// Returns 'false' if the parameter is not found.
private bool TryGetParameter(string paramName, out ParameterDefn defn)
{
bool ret = false;
ParameterDefn foundDefn = new ParameterDefn();
string pName = paramName.ToLower();
foreach (ParameterDefn parm in ParameterDefinitions)
{
if (pName == parm.name.ToLower())
{
foundDefn = parm;
ret = true;
break;
}
}
defn = foundDefn;
return ret;
}
// Pass through the settable parameters and set the default values
private void SetParameterDefaultValues()
{
foreach (ParameterDefn parm in ParameterDefinitions)
{
parm.setter(this, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue);
}
}
// Get user set values out of the ini file.
private void SetParameterConfigurationValues(IConfig cfg)
{
foreach (ParameterDefn parm in ParameterDefinitions)
{
parm.userParam(this, cfg, parm.name, parm.defaultValue);
}
}
private PhysParameterEntry[] SettableParameters = new PhysParameterEntry[1];
private void BuildParameterTable()
{
if (SettableParameters.Length < ParameterDefinitions.Length)
{
List<PhysParameterEntry> entries = new List<PhysParameterEntry>();
for (int ii = 0; ii < ParameterDefinitions.Length; ii++)
{
ParameterDefn pd = ParameterDefinitions[ii];
entries.Add(new PhysParameterEntry(pd.name, pd.desc));
}
// make the list in alphabetical order for estetic reasons
entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2)
{
return ppe1.name.CompareTo(ppe2.name);
});
SettableParameters = entries.ToArray();
}
}
#region IPhysicsParameters #region IPhysicsParameters
// Get the list of parameters this physics engine supports // Get the list of parameters this physics engine supports
public PhysParameterEntry[] GetParameterList() public PhysParameterEntry[] GetParameterList()
{ {
BuildParameterTable();
return SettableParameters; return SettableParameters;
} }
@ -919,63 +1156,18 @@ public class BSScene : PhysicsScene, IPhysicsParameters
// value activated ('terrainFriction' for instance). // value activated ('terrainFriction' for instance).
public bool SetPhysicsParameter(string parm, float val, uint localID) public bool SetPhysicsParameter(string parm, float val, uint localID)
{ {
bool ret = true; bool ret = false;
string lparm = parm.ToLower(); ParameterDefn theParam;
switch (lparm) if (TryGetParameter(parm, out theParam))
{ {
case "detailedstats": m_detailedStatsStep = (int)val; break; theParam.setter(this, parm, localID, val);
ret = true;
case "meshlod": m_meshLOD = (int)val; break;
case "sculptlod": m_sculptLOD = (int)val; break;
case "maxsubstep": m_maxSubSteps = (int)val; break;
case "fixedtimestep": m_fixedTimeStep = val; break;
case "maxobjectmass": m_maximumObjectMass = val; break;
case "defaultfriction": m_params[0].defaultFriction = val; break;
case "defaultdensity": m_params[0].defaultDensity = val; break;
case "defaultrestitution": m_params[0].defaultRestitution = val; break;
case "collisionmargin": m_params[0].collisionMargin = val; break;
case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, localID, val); break;
case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break;
case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break;
case "deactivationtime": UpdateParameterPrims(ref m_params[0].deactivationTime, lparm, localID, val); break;
case "linearsleepingthreshold": UpdateParameterPrims(ref m_params[0].linearSleepingThreshold, lparm, localID, val); break;
case "angularsleepingthreshold": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break;
case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break;
case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break;
case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break;
// the following are used only at initialization time so setting them makes no sense
// case "maxPersistantmanifoldpoolSize": m_params[0].maxPersistantManifoldPoolSize = val; break;
// case "shoulddisablecontactpooldynamicallocation": m_params[0].shouldDisableContactPoolDynamicAllocation = val; break;
// case "shouldforceupdateallaabbs": m_params[0].shouldForceUpdateAllAabbs = val; break;
// case "shouldrandomizesolverorder": m_params[0].shouldRandomizeSolverOrder = val; break;
// case "shouldsplitsimulationislands": m_params[0].shouldSplitSimulationIslands = val; break;
// case "shouldenablefrictioncaching": m_params[0].shouldEnableFrictionCaching = val; break;
// case "numberofsolveriterations": m_params[0].numberOfSolverIterations = val; break;
case "friction": TaintedUpdateParameter(lparm, localID, val); break;
case "restitution": TaintedUpdateParameter(lparm, localID, val); break;
// set a terrain physical feature and cause terrain to be recalculated
case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break;
case "terrainhitfraction": m_params[0].terrainHitFraction = val; TaintedUpdateParameter("terrain", 0, val); break;
case "terrainrestitution": m_params[0].terrainRestitution = val; TaintedUpdateParameter("terrain", 0, val); break;
// set an avatar physical feature and cause avatar(s) to be recalculated
case "avatarfriction": UpdateParameterAvatars(ref m_params[0].avatarFriction, "avatar", localID, val); break;
case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break;
case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break;
case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break;
case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break;
case "avatarcontactprocessingthreshold": UpdateParameterAvatars(ref m_params[0].avatarContactProcessingThreshold, "avatar", localID, val); break;
default: ret = false; break;
} }
return ret; return ret;
} }
// check to see if we are updating a parameter for a particular or all of the prims // check to see if we are updating a parameter for a particular or all of the prims
private void UpdateParameterPrims(ref float loc, string parm, uint localID, float val) protected void UpdateParameterPrims(ref float loc, string parm, uint localID, float val)
{ {
List<uint> operateOn; List<uint> operateOn;
lock (m_prims) operateOn = new List<uint>(m_prims.Keys); lock (m_prims) operateOn = new List<uint>(m_prims.Keys);
@ -983,7 +1175,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
} }
// check to see if we are updating a parameter for a particular or all of the avatars // check to see if we are updating a parameter for a particular or all of the avatars
private void UpdateParameterAvatars(ref float loc, string parm, uint localID, float val) protected void UpdateParameterAvatars(ref float loc, string parm, uint localID, float val)
{ {
List<uint> operateOn; List<uint> operateOn;
lock (m_avatars) operateOn = new List<uint>(m_avatars.Keys); lock (m_avatars) operateOn = new List<uint>(m_avatars.Keys);
@ -994,7 +1186,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
// If the local ID is APPLY_TO_NONE, just change the default value // If the local ID is APPLY_TO_NONE, just change the default value
// If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
// If the localID is a specific object, apply the parameter change to only that object // If the localID is a specific object, apply the parameter change to only that object
private void UpdateParameterSet(List<uint> lIDs, ref float defaultLoc, string parm, uint localID, float val) protected void UpdateParameterSet(List<uint> lIDs, ref float defaultLoc, string parm, uint localID, float val)
{ {
switch (localID) switch (localID)
{ {
@ -1021,7 +1213,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
} }
// schedule the actual updating of the paramter to when the phys engine is not busy // schedule the actual updating of the paramter to when the phys engine is not busy
private void TaintedUpdateParameter(string parm, uint localID, float val) protected void TaintedUpdateParameter(string parm, uint localID, float val)
{ {
uint xlocalID = localID; uint xlocalID = localID;
string xparm = parm.ToLower(); string xparm = parm.ToLower();
@ -1036,50 +1228,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters
public bool GetPhysicsParameter(string parm, out float value) public bool GetPhysicsParameter(string parm, out float value)
{ {
float val = 0f; float val = 0f;
bool ret = true; bool ret = false;
switch (parm.ToLower()) ParameterDefn theParam;
if (TryGetParameter(parm, out theParam))
{ {
case "detailedstats": val = (int)m_detailedStatsStep; break; val = theParam.getter(this);
case "meshlod": val = (float)m_meshLOD; break; ret = true;
case "sculptlod": val = (float)m_sculptLOD; break;
case "maxsubstep": val = (float)m_maxSubSteps; break;
case "fixedtimestep": val = m_fixedTimeStep; break;
case "maxobjectmass": val = m_maximumObjectMass; break;
case "defaultfriction": val = m_params[0].defaultFriction; break;
case "defaultdensity": val = m_params[0].defaultDensity; break;
case "defaultrestitution": val = m_params[0].defaultRestitution; break;
case "collisionmargin": val = m_params[0].collisionMargin; break;
case "gravity": val = m_params[0].gravity; break;
case "lineardamping": val = m_params[0].linearDamping; break;
case "angulardamping": val = m_params[0].angularDamping; break;
case "deactivationtime": val = m_params[0].deactivationTime; break;
case "linearsleepingthreshold": val = m_params[0].linearSleepingThreshold; break;
case "angularsleepingthreshold": val = m_params[0].angularDamping; break;
case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break;
case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break;
case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break;
case "maxPersistantmanifoldpoolSize": val = m_params[0].maxPersistantManifoldPoolSize; break;
case "shoulddisablecontactpooldynamicallocation": val = m_params[0].shouldDisableContactPoolDynamicAllocation; break;
case "shouldforceupdateallaabbs": val = m_params[0].shouldForceUpdateAllAabbs; break;
case "shouldrandomizesolverorder": val = m_params[0].shouldRandomizeSolverOrder; break;
case "shouldsplitsimulationislands": val = m_params[0].shouldSplitSimulationIslands; break;
case "shouldenablefrictioncaching": val = m_params[0].shouldEnableFrictionCaching; break;
case "numberofsolveriterations": val = m_params[0].numberOfSolverIterations; break;
case "terrainfriction": val = m_params[0].terrainFriction; break;
case "terrainhitfraction": val = m_params[0].terrainHitFraction; break;
case "terrainrestitution": val = m_params[0].terrainRestitution; break;
case "avatarfriction": val = m_params[0].avatarFriction; break;
case "avatardensity": val = m_params[0].avatarDensity; break;
case "avatarrestitution": val = m_params[0].avatarRestitution; break;
case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break;
case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break;
case "avatarcontactprocessingthreshold": val = m_params[0].avatarContactProcessingThreshold; break;
default: ret = false; break;
} }
value = val; value = val;
return ret; return ret;

View File

@ -32,6 +32,28 @@ using OpenMetaverse;
namespace OpenSim.Region.Physics.BulletSPlugin { namespace OpenSim.Region.Physics.BulletSPlugin {
// Classes to allow some type checking for the API
public struct BulletSim
{
public BulletSim(uint id, IntPtr xx) { ID = id; Ptr = xx; }
public IntPtr Ptr;
public uint ID;
}
public struct BulletBody
{
public BulletBody(uint id, IntPtr xx) { ID = id; Ptr = xx; }
public IntPtr Ptr;
public uint ID;
}
public struct BulletConstraint
{
public BulletConstraint(IntPtr xx) { Ptr = xx; }
public IntPtr Ptr;
}
// ===============================================================================
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct ConvexHull public struct ConvexHull
{ {
@ -142,6 +164,11 @@ public struct ConfigurationParameters
public float shouldEnableFrictionCaching; public float shouldEnableFrictionCaching;
public float numberOfSolverIterations; public float numberOfSolverIterations;
public float linkConstraintUseFrameOffset;
public float linkConstraintEnableTransMotor;
public float linkConstraintTransMotorMaxVel;
public float linkConstraintTransMotorMaxForce;
public const float numericTrue = 1f; public const float numericTrue = 1f;
public const float numericFalse = 0f; public const float numericFalse = 0f;
} }
@ -162,6 +189,7 @@ public enum CollisionFlags : uint
PHYSICAL_OBJECT = 1 << 12, PHYSICAL_OBJECT = 1 << 12,
}; };
// ===============================================================================
static class BulletSimAPI { static class BulletSimAPI {
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@ -211,6 +239,7 @@ public static extern bool DestroyMesh(uint worldID, System.UInt64 meshKey);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool CreateObject(uint worldID, ShapeData shapeData); public static extern bool CreateObject(uint worldID, ShapeData shapeData);
/* Remove old functionality
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern void CreateLinkset(uint worldID, int objectCount, ShapeData[] shapeDatas); public static extern void CreateLinkset(uint worldID, int objectCount, ShapeData[] shapeDatas);
@ -225,6 +254,7 @@ public static extern bool RemoveConstraintByID(uint worldID, uint id1);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool RemoveConstraint(uint worldID, uint id1, uint id2); public static extern bool RemoveConstraint(uint worldID, uint id1, uint id2);
*/
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Vector3 GetObjectPosition(uint WorldID, uint id); public static extern Vector3 GetObjectPosition(uint WorldID, uint id);
@ -350,8 +380,22 @@ public static extern IntPtr CreateObject2(IntPtr sim, ShapeData shapeData);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr CreateConstraint2(IntPtr sim, IntPtr obj1, IntPtr obj2, public static extern IntPtr CreateConstraint2(IntPtr sim, IntPtr obj1, IntPtr obj2,
Vector3 frame1loc, Quaternion frame1rot, Vector3 frame1loc, Quaternion frame1rot,
Vector3 frame2loc, Quaternion frame2rot, Vector3 frame2loc, Quaternion frame2rot);
Vector3 lowLinear, Vector3 hiLinear, Vector3 lowAngular, Vector3 hiAngular);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool UseFrameOffset2(IntPtr constrain, float enable);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool CalculateTransforms2(IntPtr constrain);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool DestroyConstraint2(IntPtr sim, IntPtr constrain); public static extern bool DestroyConstraint2(IntPtr sim, IntPtr constrain);

View File

@ -290,7 +290,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private readonly IntPtr contactgroup; private readonly IntPtr contactgroup;
internal IntPtr LandGeom;
internal IntPtr WaterGeom; internal IntPtr WaterGeom;
private float nmTerrainContactFriction = 255.0f; private float nmTerrainContactFriction = 255.0f;
@ -489,6 +488,8 @@ namespace OpenSim.Region.Physics.OdePlugin
/// </summary> /// </summary>
internal Object OdeLock = new Object(); internal Object OdeLock = new Object();
private bool _worldInitialized = false;
public IMesher mesher; public IMesher mesher;
private IConfigSource m_config; private IConfigSource m_config;
@ -875,6 +876,8 @@ namespace OpenSim.Region.Physics.OdePlugin
staticPrimspace[i, j] = IntPtr.Zero; staticPrimspace[i, j] = IntPtr.Zero;
} }
} }
_worldInitialized = true;
} }
// internal void waitForSpaceUnlock(IntPtr space) // internal void waitForSpaceUnlock(IntPtr space)
@ -1508,8 +1511,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f)
&& (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f)
&& (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)))
&& contactGeom.g1 != LandGeom && contactGeom.g2 != LandGeom)
{ {
if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f) if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f)
{ {
@ -1538,7 +1540,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//d.GeomGetAABB(contactGeom.g2, out aabb2); //d.GeomGetAABB(contactGeom.g2, out aabb2);
//d.GeomGetAABB(contactGeom.g1, out aabb1); //d.GeomGetAABB(contactGeom.g1, out aabb1);
//aabb1. //aabb1.
if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)) && contactGeom.g1 != LandGeom && contactGeom.g2 != LandGeom) if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)))
{ {
if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z) if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z)
{ {
@ -2896,6 +2898,8 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <returns>The number of frames simulated over that period.</returns> /// <returns>The number of frames simulated over that period.</returns>
public override float Simulate(float timeStep) public override float Simulate(float timeStep)
{ {
if (!_worldInitialized) return 11f;
int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0;
int tempTick = 0, tempTick2 = 0; int tempTick = 0, tempTick2 = 0;
@ -4017,6 +4021,8 @@ namespace OpenSim.Region.Physics.OdePlugin
public override void Dispose() public override void Dispose()
{ {
_worldInitialized = false;
m_rayCastManager.Dispose(); m_rayCastManager.Dispose();
m_rayCastManager = null; m_rayCastManager = null;
@ -4037,6 +4043,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.WorldDestroy(world); d.WorldDestroy(world);
//d.CloseODE(); //d.CloseODE();
} }
} }
public override Dictionary<uint, float> GetTopColliders() public override Dictionary<uint, float> GetTopColliders()

View File

@ -99,6 +99,8 @@ namespace OpenSim.Region.RegionCombinerModule
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
lock (m_startingScenes)
m_startingScenes.Remove(scene.RegionInfo.originRegionID);
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)

View File

@ -31,6 +31,7 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared;

View File

@ -3290,8 +3290,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
((LSL_Api)m_LSL_Api).llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName)); ((LSL_Api)m_LSL_Api).llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName));
throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName)); throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName));
return;
} }
ScenePresence sp = World.GetScenePresence(avatarId); ScenePresence sp = World.GetScenePresence(avatarId);
@ -3336,5 +3334,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID test; UUID test;
return UUID.TryParse(thing, out test) ? 1 : 0; return UUID.TryParse(thing, out test) ? 1 : 0;
} }
/// <summary>
/// Wraps to Math.Min()
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public LSL_Float osMin(double a, double b)
{
CheckThreatLevel(ThreatLevel.None, "osMin");
m_host.AddScriptLPS(1);
return Math.Min(a, b);
}
/// <summary>
/// Wraps to Math.max()
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public LSL_Float osMax(double a, double b)
{
CheckThreatLevel(ThreatLevel.None, "osMax");
m_host.AddScriptLPS(1);
return Math.Max(a, b);
}
} }
} }

View File

@ -283,5 +283,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// <param name="thing"></param> /// <param name="thing"></param>
/// <returns>1 if thing is a valid UUID, 0 otherwise</returns> /// <returns>1 if thing is a valid UUID, 0 otherwise</returns>
LSL_Integer osIsUUID(string thing); LSL_Integer osIsUUID(string thing);
/// <summary>
/// Wraps to Math.Min()
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
LSL_Float osMin(double a, double b);
/// <summary>
/// Wraps to Math.max()
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
LSL_Float osMax(double a, double b);
} }
} }

View File

@ -935,5 +935,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
return m_OSSL_Functions.osIsUUID(thing); return m_OSSL_Functions.osIsUUID(thing);
} }
public LSL_Float osMin(double a, double b)
{
return m_OSSL_Functions.osMin(a, b);
}
public LSL_Float osMax(double a, double b)
{
return m_OSSL_Functions.osMax(a, b);
}
} }
} }

View File

@ -719,7 +719,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// If region ready has been triggered, then the region had no scripts to compile and completed its other // If region ready has been triggered, then the region had no scripts to compile and completed its other
// work. // work.
m_Scene.EventManager.OnRegionReady += s => m_InitialStartup = false; m_Scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) m_InitialStartup = false; };
if (m_SleepTime > 0) if (m_SleepTime > 0)
{ {

View File

@ -34,7 +34,7 @@ using Mono.Data.SqliteClient;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
namespace OpenSim.Region.UserStatistics namespace OpenSim.Region.UserStatistics
{ {

View File

@ -33,7 +33,7 @@ using System.Text;
using Mono.Data.SqliteClient; using Mono.Data.SqliteClient;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
namespace OpenSim.Region.UserStatistics namespace OpenSim.Region.UserStatistics

View File

@ -34,7 +34,7 @@ using System.Text.RegularExpressions;
using Mono.Data.SqliteClient; using Mono.Data.SqliteClient;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
namespace OpenSim.Region.UserStatistics namespace OpenSim.Region.UserStatistics
{ {

View File

@ -33,7 +33,7 @@ using System.Text;
using Mono.Data.SqliteClient; using Mono.Data.SqliteClient;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Monitoring;
namespace OpenSim.Region.UserStatistics namespace OpenSim.Region.UserStatistics
{ {

0
bin/Ionic.Zip.dll Normal file → Executable file
View File

View File

@ -914,6 +914,12 @@
ShouldEnableFrictionCaching = False; ShouldEnableFrictionCaching = False;
NumberOfSolverIterations = 0; NumberOfSolverIterations = 0;
; Linkset constraint parameters
LinkConstraintUseFrameOffset = False;
LinkConstraintEnableTransMotor = True;
LinkConstraintTransMotorMaxVel = 5.0;
LinkConstraintTransMotorMaxForce = 0.1;
; Whether to mesh sculpties ; Whether to mesh sculpties
MeshSculptedPrim = true MeshSculptedPrim = true
@ -931,7 +937,7 @@
FixedTimeStep = .01667 FixedTimeStep = .01667
MaxCollisionsPerFrame = 2048 MaxCollisionsPerFrame = 2048
MaxUpdatesPerFrame = 2048 MaxUpdatesPerFrame = 8192
[RemoteAdmin] [RemoteAdmin]
enabled = false enabled = false

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -112,7 +112,37 @@
</Files> </Files>
</Project> </Project>
<<<<<<< HEAD:prebuild.xml
<Project frameworkVersion="v4_0" name="OpenSim.Framework.Servers.HttpServer" path="OpenSim/Framework/Servers/HttpServer" type="Library"> <Project frameworkVersion="v4_0" name="OpenSim.Framework.Servers.HttpServer" path="OpenSim/Framework/Servers/HttpServer" type="Library">
=======
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Monitoring" path="OpenSim/Framework/Monitoring" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Servers.HttpServer" path="OpenSim/Framework/Servers/HttpServer" type="Library">
>>>>>>> master:prebuild.xml
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
<OutputPath>../../../../bin/</OutputPath> <OutputPath>../../../../bin/</OutputPath>
@ -130,6 +160,7 @@
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/> <Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
<Reference name="XMLRPC" path="../../../../bin/"/> <Reference name="XMLRPC" path="../../../../bin/"/>
@ -235,6 +266,7 @@
</Files> </Files>
</Project> </Project>
<<<<<<< HEAD:prebuild.xml
<Project frameworkVersion="v4_0" name="OpenSim.Framework.Statistics" path="OpenSim/Framework/Statistics" type="Library"> <Project frameworkVersion="v4_0" name="OpenSim.Framework.Statistics" path="OpenSim/Framework/Statistics" type="Library">
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
@ -260,6 +292,9 @@
</Project> </Project>
<Project frameworkVersion="v4_0" name="OpenSim.Data" path="OpenSim/Data" type="Library"> <Project frameworkVersion="v4_0" name="OpenSim.Data" path="OpenSim/Data" type="Library">
=======
<Project frameworkVersion="v3_5" name="OpenSim.Data" path="OpenSim/Data" type="Library">
>>>>>>> master:prebuild.xml
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
<OutputPath>../../bin/</OutputPath> <OutputPath>../../bin/</OutputPath>
@ -436,7 +471,7 @@
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Statistics"/> <Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="XMLRPC" path="../../../bin/"/> <Reference name="XMLRPC" path="../../../bin/"/>
@ -720,9 +755,9 @@
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenMetaverse" path="../../bin/"/> <Reference name="OpenMetaverse" path="../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../bin/"/>
@ -754,13 +789,13 @@
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.AssetLoader.Filesystem"/> <Reference name="OpenSim.Framework.AssetLoader.Filesystem"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
@ -806,10 +841,10 @@
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Serialization"/> <Reference name="OpenSim.Framework.Serialization"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<!-- For scripting in funny languages by default --> <!-- For scripting in funny languages by default -->
@ -1525,10 +1560,10 @@
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Serialization"/> <Reference name="OpenSim.Framework.Serialization"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Server.Base"/> <Reference name="OpenSim.Server.Base"/>
@ -1616,11 +1651,11 @@
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="XMLRPC" path="../../../bin/"/> <Reference name="XMLRPC" path="../../../bin/"/>
<Reference name="Nini" path="../../../bin/"/> <Reference name="Nini" path="../../../bin/"/>
@ -1653,15 +1688,15 @@
<Reference name="OpenMetaverseTypes" path="../../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/> <Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../../../bin/"/> <Reference name="OpenMetaverse" path="../../../../../bin/"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.ClientStack"/> <Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>
<Reference name="Nini" path="../../../../../bin/"/> <Reference name="Nini" path="../../../../../bin/"/>
<Reference name="log4net" path="../../../../../bin/"/> <Reference name="log4net" path="../../../../../bin/"/>
@ -1744,9 +1779,9 @@
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/> <Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
@ -1882,15 +1917,15 @@
<Reference name="OpenMetaverse" path="../../../bin/"/> <Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.ClientStack"/> <Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Server.Base"/> <Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Services.Base"/> <Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>
@ -2403,10 +2438,11 @@
<Reference name="OpenSim"/> <Reference name="OpenSim"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared"/> <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/> <Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/>
@ -2529,8 +2565,12 @@
</Files> </Files>
</Project> </Project>
<<<<<<< HEAD:prebuild.xml
<Project frameworkVersion="v4_0" name="OpenSim.Region.UserStatistics" path="OpenSim/Region/UserStatistics" type="Library"> <Project frameworkVersion="v4_0" name="OpenSim.Region.UserStatistics" path="OpenSim/Region/UserStatistics" type="Library">
=======
<Project frameworkVersion="v3_5" name="OpenSim.Region.UserStatistics" path="OpenSim/Region/UserStatistics" type="Library">
>>>>>>> master:prebuild.xml
<Configuration name="Debug"> <Configuration name="Debug">
<Options> <Options>
<OutputPath>../../../bin/</OutputPath> <OutputPath>../../../bin/</OutputPath>
@ -2558,9 +2598,9 @@
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="Mono.Data.SqliteClient" path="../../../bin/"/> <Reference name="Mono.Data.SqliteClient" path="../../../bin/"/>
<Reference name="Mono.Addins"/> <Reference name="Mono.Addins"/>
@ -3044,9 +3084,9 @@
<Reference name="OpenSim.Framework.Serialization"/> <Reference name="OpenSim.Framework.Serialization"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
@ -3116,9 +3156,9 @@
<Reference name="OpenSim.Framework.Serialization"/> <Reference name="OpenSim.Framework.Serialization"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.OptionalModules"/> <Reference name="OpenSim.Region.OptionalModules"/>
@ -3175,8 +3215,8 @@
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Region.ClientStack.LindenCaps"/> <Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
@ -3232,9 +3272,9 @@
<Reference name="OpenMetaverseTypes" path="../../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.ClientStack.LindenCaps"/> <Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/> <Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
@ -3269,7 +3309,7 @@
<Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Framework.Statistics"/> <Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Region.ClientStack"/> <Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/> <Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>

View File

@ -1,4 +1,42 @@
#!/bin/sh #!/bin/sh
mono bin/Prebuild.exe /target nant case "$1" in
mono bin/Prebuild.exe /target vs2008
'clean')
mono bin/Prebuild.exe /clean
;;
'autoclean')
echo y|mono bin/Prebuild.exe /clean
;;
'vs2010')
mono bin/Prebuild.exe /target vs2010
;;
'vs2008')
mono bin/Prebuild.exe /target vs2008
;;
*)
mono bin/Prebuild.exe /target nant
mono bin/Prebuild.exe /target vs2008
;;
esac