Merge branch 'master' into vehicles
commit
31a848e97b
|
@ -341,14 +341,15 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
|
|
||||||
// Actually load it
|
// Actually load it
|
||||||
INonSharedRegionModule module = null;
|
INonSharedRegionModule module = null;
|
||||||
try
|
|
||||||
{
|
Type[] ctorParamTypes = new Type[ctorArgs.Length];
|
||||||
|
for (int i = 0; i < ctorParamTypes.Length; i++)
|
||||||
|
ctorParamTypes[i] = ctorArgs[i].GetType();
|
||||||
|
|
||||||
|
if (node.Type.GetConstructor(ctorParamTypes) != null)
|
||||||
module = (INonSharedRegionModule)Activator.CreateInstance(node.Type, ctorArgs);
|
module = (INonSharedRegionModule)Activator.CreateInstance(node.Type, ctorArgs);
|
||||||
}
|
else
|
||||||
catch
|
|
||||||
{
|
|
||||||
module = (INonSharedRegionModule)Activator.CreateInstance(node.Type);
|
module = (INonSharedRegionModule)Activator.CreateInstance(node.Type);
|
||||||
}
|
|
||||||
|
|
||||||
// Check for replaceable interfaces
|
// Check for replaceable interfaces
|
||||||
Type replaceableInterface = module.ReplaceableInterface;
|
Type replaceableInterface = module.ReplaceableInterface;
|
||||||
|
|
|
@ -286,7 +286,7 @@ namespace OpenSim.Client.Linden
|
||||||
{
|
{
|
||||||
foreach (Scene nextScene in m_scenes)
|
foreach (Scene nextScene in m_scenes)
|
||||||
{
|
{
|
||||||
if (nextScene.RegionInfo.RegionName == regionName)
|
if (nextScene.RegionInfo.RegionName.Equals(regionName, StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
scene = nextScene;
|
scene = nextScene;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -52,10 +52,10 @@ namespace OpenSim.Client.MXP
|
||||||
|
|
||||||
private IConfigSource m_config;
|
private IConfigSource m_config;
|
||||||
private int m_port = 1253;
|
private int m_port = 1253;
|
||||||
|
private Timer m_ticker;
|
||||||
|
|
||||||
private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||||
private readonly Timer m_ticker = new Timer(100);
|
private bool m_shutdown;
|
||||||
private bool m_shutdown = false;
|
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
|
@ -78,6 +78,7 @@ namespace OpenSim.Client.MXP
|
||||||
|
|
||||||
m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true));
|
m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true));
|
||||||
|
|
||||||
|
m_ticker = new Timer(100);
|
||||||
m_ticker.AutoReset = false;
|
m_ticker.AutoReset = false;
|
||||||
m_ticker.Elapsed += ticker_Elapsed;
|
m_ticker.Elapsed += ticker_Elapsed;
|
||||||
|
|
||||||
|
|
|
@ -85,10 +85,7 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
|
|
||||||
m_transmitter = new Transmitter(port);
|
m_transmitter = new Transmitter(port);
|
||||||
|
|
||||||
m_clientThread = new Thread(StartListener);
|
StartListener();
|
||||||
m_clientThread.Name = "MXPThread";
|
|
||||||
m_clientThread.IsBackground = true;
|
|
||||||
m_clientThread.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartListener()
|
public void StartListener()
|
||||||
|
|
|
@ -119,14 +119,15 @@ namespace OpenSim.Data
|
||||||
|
|
||||||
PluginLoaderParamFactory<T>(connect, out pluginInitialiser, out extensionPointPath);
|
PluginLoaderParamFactory<T>(connect, out pluginInitialiser, out extensionPointPath);
|
||||||
|
|
||||||
PluginLoader<T> loader = new PluginLoader<T>(pluginInitialiser);
|
using (PluginLoader<T> loader = new PluginLoader<T>(pluginInitialiser))
|
||||||
|
{
|
||||||
|
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||||
|
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||||
|
loader.Add(extensionPointPath, new PluginProviderFilter(provider));
|
||||||
|
loader.Load();
|
||||||
|
|
||||||
// loader will try to load all providers (MySQL, MSSQL, etc)
|
return loader.Plugins;
|
||||||
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
}
|
||||||
loader.Add(extensionPointPath, new PluginProviderFilter(provider));
|
|
||||||
loader.Load();
|
|
||||||
|
|
||||||
return loader.Plugins;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
namespace OpenSim.Data
|
||||||
|
{
|
||||||
|
public class PresenceData
|
||||||
|
{
|
||||||
|
public UUID PrincipalID;
|
||||||
|
public UUID RegionID;
|
||||||
|
public Dictionary<string, object> Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An interface for connecting to the authentication datastore
|
||||||
|
/// </summary>
|
||||||
|
public interface IPresenceData
|
||||||
|
{
|
||||||
|
bool Store(PresenceData data);
|
||||||
|
|
||||||
|
PresenceData Get(UUID principalID);
|
||||||
|
|
||||||
|
bool SetDataItem(UUID principalID, string item, string value);
|
||||||
|
|
||||||
|
bool Delete(UUID regionID);
|
||||||
|
}
|
||||||
|
}
|
|
@ -167,9 +167,6 @@ namespace OpenSim.Data.MySQL
|
||||||
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset != null)
|
|
||||||
UpdateAccessTime(asset);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,22 +66,26 @@ namespace OpenSim.Data.MySQL
|
||||||
Migration m = new Migration(m_Connection, assem, "RegionStore");
|
Migration m = new Migration(m_Connection, assem, "RegionStore");
|
||||||
m.Update();
|
m.Update();
|
||||||
|
|
||||||
|
// NOTE: This is a very slow query that times out on regions with a lot of prims.
|
||||||
|
// I'm told that it is no longer relevant so it's commented out now, but if it
|
||||||
|
// is relevant it should be added as a console command instead of part of the
|
||||||
|
// startup phase
|
||||||
// Clean dropped attachments
|
// Clean dropped attachments
|
||||||
//
|
//
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
using (MySqlCommand cmd = m_Connection.CreateCommand())
|
// using (MySqlCommand cmd = m_Connection.CreateCommand())
|
||||||
{
|
// {
|
||||||
cmd.CommandText = "delete from prims, primshapes using prims " +
|
// cmd.CommandText = "delete from prims, primshapes using prims " +
|
||||||
"left join primshapes on prims.uuid = primshapes.uuid " +
|
// "left join primshapes on prims.uuid = primshapes.uuid " +
|
||||||
"where PCode = 9 and State <> 0";
|
// "where PCode = 9 and State <> 0";
|
||||||
ExecuteNonQuery(cmd);
|
// ExecuteNonQuery(cmd);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
catch (MySqlException ex)
|
//catch (MySqlException ex)
|
||||||
{
|
//{
|
||||||
m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
|
// m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IDataReader ExecuteReader(MySqlCommand c)
|
private IDataReader ExecuteReader(MySqlCommand c)
|
||||||
|
@ -1430,37 +1434,36 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
PrimitiveBaseShape s = new PrimitiveBaseShape();
|
PrimitiveBaseShape s = new PrimitiveBaseShape();
|
||||||
s.Scale = new Vector3(
|
s.Scale = new Vector3(
|
||||||
Convert.ToSingle(row["ScaleX"]),
|
(float)(double)row["ScaleX"],
|
||||||
Convert.ToSingle(row["ScaleY"]),
|
(float)(double)row["ScaleY"],
|
||||||
Convert.ToSingle(row["ScaleZ"])
|
(float)(double)row["ScaleZ"]
|
||||||
);
|
);
|
||||||
// paths
|
// paths
|
||||||
s.PCode = Convert.ToByte(row["PCode"]);
|
s.PCode = (byte)(int)row["PCode"];
|
||||||
s.PathBegin = Convert.ToUInt16(row["PathBegin"]);
|
s.PathBegin = (ushort)(int)row["PathBegin"];
|
||||||
s.PathEnd = Convert.ToUInt16(row["PathEnd"]);
|
s.PathEnd = (ushort)(int)row["PathEnd"];
|
||||||
s.PathScaleX = Convert.ToByte(row["PathScaleX"]);
|
s.PathScaleX = (byte)(int)row["PathScaleX"];
|
||||||
s.PathScaleY = Convert.ToByte(row["PathScaleY"]);
|
s.PathScaleY = (byte)(int)row["PathScaleY"];
|
||||||
s.PathShearX = Convert.ToByte(row["PathShearX"]);
|
s.PathShearX = (byte)(int)row["PathShearX"];
|
||||||
s.PathShearY = Convert.ToByte(row["PathShearY"]);
|
s.PathShearY = (byte)(int)row["PathShearY"];
|
||||||
s.PathSkew = Convert.ToSByte(row["PathSkew"]);
|
s.PathSkew = (sbyte)(int)row["PathSkew"];
|
||||||
s.PathCurve = Convert.ToByte(row["PathCurve"]);
|
s.PathCurve = (byte)(int)row["PathCurve"];
|
||||||
s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]);
|
s.PathRadiusOffset = (sbyte)(int)row["PathRadiusOffset"];
|
||||||
s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]);
|
s.PathRevolutions = (byte)(int)row["PathRevolutions"];
|
||||||
s.PathTaperX = Convert.ToSByte(row["PathTaperX"]);
|
s.PathTaperX = (sbyte)(int)row["PathTaperX"];
|
||||||
s.PathTaperY = Convert.ToSByte(row["PathTaperY"]);
|
s.PathTaperY = (sbyte)(int)row["PathTaperY"];
|
||||||
s.PathTwist = Convert.ToSByte(row["PathTwist"]);
|
s.PathTwist = (sbyte)(int)row["PathTwist"];
|
||||||
s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]);
|
s.PathTwistBegin = (sbyte)(int)row["PathTwistBegin"];
|
||||||
// profile
|
// profile
|
||||||
s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]);
|
s.ProfileBegin = (ushort)(int)row["ProfileBegin"];
|
||||||
s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
|
s.ProfileEnd = (ushort)(int)row["ProfileEnd"];
|
||||||
s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
|
s.ProfileCurve = (byte)(int)row["ProfileCurve"];
|
||||||
s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
|
s.ProfileHollow = (ushort)(int)row["ProfileHollow"];
|
||||||
byte[] textureEntry = (byte[]) row["Texture"];
|
s.TextureEntry = (byte[])row["Texture"];
|
||||||
s.TextureEntry = textureEntry;
|
|
||||||
|
|
||||||
s.ExtraParams = (byte[]) row["ExtraParams"];
|
s.ExtraParams = (byte[])row["ExtraParams"];
|
||||||
|
|
||||||
s.State = Convert.ToByte(row["State"]);
|
s.State = (byte)(int)row["State"];
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,10 @@ namespace OpenSim.Framework
|
||||||
public void ForEach(Action<IClientAPI> action)
|
public void ForEach(Action<IClientAPI> action)
|
||||||
{
|
{
|
||||||
IClientAPI[] localArray = m_array;
|
IClientAPI[] localArray = m_array;
|
||||||
Parallel.ForEach<IClientAPI>(localArray, action);
|
Parallel.For(0, localArray.Length,
|
||||||
|
delegate(int i)
|
||||||
|
{ action(localArray[i]); }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -62,7 +62,6 @@ namespace OpenSim.Framework
|
||||||
RegionInfo RegionInfo { get; }
|
RegionInfo RegionInfo { get; }
|
||||||
RegionStatus RegionStatus { get; set; }
|
RegionStatus RegionStatus { get; set; }
|
||||||
|
|
||||||
ClientManager ClientManager { get; }
|
|
||||||
IConfigSource Config { get; }
|
IConfigSource Config { get; }
|
||||||
|
|
||||||
float TimeDilation { get; }
|
float TimeDilation { get; }
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
|
@ -118,6 +118,7 @@ namespace OpenSim.Framework
|
||||||
int counter = threadCount;
|
int counter = threadCount;
|
||||||
AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
|
AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
|
||||||
IEnumerator<T> enumerator = enumerable.GetEnumerator();
|
IEnumerator<T> enumerator = enumerable.GetEnumerator();
|
||||||
|
object syncRoot = new object();
|
||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
|
|
||||||
for (int i = 0; i < threadCount; i++)
|
for (int i = 0; i < threadCount; i++)
|
||||||
|
@ -131,7 +132,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
T entry;
|
T entry;
|
||||||
|
|
||||||
lock (enumerator)
|
lock (syncRoot)
|
||||||
{
|
{
|
||||||
if (!enumerator.MoveNext())
|
if (!enumerator.MoveNext())
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -194,10 +194,15 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unregisters Mono.Addins event handlers, allowing temporary Mono.Addins
|
||||||
|
/// data to be garbage collected. Since the plugins created by this loader
|
||||||
|
/// are meant to outlive the loader itself, they must be disposed separately
|
||||||
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
foreach (T plugin in Plugins)
|
AddinManager.AddinLoadError -= on_addinloaderror_;
|
||||||
plugin.Dispose();
|
AddinManager.AddinLoaded -= on_addinloaded_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialise_plugin_dir_(string dir)
|
private void initialise_plugin_dir_(string dir)
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private static readonly Primitive.TextureEntry m_defaultTexture;
|
private static readonly byte[] DEFAULT_TEXTURE = new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f")).GetBytes();
|
||||||
|
|
||||||
private byte[] m_textureEntry;
|
private byte[] m_textureEntry;
|
||||||
|
|
||||||
|
@ -104,33 +104,32 @@ namespace OpenSim.Framework
|
||||||
private HollowShape _hollowShape;
|
private HollowShape _hollowShape;
|
||||||
|
|
||||||
// Sculpted
|
// Sculpted
|
||||||
[XmlIgnore] private UUID _sculptTexture = UUID.Zero;
|
[XmlIgnore] private UUID _sculptTexture;
|
||||||
[XmlIgnore] private byte _sculptType = (byte)0;
|
[XmlIgnore] private byte _sculptType;
|
||||||
[XmlIgnore] private byte[] _sculptData = new byte[0];
|
[XmlIgnore] private byte[] _sculptData = Utils.EmptyBytes;
|
||||||
[XmlIgnore] private Image _sculptBitmap = null;
|
|
||||||
|
|
||||||
// Flexi
|
// Flexi
|
||||||
[XmlIgnore] private int _flexiSoftness = 0;
|
[XmlIgnore] private int _flexiSoftness;
|
||||||
[XmlIgnore] private float _flexiTension = 0f;
|
[XmlIgnore] private float _flexiTension;
|
||||||
[XmlIgnore] private float _flexiDrag = 0f;
|
[XmlIgnore] private float _flexiDrag;
|
||||||
[XmlIgnore] private float _flexiGravity = 0f;
|
[XmlIgnore] private float _flexiGravity;
|
||||||
[XmlIgnore] private float _flexiWind = 0f;
|
[XmlIgnore] private float _flexiWind;
|
||||||
[XmlIgnore] private float _flexiForceX = 0f;
|
[XmlIgnore] private float _flexiForceX;
|
||||||
[XmlIgnore] private float _flexiForceY = 0f;
|
[XmlIgnore] private float _flexiForceY;
|
||||||
[XmlIgnore] private float _flexiForceZ = 0f;
|
[XmlIgnore] private float _flexiForceZ;
|
||||||
|
|
||||||
//Bright n sparkly
|
//Bright n sparkly
|
||||||
[XmlIgnore] private float _lightColorR = 0f;
|
[XmlIgnore] private float _lightColorR;
|
||||||
[XmlIgnore] private float _lightColorG = 0f;
|
[XmlIgnore] private float _lightColorG;
|
||||||
[XmlIgnore] private float _lightColorB = 0f;
|
[XmlIgnore] private float _lightColorB;
|
||||||
[XmlIgnore] private float _lightColorA = 1f;
|
[XmlIgnore] private float _lightColorA = 1.0f;
|
||||||
[XmlIgnore] private float _lightRadius = 0f;
|
[XmlIgnore] private float _lightRadius;
|
||||||
[XmlIgnore] private float _lightCutoff = 0f;
|
[XmlIgnore] private float _lightCutoff;
|
||||||
[XmlIgnore] private float _lightFalloff = 0f;
|
[XmlIgnore] private float _lightFalloff;
|
||||||
[XmlIgnore] private float _lightIntensity = 1f;
|
[XmlIgnore] private float _lightIntensity = 1.0f;
|
||||||
[XmlIgnore] private bool _flexiEntry = false;
|
[XmlIgnore] private bool _flexiEntry;
|
||||||
[XmlIgnore] private bool _lightEntry = false;
|
[XmlIgnore] private bool _lightEntry;
|
||||||
[XmlIgnore] private bool _sculptEntry = false;
|
[XmlIgnore] private bool _sculptEntry;
|
||||||
|
|
||||||
public byte ProfileCurve
|
public byte ProfileCurve
|
||||||
{
|
{
|
||||||
|
@ -172,17 +171,11 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PrimitiveBaseShape()
|
|
||||||
{
|
|
||||||
m_defaultTexture =
|
|
||||||
new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PrimitiveBaseShape()
|
public PrimitiveBaseShape()
|
||||||
{
|
{
|
||||||
PCode = (byte) PCodeEnum.Primitive;
|
PCode = (byte) PCodeEnum.Primitive;
|
||||||
ExtraParams = new byte[1];
|
ExtraParams = new byte[1];
|
||||||
Textures = m_defaultTexture;
|
m_textureEntry = DEFAULT_TEXTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimitiveBaseShape(bool noShape)
|
public PrimitiveBaseShape(bool noShape)
|
||||||
|
@ -192,7 +185,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
PCode = (byte)PCodeEnum.Primitive;
|
PCode = (byte)PCodeEnum.Primitive;
|
||||||
ExtraParams = new byte[1];
|
ExtraParams = new byte[1];
|
||||||
Textures = m_defaultTexture;
|
m_textureEntry = DEFAULT_TEXTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
|
@ -577,15 +570,6 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image SculptBitmap {
|
|
||||||
get {
|
|
||||||
return _sculptBitmap;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_sculptBitmap = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int FlexiSoftness {
|
public int FlexiSoftness {
|
||||||
get {
|
get {
|
||||||
return _flexiSoftness;
|
return _flexiSoftness;
|
||||||
|
|
|
@ -1559,15 +1559,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
m_log.Info("[HTTPD]: Starting up HTTP Server");
|
m_log.Info("[HTTPD]: Starting up HTTP Server");
|
||||||
|
|
||||||
//m_workerThread = new Thread(new ThreadStart(StartHTTP));
|
|
||||||
//m_workerThread.Name = "HttpThread";
|
|
||||||
//m_workerThread.IsBackground = true;
|
|
||||||
//m_workerThread.Start();
|
|
||||||
//ThreadTracker.Add(m_workerThread);
|
|
||||||
StartHTTP();
|
StartHTTP();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartHTTP()
|
private void StartHTTP()
|
||||||
|
|
|
@ -50,8 +50,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
m_WorkerThreadCount = pWorkerThreadCount;
|
m_WorkerThreadCount = pWorkerThreadCount;
|
||||||
m_workerThreads = new Thread[m_WorkerThreadCount];
|
m_workerThreads = new Thread[m_WorkerThreadCount];
|
||||||
m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
|
m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
|
||||||
m_watcherThread = new Thread(ThreadStart);
|
|
||||||
|
|
||||||
|
|
||||||
//startup worker threads
|
//startup worker threads
|
||||||
for (uint i=0;i<m_WorkerThreadCount;i++)
|
for (uint i=0;i<m_WorkerThreadCount;i++)
|
||||||
|
@ -65,11 +63,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
m_workerThreads[i].Start();
|
m_workerThreads[i].Start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//start watcher threads
|
//start watcher threads
|
||||||
|
m_watcherThread = new Thread(ThreadStart);
|
||||||
m_watcherThread.Name = "PollServiceWatcherThread";
|
m_watcherThread.Name = "PollServiceWatcherThread";
|
||||||
m_watcherThread.Start();
|
m_watcherThread.Start();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ReQueueEvent(PollServiceHttpRequest req)
|
internal void ReQueueEvent(PollServiceHttpRequest req)
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
public class VersionInfo
|
public class VersionInfo
|
||||||
{
|
{
|
||||||
private const string VERSION_NUMBER = "0.6.7";
|
private const string VERSION_NUMBER = "0.6.8";
|
||||||
private const Flavour VERSION_FLAVOUR = Flavour.RC1;
|
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||||
|
|
||||||
public enum Flavour
|
public enum Flavour
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,8 +69,6 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Util
|
public class Util
|
||||||
{
|
{
|
||||||
private static SmartThreadPool m_ThreadPool = null;
|
|
||||||
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private static uint nextXferID = 5000;
|
private static uint nextXferID = 5000;
|
||||||
|
@ -79,6 +77,9 @@ namespace OpenSim.Framework
|
||||||
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
|
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
|
||||||
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
|
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
|
||||||
private static object XferLock = new object();
|
private static object XferLock = new object();
|
||||||
|
/// <summary>Thread pool used for Util.FireAndForget if
|
||||||
|
/// FireAndForgetMethod.SmartThreadPool is used</summary>
|
||||||
|
private static SmartThreadPool m_ThreadPool;
|
||||||
|
|
||||||
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
|
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
|
||||||
private static readonly DateTime unixEpoch =
|
private static readonly DateTime unixEpoch =
|
||||||
|
@ -1319,21 +1320,14 @@ namespace OpenSim.Framework
|
||||||
FireAndForget(callback, null);
|
FireAndForget(callback, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetMaxThreads(int maxThreads)
|
public static void InitThreadPool(int maxThreads)
|
||||||
{
|
{
|
||||||
|
if (maxThreads < 2)
|
||||||
|
throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2");
|
||||||
if (m_ThreadPool != null)
|
if (m_ThreadPool != null)
|
||||||
return;
|
throw new InvalidOperationException("SmartThreadPool is already initialized");
|
||||||
|
|
||||||
STPStartInfo startInfo = new STPStartInfo();
|
m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2);
|
||||||
startInfo.IdleTimeout = 2000; // 2 seconds
|
|
||||||
startInfo.MaxWorkerThreads = maxThreads;
|
|
||||||
startInfo.MinWorkerThreads = 2;
|
|
||||||
startInfo.StackSize = 524288;
|
|
||||||
startInfo.ThreadPriority = ThreadPriority.Normal;
|
|
||||||
|
|
||||||
startInfo.StartSuspended = false;
|
|
||||||
|
|
||||||
m_ThreadPool = new SmartThreadPool(startInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
|
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
|
||||||
|
@ -1341,20 +1335,22 @@ namespace OpenSim.Framework
|
||||||
switch (FireAndForgetMethod)
|
switch (FireAndForgetMethod)
|
||||||
{
|
{
|
||||||
case FireAndForgetMethod.UnsafeQueueUserWorkItem:
|
case FireAndForgetMethod.UnsafeQueueUserWorkItem:
|
||||||
System.Threading.ThreadPool.UnsafeQueueUserWorkItem(callback, obj);
|
ThreadPool.UnsafeQueueUserWorkItem(callback, obj);
|
||||||
break;
|
break;
|
||||||
case FireAndForgetMethod.QueueUserWorkItem:
|
case FireAndForgetMethod.QueueUserWorkItem:
|
||||||
System.Threading.ThreadPool.QueueUserWorkItem(callback, obj);
|
ThreadPool.QueueUserWorkItem(callback, obj);
|
||||||
break;
|
break;
|
||||||
case FireAndForgetMethod.BeginInvoke:
|
case FireAndForgetMethod.BeginInvoke:
|
||||||
FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
|
FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
|
||||||
wrapper.FireAndForget(callback, obj);
|
wrapper.FireAndForget(callback, obj);
|
||||||
break;
|
break;
|
||||||
case FireAndForgetMethod.SmartThreadPool:
|
case FireAndForgetMethod.SmartThreadPool:
|
||||||
m_ThreadPool.QueueWorkItem(delegate(object o) { callback(o); return null; }, obj);
|
if (m_ThreadPool == null)
|
||||||
|
m_ThreadPool = new SmartThreadPool(2000, 15, 2);
|
||||||
|
m_ThreadPool.QueueWorkItem(SmartThreadPoolCallback, new object[] { callback, obj });
|
||||||
break;
|
break;
|
||||||
case FireAndForgetMethod.Thread:
|
case FireAndForgetMethod.Thread:
|
||||||
System.Threading.Thread thread = new System.Threading.Thread(delegate(object o) { callback(o); });
|
Thread thread = new Thread(delegate(object o) { callback(o); });
|
||||||
thread.Start(obj);
|
thread.Start(obj);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1362,6 +1358,16 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static object SmartThreadPoolCallback(object o)
|
||||||
|
{
|
||||||
|
object[] array = (object[])o;
|
||||||
|
WaitCallback callback = (WaitCallback)array[0];
|
||||||
|
object obj = array[1];
|
||||||
|
|
||||||
|
callback(obj);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion FireAndForget Threading Pattern
|
#endregion FireAndForget Threading Pattern
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,183 @@
|
||||||
|
/*
|
||||||
|
* 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.Threading;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Manages launching threads and keeping watch over them for timeouts
|
||||||
|
/// </summary>
|
||||||
|
public static class Watchdog
|
||||||
|
{
|
||||||
|
/// <summary>Timer interval in milliseconds for the watchdog timer</summary>
|
||||||
|
const double WATCHDOG_INTERVAL_MS = 2500.0d;
|
||||||
|
/// <summary>Maximum timeout in milliseconds before a thread is considered dead</summary>
|
||||||
|
const int WATCHDOG_TIMEOUT_MS = 5000;
|
||||||
|
|
||||||
|
[System.Diagnostics.DebuggerDisplay("{Thread.Name}")]
|
||||||
|
private class ThreadWatchdogInfo
|
||||||
|
{
|
||||||
|
public Thread Thread;
|
||||||
|
public int LastTick;
|
||||||
|
|
||||||
|
public ThreadWatchdogInfo(Thread thread)
|
||||||
|
{
|
||||||
|
Thread = thread;
|
||||||
|
LastTick = Environment.TickCount & Int32.MaxValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This event is called whenever a tracked thread is stopped or
|
||||||
|
/// has not called UpdateThread() in time
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="thread">The thread that has been identified as dead</param>
|
||||||
|
/// <param name="lastTick">The last time this thread called UpdateThread()</param>
|
||||||
|
public delegate void WatchdogTimeout(Thread thread, int lastTick);
|
||||||
|
|
||||||
|
/// <summary>This event is called whenever a tracked thread is
|
||||||
|
/// stopped or has not called UpdateThread() in time</summary>
|
||||||
|
public static event WatchdogTimeout OnWatchdogTimeout;
|
||||||
|
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
private static Dictionary<int, ThreadWatchdogInfo> m_threads;
|
||||||
|
private static System.Timers.Timer m_watchdogTimer;
|
||||||
|
|
||||||
|
static Watchdog()
|
||||||
|
{
|
||||||
|
m_threads = new Dictionary<int, ThreadWatchdogInfo>();
|
||||||
|
m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS);
|
||||||
|
m_watchdogTimer.AutoReset = false;
|
||||||
|
m_watchdogTimer.Elapsed += WatchdogTimerElapsed;
|
||||||
|
m_watchdogTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start a new thread that is tracked by the watchdog timer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="start">The method that will be executed in a new thread</param>
|
||||||
|
/// <param name="name">A name to give to the new thread</param>
|
||||||
|
/// <param name="priority">Priority to run the thread at</param>
|
||||||
|
/// <param name="isBackground">True to run this thread as a background
|
||||||
|
/// thread, otherwise false</param>
|
||||||
|
/// <returns>The newly created Thread object</returns>
|
||||||
|
public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground)
|
||||||
|
{
|
||||||
|
Thread thread = new Thread(start);
|
||||||
|
thread.Name = name;
|
||||||
|
thread.Priority = priority;
|
||||||
|
thread.IsBackground = isBackground;
|
||||||
|
thread.Start();
|
||||||
|
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Marks the current thread as alive
|
||||||
|
/// </summary>
|
||||||
|
public static void UpdateThread()
|
||||||
|
{
|
||||||
|
UpdateThread(Thread.CurrentThread.ManagedThreadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops watchdog tracking on the current thread
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the thread was removed from the list of tracked
|
||||||
|
/// threads, otherwise false</returns>
|
||||||
|
public static bool RemoveThread()
|
||||||
|
{
|
||||||
|
return RemoveThread(Thread.CurrentThread.ManagedThreadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddThread(ThreadWatchdogInfo threadInfo)
|
||||||
|
{
|
||||||
|
m_log.Debug("[WATCHDOG]: Started tracking thread \"" + threadInfo.Thread.Name + "\" (ID " + threadInfo.Thread.ManagedThreadId + ")");
|
||||||
|
|
||||||
|
lock (m_threads)
|
||||||
|
m_threads.Add(threadInfo.Thread.ManagedThreadId, threadInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool RemoveThread(int threadID)
|
||||||
|
{
|
||||||
|
lock (m_threads)
|
||||||
|
return m_threads.Remove(threadID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UpdateThread(int threadID)
|
||||||
|
{
|
||||||
|
ThreadWatchdogInfo threadInfo;
|
||||||
|
|
||||||
|
// Although TryGetValue is not a thread safe operation, we use a try/catch here instead
|
||||||
|
// of a lock for speed. Adding/removing threads is a very rare operation compared to
|
||||||
|
// UpdateThread(), and a single UpdateThread() failure here and there won't break
|
||||||
|
// anything
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (m_threads.TryGetValue(threadID, out threadInfo))
|
||||||
|
threadInfo.LastTick = Environment.TickCount & Int32.MaxValue;
|
||||||
|
else
|
||||||
|
AddThread(new ThreadWatchdogInfo(Thread.CurrentThread));
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
WatchdogTimeout callback = OnWatchdogTimeout;
|
||||||
|
|
||||||
|
if (callback != null)
|
||||||
|
{
|
||||||
|
ThreadWatchdogInfo timedOut = null;
|
||||||
|
|
||||||
|
lock (m_threads)
|
||||||
|
{
|
||||||
|
int now = Environment.TickCount & Int32.MaxValue;
|
||||||
|
|
||||||
|
foreach (ThreadWatchdogInfo threadInfo in m_threads.Values)
|
||||||
|
{
|
||||||
|
if (threadInfo.Thread.ThreadState == ThreadState.Stopped || now - threadInfo.LastTick >= WATCHDOG_TIMEOUT_MS)
|
||||||
|
{
|
||||||
|
timedOut = threadInfo;
|
||||||
|
m_threads.Remove(threadInfo.Thread.ManagedThreadId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timedOut != null)
|
||||||
|
callback(timedOut.Thread, timedOut.LastTick);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_watchdogTimer.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,7 +29,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Timers;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -115,11 +114,11 @@ namespace OpenSim.Grid.GridServer
|
||||||
|
|
||||||
protected virtual void LoadPlugins()
|
protected virtual void LoadPlugins()
|
||||||
{
|
{
|
||||||
PluginLoader<IGridPlugin> loader =
|
using (PluginLoader<IGridPlugin> loader = new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this)))
|
||||||
new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this));
|
{
|
||||||
|
loader.Load("/OpenSim/GridServer");
|
||||||
loader.Load("/OpenSim/GridServer");
|
m_plugins = loader.Plugins;
|
||||||
m_plugins = loader.Plugins;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ShutdownSpecific()
|
public override void ShutdownSpecific()
|
||||||
|
|
|
@ -78,8 +78,6 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
private OpenSim.Framework.BlockingQueue<PresenceNotification> m_NotifyQueue =
|
private OpenSim.Framework.BlockingQueue<PresenceNotification> m_NotifyQueue =
|
||||||
new OpenSim.Framework.BlockingQueue<PresenceNotification>();
|
new OpenSim.Framework.BlockingQueue<PresenceNotification>();
|
||||||
|
|
||||||
Thread m_NotifyThread;
|
|
||||||
|
|
||||||
private IGridServiceCore m_core;
|
private IGridServiceCore m_core;
|
||||||
|
|
||||||
public event AgentLocationDelegate OnAgentLocation;
|
public event AgentLocationDelegate OnAgentLocation;
|
||||||
|
@ -96,8 +94,8 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
{
|
{
|
||||||
m_core = core;
|
m_core = core;
|
||||||
m_core.RegisterInterface<MessageServersConnector>(this);
|
m_core.RegisterInterface<MessageServersConnector>(this);
|
||||||
m_NotifyThread = new Thread(new ThreadStart(NotifyQueueRunner));
|
|
||||||
m_NotifyThread.Start();
|
Watchdog.StartThread(NotifyQueueRunner, "NotifyQueueRunner", ThreadPriority.Normal, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -427,6 +425,8 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
{
|
{
|
||||||
TellMessageServersAboutUserLogoffInternal(presence.agentID);
|
TellMessageServersAboutUserLogoffInternal(presence.agentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim
|
||||||
|
|
||||||
IConfig startupConfig = m_config.Source.Configs["Startup"];
|
IConfig startupConfig = m_config.Source.Configs["Startup"];
|
||||||
|
|
||||||
Util.SetMaxThreads(startupConfig.GetInt("MaxPoolThreads", 15));
|
int stpMaxThreads = 15;
|
||||||
|
|
||||||
if (startupConfig != null)
|
if (startupConfig != null)
|
||||||
{
|
{
|
||||||
|
@ -100,8 +100,13 @@ namespace OpenSim
|
||||||
FireAndForgetMethod asyncCallMethod;
|
FireAndForgetMethod asyncCallMethod;
|
||||||
if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
|
if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
|
||||||
Util.FireAndForgetMethod = asyncCallMethod;
|
Util.FireAndForgetMethod = asyncCallMethod;
|
||||||
|
|
||||||
|
stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
|
||||||
|
Util.InitThreadPool(stpMaxThreads);
|
||||||
|
|
||||||
m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
|
m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +172,9 @@ namespace OpenSim
|
||||||
m_scriptTimer.Elapsed += RunAutoTimerScript;
|
m_scriptTimer.Elapsed += RunAutoTimerScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hook up to the watchdog timer
|
||||||
|
Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
|
||||||
|
|
||||||
PrintFileToConsole("startuplogo.txt");
|
PrintFileToConsole("startuplogo.txt");
|
||||||
|
|
||||||
// For now, start at the 'root' level by default
|
// For now, start at the 'root' level by default
|
||||||
|
@ -379,6 +387,14 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void WatchdogTimeoutHandler(System.Threading.Thread thread, int lastTick)
|
||||||
|
{
|
||||||
|
int now = Environment.TickCount & Int32.MaxValue;
|
||||||
|
|
||||||
|
m_log.ErrorFormat("[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago",
|
||||||
|
thread.Name, thread.ThreadState, now - lastTick);
|
||||||
|
}
|
||||||
|
|
||||||
#region Console Commands
|
#region Console Commands
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -954,12 +970,12 @@ namespace OpenSim
|
||||||
m_sceneManager.ForEachScene(
|
m_sceneManager.ForEachScene(
|
||||||
delegate(Scene scene)
|
delegate(Scene scene)
|
||||||
{
|
{
|
||||||
scene.ClientManager.ForEachSync(
|
scene.ForEachClient(
|
||||||
delegate(IClientAPI client)
|
delegate(IClientAPI client)
|
||||||
{
|
{
|
||||||
connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n",
|
connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n",
|
||||||
scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode);
|
scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode);
|
||||||
}
|
}, false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -162,11 +162,11 @@ namespace OpenSim
|
||||||
|
|
||||||
protected virtual void LoadPlugins()
|
protected virtual void LoadPlugins()
|
||||||
{
|
{
|
||||||
PluginLoader<IApplicationPlugin> loader =
|
using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this)))
|
||||||
new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this));
|
{
|
||||||
|
loader.Load("/OpenSim/Startup");
|
||||||
loader.Load("/OpenSim/Startup");
|
m_plugins = loader.Plugins;
|
||||||
m_plugins = loader.Plugins;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<string> GetHelpTopics()
|
protected override List<string> GetHelpTopics()
|
||||||
|
|
|
@ -346,15 +346,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
protected int m_terrainCheckerCount;
|
protected int m_terrainCheckerCount;
|
||||||
protected uint m_agentFOVCounter;
|
protected uint m_agentFOVCounter;
|
||||||
|
|
||||||
// These numbers are guesses at a decent tradeoff between responsiveness
|
|
||||||
// of the interest list and throughput. Lower is more responsive, higher
|
|
||||||
// is better throughput
|
|
||||||
protected int m_primTerseUpdatesPerPacket = 25;
|
|
||||||
protected int m_primFullUpdatesPerPacket = 100;
|
|
||||||
protected int m_avatarTerseUpdatesPerPacket = 10;
|
|
||||||
/// <summary>Number of texture packets to put on the queue each time the
|
|
||||||
/// OnQueueEmpty event is triggered for the texture category</summary>
|
|
||||||
protected int m_textureSendLimit = 20;
|
|
||||||
protected IAssetService m_assetService;
|
protected IAssetService m_assetService;
|
||||||
private IHyperAssetService m_hyperAssets;
|
private IHyperAssetService m_hyperAssets;
|
||||||
|
|
||||||
|
@ -2114,12 +2105,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
|
public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
|
||||||
{
|
{
|
||||||
ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
|
ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
|
||||||
packet.Effect = effectBlocks;
|
packet.Header.Reliable = false;
|
||||||
|
packet.Header.Zerocoded = true;
|
||||||
|
|
||||||
packet.AgentData.AgentID = AgentId;
|
packet.AgentData.AgentID = AgentId;
|
||||||
packet.AgentData.SessionID = SessionId;
|
packet.AgentData.SessionID = SessionId;
|
||||||
packet.Header.Reliable = false;
|
|
||||||
packet.Header.Zerocoded = true;
|
packet.Effect = effectBlocks;
|
||||||
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.State);
|
OutPacket(packet, ThrottleOutPacketType.State);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3333,7 +3326,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
lock (m_avatarTerseUpdates.SyncRoot)
|
lock (m_avatarTerseUpdates.SyncRoot)
|
||||||
{
|
{
|
||||||
int count = Math.Min(m_avatarTerseUpdates.Count, m_avatarTerseUpdatesPerPacket);
|
int count = Math.Min(m_avatarTerseUpdates.Count, m_udpServer.AvatarTerseUpdatesPerPacket);
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -3418,7 +3411,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
lock (m_primFullUpdates.SyncRoot)
|
lock (m_primFullUpdates.SyncRoot)
|
||||||
{
|
{
|
||||||
int count = Math.Min(m_primFullUpdates.Count, m_primFullUpdatesPerPacket);
|
int count = Math.Min(m_primFullUpdates.Count, m_udpServer.PrimFullUpdatesPerPacket);
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -3462,7 +3455,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
lock (m_primTerseUpdates.SyncRoot)
|
lock (m_primTerseUpdates.SyncRoot)
|
||||||
{
|
{
|
||||||
int count = Math.Min(m_primTerseUpdates.Count, m_primTerseUpdatesPerPacket);
|
int count = Math.Min(m_primTerseUpdates.Count, m_udpServer.PrimTerseUpdatesPerPacket);
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -3585,7 +3578,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
void ProcessTextureRequests()
|
void ProcessTextureRequests()
|
||||||
{
|
{
|
||||||
if (m_imageManager != null)
|
if (m_imageManager != null)
|
||||||
m_imageManager.ProcessImageQueue(m_textureSendLimit);
|
m_imageManager.ProcessImageQueue(m_udpServer.TextureSendLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
|
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
|
||||||
|
@ -4167,6 +4160,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
pack.Data = dataBlock;
|
pack.Data = dataBlock;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pack.Data = new ParcelObjectOwnersReplyPacket.DataBlock[0];
|
||||||
|
}
|
||||||
pack.Header.Zerocoded = true;
|
pack.Header.Zerocoded = true;
|
||||||
this.OutPacket(pack, ThrottleOutPacketType.Task);
|
this.OutPacket(pack, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
@ -4434,6 +4431,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
protected virtual void RegisterLocalPacketHandlers()
|
protected virtual void RegisterLocalPacketHandlers()
|
||||||
{
|
{
|
||||||
AddLocalPacketHandler(PacketType.LogoutRequest, Logout);
|
AddLocalPacketHandler(PacketType.LogoutRequest, Logout);
|
||||||
|
AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate);
|
||||||
AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect);
|
AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect);
|
||||||
AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached);
|
AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached);
|
||||||
AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate);
|
AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate);
|
||||||
|
@ -4446,6 +4444,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
#region Packet Handlers
|
#region Packet Handlers
|
||||||
|
|
||||||
|
private bool HandleAgentUpdate(IClientAPI sener, Packet Pack)
|
||||||
|
{
|
||||||
|
if (OnAgentUpdate != null)
|
||||||
|
{
|
||||||
|
bool update = false;
|
||||||
|
AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
|
||||||
|
|
||||||
|
#region Packet Session and User Check
|
||||||
|
if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId)
|
||||||
|
return false;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
|
||||||
|
|
||||||
|
// We can only check when we have something to check
|
||||||
|
// against.
|
||||||
|
|
||||||
|
if (lastarg != null)
|
||||||
|
{
|
||||||
|
update =
|
||||||
|
(
|
||||||
|
(x.BodyRotation != lastarg.BodyRotation) ||
|
||||||
|
(x.CameraAtAxis != lastarg.CameraAtAxis) ||
|
||||||
|
(x.CameraCenter != lastarg.CameraCenter) ||
|
||||||
|
(x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
|
||||||
|
(x.CameraUpAxis != lastarg.CameraUpAxis) ||
|
||||||
|
(x.ControlFlags != lastarg.ControlFlags) ||
|
||||||
|
(x.Far != lastarg.Far) ||
|
||||||
|
(x.Flags != lastarg.Flags) ||
|
||||||
|
(x.State != lastarg.State) ||
|
||||||
|
(x.HeadRotation != lastarg.HeadRotation) ||
|
||||||
|
(x.SessionID != lastarg.SessionID) ||
|
||||||
|
(x.AgentID != lastarg.AgentID)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
update = true;
|
||||||
|
|
||||||
|
// These should be ordered from most-likely to
|
||||||
|
// least likely to change. I've made an initial
|
||||||
|
// guess at that.
|
||||||
|
|
||||||
|
if (update)
|
||||||
|
{
|
||||||
|
AgentUpdateArgs arg = new AgentUpdateArgs();
|
||||||
|
arg.AgentID = x.AgentID;
|
||||||
|
arg.BodyRotation = x.BodyRotation;
|
||||||
|
arg.CameraAtAxis = x.CameraAtAxis;
|
||||||
|
arg.CameraCenter = x.CameraCenter;
|
||||||
|
arg.CameraLeftAxis = x.CameraLeftAxis;
|
||||||
|
arg.CameraUpAxis = x.CameraUpAxis;
|
||||||
|
arg.ControlFlags = x.ControlFlags;
|
||||||
|
arg.Far = x.Far;
|
||||||
|
arg.Flags = x.Flags;
|
||||||
|
arg.HeadRotation = x.HeadRotation;
|
||||||
|
arg.SessionID = x.SessionID;
|
||||||
|
arg.State = x.State;
|
||||||
|
UpdateAgent handlerAgentUpdate = OnAgentUpdate;
|
||||||
|
lastarg = arg; // save this set of arguments for nexttime
|
||||||
|
if (handlerAgentUpdate != null)
|
||||||
|
OnAgentUpdate(this, arg);
|
||||||
|
|
||||||
|
handlerAgentUpdate = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack)
|
private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack)
|
||||||
{
|
{
|
||||||
MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack;
|
MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack;
|
||||||
|
@ -5631,77 +5698,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketType.AgentUpdate:
|
|
||||||
if (OnAgentUpdate != null)
|
|
||||||
{
|
|
||||||
bool update = false;
|
|
||||||
AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
|
|
||||||
|
|
||||||
#region Packet Session and User Check
|
|
||||||
if (m_checkPackets)
|
|
||||||
{
|
|
||||||
if (agenUpdate.AgentData.SessionID != SessionId ||
|
|
||||||
agenUpdate.AgentData.AgentID != AgentId)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
|
|
||||||
|
|
||||||
// We can only check when we have something to check
|
|
||||||
// against.
|
|
||||||
|
|
||||||
if (lastarg != null)
|
|
||||||
{
|
|
||||||
update =
|
|
||||||
(
|
|
||||||
(x.BodyRotation != lastarg.BodyRotation) ||
|
|
||||||
(x.CameraAtAxis != lastarg.CameraAtAxis) ||
|
|
||||||
(x.CameraCenter != lastarg.CameraCenter) ||
|
|
||||||
(x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
|
|
||||||
(x.CameraUpAxis != lastarg.CameraUpAxis) ||
|
|
||||||
(x.ControlFlags != lastarg.ControlFlags) ||
|
|
||||||
(x.Far != lastarg.Far) ||
|
|
||||||
(x.Flags != lastarg.Flags) ||
|
|
||||||
(x.State != lastarg.State) ||
|
|
||||||
(x.HeadRotation != lastarg.HeadRotation) ||
|
|
||||||
(x.SessionID != lastarg.SessionID) ||
|
|
||||||
(x.AgentID != lastarg.AgentID)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
update = true;
|
|
||||||
|
|
||||||
// These should be ordered from most-likely to
|
|
||||||
// least likely to change. I've made an initial
|
|
||||||
// guess at that.
|
|
||||||
|
|
||||||
if (update)
|
|
||||||
{
|
|
||||||
AgentUpdateArgs arg = new AgentUpdateArgs();
|
|
||||||
arg.AgentID = x.AgentID;
|
|
||||||
arg.BodyRotation = x.BodyRotation;
|
|
||||||
arg.CameraAtAxis = x.CameraAtAxis;
|
|
||||||
arg.CameraCenter = x.CameraCenter;
|
|
||||||
arg.CameraLeftAxis = x.CameraLeftAxis;
|
|
||||||
arg.CameraUpAxis = x.CameraUpAxis;
|
|
||||||
arg.ControlFlags = x.ControlFlags;
|
|
||||||
arg.Far = x.Far;
|
|
||||||
arg.Flags = x.Flags;
|
|
||||||
arg.HeadRotation = x.HeadRotation;
|
|
||||||
arg.SessionID = x.SessionID;
|
|
||||||
arg.State = x.State;
|
|
||||||
UpdateAgent handlerAgentUpdate = OnAgentUpdate;
|
|
||||||
lastarg = arg; // save this set of arguments for nexttime
|
|
||||||
if (handlerAgentUpdate != null)
|
|
||||||
OnAgentUpdate(this, arg);
|
|
||||||
|
|
||||||
handlerAgentUpdate = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PacketType.AgentAnimation:
|
case PacketType.AgentAnimation:
|
||||||
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
|
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
|
||||||
|
|
||||||
|
@ -6762,11 +6758,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (OnRequestTexture != null)
|
if (OnRequestTexture != null)
|
||||||
{
|
{
|
||||||
TextureRequestArgs args = new TextureRequestArgs();
|
TextureRequestArgs args = new TextureRequestArgs();
|
||||||
args.RequestedAssetID = imageRequest.RequestImage[i].Image;
|
|
||||||
args.DiscardLevel = imageRequest.RequestImage[i].DiscardLevel;
|
RequestImagePacket.RequestImageBlock block = imageRequest.RequestImage[i];
|
||||||
args.PacketNumber = imageRequest.RequestImage[i].Packet;
|
|
||||||
args.Priority = imageRequest.RequestImage[i].DownloadPriority;
|
args.RequestedAssetID = block.Image;
|
||||||
|
args.DiscardLevel = block.DiscardLevel;
|
||||||
|
args.PacketNumber = block.Packet;
|
||||||
|
args.Priority = block.DownloadPriority;
|
||||||
args.requestSequence = imageRequest.Header.Sequence;
|
args.requestSequence = imageRequest.Header.Sequence;
|
||||||
|
|
||||||
|
// NOTE: This is not a built in part of the LLUDP protocol, but we double the
|
||||||
|
// priority of avatar textures to get avatars rezzing in faster than the
|
||||||
|
// surrounding scene
|
||||||
|
if ((ImageType)block.Type == ImageType.Baked)
|
||||||
|
args.Priority *= 2.0f;
|
||||||
|
|
||||||
//handlerTextureRequest = OnRequestTexture;
|
//handlerTextureRequest = OnRequestTexture;
|
||||||
|
|
||||||
//if (handlerTextureRequest != null)
|
//if (handlerTextureRequest != null)
|
||||||
|
|
|
@ -304,8 +304,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
int total = resend + land + wind + cloud + task + texture + asset + state;
|
int total = resend + land + wind + cloud + task + texture + asset + state;
|
||||||
|
|
||||||
m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, State={8}, Total={9}",
|
//m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, State={8}, Total={9}",
|
||||||
AgentID, resend, land, wind, cloud, task, texture, asset, state, total);
|
// AgentID, resend, land, wind, cloud, task, texture, asset, state, total);
|
||||||
|
|
||||||
// Update the token buckets with new throttle values
|
// Update the token buckets with new throttle values
|
||||||
TokenBucket bucket;
|
TokenBucket bucket;
|
||||||
|
@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
|
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
|
||||||
TokenBucket bucket = m_throttleCategories[category];
|
TokenBucket bucket = m_throttleCategories[category];
|
||||||
|
|
||||||
if (m_throttleCategories[category].RemoveTokens(packet.Buffer.DataLength))
|
if (bucket.RemoveTokens(packet.Buffer.DataLength))
|
||||||
{
|
{
|
||||||
// Enough tokens were removed from the bucket, the packet will not be queued
|
// Enough tokens were removed from the bucket, the packet will not be queued
|
||||||
return false;
|
return false;
|
||||||
|
@ -497,15 +497,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
|
SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
|
||||||
}
|
}
|
||||||
|
|
||||||
RTO = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
|
int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
|
||||||
|
|
||||||
// Clamp the retransmission timeout to manageable values
|
// Clamp the retransmission timeout to manageable values
|
||||||
RTO = Utils.Clamp(RTO, 3000, 10000);
|
rto = Utils.Clamp(RTO, 3000, 60000);
|
||||||
|
|
||||||
|
RTO = rto;
|
||||||
|
|
||||||
//m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " +
|
//m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " +
|
||||||
// RTTVAR + " based on new RTT of " + r + "ms");
|
// RTTVAR + " based on new RTT of " + r + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Exponential backoff of the retransmission timeout, per section 5.5
|
||||||
|
/// of RFC 2988
|
||||||
|
/// </summary>
|
||||||
|
public void BackoffRTO()
|
||||||
|
{
|
||||||
|
// Reset SRTT and RTTVAR, we assume they are bogus since things
|
||||||
|
// didn't work out and we're backing off the timeout
|
||||||
|
SRTT = 0.0f;
|
||||||
|
RTTVAR = 0.0f;
|
||||||
|
|
||||||
|
// Double the retransmission timeout
|
||||||
|
RTO = Math.Min(RTO * 2, 60000);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does an early check to see if this queue empty callback is already
|
/// Does an early check to see if this queue empty callback is already
|
||||||
/// running, then asynchronously firing the event
|
/// running, then asynchronously firing the event
|
||||||
|
|
|
@ -98,6 +98,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
/// <summary>The measured resolution of Environment.TickCount</summary>
|
/// <summary>The measured resolution of Environment.TickCount</summary>
|
||||||
public readonly float TickCountResolution;
|
public readonly float TickCountResolution;
|
||||||
|
/// <summary>Number of terse prim updates to put on the queue each time the
|
||||||
|
/// OnQueueEmpty event is triggered for updates</summary>
|
||||||
|
public readonly int PrimTerseUpdatesPerPacket;
|
||||||
|
/// <summary>Number of terse avatar updates to put on the queue each time the
|
||||||
|
/// OnQueueEmpty event is triggered for updates</summary>
|
||||||
|
public readonly int AvatarTerseUpdatesPerPacket;
|
||||||
|
/// <summary>Number of full prim updates to put on the queue each time the
|
||||||
|
/// OnQueueEmpty event is triggered for updates</summary>
|
||||||
|
public readonly int PrimFullUpdatesPerPacket;
|
||||||
|
/// <summary>Number of texture packets to put on the queue each time the
|
||||||
|
/// OnQueueEmpty event is triggered for textures</summary>
|
||||||
|
public readonly int TextureSendLimit;
|
||||||
|
|
||||||
/// <summary>Handlers for incoming packets</summary>
|
/// <summary>Handlers for incoming packets</summary>
|
||||||
//PacketEventDictionary packetEvents = new PacketEventDictionary();
|
//PacketEventDictionary packetEvents = new PacketEventDictionary();
|
||||||
|
@ -172,6 +184,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_asyncPacketHandling = config.GetBoolean("async_packet_handling", false);
|
m_asyncPacketHandling = config.GetBoolean("async_packet_handling", false);
|
||||||
m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0);
|
m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0);
|
||||||
sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0);
|
sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0);
|
||||||
|
|
||||||
|
PrimTerseUpdatesPerPacket = config.GetInt("PrimTerseUpdatesPerPacket", 25);
|
||||||
|
AvatarTerseUpdatesPerPacket = config.GetInt("AvatarTerseUpdatesPerPacket", 10);
|
||||||
|
PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100);
|
||||||
|
TextureSendLimit = config.GetInt("TextureSendLimit", 20);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrimTerseUpdatesPerPacket = 25;
|
||||||
|
AvatarTerseUpdatesPerPacket = 10;
|
||||||
|
PrimFullUpdatesPerPacket = 100;
|
||||||
|
TextureSendLimit = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps);
|
m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps);
|
||||||
|
@ -187,14 +211,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
base.Start(m_recvBufferSize, m_asyncPacketHandling);
|
base.Start(m_recvBufferSize, m_asyncPacketHandling);
|
||||||
|
|
||||||
// Start the incoming packet processing thread
|
// Start the packet processing threads
|
||||||
Thread incomingThread = new Thread(IncomingPacketHandler);
|
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||||
incomingThread.Name = "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")";
|
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||||
incomingThread.Start();
|
|
||||||
|
|
||||||
Thread outgoingThread = new Thread(OutgoingPacketHandler);
|
|
||||||
outgoingThread.Name = "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")";
|
|
||||||
outgoingThread.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public new void Stop()
|
public new void Stop()
|
||||||
|
@ -243,7 +262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
for (int i = 0; i < packetCount; i++)
|
for (int i = 0; i < packetCount; i++)
|
||||||
{
|
{
|
||||||
byte[] data = datas[i];
|
byte[] data = datas[i];
|
||||||
m_scene.ClientManager.ForEach(
|
m_scene.ForEachClient(
|
||||||
delegate(IClientAPI client)
|
delegate(IClientAPI client)
|
||||||
{
|
{
|
||||||
if (client is LLClientView)
|
if (client is LLClientView)
|
||||||
|
@ -255,7 +274,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byte[] data = packet.ToBytes();
|
byte[] data = packet.ToBytes();
|
||||||
m_scene.ClientManager.ForEach(
|
m_scene.ForEachClient(
|
||||||
delegate(IClientAPI client)
|
delegate(IClientAPI client)
|
||||||
{
|
{
|
||||||
if (client is LLClientView)
|
if (client is LLClientView)
|
||||||
|
@ -412,6 +431,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
|
m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
|
||||||
|
|
||||||
|
// Exponential backoff of the retransmission timeout
|
||||||
|
udpClient.BackoffRTO();
|
||||||
|
|
||||||
// Resend packets
|
// Resend packets
|
||||||
for (int i = 0; i < expiredPackets.Count; i++)
|
for (int i = 0; i < expiredPackets.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -548,27 +570,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// UseCircuitCode handling
|
// UseCircuitCode handling
|
||||||
if (packet.Type == PacketType.UseCircuitCode)
|
if (packet.Type == PacketType.UseCircuitCode)
|
||||||
{
|
{
|
||||||
Util.FireAndForget(
|
m_log.Debug("[LLUDPSERVER]: Handling UseCircuitCode packet from " + buffer.RemoteEndPoint);
|
||||||
delegate(object o)
|
object[] array = new object[] { buffer, packet };
|
||||||
{
|
|
||||||
IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
|
|
||||||
|
|
||||||
// Begin the process of adding the client to the simulator
|
if (m_asyncPacketHandling)
|
||||||
AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint);
|
Util.FireAndForget(HandleUseCircuitCode, array);
|
||||||
|
else
|
||||||
|
HandleUseCircuitCode(array);
|
||||||
|
|
||||||
// Acknowledge the UseCircuitCode packet
|
|
||||||
SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine which agent this packet came from
|
// Determine which agent this packet came from
|
||||||
IClientAPI client;
|
IClientAPI client;
|
||||||
if (!m_scene.ClientManager.TryGetValue(address, out client) || !(client is LLClientView))
|
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
|
||||||
{
|
{
|
||||||
m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address +
|
m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
||||||
" in " + m_scene.RegionInfo.RegionName + ", currently tracking " + m_scene.ClientManager.Count + " clients");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,6 +687,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
packetInbox.Enqueue(new IncomingPacket(udpClient, packet));
|
packetInbox.Enqueue(new IncomingPacket(udpClient, packet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleUseCircuitCode(object o)
|
||||||
|
{
|
||||||
|
object[] array = (object[])o;
|
||||||
|
UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
|
||||||
|
UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1];
|
||||||
|
|
||||||
|
IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
|
||||||
|
|
||||||
|
// Begin the process of adding the client to the simulator
|
||||||
|
AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint);
|
||||||
|
|
||||||
|
// Acknowledge the UseCircuitCode packet
|
||||||
|
SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
|
||||||
|
}
|
||||||
|
|
||||||
private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
|
private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
|
||||||
{
|
{
|
||||||
PacketAckPacket ack = new PacketAckPacket();
|
PacketAckPacket ack = new PacketAckPacket();
|
||||||
|
@ -731,8 +763,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
// Create the LLUDPClient
|
// Create the LLUDPClient
|
||||||
LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint);
|
LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint);
|
||||||
|
IClientAPI existingClient;
|
||||||
|
|
||||||
if (!m_scene.ClientManager.ContainsKey(agentID))
|
if (!m_scene.TryGetClient(agentID, out existingClient))
|
||||||
{
|
{
|
||||||
// Create the LLClientView
|
// Create the LLClientView
|
||||||
LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
|
LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
|
||||||
|
@ -752,7 +785,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
// Remove this client from the scene
|
// Remove this client from the scene
|
||||||
IClientAPI client;
|
IClientAPI client;
|
||||||
if (m_scene.ClientManager.TryGetValue(udpClient.AgentID, out client))
|
if (m_scene.TryGetClient(udpClient.AgentID, out client))
|
||||||
client.Close();
|
client.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,11 +808,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
|
m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetInbox.Count > 0)
|
if (packetInbox.Count > 0)
|
||||||
m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count + " packets");
|
m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count + " packets");
|
||||||
packetInbox.Clear();
|
packetInbox.Clear();
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OutgoingPacketHandler()
|
private void OutgoingPacketHandler()
|
||||||
|
@ -788,6 +825,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// on to en-US to avoid number parsing issues
|
// on to en-US to avoid number parsing issues
|
||||||
Culture.SetCurrentCulture();
|
Culture.SetCurrentCulture();
|
||||||
|
|
||||||
|
// Typecast the function to an Action<IClientAPI> once here to avoid allocating a new
|
||||||
|
// Action generic every round
|
||||||
|
Action<IClientAPI> clientPacketHandler = ClientOutgoingPacketHandler;
|
||||||
|
|
||||||
while (base.IsRunning)
|
while (base.IsRunning)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -836,18 +877,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
// Handle outgoing packets, resends, acknowledgements, and pings for each
|
// Handle outgoing packets, resends, acknowledgements, and pings for each
|
||||||
// client. m_packetSent will be set to true if a packet is sent
|
// client. m_packetSent will be set to true if a packet is sent
|
||||||
m_scene.ClientManager.ForEachSync(ClientOutgoingPacketHandler);
|
m_scene.ForEachClient(clientPacketHandler, false);
|
||||||
|
|
||||||
// If nothing was sent, sleep for the minimum amount of time before a
|
// If nothing was sent, sleep for the minimum amount of time before a
|
||||||
// token bucket could get more tokens
|
// token bucket could get more tokens
|
||||||
if (!m_packetSent)
|
if (!m_packetSent)
|
||||||
Thread.Sleep((int)TickCountResolution);
|
Thread.Sleep((int)TickCountResolution);
|
||||||
|
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex);
|
m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClientOutgoingPacketHandler(IClientAPI client)
|
private void ClientOutgoingPacketHandler(IClientAPI client)
|
||||||
|
@ -897,7 +942,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure this client is still alive
|
// Make sure this client is still alive
|
||||||
if (m_scene.ClientManager.TryGetValue(udpClient.AgentID, out client))
|
if (m_scene.TryGetClient(udpClient.AgentID, out client))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,9 +38,20 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
public class XferModule : IRegionModule, IXfer
|
public class XferModule : IRegionModule, IXfer
|
||||||
{
|
{
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>();
|
||||||
|
private List<XferRequest> RequestTime = new List<XferRequest>();
|
||||||
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
|
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
|
||||||
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
|
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
|
||||||
|
|
||||||
|
|
||||||
|
public struct XferRequest
|
||||||
|
{
|
||||||
|
public IClientAPI remoteClient;
|
||||||
|
public ulong xferID;
|
||||||
|
public string fileName;
|
||||||
|
public DateTime timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region IRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
|
@ -86,6 +97,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
NewFiles.Add(fileName, data);
|
NewFiles.Add(fileName, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Requests.ContainsKey(fileName))
|
||||||
|
{
|
||||||
|
RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName);
|
||||||
|
Requests.Remove(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +123,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
/// <param name="fileName"></param>
|
/// <param name="fileName"></param>
|
||||||
public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
|
public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
|
||||||
{
|
{
|
||||||
|
|
||||||
lock (NewFiles)
|
lock (NewFiles)
|
||||||
{
|
{
|
||||||
if (NewFiles.ContainsKey(fileName))
|
if (NewFiles.ContainsKey(fileName))
|
||||||
|
@ -114,6 +131,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
{
|
{
|
||||||
byte[] fileData = NewFiles[fileName];
|
byte[] fileData = NewFiles[fileName];
|
||||||
XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
|
XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
|
||||||
|
|
||||||
Transfers.Add(xferID, transaction);
|
Transfers.Add(xferID, transaction);
|
||||||
NewFiles.Remove(fileName);
|
NewFiles.Remove(fileName);
|
||||||
|
|
||||||
|
@ -123,6 +141,30 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (RequestTime.Count > 0)
|
||||||
|
{
|
||||||
|
TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks);
|
||||||
|
if (ts.TotalSeconds > 30)
|
||||||
|
{
|
||||||
|
Requests.Remove(RequestTime[0].fileName);
|
||||||
|
RequestTime.RemoveAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Requests.ContainsKey(fileName))
|
||||||
|
{
|
||||||
|
XferRequest nRequest = new XferRequest();
|
||||||
|
nRequest.remoteClient = remoteClient;
|
||||||
|
nRequest.xferID = xferID;
|
||||||
|
nRequest.fileName = fileName;
|
||||||
|
nRequest.timeStamp = DateTime.UtcNow;
|
||||||
|
Requests.Add(fileName, nRequest);
|
||||||
|
RequestTime.Add(nRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +219,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
||||||
Array.Copy(Data, 0, transferData, 4, Data.Length);
|
Array.Copy(Data, 0, transferData, 4, Data.Length);
|
||||||
Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
|
Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
|
||||||
|
|
||||||
complete = true;
|
complete = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -96,12 +96,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool foundResult = false;
|
bool foundResult = false;
|
||||||
string resultstring = "";
|
string resultstring = String.Empty;
|
||||||
List<ScenePresence> allav = DeadAvatar.Scene.GetScenePresences();
|
ScenePresence[] allav = DeadAvatar.Scene.GetScenePresences();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (ScenePresence av in allav)
|
for (int i = 0; i < allav.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence av = allav[i];
|
||||||
|
|
||||||
if (av.LocalId == killerObjectLocalID)
|
if (av.LocalId == killerObjectLocalID)
|
||||||
{
|
{
|
||||||
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
|
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
|
||||||
|
|
|
@ -85,10 +85,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||||
|
|
||||||
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
|
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
|
||||||
{
|
{
|
||||||
List<ScenePresence> presenceList = m_scene.GetScenePresences();
|
ScenePresence[] presenceList = m_scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence presence in presenceList)
|
for (int i = 0; i < presenceList.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presenceList[i];
|
||||||
|
|
||||||
if (presence.Firstname == firstName && presence.Lastname == lastName)
|
if (presence.Firstname == firstName && presence.Lastname == lastName)
|
||||||
{
|
{
|
||||||
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||||
|
@ -99,10 +101,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||||
|
|
||||||
public void SendGeneralAlert(string message)
|
public void SendGeneralAlert(string message)
|
||||||
{
|
{
|
||||||
List<ScenePresence> presenceList = m_scene.GetScenePresences();
|
ScenePresence[] presenceList = m_scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence presence in presenceList)
|
for (int i = 0; i < presenceList.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presenceList[i];
|
||||||
|
|
||||||
if (!presence.IsChildAgent)
|
if (!presence.IsChildAgent)
|
||||||
presence.ControllingClient.SendAlertMessage(message);
|
presence.ControllingClient.SendAlertMessage(message);
|
||||||
}
|
}
|
||||||
|
@ -150,10 +154,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||||
public void SendNotificationToUsersInRegion(
|
public void SendNotificationToUsersInRegion(
|
||||||
UUID fromAvatarID, string fromAvatarName, string message)
|
UUID fromAvatarID, string fromAvatarName, string message)
|
||||||
{
|
{
|
||||||
List<ScenePresence> presenceList = m_scene.GetScenePresences();
|
ScenePresence[] presences = m_scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence presence in presenceList)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presences[i];
|
||||||
if (!presence.IsChildAgent)
|
if (!presence.IsChildAgent)
|
||||||
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
|
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
||||||
{
|
{
|
||||||
string reasonStr = Utils.BytesToString(reason);
|
string reasonStr = Utils.BytesToString(reason);
|
||||||
|
|
||||||
m_scene.ClientManager.ForEach(
|
m_scene.ForEachClient(
|
||||||
delegate(IClientAPI controller)
|
delegate(IClientAPI controller)
|
||||||
{
|
{
|
||||||
if (controller.AgentId != godID)
|
if (controller.AgentId != godID)
|
||||||
|
|
|
@ -274,8 +274,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
}
|
}
|
||||||
m_RootAgents[agentID] = scene;
|
m_RootAgents[agentID] = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
// inform messaging server that agent changed the region
|
// inform messaging server that agent changed the region
|
||||||
NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
|
Util.FireAndForget(
|
||||||
|
delegate(object o)
|
||||||
|
{
|
||||||
|
NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEconomyDataRequest(UUID agentID)
|
private void OnEconomyDataRequest(UUID agentID)
|
||||||
|
|
|
@ -1208,10 +1208,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
||||||
if (homeScene.TryGetAvatar(avatarId,out avatar))
|
if (homeScene.TryGetAvatar(avatarId,out avatar))
|
||||||
{
|
{
|
||||||
KillAUser ku = new KillAUser(avatar,mod);
|
KillAUser ku = new KillAUser(avatar,mod);
|
||||||
Thread ta = new Thread(ku.ShutdownNoLogout);
|
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true);
|
||||||
ta.IsBackground = true;
|
|
||||||
ta.Name = "ShutdownThread";
|
|
||||||
ta.Start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1261,7 +1258,13 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
||||||
|
|
||||||
avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false;
|
avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false;
|
||||||
|
|
||||||
Thread.Sleep(30000);
|
int sleepMS = 30000;
|
||||||
|
while (sleepMS > 0)
|
||||||
|
{
|
||||||
|
Watchdog.UpdateThread();
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
sleepMS -= 1000;
|
||||||
|
}
|
||||||
|
|
||||||
// test for child agent because they might have come back
|
// test for child agent because they might have come back
|
||||||
if (avToBeKilled.IsChildAgent)
|
if (avToBeKilled.IsChildAgent)
|
||||||
|
@ -1270,6 +1273,8 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
||||||
avToBeKilled.ControllingClient.Close();
|
avToBeKilled.ControllingClient.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
if (m_repliesRequired == 0)
|
if (m_repliesRequired == 0)
|
||||||
{
|
{
|
||||||
m_requestState = RequestState.Completed;
|
m_requestState = RequestState.Completed;
|
||||||
PerformAssetsRequestCallback();
|
PerformAssetsRequestCallback(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,9 +246,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
// We want to stop using the asset cache thread asap
|
// We want to stop using the asset cache thread asap
|
||||||
// as we now need to do the work of producing the rest of the archive
|
// as we now need to do the work of producing the rest of the archive
|
||||||
Thread newThread = new Thread(PerformAssetsRequestCallback);
|
Util.FireAndForget(PerformAssetsRequestCallback);
|
||||||
newThread.Name = "OpenSimulator archiving thread post assets receipt";
|
|
||||||
newThread.Start();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -265,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform the callback on the original requester of the assets
|
/// Perform the callback on the original requester of the assets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void PerformAssetsRequestCallback()
|
protected void PerformAssetsRequestCallback(object o)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -414,9 +414,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
|
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
|
||||||
{
|
{
|
||||||
// Get a fresh list that will not change as people get teleported away
|
// Get a fresh list that will not change as people get teleported away
|
||||||
List<ScenePresence> prescences = m_scene.GetScenePresences();
|
ScenePresence[] presences = m_scene.GetScenePresences();
|
||||||
foreach (ScenePresence p in prescences)
|
|
||||||
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence p = presences[i];
|
||||||
|
|
||||||
if (p.UUID != senderID)
|
if (p.UUID != senderID)
|
||||||
{
|
{
|
||||||
// make sure they are still there, we could be working down a long list
|
// make sure they are still there, we could be working down a long list
|
||||||
|
|
|
@ -264,10 +264,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
avatar.ControllingClient.SendAlertMessage(
|
avatar.ControllingClient.SendAlertMessage(
|
||||||
"You are not allowed on this parcel because you are banned. Please go away.");
|
"You are not allowed on this parcel because you are banned. Please go away.");
|
||||||
|
|
||||||
avatar.PhysicsActor.Position =
|
avatar.PhysicsActor.Position = avatar.lastKnownAllowedPosition;
|
||||||
new PhysicsVector(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y,
|
avatar.PhysicsActor.Velocity = Vector3.Zero;
|
||||||
avatar.lastKnownAllowedPosition.Z);
|
|
||||||
avatar.PhysicsActor.Velocity = new PhysicsVector(0, 0, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,27 +98,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
}
|
}
|
||||||
terrainRenderer.Initialise(m_scene, m_config);
|
terrainRenderer.Initialise(m_scene, m_config);
|
||||||
|
|
||||||
Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize);
|
using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize))
|
||||||
//long t = System.Environment.TickCount;
|
{
|
||||||
//for (int i = 0; i < 10; ++i) {
|
//long t = System.Environment.TickCount;
|
||||||
|
//for (int i = 0; i < 10; ++i) {
|
||||||
terrainRenderer.TerrainToBitmap(mapbmp);
|
terrainRenderer.TerrainToBitmap(mapbmp);
|
||||||
//}
|
//}
|
||||||
//t = System.Environment.TickCount - t;
|
//t = System.Environment.TickCount - t;
|
||||||
//m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
|
//m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
|
||||||
|
|
||||||
|
|
||||||
if (drawPrimVolume)
|
if (drawPrimVolume)
|
||||||
{
|
{
|
||||||
DrawObjectVolume(m_scene, mapbmp);
|
DrawObjectVolume(m_scene, mapbmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
imageData = OpenJPEG.EncodeFromImage(mapbmp, true);
|
imageData = OpenJPEG.EncodeFromImage(mapbmp, true);
|
||||||
}
|
}
|
||||||
catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
|
catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
|
||||||
{
|
{
|
||||||
m_log.Error("Failed generating terrain map: " + e);
|
m_log.Error("Failed generating terrain map: " + e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return imageData;
|
return imageData;
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg";
|
private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg";
|
||||||
|
private static readonly UUID STOP_UUID = UUID.Random();
|
||||||
private static readonly string m_mapLayerPath = "0001/";
|
private static readonly string m_mapLayerPath = "0001/";
|
||||||
|
|
||||||
private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
|
private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
|
||||||
|
@ -74,7 +74,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>();
|
private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>();
|
||||||
private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>();
|
private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>();
|
||||||
private List<UUID> m_rootAgents = new List<UUID>();
|
private List<UUID> m_rootAgents = new List<UUID>();
|
||||||
private Thread mapItemReqThread;
|
|
||||||
private volatile bool threadrunning = false;
|
private volatile bool threadrunning = false;
|
||||||
|
|
||||||
//private int CacheRegionsDistance = 256;
|
//private int CacheRegionsDistance = 256;
|
||||||
|
@ -338,13 +337,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
{
|
{
|
||||||
if (threadrunning) return;
|
if (threadrunning) return;
|
||||||
threadrunning = true;
|
threadrunning = true;
|
||||||
|
|
||||||
m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread");
|
m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread");
|
||||||
mapItemReqThread = new Thread(new ThreadStart(process));
|
|
||||||
mapItemReqThread.IsBackground = true;
|
Watchdog.StartThread(process, "MapItemRequestThread", ThreadPriority.BelowNormal, true);
|
||||||
mapItemReqThread.Name = "MapItemRequestThread";
|
|
||||||
mapItemReqThread.Priority = ThreadPriority.BelowNormal;
|
|
||||||
mapItemReqThread.SetApartmentState(ApartmentState.MTA);
|
|
||||||
mapItemReqThread.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -353,7 +349,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
private void StopThread()
|
private void StopThread()
|
||||||
{
|
{
|
||||||
MapRequestState st = new MapRequestState();
|
MapRequestState st = new MapRequestState();
|
||||||
st.agentID=UUID.Zero;
|
st.agentID=STOP_UUID;
|
||||||
st.EstateID=0;
|
st.EstateID=0;
|
||||||
st.flags=0;
|
st.flags=0;
|
||||||
st.godlike=false;
|
st.godlike=false;
|
||||||
|
@ -441,26 +437,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
MapRequestState st = requests.Dequeue();
|
MapRequestState st = requests.Dequeue(1000);
|
||||||
|
|
||||||
// end gracefully
|
// end gracefully
|
||||||
if (st.agentID == UUID.Zero)
|
if (st.agentID == STOP_UUID)
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (st.agentID != UUID.Zero)
|
||||||
|
{
|
||||||
|
bool dorequest = true;
|
||||||
|
lock (m_rootAgents)
|
||||||
|
{
|
||||||
|
if (!m_rootAgents.Contains(st.agentID))
|
||||||
|
dorequest = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dorequest)
|
||||||
|
{
|
||||||
|
OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
|
||||||
|
RequestMapItemsCompleted(response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dorequest = true;
|
Watchdog.UpdateThread();
|
||||||
lock (m_rootAgents)
|
|
||||||
{
|
|
||||||
if (!m_rootAgents.Contains(st.agentID))
|
|
||||||
dorequest = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dorequest)
|
|
||||||
{
|
|
||||||
OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
|
|
||||||
RequestMapItemsCompleted(response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -469,6 +468,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
}
|
}
|
||||||
|
|
||||||
threadrunning = false;
|
threadrunning = false;
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -30,6 +30,8 @@ using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
using Animation = OpenSim.Framework.Animation;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
|
@ -394,7 +394,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
|
void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
|
||||||
{
|
{
|
||||||
// TODO: don't create new blocks if recycling an old packet
|
// TODO: don't create new blocks if recycling an old packet
|
||||||
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
|
ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
|
||||||
for (int i = 0; i < args.Count; i++)
|
for (int i = 0; i < args.Count; i++)
|
||||||
{
|
{
|
||||||
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
|
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
|
||||||
|
@ -404,11 +404,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
effect.ID = args[i].ID;
|
effect.ID = args[i].ID;
|
||||||
effect.Type = args[i].Type;
|
effect.Type = args[i].Type;
|
||||||
effect.TypeData = args[i].TypeData;
|
effect.TypeData = args[i].TypeData;
|
||||||
effectBlock.Add(effect);
|
effectBlockArray[i] = effect;
|
||||||
}
|
}
|
||||||
ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
|
|
||||||
|
|
||||||
ClientManager.ForEach(
|
ForEachClient(
|
||||||
delegate(IClientAPI client)
|
delegate(IClientAPI client)
|
||||||
{
|
{
|
||||||
if (client.AgentId != remoteClient.AgentId)
|
if (client.AgentId != remoteClient.AgentId)
|
||||||
|
|
|
@ -61,6 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Time = 0,
|
Time = 0,
|
||||||
Distance = 1,
|
Distance = 1,
|
||||||
SimpleAngularDistance = 2,
|
SimpleAngularDistance = 2,
|
||||||
|
FrontBack = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void SynchronizeSceneHandler(Scene scene);
|
public delegate void SynchronizeSceneHandler(Scene scene);
|
||||||
|
@ -81,8 +82,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected Timer m_restartWaitTimer = new Timer();
|
protected Timer m_restartWaitTimer = new Timer();
|
||||||
|
|
||||||
protected Thread m_updateEntitiesThread;
|
|
||||||
|
|
||||||
public SimStatsReporter StatsReporter;
|
public SimStatsReporter StatsReporter;
|
||||||
|
|
||||||
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
|
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
|
||||||
|
@ -107,11 +106,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public bool m_physicalPrim;
|
public bool m_physicalPrim;
|
||||||
public float m_maxNonphys = 256;
|
public float m_maxNonphys = 256;
|
||||||
public float m_maxPhys = 10;
|
public float m_maxPhys = 10;
|
||||||
public bool m_clampPrimSize = false;
|
public bool m_clampPrimSize;
|
||||||
public bool m_trustBinaries = false;
|
public bool m_trustBinaries;
|
||||||
public bool m_allowScriptCrossings = false;
|
public bool m_allowScriptCrossings;
|
||||||
public bool m_useFlySlow = false;
|
public bool m_useFlySlow;
|
||||||
public bool m_usePreJump = false;
|
public bool m_usePreJump;
|
||||||
public bool m_seeIntoRegionFromNeighbor;
|
public bool m_seeIntoRegionFromNeighbor;
|
||||||
// TODO: need to figure out how allow client agents but deny
|
// TODO: need to figure out how allow client agents but deny
|
||||||
// root agents when ACL denies access to root agent
|
// root agents when ACL denies access to root agent
|
||||||
|
@ -119,11 +118,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public int MaxUndoCount = 5;
|
public int MaxUndoCount = 5;
|
||||||
private int m_RestartTimerCounter;
|
private int m_RestartTimerCounter;
|
||||||
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
|
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
|
||||||
private int m_incrementsof15seconds = 0;
|
private int m_incrementsof15seconds;
|
||||||
private volatile bool m_backingup = false;
|
private volatile bool m_backingup;
|
||||||
|
private bool m_useAsyncWhenPossible;
|
||||||
|
|
||||||
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
|
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
|
||||||
|
|
||||||
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
|
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
|
||||||
|
|
||||||
protected string m_simulatorVersion = "OpenSimulator Server";
|
protected string m_simulatorVersion = "OpenSimulator Server";
|
||||||
|
@ -143,8 +142,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public IXfer XferManager;
|
public IXfer XferManager;
|
||||||
|
|
||||||
protected IAssetService m_AssetService = null;
|
protected IAssetService m_AssetService;
|
||||||
protected IAuthorizationService m_AuthorizationService = null;
|
protected IAuthorizationService m_AuthorizationService;
|
||||||
|
|
||||||
private Object m_heartbeatLock = new Object();
|
private Object m_heartbeatLock = new Object();
|
||||||
|
|
||||||
|
@ -185,7 +184,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IInventoryService m_InventoryService = null;
|
protected IInventoryService m_InventoryService;
|
||||||
|
|
||||||
public IInventoryService InventoryService
|
public IInventoryService InventoryService
|
||||||
{
|
{
|
||||||
|
@ -205,7 +204,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IGridService m_GridService = null;
|
protected IGridService m_GridService;
|
||||||
|
|
||||||
public IGridService GridService
|
public IGridService GridService
|
||||||
{
|
{
|
||||||
|
@ -253,9 +252,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Central Update Loop
|
// Central Update Loop
|
||||||
|
|
||||||
protected int m_fps = 10;
|
protected int m_fps = 10;
|
||||||
protected int m_frame = 0;
|
protected int m_frame;
|
||||||
protected float m_timespan = 0.089f;
|
protected float m_timespan = 0.089f;
|
||||||
protected DateTime m_lastupdate = DateTime.Now;
|
protected DateTime m_lastupdate = DateTime.UtcNow;
|
||||||
|
|
||||||
private int m_update_physics = 1;
|
private int m_update_physics = 1;
|
||||||
private int m_update_entitymovement = 1;
|
private int m_update_entitymovement = 1;
|
||||||
|
@ -266,17 +265,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private int m_update_terrain = 50;
|
private int m_update_terrain = 50;
|
||||||
private int m_update_land = 1;
|
private int m_update_land = 1;
|
||||||
|
|
||||||
private int frameMS = 0;
|
private int frameMS;
|
||||||
private int physicsMS2 = 0;
|
private int physicsMS2;
|
||||||
private int physicsMS = 0;
|
private int physicsMS;
|
||||||
private int otherMS = 0;
|
private int otherMS;
|
||||||
|
|
||||||
private bool m_physics_enabled = true;
|
private bool m_physics_enabled = true;
|
||||||
private bool m_scripts_enabled = true;
|
private bool m_scripts_enabled = true;
|
||||||
private string m_defaultScriptEngine;
|
private string m_defaultScriptEngine;
|
||||||
private int m_LastLogin = 0;
|
private int m_LastLogin;
|
||||||
private Thread HeartbeatThread = null;
|
private Thread HeartbeatThread;
|
||||||
private volatile bool shuttingdown = false;
|
private volatile bool shuttingdown;
|
||||||
|
|
||||||
private int m_lastUpdate = Environment.TickCount;
|
private int m_lastUpdate = Environment.TickCount;
|
||||||
private bool m_firstHeartbeat = true;
|
private bool m_firstHeartbeat = true;
|
||||||
|
@ -480,6 +479,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//
|
//
|
||||||
IConfig startupConfig = m_config.Configs["Startup"];
|
IConfig startupConfig = m_config.Configs["Startup"];
|
||||||
|
|
||||||
|
// Should we try to run loops synchronously or asynchronously?
|
||||||
|
m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", false);
|
||||||
|
|
||||||
//Animation states
|
//Animation states
|
||||||
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
||||||
// TODO: Change default to true once the feature is supported
|
// TODO: Change default to true once the feature is supported
|
||||||
|
@ -542,6 +544,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
case "simpleangulardistance":
|
case "simpleangulardistance":
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance;
|
m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance;
|
||||||
break;
|
break;
|
||||||
|
case "frontback":
|
||||||
|
m_update_prioritization_scheme = UpdatePrioritizationSchemes.FrontBack;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time");
|
m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time");
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
|
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
|
||||||
|
@ -889,6 +894,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
|
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
|
||||||
|
|
||||||
|
m_restartTimer.Stop();
|
||||||
|
m_restartTimer.Close();
|
||||||
|
|
||||||
// Kick all ROOT agents with the message, 'The simulator is going down'
|
// Kick all ROOT agents with the message, 'The simulator is going down'
|
||||||
ForEachScenePresence(delegate(ScenePresence avatar)
|
ForEachScenePresence(delegate(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
|
@ -945,11 +953,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
HeartbeatThread = null;
|
HeartbeatThread = null;
|
||||||
}
|
}
|
||||||
m_lastUpdate = Environment.TickCount;
|
m_lastUpdate = Environment.TickCount;
|
||||||
HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
|
|
||||||
HeartbeatThread.SetApartmentState(ApartmentState.MTA);
|
HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
|
||||||
HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
|
|
||||||
HeartbeatThread.Priority = ThreadPriority.AboveNormal;
|
|
||||||
HeartbeatThread.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -976,12 +981,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs per-frame updates regularly
|
/// Performs per-frame updates regularly
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
private void Heartbeat()
|
||||||
/// <param name="e"></param>
|
|
||||||
private void Heartbeat(object sender)
|
|
||||||
{
|
{
|
||||||
if (!Monitor.TryEnter(m_heartbeatLock))
|
if (!Monitor.TryEnter(m_heartbeatLock))
|
||||||
|
{
|
||||||
|
Watchdog.RemoveThread();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -998,6 +1004,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Monitor.Pulse(m_heartbeatLock);
|
Monitor.Pulse(m_heartbeatLock);
|
||||||
Monitor.Exit(m_heartbeatLock);
|
Monitor.Exit(m_heartbeatLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1016,10 +1024,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//#endif
|
//#endif
|
||||||
maintc = Environment.TickCount;
|
maintc = Environment.TickCount;
|
||||||
|
|
||||||
TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
|
TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
|
||||||
float physicsFPS = 0;
|
float physicsFPS = 0;
|
||||||
|
|
||||||
frameMS = Environment.TickCount;
|
frameMS = Environment.TickCount;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Increment the frame counter
|
// Increment the frame counter
|
||||||
|
@ -1101,6 +1110,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
if (loginsdisabled && (m_frame > 20))
|
if (loginsdisabled && (m_frame > 20))
|
||||||
{
|
{
|
||||||
|
// In 99.9% of cases it is a bad idea to manually force garbage collection. However,
|
||||||
|
// this is a rare case where we know we have just went through a long cycle of heap
|
||||||
|
// allocations, and there is no more work to be done until someone logs in
|
||||||
|
GC.Collect();
|
||||||
|
|
||||||
m_log.Debug("[REGION]: Enabling Logins");
|
m_log.Debug("[REGION]: Enabling Logins");
|
||||||
loginsdisabled = false;
|
loginsdisabled = false;
|
||||||
}
|
}
|
||||||
|
@ -1139,13 +1153,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
m_timedilation = tmpval;
|
m_timedilation = tmpval;
|
||||||
|
|
||||||
m_lastupdate = DateTime.Now;
|
m_lastupdate = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
maintc = Environment.TickCount - maintc;
|
maintc = Environment.TickCount - maintc;
|
||||||
maintc = (int)(m_timespan * 1000) - maintc;
|
maintc = (int)(m_timespan * 1000) - maintc;
|
||||||
|
|
||||||
if ((maintc < (m_timespan * 1000)) && maintc > 0)
|
if ((maintc < (m_timespan * 1000)) && maintc > 0)
|
||||||
Thread.Sleep(maintc);
|
Thread.Sleep(maintc);
|
||||||
|
|
||||||
|
// Tell the watchdog that this thread is still alive
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1219,10 +1236,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (!m_backingup)
|
if (!m_backingup)
|
||||||
{
|
{
|
||||||
m_backingup = true;
|
m_backingup = true;
|
||||||
|
Util.FireAndForget(BackupWaitCallback);
|
||||||
System.ComponentModel.BackgroundWorker backupWorker = new System.ComponentModel.BackgroundWorker();
|
|
||||||
backupWorker.DoWork += delegate(object sender, System.ComponentModel.DoWorkEventArgs e) { Backup(); };
|
|
||||||
backupWorker.RunWorkerAsync();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1234,6 +1248,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_eventManager.TriggerOnFrame();
|
m_eventManager.TriggerOnFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper for Backup() that can be called with Util.FireAndForget()
|
||||||
|
/// </summary>
|
||||||
|
private void BackupWaitCallback(object o)
|
||||||
|
{
|
||||||
|
Backup();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Backup the scene. This acts as the main method of the backup thread.
|
/// Backup the scene. This acts as the main method of the backup thread.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2460,7 +2482,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
public override void AddNewClient(IClientAPI client)
|
public override void AddNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
ClientManager.Add(client);
|
m_clientManager.Add(client);
|
||||||
|
|
||||||
CheckHeartbeat();
|
CheckHeartbeat();
|
||||||
SubscribeToClientEvents(client);
|
SubscribeToClientEvents(client);
|
||||||
|
@ -3099,7 +3121,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// Remove the avatar from the scene
|
// Remove the avatar from the scene
|
||||||
m_sceneGraph.RemoveScenePresence(agentID);
|
m_sceneGraph.RemoveScenePresence(agentID);
|
||||||
ClientManager.Remove(agentID);
|
m_clientManager.Remove(agentID);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -3496,9 +3518,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
|
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
|
||||||
{
|
{
|
||||||
ScenePresence presence;
|
ScenePresence presence;
|
||||||
|
m_sceneGraph.TryGetAvatar(agentID, out presence);
|
||||||
lock (m_sceneGraph.ScenePresences)
|
|
||||||
m_sceneGraph.ScenePresences.TryGetValue(agentID, out presence);
|
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
|
@ -3709,8 +3729,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Vector3 lookAt, uint teleportFlags)
|
Vector3 lookAt, uint teleportFlags)
|
||||||
{
|
{
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
lock (m_sceneGraph.ScenePresences)
|
m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp);
|
||||||
m_sceneGraph.ScenePresences.TryGetValue(remoteClient.AgentId, out sp);
|
|
||||||
|
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
{
|
{
|
||||||
|
@ -4112,7 +4131,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// This list is a new object, so it can be iterated over without locking.
|
/// This list is a new object, so it can be iterated over without locking.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<ScenePresence> GetScenePresences()
|
public ScenePresence[] GetScenePresences()
|
||||||
{
|
{
|
||||||
return m_sceneGraph.GetScenePresences();
|
return m_sceneGraph.GetScenePresences();
|
||||||
}
|
}
|
||||||
|
@ -4159,15 +4178,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void ForEachScenePresence(Action<ScenePresence> action)
|
public void ForEachScenePresence(Action<ScenePresence> action)
|
||||||
{
|
{
|
||||||
// We don't want to try to send messages if there are no avatars.
|
// We don't want to try to send messages if there are no avatars.
|
||||||
if (m_sceneGraph != null && m_sceneGraph.ScenePresences != null)
|
if (m_sceneGraph != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<ScenePresence> presenceList = GetScenePresences();
|
ScenePresence[] presences = GetScenePresences();
|
||||||
foreach (ScenePresence presence in presenceList)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
action(presences[i]);
|
||||||
action(presence);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -4239,7 +4256,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void ForEachClient(Action<IClientAPI> action)
|
public void ForEachClient(Action<IClientAPI> action)
|
||||||
{
|
{
|
||||||
ClientManager.ForEach(action);
|
ForEachClient(action, m_useAsyncWhenPossible);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ForEachClient(Action<IClientAPI> action, bool doAsynchronous)
|
||||||
|
{
|
||||||
|
// FIXME: Asynchronous iteration is disabled until we have a threading model that
|
||||||
|
// can support calling this function from an async packet handler without
|
||||||
|
// potentially deadlocking
|
||||||
|
//if (doAsynchronous)
|
||||||
|
// m_clientManager.ForEach(action);
|
||||||
|
//else
|
||||||
|
// m_clientManager.ForEachSync(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryGetClient(UUID avatarID, out IClientAPI client)
|
||||||
|
{
|
||||||
|
return m_clientManager.TryGetValue(avatarID, out client);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryGetClient(System.Net.IPEndPoint remoteEndPoint, out IClientAPI client)
|
||||||
|
{
|
||||||
|
return m_clientManager.TryGetValue(remoteEndPoint, out client);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ForEachSOG(Action<SceneObjectGroup> action)
|
public void ForEachSOG(Action<SceneObjectGroup> action)
|
||||||
|
@ -4571,7 +4609,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
case PhysicsJointType.Ball:
|
case PhysicsJointType.Ball:
|
||||||
{
|
{
|
||||||
PhysicsVector jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
||||||
Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z);
|
Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z);
|
||||||
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
|
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
|
||||||
}
|
}
|
||||||
|
@ -4579,7 +4617,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
case PhysicsJointType.Hinge:
|
case PhysicsJointType.Hinge:
|
||||||
{
|
{
|
||||||
PhysicsVector jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
||||||
|
|
||||||
// Normally, we would just ask the physics scene to return the axis for the joint.
|
// Normally, we would just ask the physics scene to return the axis for the joint.
|
||||||
// Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should
|
// Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should
|
||||||
|
|
|
@ -102,12 +102,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private readonly Mutex _primAllocateMutex = new Mutex(false);
|
private readonly Mutex _primAllocateMutex = new Mutex(false);
|
||||||
|
|
||||||
private readonly ClientManager m_clientManager = new ClientManager();
|
protected readonly ClientManager m_clientManager = new ClientManager();
|
||||||
|
|
||||||
public ClientManager ClientManager
|
|
||||||
{
|
|
||||||
get { return m_clientManager; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public float TimeDilation
|
public float TimeDilation
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
protected internal Dictionary<UUID, ScenePresence> ScenePresences = new Dictionary<UUID, ScenePresence>();
|
protected Dictionary<UUID, ScenePresence> m_scenePresences = new Dictionary<UUID, ScenePresence>();
|
||||||
|
protected ScenePresence[] m_scenePresenceArray = new ScenePresence[0];
|
||||||
|
|
||||||
// SceneObjects is not currently populated or used.
|
// SceneObjects is not currently populated or used.
|
||||||
//public Dictionary<UUID, SceneObjectGroup> SceneObjects;
|
//public Dictionary<UUID, SceneObjectGroup> SceneObjects;
|
||||||
protected internal EntityManager Entities = new EntityManager();
|
protected internal EntityManager Entities = new EntityManager();
|
||||||
|
@ -126,10 +128,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal void Close()
|
protected internal void Close()
|
||||||
{
|
{
|
||||||
lock (ScenePresences)
|
lock (m_scenePresences)
|
||||||
{
|
{
|
||||||
ScenePresences.Clear();
|
m_scenePresences.Clear();
|
||||||
|
m_scenePresenceArray = new ScenePresence[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_dictionary_lock)
|
lock (m_dictionary_lock)
|
||||||
{
|
{
|
||||||
SceneObjectGroupsByFullID.Clear();
|
SceneObjectGroupsByFullID.Clear();
|
||||||
|
@ -157,11 +161,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal void UpdatePresences()
|
protected internal void UpdatePresences()
|
||||||
{
|
{
|
||||||
List<ScenePresence> updateScenePresences = GetScenePresences();
|
ScenePresence[] updateScenePresences = GetScenePresences();
|
||||||
foreach (ScenePresence pres in updateScenePresences)
|
for (int i = 0; i < updateScenePresences.Length; i++)
|
||||||
{
|
updateScenePresences[i].Update();
|
||||||
pres.Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal float UpdatePhysics(double elapsed)
|
protected internal float UpdatePhysics(double elapsed)
|
||||||
|
@ -190,15 +192,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal void UpdateScenePresenceMovement()
|
protected internal void UpdateScenePresenceMovement()
|
||||||
{
|
{
|
||||||
List<ScenePresence> moveEntities = GetScenePresences();
|
ScenePresence[] moveEntities = GetScenePresences();
|
||||||
|
for (int i = 0; i < moveEntities.Length; i++)
|
||||||
foreach (EntityBase entity in moveEntities)
|
moveEntities[i].UpdateMovement();
|
||||||
{
|
|
||||||
//cfk. This throws occaisional exceptions on a heavily used region
|
|
||||||
//and I added this null check to try to preclude the exception.
|
|
||||||
if (entity != null)
|
|
||||||
entity.UpdateMovement();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -645,9 +641,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Entities[presence.UUID] = presence;
|
Entities[presence.UUID] = presence;
|
||||||
|
|
||||||
lock (ScenePresences)
|
lock (m_scenePresences)
|
||||||
{
|
{
|
||||||
ScenePresences[presence.UUID] = presence;
|
if (!m_scenePresences.ContainsKey(presence.UUID))
|
||||||
|
{
|
||||||
|
m_scenePresences.Add(presence.UUID, presence);
|
||||||
|
|
||||||
|
// Create a new array of ScenePresence references
|
||||||
|
int oldLength = m_scenePresenceArray.Length;
|
||||||
|
ScenePresence[] newArray = new ScenePresence[oldLength + 1];
|
||||||
|
Array.Copy(m_scenePresenceArray, newArray, oldLength);
|
||||||
|
newArray[oldLength] = presence;
|
||||||
|
m_scenePresenceArray = newArray;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_scenePresences[presence.UUID] = presence;
|
||||||
|
|
||||||
|
// Do a linear search through the array of ScenePresence references
|
||||||
|
// and update the modified entry
|
||||||
|
for (int i = 0; i < m_scenePresenceArray.Length; i++)
|
||||||
|
{
|
||||||
|
if (m_scenePresenceArray[i].UUID == presence.UUID)
|
||||||
|
{
|
||||||
|
m_scenePresenceArray[i] = presence;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,16 +684,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
agentID);
|
agentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (ScenePresences)
|
lock (m_scenePresences)
|
||||||
{
|
{
|
||||||
if (!ScenePresences.Remove(agentID))
|
if (m_scenePresences.Remove(agentID))
|
||||||
|
{
|
||||||
|
// Copy all of the elements from the previous array
|
||||||
|
// into the new array except the removed element
|
||||||
|
int oldLength = m_scenePresenceArray.Length;
|
||||||
|
ScenePresence[] newArray = new ScenePresence[oldLength - 1];
|
||||||
|
int j = 0;
|
||||||
|
for (int i = 0; i < m_scenePresenceArray.Length; i++)
|
||||||
|
{
|
||||||
|
ScenePresence presence = m_scenePresenceArray[i];
|
||||||
|
if (presence.UUID != agentID)
|
||||||
|
{
|
||||||
|
newArray[j] = presence;
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_scenePresenceArray = newArray;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
|
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
|
||||||
}
|
}
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.InfoFormat("[SCENE] Removed scene presence {0} from scene presences list", agentID);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,20 +739,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void RecalculateStats()
|
public void RecalculateStats()
|
||||||
{
|
{
|
||||||
List<ScenePresence> SPList = GetScenePresences();
|
ScenePresence[] presences = GetScenePresences();
|
||||||
int rootcount = 0;
|
int rootcount = 0;
|
||||||
int childcount = 0;
|
int childcount = 0;
|
||||||
|
|
||||||
foreach (ScenePresence user in SPList)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence user = presences[i];
|
||||||
if (user.IsChildAgent)
|
if (user.IsChildAgent)
|
||||||
childcount++;
|
++childcount;
|
||||||
else
|
else
|
||||||
rootcount++;
|
++rootcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_numRootAgents = rootcount;
|
m_numRootAgents = rootcount;
|
||||||
m_numChildAgents = childcount;
|
m_numChildAgents = childcount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetChildAgentCount()
|
public int GetChildAgentCount()
|
||||||
|
@ -767,12 +803,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// locking is required to iterate over it.
|
/// locking is required to iterate over it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected internal List<ScenePresence> GetScenePresences()
|
protected internal ScenePresence[] GetScenePresences()
|
||||||
{
|
{
|
||||||
lock (ScenePresences)
|
return m_scenePresenceArray;
|
||||||
{
|
|
||||||
return new List<ScenePresence>(ScenePresences.Values);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal List<ScenePresence> GetAvatars()
|
protected internal List<ScenePresence> GetAvatars()
|
||||||
|
@ -817,14 +850,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// No locking of scene presences here since we're passing back a list...
|
// No locking of scene presences here since we're passing back a list...
|
||||||
|
|
||||||
List<ScenePresence> result = new List<ScenePresence>();
|
List<ScenePresence> result = new List<ScenePresence>();
|
||||||
List<ScenePresence> ScenePresencesList = GetScenePresences();
|
ScenePresence[] scenePresences = GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence avatar in ScenePresencesList)
|
for (int i = 0; i < scenePresences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence avatar = scenePresences[i];
|
||||||
if (filter(avatar))
|
if (filter(avatar))
|
||||||
{
|
|
||||||
result.Add(avatar);
|
result.Add(avatar);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -839,9 +871,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
|
|
||||||
lock (ScenePresences)
|
lock (m_scenePresences)
|
||||||
{
|
{
|
||||||
ScenePresences.TryGetValue(agentID, out sp);
|
m_scenePresences.TryGetValue(agentID, out sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sp;
|
return sp;
|
||||||
|
@ -1000,48 +1032,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
|
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
|
||||||
{
|
{
|
||||||
ScenePresence presence;
|
lock (m_scenePresences)
|
||||||
|
return m_scenePresences.TryGetValue(avatarId, out avatar);
|
||||||
lock (ScenePresences)
|
|
||||||
{
|
|
||||||
if (ScenePresences.TryGetValue(avatarId, out presence))
|
|
||||||
{
|
|
||||||
avatar = presence;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
//if (!presence.IsChildAgent)
|
|
||||||
//{
|
|
||||||
// avatar = presence;
|
|
||||||
// return true;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// m_log.WarnFormat(
|
|
||||||
// "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!",
|
|
||||||
// avatarId, m_parentScene.RegionInfo.RegionName);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
avatar = null;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
|
protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
|
||||||
{
|
{
|
||||||
lock (ScenePresences)
|
ScenePresence[] presences = GetScenePresences();
|
||||||
{
|
|
||||||
foreach (ScenePresence presence in ScenePresences.Values)
|
|
||||||
{
|
|
||||||
if (!presence.IsChildAgent)
|
|
||||||
{
|
|
||||||
string name = presence.ControllingClient.Name;
|
|
||||||
|
|
||||||
if (String.Compare(avatarName, name, true) == 0)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
avatar = presence;
|
ScenePresence presence = presences[i];
|
||||||
return true;
|
|
||||||
}
|
if (!presence.IsChildAgent)
|
||||||
|
{
|
||||||
|
if (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0)
|
||||||
|
{
|
||||||
|
avatar = presence;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,41 +411,46 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="newDebug"></param>
|
/// <param name="newDebug"></param>
|
||||||
public void SetDebugPacketLevelOnCurrentScene(int newDebug)
|
public void SetDebugPacketLevelOnCurrentScene(int newDebug)
|
||||||
{
|
{
|
||||||
ForEachCurrentScene(delegate(Scene scene)
|
ForEachCurrentScene(
|
||||||
{
|
delegate(Scene scene)
|
||||||
List<ScenePresence> scenePresences = scene.GetScenePresences();
|
{
|
||||||
|
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence scenePresence in scenePresences)
|
for (int i = 0; i < scenePresences.Length; i++)
|
||||||
{
|
{
|
||||||
if (!scenePresence.IsChildAgent)
|
ScenePresence scenePresence = scenePresences[i];
|
||||||
{
|
|
||||||
m_log.ErrorFormat("Packet debug for {0} {1} set to {2}",
|
|
||||||
scenePresence.Firstname,
|
|
||||||
scenePresence.Lastname,
|
|
||||||
newDebug);
|
|
||||||
|
|
||||||
scenePresence.ControllingClient.SetDebugPacketLevel(newDebug);
|
if (!scenePresence.IsChildAgent)
|
||||||
}
|
{
|
||||||
}
|
m_log.ErrorFormat("Packet debug for {0} {1} set to {2}",
|
||||||
});
|
scenePresence.Firstname,
|
||||||
|
scenePresence.Lastname,
|
||||||
|
newDebug);
|
||||||
|
|
||||||
|
scenePresence.ControllingClient.SetDebugPacketLevel(newDebug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ScenePresence> GetCurrentSceneAvatars()
|
public List<ScenePresence> GetCurrentSceneAvatars()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = new List<ScenePresence>();
|
List<ScenePresence> avatars = new List<ScenePresence>();
|
||||||
|
|
||||||
ForEachCurrentScene(delegate(Scene scene)
|
ForEachCurrentScene(
|
||||||
{
|
delegate(Scene scene)
|
||||||
List<ScenePresence> scenePresences = scene.GetScenePresences();
|
|
||||||
|
|
||||||
foreach (ScenePresence scenePresence in scenePresences)
|
|
||||||
{
|
{
|
||||||
if (!scenePresence.IsChildAgent)
|
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||||
|
|
||||||
|
for (int i = 0; i < scenePresences.Length; i++)
|
||||||
{
|
{
|
||||||
avatars.Add(scenePresence);
|
ScenePresence scenePresence = scenePresences[i];
|
||||||
|
if (!scenePresence.IsChildAgent)
|
||||||
|
avatars.Add(scenePresence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
return avatars;
|
return avatars;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +461,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
ForEachCurrentScene(delegate(Scene scene)
|
ForEachCurrentScene(delegate(Scene scene)
|
||||||
{
|
{
|
||||||
List<ScenePresence> scenePresences = scene.GetScenePresences();
|
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||||
presences.AddRange(scenePresences);
|
presences.AddRange(scenePresences);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -493,8 +493,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public Vector3 GroupScale()
|
public Vector3 GroupScale()
|
||||||
{
|
{
|
||||||
Vector3 minScale = new Vector3(Constants.RegionSize,Constants.RegionSize,Constants.RegionSize);
|
Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
|
||||||
Vector3 maxScale = new Vector3(0f,0f,0f);
|
Vector3 maxScale = Vector3.Zero;
|
||||||
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
|
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
lock (m_parts)
|
lock (m_parts)
|
||||||
|
@ -577,7 +577,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector3 worldPos = part.GetWorldPosition();
|
Vector3 worldPos = part.GetWorldPosition();
|
||||||
Vector3 offset = worldPos - AbsolutePosition;
|
Vector3 offset = worldPos - AbsolutePosition;
|
||||||
Quaternion worldRot;
|
Quaternion worldRot;
|
||||||
|
@ -1182,8 +1181,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// part.Inventory.RemoveScriptInstances();
|
// part.Inventory.RemoveScriptInstances();
|
||||||
|
|
||||||
List<ScenePresence> avatars = Scene.GetScenePresences();
|
ScenePresence[] avatars = Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
if (avatars[i].ParentID == LocalId)
|
if (avatars[i].ParentID == LocalId)
|
||||||
{
|
{
|
||||||
|
@ -1335,7 +1334,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
(parcel.LandData.GroupID != GroupID ||
|
(parcel.LandData.GroupID != GroupID ||
|
||||||
parcel.LandData.GroupID == UUID.Zero))
|
parcel.LandData.GroupID == UUID.Zero))
|
||||||
{
|
{
|
||||||
if ((DateTime.Now - RootPart.Rezzed).TotalMinutes >
|
if ((DateTime.UtcNow - RootPart.Rezzed).TotalMinutes >
|
||||||
parcel.LandData.OtherCleanTime)
|
parcel.LandData.OtherCleanTime)
|
||||||
{
|
{
|
||||||
DetachFromBackup();
|
DetachFromBackup();
|
||||||
|
@ -1480,8 +1479,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
|
dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
|
||||||
dupe.RootPart.Name,
|
dupe.RootPart.Name,
|
||||||
pbs,
|
pbs,
|
||||||
new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z),
|
dupe.RootPart.AbsolutePosition,
|
||||||
new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
|
dupe.RootPart.Scale,
|
||||||
dupe.RootPart.RotationOffset,
|
dupe.RootPart.RotationOffset,
|
||||||
dupe.RootPart.PhysActor.IsPhysical);
|
dupe.RootPart.PhysActor.IsPhysical);
|
||||||
|
|
||||||
|
@ -1596,7 +1595,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyImpulse(PhysicsVector impulse)
|
public void applyImpulse(Vector3 impulse)
|
||||||
{
|
{
|
||||||
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
||||||
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
||||||
|
@ -1623,7 +1622,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyAngularImpulse(PhysicsVector impulse)
|
public void applyAngularImpulse(Vector3 impulse)
|
||||||
{
|
{
|
||||||
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
||||||
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
||||||
|
@ -1642,7 +1641,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAngularImpulse(PhysicsVector impulse)
|
public void setAngularImpulse(Vector3 impulse)
|
||||||
{
|
{
|
||||||
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
||||||
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
||||||
|
@ -1673,8 +1672,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (!IsAttachment)
|
if (!IsAttachment)
|
||||||
{
|
{
|
||||||
PhysicsVector torque = rootpart.PhysActor.Torque;
|
Vector3 torque = rootpart.PhysActor.Torque;
|
||||||
return new Vector3(torque.X, torque.Y, torque.Z);
|
return torque;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1707,7 +1706,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (rootpart.PhysActor != null)
|
if (rootpart.PhysActor != null)
|
||||||
{
|
{
|
||||||
rootpart.PhysActor.PIDTarget = new PhysicsVector(target.X, target.Y, target.Z);
|
rootpart.PhysActor.PIDTarget = target;
|
||||||
rootpart.PhysActor.PIDTau = tau;
|
rootpart.PhysActor.PIDTau = tau;
|
||||||
rootpart.PhysActor.PIDActive = true;
|
rootpart.PhysActor.PIDActive = true;
|
||||||
}
|
}
|
||||||
|
@ -2375,7 +2374,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_rootPart.PhysActor.IsPhysical)
|
if (m_rootPart.PhysActor.IsPhysical)
|
||||||
{
|
{
|
||||||
Vector3 llmoveforce = pos - AbsolutePosition;
|
Vector3 llmoveforce = pos - AbsolutePosition;
|
||||||
PhysicsVector grabforce = new PhysicsVector(llmoveforce.X, llmoveforce.Y, llmoveforce.Z);
|
Vector3 grabforce = llmoveforce;
|
||||||
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
|
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
|
||||||
m_rootPart.PhysActor.AddForce(grabforce,true);
|
m_rootPart.PhysActor.AddForce(grabforce,true);
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
||||||
|
@ -2480,7 +2479,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
rotationAxis.Normalize();
|
rotationAxis.Normalize();
|
||||||
|
|
||||||
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
|
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
|
||||||
PhysicsVector spinforce = new PhysicsVector(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
|
Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
|
||||||
spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor
|
spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor
|
||||||
m_rootPart.PhysActor.AddAngularForce(spinforce,true);
|
m_rootPart.PhysActor.AddAngularForce(spinforce,true);
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
||||||
|
@ -2707,8 +2706,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (scale.Z > m_scene.m_maxPhys)
|
if (scale.Z > m_scene.m_maxPhys)
|
||||||
scale.Z = m_scene.m_maxPhys;
|
scale.Z = m_scene.m_maxPhys;
|
||||||
}
|
}
|
||||||
part.PhysActor.Size =
|
part.PhysActor.Size = scale;
|
||||||
new PhysicsVector(scale.X, scale.Y, scale.Z);
|
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
|
||||||
}
|
}
|
||||||
//if (part.UUID != m_rootPart.UUID)
|
//if (part.UUID != m_rootPart.UUID)
|
||||||
|
@ -2852,8 +2850,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (part.PhysActor != null)
|
if (part.PhysActor != null)
|
||||||
{
|
{
|
||||||
part.PhysActor.Size =
|
part.PhysActor.Size = prevScale;
|
||||||
new PhysicsVector(prevScale.X, prevScale.Y, prevScale.Z);
|
|
||||||
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
|
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3366,6 +3363,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return GetPriorityByDistance(client);
|
return GetPriorityByDistance(client);
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
return GetPriorityBySimpleAngularDistance(client);
|
return GetPriorityBySimpleAngularDistance(client);
|
||||||
|
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return GetPriorityByFrontBack(client);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
||||||
}
|
}
|
||||||
|
@ -3398,6 +3397,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return double.NaN;
|
return double.NaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double GetPriorityByFrontBack(IClientAPI client)
|
||||||
|
{
|
||||||
|
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
||||||
|
if (presence != null)
|
||||||
|
{
|
||||||
|
return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
|
||||||
|
}
|
||||||
|
return double.NaN;
|
||||||
|
}
|
||||||
|
|
||||||
public double GetPriorityByDistance(Vector3 position)
|
public double GetPriorityByDistance(Vector3 position)
|
||||||
{
|
{
|
||||||
return Vector3.Distance(AbsolutePosition, position);
|
return Vector3.Distance(AbsolutePosition, position);
|
||||||
|
@ -3427,5 +3436,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
return double.MinValue;
|
return double.MinValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
|
||||||
|
{
|
||||||
|
// Distance
|
||||||
|
double priority = Vector3.Distance(camPosition, AbsolutePosition);
|
||||||
|
|
||||||
|
// Scale
|
||||||
|
//priority -= GroupScale().Length();
|
||||||
|
|
||||||
|
// Plane equation
|
||||||
|
float d = -Vector3.Dot(camPosition, camAtAxis);
|
||||||
|
float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
|
||||||
|
if (p < 0.0f) priority *= 2.0f;
|
||||||
|
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,16 +102,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
public bool AllowedDrop = false;
|
public bool AllowedDrop;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool DIE_AT_EDGE = false;
|
public bool DIE_AT_EDGE;
|
||||||
|
|
||||||
// TODO: This needs to be persisted in next XML version update!
|
// TODO: This needs to be persisted in next XML version update!
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public int[] PayPrice = {-2,-2,-2,-2,-2};
|
public readonly int[] PayPrice = {-2,-2,-2,-2,-2};
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public PhysicsActor PhysActor = null;
|
public PhysicsActor PhysActor;
|
||||||
|
|
||||||
//Xantor 20080528 Sound stuff:
|
//Xantor 20080528 Sound stuff:
|
||||||
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
|
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
|
||||||
|
@ -130,22 +130,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public double SoundRadius;
|
public double SoundRadius;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public uint TimeStampFull = 0;
|
public uint TimeStampFull;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
|
public uint TimeStampLastActivity; // Will be used for AutoReturn
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public uint TimeStampTerse = 0;
|
public uint TimeStampTerse;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public UUID FromItemID = UUID.Zero;
|
public UUID FromItemID;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The UUID of the user inventory item from which this object was rezzed if this is a root part.
|
/// The UUID of the user inventory item from which this object was rezzed if this is a root part.
|
||||||
/// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item.
|
/// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item.
|
||||||
/// </value>
|
/// </value>
|
||||||
private UUID m_fromUserInventoryItemID = UUID.Zero;
|
private UUID m_fromUserInventoryItemID;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public UUID FromUserInventoryItemID
|
public UUID FromUserInventoryItemID
|
||||||
|
@ -154,31 +154,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool IsAttachment = false;
|
public bool IsAttachment;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public scriptEvents AggregateScriptEvents = 0;
|
public scriptEvents AggregateScriptEvents;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public UUID AttachedAvatar = UUID.Zero;
|
public UUID AttachedAvatar;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Vector3 AttachedPos = Vector3.Zero;
|
public Vector3 AttachedPos;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public uint AttachmentPoint = (byte)0;
|
public uint AttachmentPoint;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f);
|
public Vector3 RotationAxis = Vector3.One;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool VolumeDetectActive = false; // XmlIgnore set to avoid problems with persistance until I come to care for this
|
public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this
|
||||||
// Certainly this must be a persistant setting finally
|
// Certainly this must be a persistant setting finally
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool IsWaitingForFirstSpinUpdatePacket = false;
|
public bool IsWaitingForFirstSpinUpdatePacket;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Quaternion SpinOldOrientation = new Quaternion();
|
public Quaternion SpinOldOrientation = Quaternion.Identity;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This part's inventory
|
/// This part's inventory
|
||||||
|
@ -191,34 +192,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
protected SceneObjectPartInventory m_inventory;
|
protected SceneObjectPartInventory m_inventory;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool Undoing = false;
|
public bool Undoing;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
private PrimFlags LocalFlags = 0;
|
private PrimFlags LocalFlags;
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
private float m_damage = -1.0f;
|
private float m_damage = -1.0f;
|
||||||
private byte[] m_TextureAnimation;
|
private byte[] m_TextureAnimation;
|
||||||
private byte m_clickAction = 0;
|
private byte m_clickAction;
|
||||||
private Color m_color = Color.Black;
|
private Color m_color = Color.Black;
|
||||||
private string m_description = String.Empty;
|
private string m_description = String.Empty;
|
||||||
private readonly List<uint> m_lastColliders = new List<uint>();
|
private readonly List<uint> m_lastColliders = new List<uint>();
|
||||||
// private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero;
|
private int m_linkNum;
|
||||||
private int m_linkNum = 0;
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
private int m_scriptAccessPin = 0;
|
private int m_scriptAccessPin;
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
|
private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
|
||||||
private string m_sitName = String.Empty;
|
private string m_sitName = String.Empty;
|
||||||
private Quaternion m_sitTargetOrientation = Quaternion.Identity;
|
private Quaternion m_sitTargetOrientation = Quaternion.Identity;
|
||||||
private Vector3 m_sitTargetPosition = Vector3.Zero;
|
private Vector3 m_sitTargetPosition;
|
||||||
private string m_sitAnimation = "SIT";
|
private string m_sitAnimation = "SIT";
|
||||||
private string m_text = String.Empty;
|
private string m_text = String.Empty;
|
||||||
private string m_touchName = String.Empty;
|
private string m_touchName = String.Empty;
|
||||||
private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
|
private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
|
||||||
private UUID _creatorID;
|
private UUID _creatorID;
|
||||||
|
|
||||||
|
private bool m_passTouches;
|
||||||
private bool m_passTouches = false;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only used internally to schedule client updates.
|
/// Only used internally to schedule client updates.
|
||||||
|
@ -236,28 +235,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//unkown if this will be kept, added as a way of removing the group position from the group class
|
//unkown if this will be kept, added as a way of removing the group position from the group class
|
||||||
protected Vector3 m_groupPosition;
|
protected Vector3 m_groupPosition;
|
||||||
protected uint m_localId;
|
protected uint m_localId;
|
||||||
protected Material m_material = (Material)3; // Wood
|
protected Material m_material = OpenMetaverse.Material.Wood;
|
||||||
protected string m_name;
|
protected string m_name;
|
||||||
protected Vector3 m_offsetPosition;
|
protected Vector3 m_offsetPosition;
|
||||||
|
|
||||||
// FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
|
// FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
|
||||||
protected SceneObjectGroup m_parentGroup;
|
protected SceneObjectGroup m_parentGroup;
|
||||||
protected byte[] m_particleSystem = new byte[0];
|
protected byte[] m_particleSystem = Utils.EmptyBytes;
|
||||||
protected ulong m_regionHandle;
|
protected ulong m_regionHandle;
|
||||||
protected Quaternion m_rotationOffset;
|
protected Quaternion m_rotationOffset;
|
||||||
protected PrimitiveBaseShape m_shape = null;
|
protected PrimitiveBaseShape m_shape;
|
||||||
protected UUID m_uuid;
|
protected UUID m_uuid;
|
||||||
protected Vector3 m_velocity;
|
protected Vector3 m_velocity;
|
||||||
|
|
||||||
|
protected Vector3 m_lastPosition;
|
||||||
|
protected Quaternion m_lastRotation;
|
||||||
|
protected Vector3 m_lastVelocity;
|
||||||
|
protected Vector3 m_lastAcceleration;
|
||||||
|
protected Vector3 m_lastAngularVelocity;
|
||||||
|
|
||||||
// TODO: Those have to be changed into persistent properties at some later point,
|
// TODO: Those have to be changed into persistent properties at some later point,
|
||||||
// or sit-camera on vehicles will break on sim-crossing.
|
// or sit-camera on vehicles will break on sim-crossing.
|
||||||
private Vector3 m_cameraEyeOffset = new Vector3(0.0f, 0.0f, 0.0f);
|
private Vector3 m_cameraEyeOffset;
|
||||||
private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f);
|
private Vector3 m_cameraAtOffset;
|
||||||
private bool m_forceMouselook = false;
|
private bool m_forceMouselook;
|
||||||
|
|
||||||
// TODO: Collision sound should have default.
|
// TODO: Collision sound should have default.
|
||||||
private UUID m_collisionSound = UUID.Zero;
|
private UUID m_collisionSound;
|
||||||
private float m_collisionSoundVolume = 0.0f;
|
private float m_collisionSoundVolume;
|
||||||
|
|
||||||
#endregion Fields
|
#endregion Fields
|
||||||
|
|
||||||
|
@ -269,9 +274,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public SceneObjectPart()
|
public SceneObjectPart()
|
||||||
{
|
{
|
||||||
// It's not necessary to persist this
|
// It's not necessary to persist this
|
||||||
m_TextureAnimation = new byte[0];
|
m_TextureAnimation = Utils.EmptyBytes;
|
||||||
m_particleSystem = new byte[0];
|
m_particleSystem = Utils.EmptyBytes;
|
||||||
Rezzed = DateTime.Now;
|
Rezzed = DateTime.UtcNow;
|
||||||
|
|
||||||
m_inventory = new SceneObjectPartInventory(this);
|
m_inventory = new SceneObjectPartInventory(this);
|
||||||
}
|
}
|
||||||
|
@ -290,8 +295,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_name = "Primitive";
|
m_name = "Primitive";
|
||||||
|
|
||||||
Rezzed = DateTime.Now;
|
Rezzed = DateTime.UtcNow;
|
||||||
_creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
_creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
|
||||||
_ownerID = ownerID;
|
_ownerID = ownerID;
|
||||||
_creatorID = _ownerID;
|
_creatorID = _ownerID;
|
||||||
_lastOwnerID = UUID.Zero;
|
_lastOwnerID = UUID.Zero;
|
||||||
|
@ -299,19 +304,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Shape = shape;
|
Shape = shape;
|
||||||
// Todo: Add More Object Parameter from above!
|
// Todo: Add More Object Parameter from above!
|
||||||
_ownershipCost = 0;
|
_ownershipCost = 0;
|
||||||
_objectSaleType = (byte) 0;
|
_objectSaleType = 0;
|
||||||
_salePrice = 0;
|
_salePrice = 0;
|
||||||
_category = (uint) 0;
|
_category = 0;
|
||||||
_lastOwnerID = _creatorID;
|
_lastOwnerID = _creatorID;
|
||||||
// End Todo: ///
|
// End Todo: ///
|
||||||
GroupPosition = groupPosition;
|
GroupPosition = groupPosition;
|
||||||
OffsetPosition = offsetPosition;
|
OffsetPosition = offsetPosition;
|
||||||
RotationOffset = rotationOffset;
|
RotationOffset = rotationOffset;
|
||||||
Velocity = new Vector3(0, 0, 0);
|
Velocity = Vector3.Zero;
|
||||||
AngularVelocity = new Vector3(0, 0, 0);
|
AngularVelocity = Vector3.Zero;
|
||||||
Acceleration = new Vector3(0, 0, 0);
|
Acceleration = Vector3.Zero;
|
||||||
m_TextureAnimation = new byte[0];
|
m_TextureAnimation = Utils.EmptyBytes;
|
||||||
m_particleSystem = new byte[0];
|
m_particleSystem = Utils.EmptyBytes;
|
||||||
|
|
||||||
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
|
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
|
||||||
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
|
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
|
||||||
|
@ -532,13 +537,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Root prim actually goes at Position
|
// Root prim actually goes at Position
|
||||||
if (_parentID == 0)
|
if (_parentID == 0)
|
||||||
{
|
{
|
||||||
PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
|
PhysActor.Position = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// To move the child prim in respect to the group position and rotation we have to calculate
|
// To move the child prim in respect to the group position and rotation we have to calculate
|
||||||
Vector3 resultingposition = GetWorldPosition();
|
Vector3 resultingposition = GetWorldPosition();
|
||||||
PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
|
PhysActor.Position = resultingposition;
|
||||||
Quaternion resultingrot = GetWorldRotation();
|
Quaternion resultingrot = GetWorldRotation();
|
||||||
PhysActor.Orientation = resultingrot;
|
PhysActor.Orientation = resultingrot;
|
||||||
}
|
}
|
||||||
|
@ -580,7 +585,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (_parentID != 0 && PhysActor != null)
|
if (_parentID != 0 && PhysActor != null)
|
||||||
{
|
{
|
||||||
Vector3 resultingposition = GetWorldPosition();
|
Vector3 resultingposition = GetWorldPosition();
|
||||||
PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
|
PhysActor.Position = resultingposition;
|
||||||
Quaternion resultingrot = GetWorldRotation();
|
Quaternion resultingrot = GetWorldRotation();
|
||||||
PhysActor.Orientation = resultingrot;
|
PhysActor.Orientation = resultingrot;
|
||||||
|
|
||||||
|
@ -670,7 +675,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (PhysActor.IsPhysical)
|
if (PhysActor.IsPhysical)
|
||||||
{
|
{
|
||||||
PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
|
PhysActor.Velocity = value;
|
||||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -812,7 +817,7 @@ if (m_shape != null) {
|
||||||
{
|
{
|
||||||
if (m_parentGroup.Scene.PhysicsScene != null)
|
if (m_parentGroup.Scene.PhysicsScene != null)
|
||||||
{
|
{
|
||||||
PhysActor.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z);
|
PhysActor.Size = m_shape.Scale;
|
||||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1077,8 +1082,8 @@ if (m_shape != null) {
|
||||||
|
|
||||||
private void SendObjectPropertiesToClient(UUID AgentID)
|
private void SendObjectPropertiesToClient(UUID AgentID)
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
// Ugly reference :(
|
// Ugly reference :(
|
||||||
if (avatars[i].UUID == AgentID)
|
if (avatars[i].UUID == AgentID)
|
||||||
|
@ -1140,8 +1145,8 @@ if (m_shape != null) {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddFullUpdateToAllAvatars()
|
public void AddFullUpdateToAllAvatars()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
||||||
}
|
}
|
||||||
|
@ -1165,8 +1170,8 @@ if (m_shape != null) {
|
||||||
/// Terse updates
|
/// Terse updates
|
||||||
public void AddTerseUpdateToAllAvatars()
|
public void AddTerseUpdateToAllAvatars()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
||||||
}
|
}
|
||||||
|
@ -1220,7 +1225,7 @@ if (m_shape != null) {
|
||||||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||||
public void ApplyImpulse(Vector3 impulsei, bool localGlobalTF)
|
public void ApplyImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||||
{
|
{
|
||||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
Vector3 impulse = impulsei;
|
||||||
|
|
||||||
if (localGlobalTF)
|
if (localGlobalTF)
|
||||||
{
|
{
|
||||||
|
@ -1228,7 +1233,7 @@ if (m_shape != null) {
|
||||||
Quaternion AXgrot = grot;
|
Quaternion AXgrot = grot;
|
||||||
Vector3 AXimpulsei = impulsei;
|
Vector3 AXimpulsei = impulsei;
|
||||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
impulse = newimpulse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
|
@ -1246,7 +1251,7 @@ if (m_shape != null) {
|
||||||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||||
public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||||
{
|
{
|
||||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
Vector3 impulse = impulsei;
|
||||||
|
|
||||||
if (localGlobalTF)
|
if (localGlobalTF)
|
||||||
{
|
{
|
||||||
|
@ -1254,7 +1259,7 @@ if (m_shape != null) {
|
||||||
Quaternion AXgrot = grot;
|
Quaternion AXgrot = grot;
|
||||||
Vector3 AXimpulsei = impulsei;
|
Vector3 AXimpulsei = impulsei;
|
||||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
impulse = newimpulse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
|
@ -1272,7 +1277,7 @@ if (m_shape != null) {
|
||||||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||||
public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||||
{
|
{
|
||||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
Vector3 impulse = impulsei;
|
||||||
|
|
||||||
if (localGlobalTF)
|
if (localGlobalTF)
|
||||||
{
|
{
|
||||||
|
@ -1280,7 +1285,7 @@ if (m_shape != null) {
|
||||||
Quaternion AXgrot = grot;
|
Quaternion AXgrot = grot;
|
||||||
Vector3 AXimpulsei = impulsei;
|
Vector3 AXimpulsei = impulsei;
|
||||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
impulse = newimpulse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
|
@ -1328,8 +1333,8 @@ if (m_shape != null) {
|
||||||
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||||
Name,
|
Name,
|
||||||
Shape,
|
Shape,
|
||||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
AbsolutePosition,
|
||||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
Scale,
|
||||||
RotationOffset,
|
RotationOffset,
|
||||||
RigidBody);
|
RigidBody);
|
||||||
|
|
||||||
|
@ -1518,7 +1523,7 @@ if (m_shape != null) {
|
||||||
PhysicsJoint joint;
|
PhysicsJoint joint;
|
||||||
|
|
||||||
joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
|
joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
|
||||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
AbsolutePosition,
|
||||||
this.RotationOffset,
|
this.RotationOffset,
|
||||||
Description,
|
Description,
|
||||||
bodyNames,
|
bodyNames,
|
||||||
|
@ -1703,12 +1708,12 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsVector GetForce()
|
public Vector3 GetForce()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
if (PhysActor != null)
|
||||||
return PhysActor.Force;
|
return PhysActor.Force;
|
||||||
else
|
else
|
||||||
return new PhysicsVector();
|
return Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetProperties(IClientAPI client)
|
public void GetProperties(IClientAPI client)
|
||||||
|
@ -1894,24 +1899,24 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||||
if (avlist != null)
|
|
||||||
|
for (int i = 0; i < avlist.Length; i++)
|
||||||
{
|
{
|
||||||
foreach (ScenePresence av in avlist)
|
ScenePresence av = avlist[i];
|
||||||
|
|
||||||
|
if (av.LocalId == localId)
|
||||||
{
|
{
|
||||||
if (av.LocalId == localId)
|
DetectedObject detobj = new DetectedObject();
|
||||||
{
|
detobj.keyUUID = av.UUID;
|
||||||
DetectedObject detobj = new DetectedObject();
|
detobj.nameStr = av.ControllingClient.Name;
|
||||||
detobj.keyUUID = av.UUID;
|
detobj.ownerUUID = av.UUID;
|
||||||
detobj.nameStr = av.ControllingClient.Name;
|
detobj.posVector = av.AbsolutePosition;
|
||||||
detobj.ownerUUID = av.UUID;
|
detobj.rotQuat = av.Rotation;
|
||||||
detobj.posVector = av.AbsolutePosition;
|
detobj.velVector = av.Velocity;
|
||||||
detobj.rotQuat = av.Rotation;
|
detobj.colliderType = 0;
|
||||||
detobj.velVector = av.Velocity;
|
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||||
detobj.colliderType = 0;
|
colliding.Add(detobj);
|
||||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
|
||||||
colliding.Add(detobj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1965,26 +1970,25 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||||
if (avlist != null)
|
|
||||||
{
|
|
||||||
foreach (ScenePresence av in avlist)
|
|
||||||
{
|
|
||||||
if (av.LocalId == localId)
|
|
||||||
{
|
|
||||||
DetectedObject detobj = new DetectedObject();
|
|
||||||
detobj.keyUUID = av.UUID;
|
|
||||||
detobj.nameStr = av.Name;
|
|
||||||
detobj.ownerUUID = av.UUID;
|
|
||||||
detobj.posVector = av.AbsolutePosition;
|
|
||||||
detobj.rotQuat = av.Rotation;
|
|
||||||
detobj.velVector = av.Velocity;
|
|
||||||
detobj.colliderType = 0;
|
|
||||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
|
||||||
colliding.Add(detobj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (int i = 0; i < avlist.Length; i++)
|
||||||
|
{
|
||||||
|
ScenePresence av = avlist[i];
|
||||||
|
|
||||||
|
if (av.LocalId == localId)
|
||||||
|
{
|
||||||
|
DetectedObject detobj = new DetectedObject();
|
||||||
|
detobj.keyUUID = av.UUID;
|
||||||
|
detobj.nameStr = av.Name;
|
||||||
|
detobj.ownerUUID = av.UUID;
|
||||||
|
detobj.posVector = av.AbsolutePosition;
|
||||||
|
detobj.rotQuat = av.Rotation;
|
||||||
|
detobj.velVector = av.Velocity;
|
||||||
|
detobj.colliderType = 0;
|
||||||
|
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||||
|
colliding.Add(detobj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2035,24 +2039,24 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||||
if (avlist != null)
|
|
||||||
|
for (int i = 0; i < avlist.Length; i++)
|
||||||
{
|
{
|
||||||
foreach (ScenePresence av in avlist)
|
ScenePresence av = avlist[i];
|
||||||
|
|
||||||
|
if (av.LocalId == localId)
|
||||||
{
|
{
|
||||||
if (av.LocalId == localId)
|
DetectedObject detobj = new DetectedObject();
|
||||||
{
|
detobj.keyUUID = av.UUID;
|
||||||
DetectedObject detobj = new DetectedObject();
|
detobj.nameStr = av.Name;
|
||||||
detobj.keyUUID = av.UUID;
|
detobj.ownerUUID = av.UUID;
|
||||||
detobj.nameStr = av.Name;
|
detobj.posVector = av.AbsolutePosition;
|
||||||
detobj.ownerUUID = av.UUID;
|
detobj.rotQuat = av.Rotation;
|
||||||
detobj.posVector = av.AbsolutePosition;
|
detobj.velVector = av.Velocity;
|
||||||
detobj.rotQuat = av.Rotation;
|
detobj.colliderType = 0;
|
||||||
detobj.velVector = av.Velocity;
|
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||||
detobj.colliderType = 0;
|
colliding.Add(detobj);
|
||||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
|
||||||
colliding.Add(detobj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2074,7 +2078,7 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PhysicsOutOfBounds(PhysicsVector pos)
|
public void PhysicsOutOfBounds(Vector3 pos)
|
||||||
{
|
{
|
||||||
m_log.Error("[PHYSICS]: Physical Object went out of bounds.");
|
m_log.Error("[PHYSICS]: Physical Object went out of bounds.");
|
||||||
|
|
||||||
|
@ -2312,8 +2316,8 @@ if (m_shape != null) {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendFullUpdateToAllClients()
|
public void SendFullUpdateToAllClients()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
// Ugly reference :(
|
// Ugly reference :(
|
||||||
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
|
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
|
||||||
|
@ -2323,8 +2327,8 @@ if (m_shape != null) {
|
||||||
|
|
||||||
public void SendFullUpdateToAllClientsExcept(UUID agentID)
|
public void SendFullUpdateToAllClientsExcept(UUID agentID)
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
// Ugly reference :(
|
// Ugly reference :(
|
||||||
if (avatars[i].UUID != agentID)
|
if (avatars[i].UUID != agentID)
|
||||||
|
@ -2389,18 +2393,36 @@ if (m_shape != null) {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendScheduledUpdates()
|
public void SendScheduledUpdates()
|
||||||
{
|
{
|
||||||
if (m_updateFlag == 1) //some change has been made so update the clients
|
const float VELOCITY_TOLERANCE = 0.01f;
|
||||||
{
|
const float POSITION_TOLERANCE = 10.0f;
|
||||||
AddTerseUpdateToAllAvatars();
|
|
||||||
ClearUpdateSchedule();
|
|
||||||
|
|
||||||
// This causes the Scene to 'poll' physical objects every couple of frames
|
if (m_updateFlag == 1)
|
||||||
// bad, so it's been replaced by an event driven method.
|
{
|
||||||
//if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
|
// Throw away duplicate or insignificant updates
|
||||||
//{
|
if (RotationOffset != m_lastRotation ||
|
||||||
// Only send the constant terse updates on physical objects!
|
Acceleration != m_lastAcceleration ||
|
||||||
//ScheduleTerseUpdate();
|
(Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE ||
|
||||||
//}
|
(RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE ||
|
||||||
|
(OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE)
|
||||||
|
{
|
||||||
|
AddTerseUpdateToAllAvatars();
|
||||||
|
ClearUpdateSchedule();
|
||||||
|
|
||||||
|
// This causes the Scene to 'poll' physical objects every couple of frames
|
||||||
|
// bad, so it's been replaced by an event driven method.
|
||||||
|
//if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
|
||||||
|
//{
|
||||||
|
// Only send the constant terse updates on physical objects!
|
||||||
|
//ScheduleTerseUpdate();
|
||||||
|
//}
|
||||||
|
|
||||||
|
// Update the "last" values
|
||||||
|
m_lastPosition = OffsetPosition;
|
||||||
|
m_lastRotation = RotationOffset;
|
||||||
|
m_lastVelocity = Velocity;
|
||||||
|
m_lastAcceleration = Acceleration;
|
||||||
|
m_lastAngularVelocity = RotationalVelocity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2467,8 +2489,8 @@ if (m_shape != null) {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendTerseUpdateToAllClients()
|
public void SendTerseUpdateToAllClients()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
SendTerseUpdateToClient(avatars[i].ControllingClient);
|
SendTerseUpdateToClient(avatars[i].ControllingClient);
|
||||||
}
|
}
|
||||||
|
@ -2542,7 +2564,7 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetForce(PhysicsVector force)
|
public void SetForce(Vector3 force)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
if (PhysActor != null)
|
||||||
{
|
{
|
||||||
|
@ -2566,7 +2588,7 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVehicleVectorParam(int param, PhysicsVector value)
|
public void SetVehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
if (PhysActor != null)
|
||||||
{
|
{
|
||||||
|
@ -3408,8 +3430,8 @@ if (m_shape != null) {
|
||||||
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||||
Name,
|
Name,
|
||||||
Shape,
|
Shape,
|
||||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
AbsolutePosition,
|
||||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
Scale,
|
||||||
RotationOffset,
|
RotationOffset,
|
||||||
UsePhysics);
|
UsePhysics);
|
||||||
|
|
||||||
|
@ -3549,7 +3571,7 @@ if (m_shape != null) {
|
||||||
// in SL.
|
// in SL.
|
||||||
//
|
//
|
||||||
if (ParentGroup.RootPart != this)
|
if (ParentGroup.RootPart != this)
|
||||||
ParentGroup.RootPart.Rezzed = DateTime.Now;
|
ParentGroup.RootPart.Rezzed = DateTime.UtcNow;
|
||||||
|
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
ScheduleFullUpdate();
|
ScheduleFullUpdate();
|
||||||
|
|
|
@ -93,12 +93,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public Vector3 lastKnownAllowedPosition;
|
public Vector3 lastKnownAllowedPosition;
|
||||||
public bool sentMessageAboutRestrictedParcelFlyingDown;
|
public bool sentMessageAboutRestrictedParcelFlyingDown;
|
||||||
|
|
||||||
|
private Vector3 m_lastPosition;
|
||||||
|
private Quaternion m_lastRotation;
|
||||||
|
private Vector3 m_lastVelocity;
|
||||||
|
|
||||||
private bool m_updateflag;
|
private bool m_updateflag;
|
||||||
private byte m_movementflag;
|
private byte m_movementflag;
|
||||||
private readonly List<NewForce> m_forcesList = new List<NewForce>();
|
private readonly List<NewForce> m_forcesList = new List<NewForce>();
|
||||||
private short m_updateCount;
|
|
||||||
private uint m_requestedSitTargetID;
|
private uint m_requestedSitTargetID;
|
||||||
private UUID m_requestedSitTargetUUID = UUID.Zero;
|
private UUID m_requestedSitTargetUUID = UUID.Zero;
|
||||||
private SendCourseLocationsMethod m_sendCourseLocationsMethod;
|
private SendCourseLocationsMethod m_sendCourseLocationsMethod;
|
||||||
|
@ -145,12 +146,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public string JID = string.Empty;
|
public string JID = string.Empty;
|
||||||
|
|
||||||
// Agent moves with a PID controller causing a force to be exerted.
|
// Agent moves with a PID controller causing a force to be exerted.
|
||||||
private bool m_newForce;
|
|
||||||
private bool m_newCoarseLocations = true;
|
private bool m_newCoarseLocations = true;
|
||||||
private float m_health = 100f;
|
private float m_health = 100f;
|
||||||
|
|
||||||
private Vector3 m_lastVelocity = Vector3.Zero;
|
|
||||||
|
|
||||||
// Default AV Height
|
// Default AV Height
|
||||||
private float m_avHeight = 127.0f;
|
private float m_avHeight = 127.0f;
|
||||||
|
|
||||||
|
@ -159,16 +157,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private readonly Vector3[] Dir_Vectors = new Vector3[6];
|
private readonly Vector3[] Dir_Vectors = new Vector3[6];
|
||||||
|
|
||||||
/// <value>
|
|
||||||
/// The avatar position last sent to clients
|
|
||||||
/// </value>
|
|
||||||
private Vector3 lastPhysPos = Vector3.Zero;
|
|
||||||
|
|
||||||
/// <value>
|
|
||||||
/// The avatar body rotation last sent to clients
|
|
||||||
/// </value>
|
|
||||||
private Quaternion lastPhysRot = Quaternion.Identity;
|
|
||||||
|
|
||||||
// Position of agent's camera in world (region cordinates)
|
// Position of agent's camera in world (region cordinates)
|
||||||
protected Vector3 m_CameraCenter = Vector3.Zero;
|
protected Vector3 m_CameraCenter = Vector3.Zero;
|
||||||
protected Vector3 m_lastCameraCenter = Vector3.Zero;
|
protected Vector3 m_lastCameraCenter = Vector3.Zero;
|
||||||
|
@ -297,6 +285,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); }
|
get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector3 CameraAtAxis
|
||||||
|
{
|
||||||
|
get { return m_CameraAtAxis; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 CameraLeftAxis
|
||||||
|
{
|
||||||
|
get { return m_CameraLeftAxis; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 CameraUpAxis
|
||||||
|
{
|
||||||
|
get { return m_CameraUpAxis; }
|
||||||
|
}
|
||||||
|
|
||||||
public Vector3 Lookat
|
public Vector3 Lookat
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -431,7 +434,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
lock (m_scene.SyncRoot)
|
lock (m_scene.SyncRoot)
|
||||||
{
|
{
|
||||||
m_physicsActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
|
m_physicsActor.Position = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -471,7 +474,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
lock (m_scene.SyncRoot)
|
lock (m_scene.SyncRoot)
|
||||||
{
|
{
|
||||||
m_physicsActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
|
m_physicsActor.Velocity = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -869,14 +872,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_isChildAgent = false;
|
m_isChildAgent = false;
|
||||||
|
|
||||||
List<ScenePresence> AnimAgents = m_scene.GetScenePresences();
|
ScenePresence[] animAgents = m_scene.GetScenePresences();
|
||||||
foreach (ScenePresence p in AnimAgents)
|
for (int i = 0; i < animAgents.Length; i++)
|
||||||
{
|
{
|
||||||
if (p != this)
|
ScenePresence presence = animAgents[i];
|
||||||
p.SendAnimPackToClient(ControllingClient);
|
|
||||||
}
|
|
||||||
m_scene.EventManager.TriggerOnMakeRootAgent(this);
|
|
||||||
|
|
||||||
|
if (presence != this)
|
||||||
|
presence.SendAnimPackToClient(ControllingClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_scene.EventManager.TriggerOnMakeRootAgent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1041,7 +1046,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_avHeight = height;
|
m_avHeight = height;
|
||||||
if (PhysicsActor != null && !IsChildAgent)
|
if (PhysicsActor != null && !IsChildAgent)
|
||||||
{
|
{
|
||||||
PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight);
|
Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight);
|
||||||
PhysicsActor.Size = SetSize;
|
PhysicsActor.Size = SetSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1106,18 +1111,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
CameraConstraintActive = true;
|
CameraConstraintActive = true;
|
||||||
//m_log.DebugFormat("[RAYCASTRESULT]: {0}, {1}, {2}, {3}", hitYN, collisionPoint, localid, distance);
|
//m_log.DebugFormat("[RAYCASTRESULT]: {0}, {1}, {2}, {3}", hitYN, collisionPoint, localid, distance);
|
||||||
|
|
||||||
Vector3 normal = Vector3.Normalize(new Vector3(0,0,collisionPoint.Z) - collisionPoint);
|
Vector3 normal = Vector3.Normalize(new Vector3(0f, 0f, collisionPoint.Z) - collisionPoint);
|
||||||
ControllingClient.SendCameraConstraint(new Vector4(normal.X, normal.Y, normal.Z, -1 * Vector3.Distance(new Vector3(0,0,collisionPoint.Z),collisionPoint)));
|
ControllingClient.SendCameraConstraint(new Vector4(normal.X, normal.Y, normal.Z, -1 * Vector3.Distance(new Vector3(0,0,collisionPoint.Z),collisionPoint)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02)
|
if ((m_pos - m_lastPosition).Length() > 0.02f ||
|
||||||
|| (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)
|
(m_velocity - m_lastVelocity).Length() > 0.02f ||
|
||||||
|| lastPhysRot != m_bodyRot))
|
m_bodyRot != m_lastRotation)
|
||||||
{
|
{
|
||||||
if (CameraConstraintActive)
|
if (CameraConstraintActive)
|
||||||
{
|
{
|
||||||
ControllingClient.SendCameraConstraint(new Vector4(0, 0.5f, 0.9f, -3000f));
|
ControllingClient.SendCameraConstraint(new Vector4(0f, 0.5f, 0.9f, -3000f));
|
||||||
CameraConstraintActive = false;
|
CameraConstraintActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2356,6 +2361,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
|
const float VELOCITY_TOLERANCE = 0.01f;
|
||||||
|
const float POSITION_TOLERANCE = 10.0f;
|
||||||
|
|
||||||
SendPrimUpdates();
|
SendPrimUpdates();
|
||||||
|
|
||||||
if (m_newCoarseLocations)
|
if (m_newCoarseLocations)
|
||||||
|
@ -2366,28 +2374,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (m_isChildAgent == false)
|
if (m_isChildAgent == false)
|
||||||
{
|
{
|
||||||
if (m_newForce) // user movement 'forces' (ie commands to move)
|
// Throw away duplicate or insignificant updates
|
||||||
|
if (m_bodyRot != m_lastRotation ||
|
||||||
|
(m_velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE ||
|
||||||
|
(m_pos - m_lastPosition).Length() > POSITION_TOLERANCE)
|
||||||
{
|
{
|
||||||
SendTerseUpdateToAllClients();
|
SendTerseUpdateToAllClients();
|
||||||
m_updateCount = 0;
|
|
||||||
}
|
// Update the "last" values
|
||||||
else if (m_movementflag != 0) // scripted movement (?)
|
m_lastPosition = m_pos;
|
||||||
{
|
m_lastRotation = m_bodyRot;
|
||||||
m_updateCount++;
|
m_lastVelocity = m_velocity;
|
||||||
if (m_updateCount > 3)
|
|
||||||
{
|
|
||||||
SendTerseUpdateToAllClients();
|
|
||||||
m_updateCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02)
|
|
||||||
|| (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)
|
|
||||||
|| lastPhysRot != m_bodyRot)
|
|
||||||
{
|
|
||||||
// Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
|
|
||||||
// doing the above assures us that we know what we sent the clients last
|
|
||||||
SendTerseUpdateToAllClients();
|
|
||||||
m_updateCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// followed suggestion from mic bowman. reversed the two lines below.
|
// followed suggestion from mic bowman. reversed the two lines below.
|
||||||
|
@ -2417,7 +2414,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
pos.Z -= m_appearance.HipOffset;
|
pos.Z -= m_appearance.HipOffset;
|
||||||
|
|
||||||
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
|
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
|
||||||
pos, m_velocity, Vector3.Zero, m_rotation, Vector4.Zero, m_uuid, null, GetUpdatePriority(remoteClient)));
|
pos, m_velocity, Vector3.Zero, m_bodyRot, Vector4.UnitW, m_uuid, null, GetUpdatePriority(remoteClient)));
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
m_scene.StatsReporter.AddAgentUpdates(1);
|
||||||
|
@ -2433,12 +2430,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||||
|
|
||||||
m_lastVelocity = m_velocity;
|
|
||||||
lastPhysPos = AbsolutePosition;
|
|
||||||
lastPhysRot = m_bodyRot;
|
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCoarseLocations()
|
public void SendCoarseLocations()
|
||||||
|
@ -2517,15 +2509,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_appearance.Texture == null)
|
if (m_appearance.Texture == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Note: because Quaternion is a struct, it can't be null
|
|
||||||
Quaternion rot = m_bodyRot;
|
|
||||||
|
|
||||||
Vector3 pos = m_pos;
|
Vector3 pos = m_pos;
|
||||||
pos.Z -= m_appearance.HipOffset;
|
pos.Z -= m_appearance.HipOffset;
|
||||||
|
|
||||||
remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
|
remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
|
||||||
LocalId, m_pos, m_appearance.Texture.GetBytes(),
|
LocalId, pos, m_appearance.Texture.GetBytes(),
|
||||||
m_parentID, rot));
|
m_parentID, m_bodyRot));
|
||||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
m_scene.StatsReporter.AddAgentUpdates(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2536,9 +2525,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_perfMonMS = Environment.TickCount;
|
m_perfMonMS = Environment.TickCount;
|
||||||
|
|
||||||
List<ScenePresence> avatars = m_scene.GetScenePresences();
|
ScenePresence[] avatars = m_scene.GetScenePresences();
|
||||||
foreach (ScenePresence avatar in avatars)
|
|
||||||
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence avatar = avatars[i];
|
||||||
|
|
||||||
// only send if this is the root (children are only "listening posts" in a foreign region)
|
// only send if this is the root (children are only "listening posts" in a foreign region)
|
||||||
if (!IsChildAgent)
|
if (!IsChildAgent)
|
||||||
{
|
{
|
||||||
|
@ -2556,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
|
m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
|
||||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||||
|
|
||||||
//SendAnimPack();
|
//SendAnimPack();
|
||||||
|
@ -2588,14 +2580,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// the inventory arrives
|
// the inventory arrives
|
||||||
// m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
|
// m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
|
||||||
|
|
||||||
// Note: because Quaternion is a struct, it can't be null
|
|
||||||
Quaternion rot = m_bodyRot;
|
|
||||||
|
|
||||||
Vector3 pos = m_pos;
|
Vector3 pos = m_pos;
|
||||||
pos.Z -= m_appearance.HipOffset;
|
pos.Z -= m_appearance.HipOffset;
|
||||||
|
|
||||||
m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
|
m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
|
||||||
m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot));
|
pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
|
||||||
|
|
||||||
if (!m_isChildAgent)
|
if (!m_isChildAgent)
|
||||||
{
|
{
|
||||||
|
@ -2679,7 +2668,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
|
if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
|
||||||
{
|
{
|
||||||
m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + (AppearanceManager.TextureIndex)j + ") for avatar " + this.Name);
|
m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name);
|
||||||
this.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
|
this.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2700,9 +2689,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_startAnimationSet = true;
|
m_startAnimationSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Quaternion rot = m_bodyRot;
|
Vector3 pos = m_pos;
|
||||||
|
pos.Z -= m_appearance.HipOffset;
|
||||||
|
|
||||||
m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
|
m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
|
||||||
m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot));
|
pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3300,7 +3291,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void UpdateMovement()
|
public override void UpdateMovement()
|
||||||
{
|
{
|
||||||
m_newForce = false;
|
|
||||||
lock (m_forcesList)
|
lock (m_forcesList)
|
||||||
{
|
{
|
||||||
if (m_forcesList.Count > 0)
|
if (m_forcesList.Count > 0)
|
||||||
|
@ -3322,7 +3312,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Ignoring this causes no movement to be sent to the physics engine...
|
// Ignoring this causes no movement to be sent to the physics engine...
|
||||||
// which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
|
// which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
|
||||||
}
|
}
|
||||||
m_newForce = true;
|
|
||||||
|
|
||||||
m_forcesList.Clear();
|
m_forcesList.Clear();
|
||||||
}
|
}
|
||||||
|
@ -3356,20 +3345,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
PhysicsScene scene = m_scene.PhysicsScene;
|
PhysicsScene scene = m_scene.PhysicsScene;
|
||||||
|
|
||||||
PhysicsVector pVec =
|
Vector3 pVec = AbsolutePosition;
|
||||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
|
|
||||||
AbsolutePosition.Z);
|
|
||||||
|
|
||||||
// Old bug where the height was in centimeters instead of meters
|
// Old bug where the height was in centimeters instead of meters
|
||||||
if (m_avHeight == 127.0f)
|
if (m_avHeight == 127.0f)
|
||||||
{
|
{
|
||||||
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f),
|
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f),
|
||||||
isFlying);
|
isFlying);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
|
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
|
||||||
new PhysicsVector(0, 0, m_avHeight), isFlying);
|
new Vector3(0f, 0f, m_avHeight), isFlying);
|
||||||
}
|
}
|
||||||
scene.AddPhysicsActorTaint(m_physicsActor);
|
scene.AddPhysicsActorTaint(m_physicsActor);
|
||||||
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
||||||
|
@ -3380,7 +3367,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OutOfBoundsCall(PhysicsVector pos)
|
private void OutOfBoundsCall(Vector3 pos)
|
||||||
{
|
{
|
||||||
//bool flying = m_physicsActor.Flying;
|
//bool flying = m_physicsActor.Flying;
|
||||||
//RemoveFromPhysicalScene();
|
//RemoveFromPhysicalScene();
|
||||||
|
@ -3603,7 +3590,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void PushForce(PhysicsVector impulse)
|
internal void PushForce(Vector3 impulse)
|
||||||
{
|
{
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
{
|
{
|
||||||
|
@ -3866,6 +3853,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return GetPriorityByDistance(client);
|
return GetPriorityByDistance(client);
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
return GetPriorityByDistance(client);
|
return GetPriorityByDistance(client);
|
||||||
|
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return GetPriorityByFrontBack(client);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
|
||||||
}
|
}
|
||||||
|
@ -3887,11 +3876,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return double.NaN;
|
return double.NaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double GetPriorityByFrontBack(IClientAPI client)
|
||||||
|
{
|
||||||
|
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
||||||
|
if (presence != null)
|
||||||
|
{
|
||||||
|
return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
|
||||||
|
}
|
||||||
|
return double.NaN;
|
||||||
|
}
|
||||||
|
|
||||||
private double GetPriorityByDistance(Vector3 position)
|
private double GetPriorityByDistance(Vector3 position)
|
||||||
{
|
{
|
||||||
return Vector3.Distance(AbsolutePosition, position);
|
return Vector3.Distance(AbsolutePosition, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
|
||||||
|
{
|
||||||
|
// Distance
|
||||||
|
double priority = Vector3.Distance(camPosition, AbsolutePosition);
|
||||||
|
|
||||||
|
// Plane equation
|
||||||
|
float d = -Vector3.Dot(camPosition, camAtAxis);
|
||||||
|
float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
|
||||||
|
if (p < 0.0f) priority *= 2.0f;
|
||||||
|
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
private double GetSOGUpdatePriority(SceneObjectGroup sog)
|
private double GetSOGUpdatePriority(SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
switch (Scene.UpdatePrioritizationScheme)
|
switch (Scene.UpdatePrioritizationScheme)
|
||||||
|
@ -3902,6 +3914,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
||||||
|
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return sog.GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
||||||
}
|
}
|
||||||
|
@ -3928,6 +3942,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
case Scene.UpdatePrioritizationSchemes.Distance:
|
case Scene.UpdatePrioritizationSchemes.Distance:
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
||||||
|
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
m_client = client;
|
m_client = client;
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
|
||||||
Thread loopThread = new Thread(InternalLoop);
|
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false);
|
||||||
loopThread.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendServerCommand(string command)
|
private void SendServerCommand(string command)
|
||||||
|
@ -102,7 +101,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string strbuf = "";
|
string strbuf = String.Empty;
|
||||||
|
|
||||||
while (m_connected && m_client.Connected)
|
while (m_connected && m_client.Connected)
|
||||||
{
|
{
|
||||||
|
@ -140,6 +139,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
|
@ -156,6 +156,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
|
|
||||||
m_log.Warn("[IRCd] Disconnected client.");
|
m_log.Warn("[IRCd] Disconnected client.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessInMessage(string message, string command)
|
private void ProcessInMessage(string message, string command)
|
||||||
|
|
|
@ -33,6 +33,7 @@ using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
|
@ -56,8 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
|
|
||||||
m_listener.Start(50);
|
m_listener.Start(50);
|
||||||
|
|
||||||
Thread thread = new Thread(ListenLoop);
|
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false);
|
||||||
thread.Start();
|
|
||||||
m_baseScene = baseScene;
|
m_baseScene = baseScene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
while (m_running)
|
while (m_running)
|
||||||
{
|
{
|
||||||
AcceptClient(m_listener.AcceptTcpClient());
|
AcceptClient(m_listener.AcceptTcpClient());
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AcceptClient(TcpClient client)
|
private void AcceptClient(TcpClient client)
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
private Dictionary<UUID, GroupRequestIDInfo> m_clientRequestIDInfo = new Dictionary<UUID, GroupRequestIDInfo>();
|
private Dictionary<UUID, GroupRequestIDInfo> m_clientRequestIDInfo = new Dictionary<UUID, GroupRequestIDInfo>();
|
||||||
private const int m_clientRequestIDFlushTimeOut = 300000; // Every 5 minutes
|
private const int m_clientRequestIDFlushTimeOut = 300000; // Every 5 minutes
|
||||||
private Timer m_clientRequestIDFlushTimer = new Timer();
|
private Timer m_clientRequestIDFlushTimer;
|
||||||
|
|
||||||
|
|
||||||
// Configuration settings
|
// Configuration settings
|
||||||
|
@ -133,6 +133,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true);
|
m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true);
|
||||||
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
|
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
|
||||||
|
|
||||||
|
m_clientRequestIDFlushTimer = new Timer();
|
||||||
m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut;
|
m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut;
|
||||||
m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache;
|
m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache;
|
||||||
m_clientRequestIDFlushTimer.AutoReset = true;
|
m_clientRequestIDFlushTimer.AutoReset = true;
|
||||||
|
|
|
@ -86,7 +86,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
/// </value>
|
/// </value>
|
||||||
Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable());
|
Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable());
|
||||||
State m_state = State.NONE;
|
State m_state = State.NONE;
|
||||||
Thread m_thread = null;
|
|
||||||
CMView m_view = null;
|
CMView m_view = null;
|
||||||
|
|
||||||
#endregion Fields
|
#endregion Fields
|
||||||
|
@ -148,10 +147,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
m_estateModule = scene.RequestModuleInterface<IEstateModule>();
|
m_estateModule = scene.RequestModuleInterface<IEstateModule>();
|
||||||
m_thread = new Thread(MainLoop);
|
Watchdog.StartThread(MainLoop, "Content Management", ThreadPriority.Normal, true);
|
||||||
m_thread.Name = "Content Management";
|
|
||||||
m_thread.IsBackground = true;
|
|
||||||
m_thread.Start();
|
|
||||||
m_state = State.NONE;
|
m_state = State.NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,6 +196,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?");
|
m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -209,6 +207,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
"[CONTENT MANAGEMENT]: Content management thread terminating with exception. PLEASE REBOOT YOUR SIM - CONTENT MANAGEMENT WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
|
"[CONTENT MANAGEMENT]: Content management thread terminating with exception. PLEASE REBOOT YOUR SIM - CONTENT MANAGEMENT WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -183,10 +183,12 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
public virtual void HideFromAll()
|
public virtual void HideFromAll()
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_Entity.Children.Values)
|
foreach (SceneObjectPart part in m_Entity.Children.Values)
|
||||||
m_Entity.Scene.ClientManager.ForEach(
|
{
|
||||||
|
m_Entity.Scene.ForEachClient(
|
||||||
delegate(IClientAPI controller)
|
delegate(IClientAPI controller)
|
||||||
{ controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); }
|
{ controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); }
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendFullUpdate(IClientAPI client)
|
public void SendFullUpdate(IClientAPI client)
|
||||||
|
@ -202,7 +204,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
|
|
||||||
public void SendFullUpdateToAll()
|
public void SendFullUpdateToAll()
|
||||||
{
|
{
|
||||||
m_Entity.Scene.ClientManager.ForEach(
|
m_Entity.Scene.ForEachClient(
|
||||||
delegate(IClientAPI controller)
|
delegate(IClientAPI controller)
|
||||||
{ m_Entity.SendFullUpdateToClient(controller); }
|
{ m_Entity.SendFullUpdateToClient(controller); }
|
||||||
);
|
);
|
||||||
|
|
|
@ -525,8 +525,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector tmp = GetSOP().PhysActor.GeometricCenter;
|
Vector3 tmp = GetSOP().PhysActor.GeometricCenter;
|
||||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
return tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,8 +534,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector tmp = GetSOP().PhysActor.CenterOfMass;
|
Vector3 tmp = GetSOP().PhysActor.CenterOfMass;
|
||||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
return tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,15 +543,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector tmp = GetSOP().PhysActor.RotationalVelocity;
|
Vector3 tmp = GetSOP().PhysActor.RotationalVelocity;
|
||||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
return tmp;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!CanEdit())
|
if (!CanEdit())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z);
|
GetSOP().PhysActor.RotationalVelocity = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,15 +559,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector tmp = GetSOP().PhysActor.Velocity;
|
Vector3 tmp = GetSOP().PhysActor.Velocity;
|
||||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
return tmp;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!CanEdit())
|
if (!CanEdit())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
|
GetSOP().PhysActor.Velocity = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,15 +575,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector tmp = GetSOP().PhysActor.Torque;
|
Vector3 tmp = GetSOP().PhysActor.Torque;
|
||||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
return tmp;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!CanEdit())
|
if (!CanEdit())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z);
|
GetSOP().PhysActor.Torque = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,8 +591,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector tmp = GetSOP().PhysActor.Acceleration;
|
Vector3 tmp = GetSOP().PhysActor.Acceleration;
|
||||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
return tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,15 +600,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector tmp = GetSOP().PhysActor.Force;
|
Vector3 tmp = GetSOP().PhysActor.Force;
|
||||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
return tmp;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!CanEdit())
|
if (!CanEdit())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z);
|
GetSOP().PhysActor.Force = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
if (!CanEdit())
|
if (!CanEdit())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce);
|
GetSOP().PhysActor.AddForce(force, pushforce);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAngularForce(Vector3 force, bool pushforce)
|
public void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
|
@ -635,7 +635,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
if (!CanEdit())
|
if (!CanEdit())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce);
|
GetSOP().PhysActor.AddAngularForce(force, pushforce);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMomentum(Vector3 momentum)
|
public void SetMomentum(Vector3 momentum)
|
||||||
|
@ -643,7 +643,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
if (!CanEdit())
|
if (!CanEdit())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z));
|
GetSOP().PhysActor.SetMomentum(momentum);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -45,13 +45,13 @@ namespace OpenSim.Region.Modules.SvnSerialiser
|
||||||
public class SvnBackupModule : IRegionModule
|
public class SvnBackupModule : IRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private readonly List<Scene> m_scenes = new List<Scene>();
|
|
||||||
private readonly Timer m_timer = new Timer();
|
|
||||||
|
|
||||||
private bool m_enabled = false;
|
private List<Scene> m_scenes;
|
||||||
private bool m_installBackupOnLoad = false;
|
private Timer m_timer;
|
||||||
|
private bool m_enabled;
|
||||||
|
private bool m_installBackupOnLoad;
|
||||||
private IRegionSerialiserModule m_serialiser;
|
private IRegionSerialiserModule m_serialiser;
|
||||||
private bool m_svnAutoSave = false;
|
private bool m_svnAutoSave;
|
||||||
private SvnClient m_svnClient;
|
private SvnClient m_svnClient;
|
||||||
private string m_svndir = "SVNmodule" + Slash.DirectorySeparatorChar + "repo";
|
private string m_svndir = "SVNmodule" + Slash.DirectorySeparatorChar + "repo";
|
||||||
private string m_svnpass = "password";
|
private string m_svnpass = "password";
|
||||||
|
@ -204,6 +204,9 @@ namespace OpenSim.Region.Modules.SvnSerialiser
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
|
m_scenes = new List<Scene>();
|
||||||
|
m_timer = new Timer();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!source.Configs["SVN"].GetBoolean("Enabled", false))
|
if (!source.Configs["SVN"].GetBoolean("Enabled", false))
|
||||||
|
|
|
@ -41,12 +41,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
// private const bool m_enabled = false;
|
// private const bool m_enabled = false;
|
||||||
|
|
||||||
private Mutex m_createMutex = new Mutex(false);
|
private Mutex m_createMutex;
|
||||||
|
private Timer m_timer;
|
||||||
private Timer m_timer = new Timer(500);
|
|
||||||
|
|
||||||
private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
|
private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
|
||||||
|
|
||||||
private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>();
|
private Dictionary<UUID,AvatarAppearance> m_appearanceCache = new Dictionary<UUID, AvatarAppearance>();
|
||||||
|
|
||||||
// Timer vars.
|
// Timer vars.
|
||||||
|
@ -138,10 +136,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
scene.RegisterModuleInterface<INPCModule>(this);
|
m_createMutex = new Mutex(false);
|
||||||
|
|
||||||
|
m_timer = new Timer(500);
|
||||||
m_timer.Elapsed += m_timer_Elapsed;
|
m_timer.Elapsed += m_timer_Elapsed;
|
||||||
m_timer.Start();
|
m_timer.Start();
|
||||||
|
|
||||||
|
scene.RegisterModuleInterface<INPCModule>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
|
|
|
@ -36,20 +36,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
{
|
{
|
||||||
public class BasicActor : PhysicsActor
|
public class BasicActor : PhysicsActor
|
||||||
{
|
{
|
||||||
private PhysicsVector _position;
|
private Vector3 _position;
|
||||||
private PhysicsVector _velocity;
|
private Vector3 _velocity;
|
||||||
private PhysicsVector _acceleration;
|
private Vector3 _acceleration;
|
||||||
private PhysicsVector _size;
|
private Vector3 _size;
|
||||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
private Vector3 m_rotationalVelocity;
|
||||||
private bool flying;
|
private bool flying;
|
||||||
private bool iscolliding;
|
private bool iscolliding;
|
||||||
|
|
||||||
public BasicActor()
|
public BasicActor()
|
||||||
{
|
{
|
||||||
_velocity = new PhysicsVector();
|
|
||||||
_position = new PhysicsVector();
|
|
||||||
_acceleration = new PhysicsVector();
|
|
||||||
_size = new PhysicsVector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int PhysicsActorType
|
public override int PhysicsActorType
|
||||||
|
@ -58,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return m_rotationalVelocity; }
|
get { return m_rotationalVelocity; }
|
||||||
set { m_rotationalVelocity = value; }
|
set { m_rotationalVelocity = value; }
|
||||||
|
@ -137,13 +133,13 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
set { _position = value; }
|
set { _position = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return _size; }
|
get { return _size; }
|
||||||
set {
|
set {
|
||||||
|
@ -162,9 +158,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
get { return 0f; }
|
get { return 0f; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +175,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -194,25 +190,25 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return _velocity; }
|
get { return _velocity; }
|
||||||
set { _velocity = value; }
|
set { _velocity = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +224,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
@ -247,24 +243,24 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAcceleration(PhysicsVector accel)
|
public void SetAcceleration(Vector3 accel)
|
||||||
{
|
{
|
||||||
_acceleration = accel;
|
_acceleration = accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +268,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget
|
public override Vector3 PIDTarget
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
BasicActor act = new BasicActor();
|
BasicActor act = new BasicActor();
|
||||||
act.Position = position;
|
act.Position = position;
|
||||||
|
@ -77,20 +77,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation)
|
Vector3 size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -105,26 +105,28 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
for (int i = 0; i < _actors.Count; ++i)
|
for (int i = 0; i < _actors.Count; ++i)
|
||||||
{
|
{
|
||||||
BasicActor actor = _actors[i];
|
BasicActor actor = _actors[i];
|
||||||
|
Vector3 actorPosition = actor.Position;
|
||||||
|
Vector3 actorVelocity = actor.Velocity;
|
||||||
|
|
||||||
actor.Position.X += actor.Velocity.X*timeStep;
|
actorPosition.X += actor.Velocity.X*timeStep;
|
||||||
actor.Position.Y += actor.Velocity.Y*timeStep;
|
actorPosition.Y += actor.Velocity.Y*timeStep;
|
||||||
|
|
||||||
if (actor.Position.Y < 0)
|
if (actor.Position.Y < 0)
|
||||||
{
|
{
|
||||||
actor.Position.Y = 0.1F;
|
actorPosition.Y = 0.1F;
|
||||||
}
|
}
|
||||||
else if (actor.Position.Y >= Constants.RegionSize)
|
else if (actor.Position.Y >= Constants.RegionSize)
|
||||||
{
|
{
|
||||||
actor.Position.Y = ((int)Constants.RegionSize - 0.1f);
|
actorPosition.Y = ((int)Constants.RegionSize - 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actor.Position.X < 0)
|
if (actor.Position.X < 0)
|
||||||
{
|
{
|
||||||
actor.Position.X = 0.1F;
|
actorPosition.X = 0.1F;
|
||||||
}
|
}
|
||||||
else if (actor.Position.X >= Constants.RegionSize)
|
else if (actor.Position.X >= Constants.RegionSize)
|
||||||
{
|
{
|
||||||
actor.Position.X = ((int)Constants.RegionSize - 0.1f);
|
actorPosition.X = ((int)Constants.RegionSize - 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z;
|
float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z;
|
||||||
|
@ -133,23 +135,27 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
|
if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
|
||||||
_heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
|
_heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
|
||||||
{
|
{
|
||||||
actor.Position.Z = height;
|
actorPosition.Z = height;
|
||||||
actor.Velocity.Z = 0;
|
actorVelocity.Z = 0;
|
||||||
actor.IsColliding = true;
|
actor.IsColliding = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actor.Position.Z += actor.Velocity.Z*timeStep;
|
actorPosition.Z += actor.Velocity.Z*timeStep;
|
||||||
actor.IsColliding = false;
|
actor.IsColliding = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actor.Position.Z = height;
|
actorPosition.Z = height;
|
||||||
actor.Velocity.Z = 0;
|
actorVelocity.Z = 0;
|
||||||
actor.IsColliding = true;
|
actor.IsColliding = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor.Position = actorPosition;
|
||||||
|
actor.Velocity = actorVelocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fps;
|
return fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,15 +60,15 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
private btQuaternion m_bodyOrientation;
|
private btQuaternion m_bodyOrientation;
|
||||||
private btDefaultMotionState m_bodyMotionState;
|
private btDefaultMotionState m_bodyMotionState;
|
||||||
private btGeneric6DofConstraint m_aMotor;
|
private btGeneric6DofConstraint m_aMotor;
|
||||||
// private PhysicsVector m_movementComparision;
|
// private Vector3 m_movementComparision;
|
||||||
private PhysicsVector m_position;
|
private Vector3 m_position;
|
||||||
private PhysicsVector m_zeroPosition;
|
private Vector3 m_zeroPosition;
|
||||||
private bool m_zeroFlag = false;
|
private bool m_zeroFlag = false;
|
||||||
private bool m_lastUpdateSent = false;
|
private bool m_lastUpdateSent = false;
|
||||||
private PhysicsVector m_velocity;
|
private Vector3 m_velocity;
|
||||||
private PhysicsVector m_target_velocity;
|
private Vector3 m_target_velocity;
|
||||||
private PhysicsVector m_acceleration;
|
private Vector3 m_acceleration;
|
||||||
private PhysicsVector m_rotationalVelocity;
|
private Vector3 m_rotationalVelocity;
|
||||||
private bool m_pidControllerActive = true;
|
private bool m_pidControllerActive = true;
|
||||||
public float PID_D = 80.0f;
|
public float PID_D = 80.0f;
|
||||||
public float PID_P = 90.0f;
|
public float PID_P = 90.0f;
|
||||||
|
@ -96,8 +96,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes.
|
private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes.
|
||||||
private bool m_taintRemove = false;
|
private bool m_taintRemove = false;
|
||||||
// private bool m_taintedPosition = false;
|
// private bool m_taintedPosition = false;
|
||||||
// private PhysicsVector m_taintedPosition_value;
|
// private Vector3 m_taintedPosition_value;
|
||||||
private PhysicsVector m_taintedForce;
|
private Vector3 m_taintedForce;
|
||||||
|
|
||||||
private float m_buoyancy = 0f;
|
private float m_buoyancy = 0f;
|
||||||
|
|
||||||
|
@ -115,14 +115,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
public int m_eventsubscription = 0;
|
public int m_eventsubscription = 0;
|
||||||
// private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
// private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||||
|
|
||||||
public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, PhysicsVector pos, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
|
public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
|
||||||
{
|
{
|
||||||
m_taintedForce = new PhysicsVector();
|
|
||||||
m_velocity = new PhysicsVector();
|
|
||||||
m_target_velocity = new PhysicsVector();
|
|
||||||
m_position = pos;
|
m_position = pos;
|
||||||
m_zeroPosition = new PhysicsVector(pos.X, pos.Y, pos.Z); // this is a class, not a struct. Must make new, or m_zeroPosition will == position regardless
|
m_zeroPosition = pos;
|
||||||
m_acceleration = new PhysicsVector();
|
|
||||||
m_parent_scene = parent_scene;
|
m_parent_scene = parent_scene;
|
||||||
PID_D = pid_d;
|
PID_D = pid_d;
|
||||||
PID_P = pid_p;
|
PID_P = pid_p;
|
||||||
|
@ -161,9 +157,6 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
tempTrans1 = new btTransform(tempQuat1, tempVector1);
|
tempTrans1 = new btTransform(tempQuat1, tempVector1);
|
||||||
// m_movementComparision = new PhysicsVector(0, 0, 0);
|
// m_movementComparision = new PhysicsVector(0, 0, 0);
|
||||||
m_CapsuleOrientationAxis = new btVector3(1, 0, 1);
|
m_CapsuleOrientationAxis = new btVector3(1, 0, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -254,18 +247,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
get { return m_zeroFlag; }
|
get { return m_zeroFlag; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return new PhysicsVector(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_pidControllerActive = true;
|
m_pidControllerActive = true;
|
||||||
|
|
||||||
PhysicsVector SetSize = value;
|
Vector3 SetSize = value;
|
||||||
m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
||||||
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
|
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
|
||||||
|
|
||||||
Velocity = new PhysicsVector(0f, 0f, 0f);
|
Velocity = Vector3.Zero;
|
||||||
|
|
||||||
m_parent_scene.AddPhysicsActorTaint(this);
|
m_parent_scene.AddPhysicsActorTaint(this);
|
||||||
}
|
}
|
||||||
|
@ -317,12 +310,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return m_position; }
|
get { return m_position; }
|
||||||
set
|
set
|
||||||
|
@ -342,9 +335,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
get { return new PhysicsVector(m_target_velocity.X, m_target_velocity.Y, m_target_velocity.Z); }
|
get { return m_target_velocity; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +352,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -374,23 +367,22 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// There's a problem with PhysicsVector.Zero! Don't Use it Here!
|
|
||||||
if (m_zeroFlag)
|
if (m_zeroFlag)
|
||||||
return new PhysicsVector(0f, 0f, 0f);
|
return Vector3.Zero;
|
||||||
m_lastUpdateSent = false;
|
m_lastUpdateSent = false;
|
||||||
return m_velocity;
|
return m_velocity;
|
||||||
}
|
}
|
||||||
|
@ -401,9 +393,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +405,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return m_acceleration; }
|
get { return m_acceleration; }
|
||||||
}
|
}
|
||||||
|
@ -586,7 +578,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return m_rotationalVelocity; }
|
get { return m_rotationalVelocity; }
|
||||||
set { m_rotationalVelocity = value; }
|
set { m_rotationalVelocity = value; }
|
||||||
|
@ -604,7 +596,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
set { m_buoyancy = value; }
|
set { m_buoyancy = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget { set { return; } }
|
public override Vector3 PIDTarget { set { return; } }
|
||||||
public override bool PIDActive { set { return; } }
|
public override bool PIDActive { set { return; } }
|
||||||
public override float PIDTau { set { return; } }
|
public override float PIDTau { set { return; } }
|
||||||
|
|
||||||
|
@ -634,7 +626,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="force"></param>
|
/// <param name="force"></param>
|
||||||
/// <param name="pushforce">Is this a push by a script?</param>
|
/// <param name="pushforce">Is this a push by a script?</param>
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
if (pushforce)
|
if (pushforce)
|
||||||
{
|
{
|
||||||
|
@ -656,7 +648,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
//m_lastUpdateSent = false;
|
//m_lastUpdateSent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doForce(PhysicsVector force, bool now)
|
public void doForce(Vector3 force, bool now)
|
||||||
{
|
{
|
||||||
|
|
||||||
tempVector3.setValue(force.X, force.Y, force.Z);
|
tempVector3.setValue(force.X, force.Y, force.Z);
|
||||||
|
@ -671,7 +663,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doImpulse(PhysicsVector force, bool now)
|
public void doImpulse(Vector3 force, bool now)
|
||||||
{
|
{
|
||||||
|
|
||||||
tempVector3.setValue(force.X, force.Y, force.Z);
|
tempVector3.setValue(force.X, force.Y, force.Z);
|
||||||
|
@ -686,12 +678,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -808,7 +800,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
AvatarGeomAndBodyCreation(m_position.X, m_position.Y,
|
AvatarGeomAndBodyCreation(m_position.X, m_position.Y,
|
||||||
m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2));
|
m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2));
|
||||||
Velocity = new PhysicsVector(0f, 0f, 0f);
|
Velocity = Vector3.Zero;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -852,9 +844,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
//PidStatus = true;
|
//PidStatus = true;
|
||||||
|
|
||||||
PhysicsVector vec = new PhysicsVector();
|
Vector3 vec = Vector3.Zero;
|
||||||
|
|
||||||
PhysicsVector vel = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
|
Vector3 vel = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
|
||||||
|
|
||||||
float movementdivisor = 1f;
|
float movementdivisor = 1f;
|
||||||
|
|
||||||
|
@ -885,7 +877,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
// Avatar to Avatar collisions
|
// Avatar to Avatar collisions
|
||||||
// Prim to avatar collisions
|
// Prim to avatar collisions
|
||||||
|
|
||||||
PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
||||||
vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2);
|
vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2);
|
||||||
vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2);
|
vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2);
|
||||||
if (m_flying)
|
if (m_flying)
|
||||||
|
@ -927,7 +919,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
{
|
{
|
||||||
// We're colliding with something and we're not flying but we're moving
|
// We're colliding with something and we're not flying but we're moving
|
||||||
// This means we're walking or running.
|
// This means we're walking or running.
|
||||||
PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
||||||
vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P;
|
vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P;
|
||||||
if (m_target_velocity.X > 0)
|
if (m_target_velocity.X > 0)
|
||||||
{
|
{
|
||||||
|
@ -1016,7 +1008,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
tempVector2 = Body.getInterpolationLinearVelocity();
|
tempVector2 = Body.getInterpolationLinearVelocity();
|
||||||
|
|
||||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
||||||
PhysicsVector vec = new PhysicsVector(tempVector1.getX(),tempVector1.getY(),tempVector1.getZ());
|
Vector3 vec = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
||||||
|
|
||||||
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
|
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
|
||||||
if (vec.X < -10.0f) vec.X = 0.0f;
|
if (vec.X < -10.0f) vec.X = 0.0f;
|
||||||
|
@ -1048,7 +1040,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_lastUpdateSent = false;
|
m_lastUpdateSent = false;
|
||||||
vec = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
|
vec = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
|
||||||
m_velocity.X = (vec.X);
|
m_velocity.X = (vec.X);
|
||||||
m_velocity.Y = (vec.Y);
|
m_velocity.Y = (vec.Y);
|
||||||
|
|
||||||
|
|
|
@ -43,44 +43,43 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private PhysicsVector _position;
|
private Vector3 _position;
|
||||||
private PhysicsVector m_zeroPosition;
|
private Vector3 m_zeroPosition;
|
||||||
private PhysicsVector _velocity;
|
private Vector3 _velocity;
|
||||||
private PhysicsVector _torque = new PhysicsVector(0, 0, 0);
|
private Vector3 _torque;
|
||||||
private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
private Vector3 m_lastVelocity;
|
||||||
private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
private Vector3 m_lastposition;
|
||||||
private Quaternion m_lastorientation = new Quaternion();
|
private Quaternion m_lastorientation = Quaternion.Identity;
|
||||||
private PhysicsVector m_rotationalVelocity;
|
private Vector3 m_rotationalVelocity;
|
||||||
private PhysicsVector _size;
|
private Vector3 _size;
|
||||||
private PhysicsVector _acceleration;
|
private Vector3 _acceleration;
|
||||||
// private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
|
// private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
|
||||||
private Quaternion _orientation;
|
private Quaternion _orientation;
|
||||||
private PhysicsVector m_taintposition;
|
private Vector3 m_taintposition;
|
||||||
private PhysicsVector m_taintsize;
|
private Vector3 m_taintsize;
|
||||||
private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0);
|
private Vector3 m_taintVelocity;
|
||||||
private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0);
|
private Vector3 m_taintTorque;
|
||||||
private Quaternion m_taintrot;
|
private Quaternion m_taintrot;
|
||||||
private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f);
|
private Vector3 m_angularlock = Vector3.One;
|
||||||
private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f);
|
private Vector3 m_taintAngularLock = Vector3.One;
|
||||||
// private btGeneric6DofConstraint Amotor;
|
// private btGeneric6DofConstraint Amotor;
|
||||||
|
|
||||||
private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0);
|
private Vector3 m_PIDTarget;
|
||||||
private float m_PIDTau = 0f;
|
private float m_PIDTau;
|
||||||
private float m_PIDHoverHeight = 0f;
|
private float m_PIDHoverHeight;
|
||||||
private float m_PIDHoverTau = 0f;
|
private float m_PIDHoverTau;
|
||||||
private bool m_useHoverPID = false;
|
private bool m_useHoverPID;
|
||||||
private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
|
private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
|
||||||
private float m_targetHoverHeight = 0f;
|
private float m_targetHoverHeight;
|
||||||
private float m_groundHeight = 0f;
|
private float m_groundHeight;
|
||||||
private float m_waterHeight = 0f;
|
private float m_waterHeight;
|
||||||
private float PID_D = 35f;
|
private float PID_D = 35f;
|
||||||
private float PID_G = 25f;
|
private float PID_G = 25f;
|
||||||
// private float m_tensor = 5f;
|
// private float m_tensor = 5f;
|
||||||
// private int body_autodisable_frames = 20;
|
// private int body_autodisable_frames = 20;
|
||||||
private IMesh primMesh = null;
|
private IMesh primMesh;
|
||||||
|
|
||||||
private bool m_usePID = false;
|
|
||||||
|
|
||||||
|
private bool m_usePID;
|
||||||
|
|
||||||
private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
|
private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
|
||||||
| CollisionCategories.Space
|
| CollisionCategories.Space
|
||||||
|
@ -88,11 +87,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
| CollisionCategories.Character
|
| CollisionCategories.Character
|
||||||
);
|
);
|
||||||
|
|
||||||
private bool m_taintshape = false;
|
private bool m_taintshape;
|
||||||
private bool m_taintPhysics = false;
|
private bool m_taintPhysics;
|
||||||
// private bool m_collidesLand = true;
|
// private bool m_collidesLand = true;
|
||||||
private bool m_collidesWater = false;
|
private bool m_collidesWater;
|
||||||
public bool m_returnCollisions = false;
|
public bool m_returnCollisions;
|
||||||
|
|
||||||
// Default we're a Geometry
|
// Default we're a Geometry
|
||||||
// private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
|
// private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
|
||||||
|
@ -100,23 +99,23 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
// Default, Collide with Other Geometries, spaces and Bodies
|
// Default, Collide with Other Geometries, spaces and Bodies
|
||||||
// private CollisionCategories m_collisionFlags = m_default_collisionFlags;
|
// private CollisionCategories m_collisionFlags = m_default_collisionFlags;
|
||||||
|
|
||||||
public bool m_taintremove = false;
|
public bool m_taintremove;
|
||||||
public bool m_taintdisable = false;
|
public bool m_taintdisable;
|
||||||
public bool m_disabled = false;
|
public bool m_disabled;
|
||||||
public bool m_taintadd = false;
|
public bool m_taintadd;
|
||||||
public bool m_taintselected = false;
|
public bool m_taintselected;
|
||||||
public bool m_taintCollidesWater = false;
|
public bool m_taintCollidesWater;
|
||||||
|
|
||||||
public uint m_localID = 0;
|
public uint m_localID;
|
||||||
|
|
||||||
//public GCHandle gc;
|
//public GCHandle gc;
|
||||||
// private CollisionLocker ode;
|
// private CollisionLocker ode;
|
||||||
|
|
||||||
private bool m_taintforce = false;
|
private bool m_taintforce;
|
||||||
private bool m_taintaddangularforce = false;
|
private bool m_taintaddangularforce;
|
||||||
private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
private Vector3 m_force;
|
||||||
private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
|
private List<Vector3> m_forcelist = new List<Vector3>();
|
||||||
private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>();
|
private List<Vector3> m_angularforcelist = new List<Vector3>();
|
||||||
|
|
||||||
private IMesh _mesh;
|
private IMesh _mesh;
|
||||||
private PrimitiveBaseShape _pbs;
|
private PrimitiveBaseShape _pbs;
|
||||||
|
@ -124,40 +123,40 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
public btCollisionShape prim_geom;
|
public btCollisionShape prim_geom;
|
||||||
public IntPtr _triMeshData;
|
public IntPtr _triMeshData;
|
||||||
|
|
||||||
private PhysicsActor _parent = null;
|
private PhysicsActor _parent;
|
||||||
private PhysicsActor m_taintparent = null;
|
private PhysicsActor m_taintparent;
|
||||||
|
|
||||||
private List<BulletDotNETPrim> childrenPrim = new List<BulletDotNETPrim>();
|
private List<BulletDotNETPrim> childrenPrim = new List<BulletDotNETPrim>();
|
||||||
|
|
||||||
private bool iscolliding = false;
|
private bool iscolliding;
|
||||||
private bool m_isphysical = false;
|
private bool m_isphysical;
|
||||||
private bool m_isSelected = false;
|
private bool m_isSelected;
|
||||||
|
|
||||||
internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively
|
internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
|
||||||
|
|
||||||
private bool m_throttleUpdates = false;
|
private bool m_throttleUpdates;
|
||||||
// private int throttleCounter = 0;
|
// private int throttleCounter;
|
||||||
public int m_interpenetrationcount = 0;
|
public int m_interpenetrationcount;
|
||||||
public float m_collisionscore = 0;
|
public float m_collisionscore;
|
||||||
public int m_roundsUnderMotionThreshold = 0;
|
public int m_roundsUnderMotionThreshold;
|
||||||
private int m_crossingfailures = 0;
|
private int m_crossingfailures;
|
||||||
|
|
||||||
public float m_buoyancy = 0f;
|
public float m_buoyancy;
|
||||||
|
|
||||||
public bool outofBounds = false;
|
public bool outofBounds;
|
||||||
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
||||||
|
|
||||||
public bool _zeroFlag = false;
|
public bool _zeroFlag;
|
||||||
private bool m_lastUpdateSent = false;
|
private bool m_lastUpdateSent;
|
||||||
|
|
||||||
|
|
||||||
private String m_primName;
|
private String m_primName;
|
||||||
private PhysicsVector _target_velocity;
|
private Vector3 _target_velocity;
|
||||||
|
|
||||||
public int m_eventsubscription = 0;
|
public int m_eventsubscription;
|
||||||
// private CollisionEventUpdate CollisionEventsThisFrame = null;
|
// private CollisionEventUpdate CollisionEventsThisFrame = null;
|
||||||
|
|
||||||
public volatile bool childPrim = false;
|
public volatile bool childPrim;
|
||||||
|
|
||||||
private btVector3 tempPosition1;
|
private btVector3 tempPosition1;
|
||||||
private btVector3 tempPosition2;
|
private btVector3 tempPosition2;
|
||||||
|
@ -190,7 +189,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
public btRigidBody Body;
|
public btRigidBody Body;
|
||||||
|
|
||||||
public BulletDotNETPrim(String primName, BulletDotNETScene parent_scene, PhysicsVector pos, PhysicsVector size,
|
public BulletDotNETPrim(String primName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size,
|
||||||
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical)
|
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical)
|
||||||
{
|
{
|
||||||
tempPosition1 = new btVector3(0, 0, 0);
|
tempPosition1 = new btVector3(0, 0, 0);
|
||||||
|
@ -225,8 +224,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
AxisLockLinearHigh = new btVector3((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionSize);
|
AxisLockLinearHigh = new btVector3((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionSize);
|
||||||
|
|
||||||
_target_velocity = new PhysicsVector(0, 0, 0);
|
_target_velocity = Vector3.Zero;
|
||||||
_velocity = new PhysicsVector();
|
_velocity = Vector3.Zero;
|
||||||
_position = pos;
|
_position = pos;
|
||||||
m_taintposition = pos;
|
m_taintposition = pos;
|
||||||
PID_D = parent_scene.bodyPIDD;
|
PID_D = parent_scene.bodyPIDD;
|
||||||
|
@ -244,8 +243,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
_size = size;
|
_size = size;
|
||||||
m_taintsize = _size;
|
m_taintsize = _size;
|
||||||
_acceleration = new PhysicsVector();
|
_acceleration = Vector3.Zero;
|
||||||
m_rotationalVelocity = PhysicsVector.Zero;
|
m_rotationalVelocity = Vector3.Zero;
|
||||||
_orientation = rotation;
|
_orientation = rotation;
|
||||||
m_taintrot = _orientation;
|
m_taintrot = _orientation;
|
||||||
_mesh = mesh;
|
_mesh = mesh;
|
||||||
|
@ -274,7 +273,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
get { return _zeroFlag; }
|
get { return _zeroFlag; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return _size; }
|
get { return _size; }
|
||||||
set { _size = value; }
|
set { _size = value; }
|
||||||
|
@ -348,13 +347,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
m_taintparent = null;
|
m_taintparent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
|
m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
|
||||||
m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z);
|
m_taintAngularLock = axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
|
|
||||||
|
@ -370,9 +369,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
get { return CalculateMass(); }
|
get { return CalculateMass(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
//get { return PhysicsVector.Zero; }
|
//get { return Vector3.Zero; }
|
||||||
get { return m_force; }
|
get { return m_force; }
|
||||||
set { m_force = value; }
|
set { m_force = value; }
|
||||||
}
|
}
|
||||||
|
@ -388,7 +387,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
//TODO:
|
//TODO:
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
//TODO:
|
//TODO:
|
||||||
}
|
}
|
||||||
|
@ -405,23 +404,23 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// Averate previous velocity with the new one so
|
// Averate previous velocity with the new one so
|
||||||
// client object interpolation works a 'little' better
|
// client object interpolation works a 'little' better
|
||||||
PhysicsVector returnVelocity = new PhysicsVector();
|
Vector3 returnVelocity;
|
||||||
returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2;
|
returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2;
|
||||||
returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2;
|
returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2;
|
||||||
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2;
|
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2;
|
||||||
|
@ -436,12 +435,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!m_isphysical || Body.Handle == IntPtr.Zero)
|
if (!m_isphysical || Body.Handle == IntPtr.Zero)
|
||||||
return new PhysicsVector(0, 0, 0);
|
return Vector3.Zero;
|
||||||
|
|
||||||
return _torque;
|
return _torque;
|
||||||
}
|
}
|
||||||
|
@ -459,7 +458,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
set { m_collisionscore = value; }
|
set { m_collisionscore = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
@ -528,16 +527,16 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
Vector3 pv = Vector3.Zero;
|
||||||
if (_zeroFlag)
|
if (_zeroFlag)
|
||||||
return pv;
|
return pv;
|
||||||
m_lastUpdateSent = false;
|
m_lastUpdateSent = false;
|
||||||
|
|
||||||
if (m_rotationalVelocity.IsIdentical(pv, 0.2f))
|
if (m_rotationalVelocity.ApproxEquals(pv, 0.2f))
|
||||||
return pv;
|
return pv;
|
||||||
|
|
||||||
return m_rotationalVelocity;
|
return m_rotationalVelocity;
|
||||||
|
@ -557,7 +556,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
set { m_buoyancy = value; }
|
set { m_buoyancy = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget { set { m_PIDTarget = value; ; } }
|
public override Vector3 PIDTarget { set { m_PIDTarget = value; ; } }
|
||||||
public override bool PIDActive { set { m_usePID = value; } }
|
public override bool PIDActive { set { m_usePID = value; } }
|
||||||
public override float PIDTau { set { m_PIDTau = value; } }
|
public override float PIDTau { set { m_PIDTau = value; } }
|
||||||
|
|
||||||
|
@ -567,20 +566,20 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
|
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
|
||||||
|
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
m_forcelist.Add(force);
|
m_forcelist.Add(force);
|
||||||
m_taintforce = true;
|
m_taintforce = true;
|
||||||
//m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
|
//m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
m_angularforcelist.Add(force);
|
m_angularforcelist.Add(force);
|
||||||
m_taintaddangularforce = true;
|
m_taintaddangularforce = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,7 +777,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_position.IsIdentical(m_taintposition, 0f))
|
if (!_position.ApproxEquals(m_taintposition, 0f))
|
||||||
{
|
{
|
||||||
m_log.Debug("[PHYSICS]: TaintMove");
|
m_log.Debug("[PHYSICS]: TaintMove");
|
||||||
changemove(timestep);
|
changemove(timestep);
|
||||||
|
@ -796,7 +795,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!_size.IsIdentical(m_taintsize, 0))
|
if (!_size.ApproxEquals(m_taintsize, 0f))
|
||||||
{
|
{
|
||||||
m_log.Debug("[PHYSICS]: TaintSize");
|
m_log.Debug("[PHYSICS]: TaintSize");
|
||||||
changesize(timestep);
|
changesize(timestep);
|
||||||
|
@ -820,7 +819,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
m_log.Debug("[PHYSICS]: TaintAngularForce");
|
m_log.Debug("[PHYSICS]: TaintAngularForce");
|
||||||
changeAddAngularForce(timestep);
|
changeAddAngularForce(timestep);
|
||||||
}
|
}
|
||||||
if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f))
|
if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
|
||||||
{
|
{
|
||||||
m_log.Debug("[PHYSICS]: TaintTorque");
|
m_log.Debug("[PHYSICS]: TaintTorque");
|
||||||
changeSetTorque(timestep);
|
changeSetTorque(timestep);
|
||||||
|
@ -835,7 +834,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
m_log.Debug("[PHYSICS]: TaintSelected");
|
m_log.Debug("[PHYSICS]: TaintSelected");
|
||||||
changeSelectedStatus(timestep);
|
changeSelectedStatus(timestep);
|
||||||
}
|
}
|
||||||
if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f))
|
if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
|
||||||
{
|
{
|
||||||
m_log.Debug("[PHYSICS]: TaintVelocity");
|
m_log.Debug("[PHYSICS]: TaintVelocity");
|
||||||
changevelocity(timestep);
|
changevelocity(timestep);
|
||||||
|
@ -849,7 +848,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
{
|
{
|
||||||
changefloatonwater(timestep);
|
changefloatonwater(timestep);
|
||||||
}
|
}
|
||||||
if (!m_angularlock.IsIdentical(m_taintAngularLock, 0))
|
if (!m_angularlock.ApproxEquals(m_taintAngularLock, 0))
|
||||||
{
|
{
|
||||||
m_log.Debug("[PHYSICS]: TaintAngularLock");
|
m_log.Debug("[PHYSICS]: TaintAngularLock");
|
||||||
changeAngularLock(timestep);
|
changeAngularLock(timestep);
|
||||||
|
@ -1012,7 +1011,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
{
|
{
|
||||||
if (_parent_scene.needsMeshing(_pbs))
|
if (_parent_scene.needsMeshing(_pbs))
|
||||||
{
|
{
|
||||||
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity);
|
ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity);
|
||||||
// createmesh returns null when it doesn't mesh.
|
// createmesh returns null when it doesn't mesh.
|
||||||
CreateGeom(IntPtr.Zero, _mesh);
|
CreateGeom(IntPtr.Zero, _mesh);
|
||||||
}
|
}
|
||||||
|
@ -1029,7 +1028,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
return _parent_scene.needsMeshing(_pbs);
|
return _parent_scene.needsMeshing(_pbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ProcessGeomCreationAsTriMesh(PhysicsVector positionOffset, Quaternion orientation)
|
internal void ProcessGeomCreationAsTriMesh(Vector3 positionOffset, Quaternion orientation)
|
||||||
{
|
{
|
||||||
// Don't need to re-enable body.. it's done in SetMesh
|
// Don't need to re-enable body.. it's done in SetMesh
|
||||||
float meshlod = _parent_scene.meshSculptLOD;
|
float meshlod = _parent_scene.meshSculptLOD;
|
||||||
|
@ -1038,7 +1037,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
meshlod = _parent_scene.MeshSculptphysicalLOD;
|
meshlod = _parent_scene.MeshSculptphysicalLOD;
|
||||||
|
|
||||||
IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
|
IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
|
||||||
if (!positionOffset.IsIdentical(PhysicsVector.Zero, 0.001f) || orientation != Quaternion.Identity)
|
if (!positionOffset.ApproxEquals(Vector3.Zero, 0.001f) || orientation != Quaternion.Identity)
|
||||||
{
|
{
|
||||||
|
|
||||||
float[] xyz = new float[3];
|
float[] xyz = new float[3];
|
||||||
|
@ -1202,7 +1201,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||||
if (IsPhysical)
|
if (IsPhysical)
|
||||||
{
|
{
|
||||||
PhysicsVector iforce = new PhysicsVector();
|
Vector3 iforce = Vector3.Zero;
|
||||||
for (int i = 0; i < m_forcelist.Count; i++)
|
for (int i = 0; i < m_forcelist.Count; i++)
|
||||||
{
|
{
|
||||||
iforce = iforce + m_forcelist[i];
|
iforce = iforce + m_forcelist[i];
|
||||||
|
@ -1237,7 +1236,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||||
if (IsPhysical)
|
if (IsPhysical)
|
||||||
{
|
{
|
||||||
PhysicsVector iforce = new PhysicsVector();
|
Vector3 iforce = Vector3.Zero;
|
||||||
for (int i = 0; i < m_angularforcelist.Count; i++)
|
for (int i = 0; i < m_angularforcelist.Count; i++)
|
||||||
{
|
{
|
||||||
iforce = iforce + m_angularforcelist[i];
|
iforce = iforce + m_angularforcelist[i];
|
||||||
|
@ -1276,7 +1275,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_taintTorque = new PhysicsVector(0, 0, 0);
|
m_taintTorque = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changedisable(float timestep)
|
private void changedisable(float timestep)
|
||||||
|
@ -1317,7 +1316,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
//resetCollisionAccounting();
|
//resetCollisionAccounting();
|
||||||
}
|
}
|
||||||
m_taintVelocity = PhysicsVector.Zero;
|
m_taintVelocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changelink(float timestep)
|
private void changelink(float timestep)
|
||||||
|
@ -1361,7 +1360,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
if (m_taintparent != null)
|
if (m_taintparent != null)
|
||||||
{
|
{
|
||||||
m_taintparent.Position.Z = m_taintparent.Position.Z + 0.02f;
|
Vector3 taintparentPosition = m_taintparent.Position;
|
||||||
|
taintparentPosition.Z = m_taintparent.Position.Z + 0.02f;
|
||||||
|
m_taintparent.Position = taintparentPosition;
|
||||||
_parent_scene.AddPhysicsActorTaint(m_taintparent);
|
_parent_scene.AddPhysicsActorTaint(m_taintparent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1382,7 +1383,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
{
|
{
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
{
|
{
|
||||||
if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f, 1f, 1f), 0))
|
if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f))
|
||||||
{
|
{
|
||||||
//d.BodySetFiniteRotationMode(Body, 0);
|
//d.BodySetFiniteRotationMode(Body, 0);
|
||||||
//d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
|
//d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
|
||||||
|
@ -1395,7 +1396,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z);
|
m_angularlock = m_taintAngularLock;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1460,17 +1461,17 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
// TODO: NEED btVector3 for Linear Velocity
|
// TODO: NEED btVector3 for Linear Velocity
|
||||||
// NEED btVector3 for Position
|
// NEED btVector3 for Position
|
||||||
|
|
||||||
PhysicsVector pos = new PhysicsVector(_position.X, _position.Y, _position.Z); //TODO: Insert values gotten from bullet
|
Vector3 pos = _position; //TODO: Insert values gotten from bullet
|
||||||
PhysicsVector vel = new PhysicsVector(_velocity.X, _velocity.Y, _velocity.Z);
|
Vector3 vel = _velocity;
|
||||||
|
|
||||||
_target_velocity =
|
_target_velocity =
|
||||||
new PhysicsVector(
|
new Vector3(
|
||||||
(m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
|
(m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
|
||||||
(m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
|
(m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
|
||||||
(m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
|
(m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f))
|
if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
|
||||||
{
|
{
|
||||||
|
|
||||||
/* TODO: Do Bullet equiv
|
/* TODO: Do Bullet equiv
|
||||||
|
@ -1512,8 +1513,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
{
|
{
|
||||||
PID_G = m_PIDTau + 1;
|
PID_G = m_PIDTau + 1;
|
||||||
}
|
}
|
||||||
PhysicsVector pos = new PhysicsVector(0, 0, 0); //TODO: Insert values gotten from bullet
|
Vector3 pos = Vector3.Zero; //TODO: Insert values gotten from bullet
|
||||||
PhysicsVector vel = new PhysicsVector(0, 0, 0);
|
Vector3 vel = Vector3.Zero;
|
||||||
|
|
||||||
// determine what our target height really is based on HoverType
|
// determine what our target height really is based on HoverType
|
||||||
switch (m_PIDHoverType)
|
switch (m_PIDHoverType)
|
||||||
|
@ -1545,13 +1546,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
|
|
||||||
_target_velocity =
|
_target_velocity =
|
||||||
new PhysicsVector(0.0f, 0.0f,
|
new Vector3(0.0f, 0.0f,
|
||||||
(m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
|
(m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
|
||||||
);
|
);
|
||||||
|
|
||||||
// if velocity is zero, use position control; otherwise, velocity control
|
// if velocity is zero, use position control; otherwise, velocity control
|
||||||
|
|
||||||
if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f))
|
if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
|
||||||
{
|
{
|
||||||
|
|
||||||
/* TODO: Do Bullet Equiv
|
/* TODO: Do Bullet Equiv
|
||||||
|
@ -1626,8 +1627,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_zeroPosition == null)
|
if (m_zeroPosition == null)
|
||||||
m_zeroPosition = new PhysicsVector(0, 0, 0);
|
m_zeroPosition = Vector3.Zero;
|
||||||
m_zeroPosition.setValues(_position.X, _position.Y, _position.Z);
|
m_zeroPosition = _position;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2177,7 +2178,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
//if (hasTrimesh)
|
//if (hasTrimesh)
|
||||||
//{
|
//{
|
||||||
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity);
|
ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity);
|
||||||
// createmesh returns null when it doesn't mesh.
|
// createmesh returns null when it doesn't mesh.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2197,11 +2198,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
{
|
{
|
||||||
if (chld == null)
|
if (chld == null)
|
||||||
continue;
|
continue;
|
||||||
PhysicsVector offset = chld.Position - Position;
|
Vector3 offset = chld.Position - Position;
|
||||||
Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z);
|
Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z);
|
||||||
pos *= Quaternion.Inverse(Orientation);
|
pos *= Quaternion.Inverse(Orientation);
|
||||||
//pos *= Orientation;
|
//pos *= Orientation;
|
||||||
offset.setValues(pos.X, pos.Y, pos.Z);
|
offset = pos;
|
||||||
chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation);
|
chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation);
|
||||||
|
|
||||||
_mesh.Append(chld._mesh);
|
_mesh.Append(chld._mesh);
|
||||||
|
@ -2433,7 +2434,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
m_collisionscore = 0;
|
m_collisionscore = 0;
|
||||||
m_disabled = false;
|
m_disabled = false;
|
||||||
// The body doesn't already have a finite rotation mode set here
|
// The body doesn't already have a finite rotation mode set here
|
||||||
if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
|
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||||
{
|
{
|
||||||
// TODO: Create Angular Motor on Axis Lock!
|
// TODO: Create Angular Motor on Axis Lock!
|
||||||
}
|
}
|
||||||
|
@ -2447,7 +2448,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
{
|
{
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
{
|
{
|
||||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
Vector3 pv = Vector3.Zero;
|
||||||
bool lastZeroFlag = _zeroFlag;
|
bool lastZeroFlag = _zeroFlag;
|
||||||
if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero)
|
if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero)
|
||||||
tempPosition3.Dispose();
|
tempPosition3.Dispose();
|
||||||
|
@ -2471,10 +2472,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel
|
tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel
|
||||||
tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel
|
tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel
|
||||||
|
|
||||||
_torque.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(),
|
_torque = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(),
|
||||||
tempAngularVelocity1.getZ());
|
tempAngularVelocity1.getZ());
|
||||||
PhysicsVector l_position = new PhysicsVector();
|
Vector3 l_position = Vector3.Zero;
|
||||||
Quaternion l_orientation = new Quaternion();
|
Quaternion l_orientation = Quaternion.Identity;
|
||||||
m_lastposition = _position;
|
m_lastposition = _position;
|
||||||
m_lastorientation = _orientation;
|
m_lastorientation = _orientation;
|
||||||
|
|
||||||
|
@ -2598,20 +2599,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
_velocity.Z = tempLinearVelocity1.getZ();
|
_velocity.Z = tempLinearVelocity1.getZ();
|
||||||
|
|
||||||
_acceleration = ((_velocity - m_lastVelocity) / 0.1f);
|
_acceleration = ((_velocity - m_lastVelocity) / 0.1f);
|
||||||
_acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f,
|
_acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f,
|
||||||
_velocity.Y - m_lastVelocity.Y / 0.1f,
|
_velocity.Y - m_lastVelocity.Y / 0.1f,
|
||||||
_velocity.Z - m_lastVelocity.Z / 0.1f);
|
_velocity.Z - m_lastVelocity.Z / 0.1f);
|
||||||
//m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
|
//m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
|
||||||
|
|
||||||
if (_velocity.IsIdentical(pv, 0.5f))
|
if (_velocity.ApproxEquals(pv, 0.5f))
|
||||||
{
|
{
|
||||||
m_rotationalVelocity = pv;
|
m_rotationalVelocity = pv;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_rotationalVelocity = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(), tempAngularVelocity1.getZ());
|
||||||
m_rotationalVelocity.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(),
|
|
||||||
tempAngularVelocity1.getZ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
|
//m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
|
||||||
|
@ -2665,7 +2664,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
m_taintremove = true;
|
m_taintremove = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void EnableAxisMotor(PhysicsVector axislock)
|
internal void EnableAxisMotor(Vector3 axislock)
|
||||||
{
|
{
|
||||||
if (m_aMotor != null)
|
if (m_aMotor != null)
|
||||||
DisableAxisMotor();
|
DisableAxisMotor();
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
BulletDotNETCharacter chr = new BulletDotNETCharacter(avName, this, position, size, avPIDD, avPIDP,
|
BulletDotNETCharacter chr = new BulletDotNETCharacter(avName, this, position, size, avPIDD, avPIDP,
|
||||||
avCapRadius, avStandupTensor, avDensity,
|
avCapRadius, avStandupTensor, avDensity,
|
||||||
|
@ -177,14 +177,14 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
|
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
|
||||||
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
|
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
|
||||||
{
|
{
|
||||||
PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
|
Vector3 pos = position;
|
||||||
//pos.X = position.X;
|
//pos.X = position.X;
|
||||||
//pos.Y = position.Y;
|
//pos.Y = position.Y;
|
||||||
//pos.Z = position.Z;
|
//pos.Z = position.Z;
|
||||||
PhysicsVector siz = new PhysicsVector();
|
Vector3 siz = Vector3.Zero;
|
||||||
siz.X = size.X;
|
siz.X = size.X;
|
||||||
siz.Y = size.Y;
|
siz.Y = size.Y;
|
||||||
siz.Z = size.Z;
|
siz.Z = size.Z;
|
||||||
|
@ -201,12 +201,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||||
return newPrim;
|
return newPrim;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation, bool isPhysical)
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical)
|
||||||
{
|
{
|
||||||
PhysicsActor result;
|
PhysicsActor result;
|
||||||
IMesh mesh = null;
|
IMesh mesh = null;
|
||||||
|
|
|
@ -52,14 +52,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
//Vector3
|
//Vector3
|
||||||
public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector)
|
public static Vector3 PhysicsVectorToXnaVector3(OpenMetaverse.Vector3 physicsVector)
|
||||||
{
|
{
|
||||||
return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z);
|
return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PhysicsVector XnaVector3ToPhysicsVector(Vector3 xnaVector3)
|
public static OpenMetaverse.Vector3 XnaVector3ToPhysicsVector(Vector3 xnaVector3)
|
||||||
{
|
{
|
||||||
return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z);
|
return new OpenMetaverse.Vector3(xnaVector3.X, xnaVector3.Y, xnaVector3.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Quaternion
|
//Quaternion
|
||||||
|
@ -349,7 +349,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
vertexBase = new Vector3[iVertexCount];
|
vertexBase = new Vector3[iVertexCount];
|
||||||
for (int i = 0; i < iVertexCount; i++)
|
for (int i = 0; i < iVertexCount; i++)
|
||||||
{
|
{
|
||||||
PhysicsVector v = mesh.getVertexList()[i];
|
OpenMetaverse.Vector3 v = mesh.getVertexList()[i];
|
||||||
if (v != null) // Note, null has special meaning. See meshing code for details
|
if (v != null) // Note, null has special meaning. See meshing code for details
|
||||||
vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
||||||
else
|
else
|
||||||
|
@ -392,7 +392,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist)
|
private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist)
|
||||||
{
|
{
|
||||||
float fstartSide;
|
float fstartSide;
|
||||||
PhysicsVector v = actA.Position;
|
OpenMetaverse.Vector3 v = actA.Position;
|
||||||
Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
||||||
|
|
||||||
fstartSide = Vector3.Dot(vNormal, v3) - fDist;
|
fstartSide = Vector3.Dot(vNormal, v3) - fDist;
|
||||||
|
@ -404,7 +404,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
{
|
{
|
||||||
Vector3 perPlaneNormal;
|
Vector3 perPlaneNormal;
|
||||||
float fPerPlaneDist;
|
float fPerPlaneDist;
|
||||||
PhysicsVector v = actA.Position;
|
OpenMetaverse.Vector3 v = actA.Position;
|
||||||
Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
||||||
//check AB
|
//check AB
|
||||||
Vector3 v1;
|
Vector3 v1;
|
||||||
|
@ -573,9 +573,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
PhysicsVector pos = new PhysicsVector();
|
OpenMetaverse.Vector3 pos = OpenMetaverse.Vector3.Zero;
|
||||||
pos.X = position.X;
|
pos.X = position.X;
|
||||||
pos.Y = position.Y;
|
pos.Y = position.Y;
|
||||||
pos.Z = position.Z + 20;
|
pos.Z = position.Z + 20;
|
||||||
|
@ -611,14 +611,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
|
||||||
PhysicsVector size, OpenMetaverse.Quaternion rotation)
|
OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation)
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
|
||||||
PhysicsVector size, OpenMetaverse.Quaternion rotation, bool isPhysical)
|
OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical)
|
||||||
{
|
{
|
||||||
PhysicsActor result;
|
PhysicsActor result;
|
||||||
|
|
||||||
|
@ -645,7 +645,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, OpenMetaverse.Quaternion rotation,
|
public PhysicsActor AddPrim(String name, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation,
|
||||||
IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
|
IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
|
||||||
{
|
{
|
||||||
BulletXPrim newPrim = null;
|
BulletXPrim newPrim = null;
|
||||||
|
@ -879,12 +879,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
{
|
{
|
||||||
protected bool flying = false;
|
protected bool flying = false;
|
||||||
protected bool _physical = false;
|
protected bool _physical = false;
|
||||||
protected PhysicsVector _position;
|
protected OpenMetaverse.Vector3 _position;
|
||||||
protected PhysicsVector _velocity;
|
protected OpenMetaverse.Vector3 _velocity;
|
||||||
protected PhysicsVector _size;
|
protected OpenMetaverse.Vector3 _size;
|
||||||
protected PhysicsVector _acceleration;
|
protected OpenMetaverse.Vector3 _acceleration;
|
||||||
protected OpenMetaverse.Quaternion _orientation;
|
protected OpenMetaverse.Quaternion _orientation;
|
||||||
protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
protected OpenMetaverse.Vector3 m_rotationalVelocity;
|
||||||
protected RigidBody rigidBody;
|
protected RigidBody rigidBody;
|
||||||
protected int m_PhysicsActorType;
|
protected int m_PhysicsActorType;
|
||||||
private Boolean iscolliding = false;
|
private Boolean iscolliding = false;
|
||||||
|
@ -900,7 +900,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override OpenMetaverse.Vector3 Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
set
|
set
|
||||||
|
@ -913,13 +913,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override OpenMetaverse.Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return m_rotationalVelocity; }
|
get { return m_rotationalVelocity; }
|
||||||
set { m_rotationalVelocity = value; }
|
set { m_rotationalVelocity = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override OpenMetaverse.Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return _velocity; }
|
get { return _velocity; }
|
||||||
set
|
set
|
||||||
|
@ -934,7 +934,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_velocity = new PhysicsVector();
|
_velocity = OpenMetaverse.Vector3.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -944,7 +944,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
get { return 0f; }
|
get { return 0f; }
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
public override PhysicsVector Size
|
public override OpenMetaverse.Vector3 Size
|
||||||
{
|
{
|
||||||
get { return _size; }
|
get { return _size; }
|
||||||
set
|
set
|
||||||
|
@ -956,9 +956,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override OpenMetaverse.Vector3 Force
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return OpenMetaverse.Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, OpenMetaverse.Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -988,14 +988,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override OpenMetaverse.Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return OpenMetaverse.Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override OpenMetaverse.Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return OpenMetaverse.Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PrimitiveBaseShape Shape
|
public override PrimitiveBaseShape Shape
|
||||||
|
@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override OpenMetaverse.Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
@ -1036,7 +1036,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(OpenMetaverse.Vector3 axis)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetAcceleration(PhysicsVector accel)
|
public virtual void SetAcceleration(OpenMetaverse.Vector3 accel)
|
||||||
{
|
{
|
||||||
lock (BulletXScene.BulletXLock)
|
lock (BulletXScene.BulletXLock)
|
||||||
{
|
{
|
||||||
|
@ -1143,19 +1143,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public override PhysicsVector Torque
|
public override OpenMetaverse.Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return OpenMetaverse.Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(OpenMetaverse.Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(OpenMetaverse.Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,7 +1174,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
Translate(_position);
|
Translate(_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal void Translate(PhysicsVector _newPos)
|
protected internal void Translate(OpenMetaverse.Vector3 _newPos)
|
||||||
{
|
{
|
||||||
Vector3 _translation;
|
Vector3 _translation;
|
||||||
_translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition;
|
_translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition;
|
||||||
|
@ -1186,7 +1186,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
Speed(_velocity);
|
Speed(_velocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal void Speed(PhysicsVector _newSpeed)
|
protected internal void Speed(OpenMetaverse.Vector3 _newSpeed)
|
||||||
{
|
{
|
||||||
Vector3 _speed;
|
Vector3 _speed;
|
||||||
_speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed);
|
_speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed);
|
||||||
|
@ -1212,7 +1212,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
ReSize(_size);
|
ReSize(_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal virtual void ReSize(PhysicsVector _newSize)
|
protected internal virtual void ReSize(OpenMetaverse.Vector3 _newSize)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,7 +1227,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public override PhysicsVector PIDTarget { set { return; } }
|
public override OpenMetaverse.Vector3 PIDTarget { set { return; } }
|
||||||
public override bool PIDActive { set { return; } }
|
public override bool PIDActive { set { return; } }
|
||||||
public override float PIDTau { set { return; } }
|
public override float PIDTau { set { return; } }
|
||||||
|
|
||||||
|
@ -1256,19 +1256,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BulletXCharacter : BulletXActor
|
public class BulletXCharacter : BulletXActor
|
||||||
{
|
{
|
||||||
public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos)
|
public BulletXCharacter(BulletXScene parent_scene, OpenMetaverse.Vector3 pos)
|
||||||
: this(String.Empty, parent_scene, pos)
|
: this(String.Empty, parent_scene, pos)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos)
|
public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos)
|
||||||
: this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(),
|
: this(avName, parent_scene, pos, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero,
|
||||||
OpenMetaverse.Quaternion.Identity)
|
OpenMetaverse.Quaternion.Identity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
|
public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity,
|
||||||
PhysicsVector size, PhysicsVector acceleration, OpenMetaverse.Quaternion orientation)
|
OpenMetaverse.Vector3 size, OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion orientation)
|
||||||
: base(avName)
|
: base(avName)
|
||||||
{
|
{
|
||||||
//This fields will be removed. They're temporal
|
//This fields will be removed. They're temporal
|
||||||
|
@ -1323,25 +1323,25 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override OpenMetaverse.Vector3 Position
|
||||||
{
|
{
|
||||||
get { return base.Position; }
|
get { return base.Position; }
|
||||||
set { base.Position = value; }
|
set { base.Position = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override OpenMetaverse.Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return base.Velocity; }
|
get { return base.Velocity; }
|
||||||
set { base.Velocity = value; }
|
set { base.Velocity = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override OpenMetaverse.Vector3 Size
|
||||||
{
|
{
|
||||||
get { return base.Size; }
|
get { return base.Size; }
|
||||||
set { base.Size = value; }
|
set { base.Size = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override OpenMetaverse.Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return base.Acceleration; }
|
get { return base.Acceleration; }
|
||||||
}
|
}
|
||||||
|
@ -1370,17 +1370,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
set { base.Kinematic = value; }
|
set { base.Kinematic = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetAcceleration(PhysicsVector accel)
|
public override void SetAcceleration(OpenMetaverse.Vector3 accel)
|
||||||
{
|
{
|
||||||
base.SetAcceleration(accel);
|
base.SetAcceleration(accel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
base.AddForce(force, pushforce);
|
base.AddForce(force, pushforce);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(OpenMetaverse.Vector3 momentum)
|
||||||
{
|
{
|
||||||
base.SetMomentum(momentum);
|
base.SetMomentum(momentum);
|
||||||
}
|
}
|
||||||
|
@ -1430,7 +1430,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
m.Translation = v3;
|
m.Translation = v3;
|
||||||
rigidBody.WorldTransform = m;
|
rigidBody.WorldTransform = m;
|
||||||
//When an Avie touch the ground it's vertical velocity it's reduced to ZERO
|
//When an Avie touch the ground it's vertical velocity it's reduced to ZERO
|
||||||
Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
|
Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1452,7 +1452,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
//For now all prims have the same density, all prims are made of water. Be water my friend! :D
|
//For now all prims have the same density, all prims are made of water. Be water my friend! :D
|
||||||
private const float _density = 1000.0f;
|
private const float _density = 1000.0f;
|
||||||
private BulletXScene _parent_scene;
|
private BulletXScene _parent_scene;
|
||||||
private PhysicsVector m_prev_position = new PhysicsVector(0, 0, 0);
|
private OpenMetaverse.Vector3 m_prev_position;
|
||||||
private bool m_lastUpdateSent = false;
|
private bool m_lastUpdateSent = false;
|
||||||
//added by jed zhu
|
//added by jed zhu
|
||||||
private IMesh _mesh;
|
private IMesh _mesh;
|
||||||
|
@ -1460,17 +1460,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size,
|
public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 size,
|
||||||
OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
|
OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
|
||||||
: this(
|
: this(
|
||||||
primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs,
|
primName, parent_scene, pos, OpenMetaverse.Vector3.Zero, size, OpenMetaverse.Vector3.Zero, rotation, mesh, pbs,
|
||||||
isPhysical)
|
isPhysical)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
|
public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity,
|
||||||
PhysicsVector size,
|
OpenMetaverse.Vector3 size,
|
||||||
PhysicsVector acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs,
|
OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs,
|
||||||
bool isPhysical)
|
bool isPhysical)
|
||||||
: base(primName)
|
: base(primName)
|
||||||
{
|
{
|
||||||
|
@ -1481,7 +1481,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
|
|
||||||
_position = pos;
|
_position = pos;
|
||||||
_physical = isPhysical;
|
_physical = isPhysical;
|
||||||
_velocity = _physical ? velocity : new PhysicsVector();
|
_velocity = _physical ? velocity : OpenMetaverse.Vector3.Zero;
|
||||||
_size = size;
|
_size = size;
|
||||||
_acceleration = acceleration;
|
_acceleration = acceleration;
|
||||||
_orientation = rotation;
|
_orientation = rotation;
|
||||||
|
@ -1497,19 +1497,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override OpenMetaverse.Vector3 Position
|
||||||
{
|
{
|
||||||
get { return base.Position; }
|
get { return base.Position; }
|
||||||
set { base.Position = value; }
|
set { base.Position = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override OpenMetaverse.Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return base.Velocity; }
|
get { return base.Velocity; }
|
||||||
set { base.Velocity = value; }
|
set { base.Velocity = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override OpenMetaverse.Vector3 Size
|
||||||
{
|
{
|
||||||
get { return _size; }
|
get { return _size; }
|
||||||
set
|
set
|
||||||
|
@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override OpenMetaverse.Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return base.Acceleration; }
|
get { return base.Acceleration; }
|
||||||
}
|
}
|
||||||
|
@ -1583,7 +1583,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
set { base.Kinematic = value; }
|
set { base.Kinematic = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetAcceleration(PhysicsVector accel)
|
public override void SetAcceleration(OpenMetaverse.Vector3 accel)
|
||||||
{
|
{
|
||||||
lock (BulletXScene.BulletXLock)
|
lock (BulletXScene.BulletXLock)
|
||||||
{
|
{
|
||||||
|
@ -1591,12 +1591,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
base.AddForce(force,pushforce);
|
base.AddForce(force,pushforce);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(OpenMetaverse.Vector3 momentum)
|
||||||
{
|
{
|
||||||
base.SetMomentum(momentum);
|
base.SetMomentum(momentum);
|
||||||
}
|
}
|
||||||
|
@ -1613,7 +1613,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
//When a Prim touch the ground it's vertical velocity it's reduced to ZERO
|
//When a Prim touch the ground it's vertical velocity it's reduced to ZERO
|
||||||
//Static objects don't have linear velocity
|
//Static objects don't have linear velocity
|
||||||
if (_physical)
|
if (_physical)
|
||||||
Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
|
Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1632,7 +1632,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
{
|
{
|
||||||
if (!m_lastUpdateSent)
|
if (!m_lastUpdateSent)
|
||||||
{
|
{
|
||||||
_velocity = new PhysicsVector(0, 0, 0);
|
_velocity = OpenMetaverse.Vector3.Zero;
|
||||||
base.ScheduleTerseUpdate();
|
base.ScheduleTerseUpdate();
|
||||||
m_lastUpdateSent = true;
|
m_lastUpdateSent = true;
|
||||||
}
|
}
|
||||||
|
@ -1654,8 +1654,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
|
|
||||||
#region Methods for updating values of RigidBody
|
#region Methods for updating values of RigidBody
|
||||||
|
|
||||||
protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, PhysicsVector pos,
|
protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, OpenMetaverse.Vector3 pos,
|
||||||
PhysicsVector size)
|
OpenMetaverse.Vector3 size)
|
||||||
{
|
{
|
||||||
//For RigidBody Constructor. The next values might change
|
//For RigidBody Constructor. The next values might change
|
||||||
float _linearDamping = 0.0f;
|
float _linearDamping = 0.0f;
|
||||||
|
@ -1683,7 +1683,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
Vector3[] v3Vertices = new Vector3[iVertexCount];
|
Vector3[] v3Vertices = new Vector3[iVertexCount];
|
||||||
for (int i = 0; i < iVertexCount; i++)
|
for (int i = 0; i < iVertexCount; i++)
|
||||||
{
|
{
|
||||||
PhysicsVector v = mesh.getVertexList()[i];
|
OpenMetaverse.Vector3 v = mesh.getVertexList()[i];
|
||||||
if (v != null) // Note, null has special meaning. See meshing code for details
|
if (v != null) // Note, null has special meaning. See meshing code for details
|
||||||
v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
||||||
else
|
else
|
||||||
|
@ -1709,7 +1709,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal void ReCreateRigidBody(PhysicsVector size)
|
protected internal void ReCreateRigidBody(OpenMetaverse.Vector3 size)
|
||||||
{
|
{
|
||||||
//There is a bug when trying to remove a rigidBody that is colliding with something..
|
//There is a bug when trying to remove a rigidBody that is colliding with something..
|
||||||
try
|
try
|
||||||
|
@ -1729,7 +1729,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal override void ReSize(PhysicsVector _newSize)
|
protected internal override void ReSize(OpenMetaverse.Vector3 _newSize)
|
||||||
{
|
{
|
||||||
//I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't
|
//I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't
|
||||||
//so i have to do it manually. That's recreating rigidbody
|
//so i have to do it manually. That's recreating rigidbody
|
||||||
|
@ -1744,8 +1744,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class BulletXPlanet
|
internal class BulletXPlanet
|
||||||
{
|
{
|
||||||
private PhysicsVector _staticPosition;
|
private OpenMetaverse.Vector3 _staticPosition;
|
||||||
// private PhysicsVector _staticVelocity;
|
// private Vector3 _staticVelocity;
|
||||||
// private OpenMetaverse.Quaternion _staticOrientation;
|
// private OpenMetaverse.Quaternion _staticOrientation;
|
||||||
private float _mass;
|
private float _mass;
|
||||||
// private BulletXScene _parentscene;
|
// private BulletXScene _parentscene;
|
||||||
|
@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
|
|
||||||
internal BulletXPlanet(BulletXScene parent_scene, float[] heightField)
|
internal BulletXPlanet(BulletXScene parent_scene, float[] heightField)
|
||||||
{
|
{
|
||||||
_staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0);
|
_staticPosition = new OpenMetaverse.Vector3(BulletXScene.MaxXY / 2, BulletXScene.MaxXY / 2, 0);
|
||||||
// _staticVelocity = new PhysicsVector();
|
// _staticVelocity = new PhysicsVector();
|
||||||
// _staticOrientation = OpenMetaverse.Quaternion.Identity;
|
// _staticOrientation = OpenMetaverse.Quaternion.Identity;
|
||||||
_mass = 0; //No active
|
_mass = 0; //No active
|
||||||
|
|
|
@ -28,13 +28,14 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.Manager
|
namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
public interface IMesher
|
public interface IMesher
|
||||||
{
|
{
|
||||||
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod);
|
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod);
|
||||||
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical);
|
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IVertex
|
public interface IVertex
|
||||||
|
@ -43,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public interface IMesh
|
public interface IMesh
|
||||||
{
|
{
|
||||||
List<PhysicsVector> getVertexList();
|
List<Vector3> getVertexList();
|
||||||
int[] getIndexListAsInt();
|
int[] getIndexListAsInt();
|
||||||
int[] getIndexListAsIntLocked();
|
int[] getIndexListAsIntLocked();
|
||||||
float[] getVertexListAsFloatLocked();
|
float[] getVertexListAsFloatLocked();
|
||||||
|
|
|
@ -32,8 +32,8 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.Manager
|
namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
public delegate void PositionUpdate(PhysicsVector position);
|
public delegate void PositionUpdate(Vector3 position);
|
||||||
public delegate void VelocityUpdate(PhysicsVector velocity);
|
public delegate void VelocityUpdate(Vector3 velocity);
|
||||||
public delegate void OrientationUpdate(Quaternion orientation);
|
public delegate void OrientationUpdate(Quaternion orientation);
|
||||||
|
|
||||||
public enum ActorTypes : int
|
public enum ActorTypes : int
|
||||||
|
@ -106,7 +106,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
public delegate void RequestTerseUpdate();
|
public delegate void RequestTerseUpdate();
|
||||||
public delegate void CollisionUpdate(EventArgs e);
|
public delegate void CollisionUpdate(EventArgs e);
|
||||||
public delegate void OutOfBounds(PhysicsVector pos);
|
public delegate void OutOfBounds(Vector3 pos);
|
||||||
|
|
||||||
// disable warning: public events
|
// disable warning: public events
|
||||||
#pragma warning disable 67
|
#pragma warning disable 67
|
||||||
|
@ -125,7 +125,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public abstract bool Stopped { get; }
|
public abstract bool Stopped { get; }
|
||||||
|
|
||||||
public abstract PhysicsVector Size { get; set; }
|
public abstract Vector3 Size { get; set; }
|
||||||
|
|
||||||
public abstract PrimitiveBaseShape Shape { set; }
|
public abstract PrimitiveBaseShape Shape { set; }
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public abstract void delink();
|
public abstract void delink();
|
||||||
|
|
||||||
public abstract void LockAngularMotion(PhysicsVector axis);
|
public abstract void LockAngularMotion(Vector3 axis);
|
||||||
|
|
||||||
public virtual void RequestPhysicsterseUpdate()
|
public virtual void RequestPhysicsterseUpdate()
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RaiseOutOfBounds(PhysicsVector pos)
|
public virtual void RaiseOutOfBounds(Vector3 pos)
|
||||||
{
|
{
|
||||||
// Make a temporary copy of the event to avoid possibility of
|
// Make a temporary copy of the event to avoid possibility of
|
||||||
// a race condition if the last subscriber unsubscribes
|
// a race condition if the last subscriber unsubscribes
|
||||||
|
@ -187,23 +187,23 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract PhysicsVector Position { get; set; }
|
public abstract Vector3 Position { get; set; }
|
||||||
public abstract float Mass { get; }
|
public abstract float Mass { get; }
|
||||||
public abstract PhysicsVector Force { get; set; }
|
public abstract Vector3 Force { get; set; }
|
||||||
|
|
||||||
public abstract int VehicleType { get; set; }
|
public abstract int VehicleType { get; set; }
|
||||||
public abstract void VehicleFloatParam(int param, float value);
|
public abstract void VehicleFloatParam(int param, float value);
|
||||||
public abstract void VehicleVectorParam(int param, PhysicsVector value);
|
public abstract void VehicleVectorParam(int param, Vector3 value);
|
||||||
public abstract void VehicleRotationParam(int param, Quaternion rotation);
|
public abstract void VehicleRotationParam(int param, Quaternion rotation);
|
||||||
|
|
||||||
public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
|
public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
|
||||||
|
|
||||||
public abstract PhysicsVector GeometricCenter { get; }
|
public abstract Vector3 GeometricCenter { get; }
|
||||||
public abstract PhysicsVector CenterOfMass { get; }
|
public abstract Vector3 CenterOfMass { get; }
|
||||||
public abstract PhysicsVector Velocity { get; set; }
|
public abstract Vector3 Velocity { get; set; }
|
||||||
public abstract PhysicsVector Torque { get; set; }
|
public abstract Vector3 Torque { get; set; }
|
||||||
public abstract float CollisionScore { get; set;}
|
public abstract float CollisionScore { get; set;}
|
||||||
public abstract PhysicsVector Acceleration { get; }
|
public abstract Vector3 Acceleration { get; }
|
||||||
public abstract Quaternion Orientation { get; set; }
|
public abstract Quaternion Orientation { get; set; }
|
||||||
public abstract int PhysicsActorType { get; set; }
|
public abstract int PhysicsActorType { get; set; }
|
||||||
public abstract bool IsPhysical { get; set; }
|
public abstract bool IsPhysical { get; set; }
|
||||||
|
@ -214,12 +214,12 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
public abstract bool CollidingGround { get; set; }
|
public abstract bool CollidingGround { get; set; }
|
||||||
public abstract bool CollidingObj { get; set; }
|
public abstract bool CollidingObj { get; set; }
|
||||||
public abstract bool FloatOnWater { set; }
|
public abstract bool FloatOnWater { set; }
|
||||||
public abstract PhysicsVector RotationalVelocity { get; set; }
|
public abstract Vector3 RotationalVelocity { get; set; }
|
||||||
public abstract bool Kinematic { get; set; }
|
public abstract bool Kinematic { get; set; }
|
||||||
public abstract float Buoyancy { get; set; }
|
public abstract float Buoyancy { get; set; }
|
||||||
|
|
||||||
// Used for MoveTo
|
// Used for MoveTo
|
||||||
public abstract PhysicsVector PIDTarget { set;}
|
public abstract Vector3 PIDTarget { set; }
|
||||||
public abstract bool PIDActive { set;}
|
public abstract bool PIDActive { set;}
|
||||||
public abstract float PIDTau { set; }
|
public abstract float PIDTau { set; }
|
||||||
|
|
||||||
|
@ -231,9 +231,9 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
public abstract float PIDHoverTau { set;}
|
public abstract float PIDHoverTau { set;}
|
||||||
|
|
||||||
|
|
||||||
public abstract void AddForce(PhysicsVector force, bool pushforce);
|
public abstract void AddForce(Vector3 force, bool pushforce);
|
||||||
public abstract void AddAngularForce(PhysicsVector force, bool pushforce);
|
public abstract void AddAngularForce(Vector3 force, bool pushforce);
|
||||||
public abstract void SetMomentum(PhysicsVector momentum);
|
public abstract void SetMomentum(Vector3 momentum);
|
||||||
public abstract void SubscribeEvents(int ms);
|
public abstract void SubscribeEvents(int ms);
|
||||||
public abstract void UnSubscribeEvents();
|
public abstract void UnSubscribeEvents();
|
||||||
public abstract bool SubscribedEvents();
|
public abstract bool SubscribedEvents();
|
||||||
|
@ -246,9 +246,9 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
get{ return false; }
|
get{ return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,9 +296,9 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,9 +307,9 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
get { return 0f; }
|
get { return 0f; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -344,14 +344,14 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PrimitiveBaseShape Shape
|
public override PrimitiveBaseShape Shape
|
||||||
|
@ -359,15 +359,15 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,9 +387,9 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsPhysical
|
public override bool IsPhysical
|
||||||
|
@ -436,26 +436,26 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget { set { return; } }
|
public override Vector3 PIDTarget { set { return; } }
|
||||||
public override bool PIDActive { set { return; } }
|
public override bool PIDActive { set { return; } }
|
||||||
public override float PIDTau { set { return; } }
|
public override float PIDTau { set { return; } }
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
public override PIDHoverType PIDHoverType { set { return; } }
|
public override PIDHoverType PIDHoverType { set { return; } }
|
||||||
public override float PIDHoverTau { set { return; } }
|
public override float PIDHoverTau { set { return; } }
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
public PhysicsJointType Type;
|
public PhysicsJointType Type;
|
||||||
public string RawParams;
|
public string RawParams;
|
||||||
public List<string> BodyNames = new List<string>();
|
public List<string> BodyNames = new List<string>();
|
||||||
public PhysicsVector Position; // global coords
|
public Vector3 Position; // global coords
|
||||||
public Quaternion Rotation; // global coords
|
public Quaternion Rotation; // global coords
|
||||||
public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
|
public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
|
||||||
public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName)
|
public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName)
|
||||||
|
|
|
@ -64,23 +64,23 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
|
public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
|
||||||
|
|
||||||
public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying);
|
public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying);
|
||||||
|
|
||||||
public abstract void RemoveAvatar(PhysicsActor actor);
|
public abstract void RemoveAvatar(PhysicsActor actor);
|
||||||
|
|
||||||
public abstract void RemovePrim(PhysicsActor prim);
|
public abstract void RemovePrim(PhysicsActor prim);
|
||||||
|
|
||||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation); //To be removed
|
Vector3 size, Quaternion rotation); //To be removed
|
||||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical);
|
Vector3 size, Quaternion rotation, bool isPhysical);
|
||||||
|
|
||||||
public virtual bool SupportsNINJAJoints
|
public virtual bool SupportsNINJAJoints
|
||||||
{
|
{
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position,
|
public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
|
||||||
Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
|
Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
|
||||||
{ return null; }
|
{ return null; }
|
||||||
|
|
||||||
|
@ -129,11 +129,11 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual PhysicsVector GetJointAnchor(PhysicsJoint joint)
|
public virtual Vector3 GetJointAnchor(PhysicsJoint joint)
|
||||||
{ return null; }
|
{ return Vector3.Zero; }
|
||||||
|
|
||||||
public virtual PhysicsVector GetJointAxis(PhysicsJoint joint)
|
public virtual Vector3 GetJointAxis(PhysicsJoint joint)
|
||||||
{ return null; }
|
{ return Vector3.Zero; }
|
||||||
|
|
||||||
|
|
||||||
public abstract void AddPhysicsActorTaint(PhysicsActor prim);
|
public abstract void AddPhysicsActorTaint(PhysicsActor prim);
|
||||||
|
@ -212,7 +212,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
// Does nothing right now
|
// Does nothing right now
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position);
|
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position);
|
||||||
return PhysicsActor.Null;
|
return PhysicsActor.Null;
|
||||||
|
@ -231,21 +231,21 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size);
|
m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||||
return PhysicsActor.Null;
|
return PhysicsActor.Null;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation) //To be removed
|
Vector3 size, Quaternion rotation) //To be removed
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size);
|
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||||
return PhysicsActor.Null;
|
return PhysicsActor.Null;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.Manager
|
namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
|
@ -46,7 +47,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
get { return new NullPhysicsSensor(); }
|
get { return new NullPhysicsSensor(); }
|
||||||
}
|
}
|
||||||
public abstract PhysicsVector Position {get; set;}
|
public abstract Vector3 Position { get; set; }
|
||||||
public abstract void TimerCallback (object obj, ElapsedEventArgs eea);
|
public abstract void TimerCallback (object obj, ElapsedEventArgs eea);
|
||||||
public abstract float radianarc {get; set;}
|
public abstract float radianarc {get; set;}
|
||||||
public abstract string targetname {get; set;}
|
public abstract string targetname {get; set;}
|
||||||
|
@ -58,9 +59,9 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public class NullPhysicsSensor : PhysicsSensor
|
public class NullPhysicsSensor : PhysicsSensor
|
||||||
{
|
{
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
public override void TimerCallback(object obj, ElapsedEventArgs eea)
|
public override void TimerCallback(object obj, ElapsedEventArgs eea)
|
||||||
|
|
|
@ -29,24 +29,24 @@ using System;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.Manager
|
namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
public class PhysicsVector
|
/*public class PhysicsVector
|
||||||
{
|
{
|
||||||
public float X;
|
public float X;
|
||||||
public float Y;
|
public float Y;
|
||||||
public float Z;
|
public float Z;
|
||||||
|
|
||||||
public PhysicsVector()
|
public Vector3()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsVector(float x, float y, float z)
|
public Vector3(float x, float y, float z)
|
||||||
{
|
{
|
||||||
X = x;
|
X = x;
|
||||||
Y = y;
|
Y = y;
|
||||||
Z = z;
|
Z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsVector(PhysicsVector pv) : this(pv.X, pv.Y, pv.Z)
|
public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,17 +115,17 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b)
|
public static PhysicsVector operator +(Vector3 a, Vector3 b)
|
||||||
{
|
{
|
||||||
return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
|
return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PhysicsVector operator -(PhysicsVector a, PhysicsVector b)
|
public static PhysicsVector operator -(Vector3 a, Vector3 b)
|
||||||
{
|
{
|
||||||
return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
|
return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PhysicsVector cross(PhysicsVector a, PhysicsVector b)
|
public static PhysicsVector cross(Vector3 a, Vector3 b)
|
||||||
{
|
{
|
||||||
return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X);
|
return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
return (float) Math.Sqrt(X*X + Y*Y + Z*Z);
|
return (float) Math.Sqrt(X*X + Y*Y + Z*Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float GetDistanceTo(PhysicsVector a, PhysicsVector b)
|
public static float GetDistanceTo(Vector3 a, Vector3 b)
|
||||||
{
|
{
|
||||||
float dx = a.X - b.X;
|
float dx = a.X - b.X;
|
||||||
float dy = a.Y - b.Y;
|
float dy = a.Y - b.Y;
|
||||||
|
@ -143,22 +143,22 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz);
|
return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PhysicsVector operator /(PhysicsVector v, float f)
|
public static PhysicsVector operator /(Vector3 v, float f)
|
||||||
{
|
{
|
||||||
return new PhysicsVector(v.X/f, v.Y/f, v.Z/f);
|
return new PhysicsVector(v.X/f, v.Y/f, v.Z/f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PhysicsVector operator *(PhysicsVector v, float f)
|
public static PhysicsVector operator *(Vector3 v, float f)
|
||||||
{
|
{
|
||||||
return new PhysicsVector(v.X*f, v.Y*f, v.Z*f);
|
return new PhysicsVector(v.X*f, v.Y*f, v.Z*f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PhysicsVector operator *(float f, PhysicsVector v)
|
public static PhysicsVector operator *(float f, Vector3 v)
|
||||||
{
|
{
|
||||||
return v*f;
|
return v*f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool isFinite(PhysicsVector v)
|
public static bool isFinite(Vector3 v)
|
||||||
{
|
{
|
||||||
if (v == null)
|
if (v == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -172,7 +172,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool IsIdentical(PhysicsVector v, float tolerance)
|
public virtual bool IsIdentical(Vector3 v, float tolerance)
|
||||||
{
|
{
|
||||||
PhysicsVector diff = this - v;
|
PhysicsVector diff = this - v;
|
||||||
float d = diff.length();
|
float d = diff.length();
|
||||||
|
@ -182,5 +182,5 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the zero mesher.
|
* This is the zero mesher.
|
||||||
|
@ -60,13 +61,16 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public class ZeroMesher : IMesher
|
public class ZeroMesher : IMesher
|
||||||
{
|
{
|
||||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
|
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
|
||||||
{
|
{
|
||||||
return CreateMesh(primName, primShape, size, lod, false);
|
return CreateMesh(primName, primShape, size, lod, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
|
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
|
||||||
{
|
{
|
||||||
|
// Remove the reference to the encoded JPEG2000 data so it can be GCed
|
||||||
|
primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,30 +33,52 @@ using OpenMetaverse;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenSim.Region.Physics.Meshing;
|
using OpenSim.Region.Physics.Meshing;
|
||||||
|
|
||||||
public class Vertex : PhysicsVector, IComparable<Vertex>
|
public class Vertex : IComparable<Vertex>
|
||||||
{
|
{
|
||||||
public Vertex(float x, float y, float z)
|
Vector3 vector;
|
||||||
: base(x, y, z)
|
|
||||||
|
public float X
|
||||||
{
|
{
|
||||||
|
get { return vector.X; }
|
||||||
|
set { vector.X = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Y
|
||||||
|
{
|
||||||
|
get { return vector.Y; }
|
||||||
|
set { vector.Y = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Z
|
||||||
|
{
|
||||||
|
get { return vector.Z; }
|
||||||
|
set { vector.Z = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vertex(float x, float y, float z)
|
||||||
|
{
|
||||||
|
vector.X = x;
|
||||||
|
vector.Y = y;
|
||||||
|
vector.Z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vertex normalize()
|
public Vertex normalize()
|
||||||
{
|
{
|
||||||
float tlength = length();
|
float tlength = vector.Length();
|
||||||
if (tlength != 0)
|
if (tlength != 0f)
|
||||||
{
|
{
|
||||||
float mul = 1.0f / tlength;
|
float mul = 1.0f / tlength;
|
||||||
return new Vertex(X * mul, Y * mul, Z * mul);
|
return new Vertex(vector.X * mul, vector.Y * mul, vector.Z * mul);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new Vertex(0, 0, 0);
|
return new Vertex(0f, 0f, 0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vertex cross(Vertex v)
|
public Vertex cross(Vertex v)
|
||||||
{
|
{
|
||||||
return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X);
|
return new Vertex(vector.Y * v.Z - vector.Z * v.Y, vector.Z * v.X - vector.X * v.Z, vector.X * v.Y - vector.Y * v.X);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable warning: mono compiler moans about overloading
|
// disable warning: mono compiler moans about overloading
|
||||||
|
@ -160,9 +182,9 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
|
||||||
return X * v.X + Y * v.Y + Z * v.Z;
|
return X * v.X + Y * v.Y + Z * v.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vertex(PhysicsVector v)
|
public Vertex(Vector3 v)
|
||||||
: base(v.X, v.Y, v.Z)
|
|
||||||
{
|
{
|
||||||
|
vector = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vertex Clone()
|
public Vertex Clone()
|
||||||
|
@ -175,11 +197,15 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
|
||||||
return new Vertex((float) Math.Cos(angle), (float) Math.Sin(angle), 0.0f);
|
return new Vertex((float) Math.Cos(angle), (float) Math.Sin(angle), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float Length()
|
||||||
|
{
|
||||||
|
return vector.Length();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool Equals(Vertex v, float tolerance)
|
public virtual bool Equals(Vertex v, float tolerance)
|
||||||
{
|
{
|
||||||
PhysicsVector diff = this - v;
|
Vertex diff = this - v;
|
||||||
float d = diff.length();
|
float d = diff.Length();
|
||||||
if (d < tolerance)
|
if (d < tolerance)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -369,22 +395,22 @@ public class Triangle
|
||||||
return s1 + ";" + s2 + ";" + s3;
|
return s1 + ";" + s2 + ";" + s3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsVector getNormal()
|
public Vector3 getNormal()
|
||||||
{
|
{
|
||||||
// Vertices
|
// Vertices
|
||||||
|
|
||||||
// Vectors for edges
|
// Vectors for edges
|
||||||
PhysicsVector e1;
|
Vector3 e1;
|
||||||
PhysicsVector e2;
|
Vector3 e2;
|
||||||
|
|
||||||
e1 = new PhysicsVector(v1.X - v2.X, v1.Y - v2.Y, v1.Z - v2.Z);
|
e1 = new Vector3(v1.X - v2.X, v1.Y - v2.Y, v1.Z - v2.Z);
|
||||||
e2 = new PhysicsVector(v1.X - v3.X, v1.Y - v3.Y, v1.Z - v3.Z);
|
e2 = new Vector3(v1.X - v3.X, v1.Y - v3.Y, v1.Z - v3.Z);
|
||||||
|
|
||||||
// Cross product for normal
|
// Cross product for normal
|
||||||
PhysicsVector n = PhysicsVector.cross(e1, e2);
|
Vector3 n = Vector3.Cross(e1, e2);
|
||||||
|
|
||||||
// Length
|
// Length
|
||||||
float l = n.length();
|
float l = n.Length();
|
||||||
|
|
||||||
// Normalized "normal"
|
// Normalized "normal"
|
||||||
n = n/l;
|
n = n/l;
|
||||||
|
|
|
@ -31,6 +31,7 @@ using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using PrimMesher;
|
using PrimMesher;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.Meshing
|
namespace OpenSim.Region.Physics.Meshing
|
||||||
{
|
{
|
||||||
|
@ -141,12 +142,12 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PhysicsVector> getVertexList()
|
public List<Vector3> getVertexList()
|
||||||
{
|
{
|
||||||
List<PhysicsVector> result = new List<PhysicsVector>();
|
List<Vector3> result = new List<Vector3>();
|
||||||
foreach (Vertex v in m_vertices.Keys)
|
foreach (Vertex v in m_vertices.Keys)
|
||||||
{
|
{
|
||||||
result.Add(v);
|
result.Add(new Vector3(v.X, v.Y, v.Z));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -174,6 +175,9 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
|
|
||||||
float[] result = getVertexListAsFloat();
|
float[] result = getVertexListAsFloat();
|
||||||
m_pinnedVertexes = GCHandle.Alloc(result, GCHandleType.Pinned);
|
m_pinnedVertexes = GCHandle.Alloc(result, GCHandleType.Pinned);
|
||||||
|
// Inform the garbage collector of this unmanaged allocation so it can schedule
|
||||||
|
// the next GC round more intelligently
|
||||||
|
GC.AddMemoryPressure(Buffer.ByteLength(result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -223,6 +227,9 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
|
|
||||||
int[] result = getIndexListAsInt();
|
int[] result = getIndexListAsInt();
|
||||||
m_pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
|
m_pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
|
||||||
|
// Inform the garbage collector of this unmanaged allocation so it can schedule
|
||||||
|
// the next GC round more intelligently
|
||||||
|
GC.AddMemoryPressure(Buffer.ByteLength(result));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.Imaging;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using PrimMesher;
|
using PrimMesher;
|
||||||
|
@ -61,7 +60,6 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
public class Meshmerizer : IMesher
|
public class Meshmerizer : IMesher
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
// Setting baseDir to a path will enable the dumping of raw files
|
// Setting baseDir to a path will enable the dumping of raw files
|
||||||
// raw files can be imported by blender so a visual inspection of the results can be done
|
// raw files can be imported by blender so a visual inspection of the results can be done
|
||||||
|
@ -160,7 +158,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
float minZ = float.MaxValue;
|
float minZ = float.MaxValue;
|
||||||
float maxZ = float.MinValue;
|
float maxZ = float.MinValue;
|
||||||
|
|
||||||
foreach (Vertex v in meshIn.getVertexList())
|
foreach (Vector3 v in meshIn.getVertexList())
|
||||||
{
|
{
|
||||||
if (v != null)
|
if (v != null)
|
||||||
{
|
{
|
||||||
|
@ -185,7 +183,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ulong GetMeshKey(PrimitiveBaseShape pbs, PhysicsVector size, float lod)
|
private ulong GetMeshKey(PrimitiveBaseShape pbs, Vector3 size, float lod)
|
||||||
{
|
{
|
||||||
ulong hash = 5381;
|
ulong hash = 5381;
|
||||||
|
|
||||||
|
@ -247,7 +245,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
|
private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
|
||||||
{
|
{
|
||||||
PrimMesh primMesh;
|
PrimMesh primMesh;
|
||||||
PrimMesher.SculptMesh sculptMesh;
|
PrimMesher.SculptMesh sculptMesh;
|
||||||
|
@ -281,16 +279,12 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
|
|
||||||
if (idata == null)
|
if (idata == null)
|
||||||
{
|
{
|
||||||
if (primShape.SculptData.Length == 0)
|
if (primShape.SculptData == null || primShape.SculptData.Length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ManagedImage managedImage; // we never use this
|
idata = CSJ2K.J2kImage.FromBytes(primShape.SculptData);
|
||||||
OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata);
|
|
||||||
|
|
||||||
// Remove the reference to the encoded JPEG2000 data so it can be GCed
|
|
||||||
primShape.SculptData = Utils.EmptyBytes;
|
|
||||||
|
|
||||||
if (cacheSculptMaps)
|
if (cacheSculptMaps)
|
||||||
{
|
{
|
||||||
|
@ -315,8 +309,6 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PrimMesher.SculptMesh.SculptType sculptType;
|
PrimMesher.SculptMesh.SculptType sculptType;
|
||||||
switch ((OpenMetaverse.SculptType)primShape.SculptType)
|
switch ((OpenMetaverse.SculptType)primShape.SculptType)
|
||||||
{
|
{
|
||||||
|
@ -351,7 +343,6 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
coords = sculptMesh.coords;
|
coords = sculptMesh.coords;
|
||||||
faces = sculptMesh.faces;
|
faces = sculptMesh.faces;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f;
|
float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f;
|
||||||
|
@ -466,6 +457,8 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
faces = primMesh.faces;
|
faces = primMesh.faces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the reference to any JPEG2000 sculpt data so it can be GCed
|
||||||
|
primShape.SculptData = Utils.EmptyBytes;
|
||||||
|
|
||||||
int numCoords = coords.Count;
|
int numCoords = coords.Count;
|
||||||
int numFaces = faces.Count;
|
int numFaces = faces.Count;
|
||||||
|
@ -488,12 +481,12 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
|
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
|
||||||
{
|
{
|
||||||
return CreateMesh(primName, primShape, size, lod, false);
|
return CreateMesh(primName, primShape, size, lod, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
|
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
|
||||||
{
|
{
|
||||||
Mesh mesh = null;
|
Mesh mesh = null;
|
||||||
ulong key = 0;
|
ulong key = 0;
|
||||||
|
|
|
@ -68,15 +68,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private PhysicsVector _position;
|
private Vector3 _position;
|
||||||
private d.Vector3 _zeroPosition;
|
private d.Vector3 _zeroPosition;
|
||||||
// private d.Matrix3 m_StandUpRotation;
|
// private d.Matrix3 m_StandUpRotation;
|
||||||
private bool _zeroFlag = false;
|
private bool _zeroFlag = false;
|
||||||
private bool m_lastUpdateSent = false;
|
private bool m_lastUpdateSent = false;
|
||||||
private PhysicsVector _velocity;
|
private Vector3 _velocity;
|
||||||
private PhysicsVector _target_velocity;
|
private Vector3 _target_velocity;
|
||||||
private PhysicsVector _acceleration;
|
private Vector3 _acceleration;
|
||||||
private PhysicsVector m_rotationalVelocity;
|
private Vector3 m_rotationalVelocity;
|
||||||
private float m_mass = 80f;
|
private float m_mass = 80f;
|
||||||
public float m_density = 60f;
|
public float m_density = 60f;
|
||||||
private bool m_pidControllerActive = true;
|
private bool m_pidControllerActive = true;
|
||||||
|
@ -99,7 +99,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private bool m_hackSentFall = false;
|
private bool m_hackSentFall = false;
|
||||||
private bool m_hackSentFly = false;
|
private bool m_hackSentFly = false;
|
||||||
private int m_requestedUpdateFrequency = 0;
|
private int m_requestedUpdateFrequency = 0;
|
||||||
private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0);
|
private Vector3 m_taintPosition = Vector3.Zero;
|
||||||
public uint m_localID = 0;
|
public uint m_localID = 0;
|
||||||
public bool m_returnCollisions = false;
|
public bool m_returnCollisions = false;
|
||||||
// taints and their non-tainted counterparts
|
// taints and their non-tainted counterparts
|
||||||
|
@ -143,22 +143,17 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
public UUID m_uuid;
|
public UUID m_uuid;
|
||||||
public bool bad = false;
|
public bool bad = false;
|
||||||
|
|
||||||
public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
|
public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
|
||||||
{
|
{
|
||||||
m_uuid = UUID.Random();
|
m_uuid = UUID.Random();
|
||||||
|
|
||||||
// ode = dode;
|
if (pos.IsFinite())
|
||||||
_velocity = new PhysicsVector();
|
|
||||||
_target_velocity = new PhysicsVector();
|
|
||||||
|
|
||||||
|
|
||||||
if (PhysicsVector.isFinite(pos))
|
|
||||||
{
|
{
|
||||||
if (pos.Z > 9999999)
|
if (pos.Z > 9999999f)
|
||||||
{
|
{
|
||||||
pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
||||||
}
|
}
|
||||||
if (pos.Z < -90000)
|
if (pos.Z < -90000f)
|
||||||
{
|
{
|
||||||
pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
||||||
}
|
}
|
||||||
|
@ -169,15 +164,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_position = new PhysicsVector(((int)_parent_scene.WorldExtents.X * 0.5f), ((int)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128, 128) + 10);
|
_position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
|
||||||
m_taintPosition.X = _position.X;
|
m_taintPosition.X = _position.X;
|
||||||
m_taintPosition.Y = _position.Y;
|
m_taintPosition.Y = _position.Y;
|
||||||
m_taintPosition.Z = _position.Z;
|
m_taintPosition.Z = _position.Z;
|
||||||
m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
|
m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_acceleration = new PhysicsVector();
|
|
||||||
_parent_scene = parent_scene;
|
_parent_scene = parent_scene;
|
||||||
|
|
||||||
PID_D = pid_d;
|
PID_D = pid_d;
|
||||||
|
@ -189,7 +182,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
walkDivisor = walk_divisor;
|
walkDivisor = walk_divisor;
|
||||||
runDivisor = rundivisor;
|
runDivisor = rundivisor;
|
||||||
|
|
||||||
|
|
||||||
// m_StandUpRotation =
|
// m_StandUpRotation =
|
||||||
// new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
|
// new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
|
||||||
// 0.5f);
|
// 0.5f);
|
||||||
|
@ -205,7 +197,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_isPhysical = false; // current status: no ODE information exists
|
m_isPhysical = false; // current status: no ODE information exists
|
||||||
m_tainted_isPhysical = true; // new tainted status: need to create ODE information
|
m_tainted_isPhysical = true; // new tainted status: need to create ODE information
|
||||||
|
|
||||||
|
|
||||||
_parent_scene.AddPhysicsActorTaint(this);
|
_parent_scene.AddPhysicsActorTaint(this);
|
||||||
|
|
||||||
m_name = avName;
|
m_name = avName;
|
||||||
|
@ -412,20 +403,20 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// Not really a good choice unless you 'know' it's a good
|
/// Not really a good choice unless you 'know' it's a good
|
||||||
/// spot otherwise you're likely to orbit the avatar.
|
/// spot otherwise you're likely to orbit the avatar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Body == IntPtr.Zero || Shell == IntPtr.Zero)
|
if (Body == IntPtr.Zero || Shell == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
if (value.Z > 9999999)
|
if (value.Z > 9999999f)
|
||||||
{
|
{
|
||||||
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
||||||
}
|
}
|
||||||
if (value.Z < -90000)
|
if (value.Z < -90000f)
|
||||||
{
|
{
|
||||||
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
||||||
}
|
}
|
||||||
|
@ -447,7 +438,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return m_rotationalVelocity; }
|
get { return m_rotationalVelocity; }
|
||||||
set { m_rotationalVelocity = value; }
|
set { m_rotationalVelocity = value; }
|
||||||
|
@ -457,20 +448,20 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight
|
/// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight
|
||||||
/// and use it to offset landings properly
|
/// and use it to offset landings properly
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
|
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
m_pidControllerActive = true;
|
m_pidControllerActive = true;
|
||||||
|
|
||||||
PhysicsVector SetSize = value;
|
Vector3 SetSize = value;
|
||||||
m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f;
|
m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f;
|
||||||
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
|
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
|
||||||
|
|
||||||
Velocity = new PhysicsVector(0f, 0f, 0f);
|
Velocity = Vector3.Zero;
|
||||||
|
|
||||||
_parent_scene.AddPhysicsActorTaint(this);
|
_parent_scene.AddPhysicsActorTaint(this);
|
||||||
}
|
}
|
||||||
|
@ -481,7 +472,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AlignAvatarTiltWithCurrentDirectionOfMovement(PhysicsVector movementVector)
|
private void AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3 movementVector)
|
||||||
{
|
{
|
||||||
movementVector.Z = 0f;
|
movementVector.Z = 0f;
|
||||||
float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y));
|
float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y));
|
||||||
|
@ -643,7 +634,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// (with -0..0 motor stops) falls into the terrain for reasons yet
|
// (with -0..0 motor stops) falls into the terrain for reasons yet
|
||||||
// to be comprehended in their entirety.
|
// to be comprehended in their entirety.
|
||||||
#endregion
|
#endregion
|
||||||
AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(0,0,0));
|
AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
|
||||||
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
|
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
|
||||||
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
|
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
|
||||||
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
|
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
|
||||||
|
@ -688,7 +679,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -716,9 +707,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
|
// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); }
|
get { return _target_velocity; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,7 +724,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -748,14 +739,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PrimitiveBaseShape Shape
|
public override PrimitiveBaseShape Shape
|
||||||
|
@ -763,18 +754,18 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get {
|
get {
|
||||||
// There's a problem with PhysicsVector.Zero! Don't Use it Here!
|
// There's a problem with Vector3.Zero! Don't Use it Here!
|
||||||
if (_zeroFlag)
|
if (_zeroFlag)
|
||||||
return new PhysicsVector(0f, 0f, 0f);
|
return Vector3.Zero;
|
||||||
m_lastUpdateSent = false;
|
m_lastUpdateSent = false;
|
||||||
return _velocity;
|
return _velocity;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
m_pidControllerActive = true;
|
m_pidControllerActive = true;
|
||||||
_target_velocity = value;
|
_target_velocity = value;
|
||||||
|
@ -786,9 +777,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,12 +805,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAcceleration(PhysicsVector accel)
|
public void SetAcceleration(Vector3 accel)
|
||||||
{
|
{
|
||||||
m_pidControllerActive = true;
|
m_pidControllerActive = true;
|
||||||
_acceleration = accel;
|
_acceleration = accel;
|
||||||
|
@ -830,9 +821,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// The PID controller takes this target velocity and tries to make it a reality
|
/// The PID controller takes this target velocity and tries to make it a reality
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="force"></param>
|
/// <param name="force"></param>
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(force))
|
if (force.IsFinite())
|
||||||
{
|
{
|
||||||
if (pushforce)
|
if (pushforce)
|
||||||
{
|
{
|
||||||
|
@ -861,7 +852,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
//m_lastUpdateSent = false;
|
//m_lastUpdateSent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -870,7 +861,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// After all of the forces add up with 'add force' we apply them with doForce
|
/// After all of the forces add up with 'add force' we apply them with doForce
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="force"></param>
|
/// <param name="force"></param>
|
||||||
public void doForce(PhysicsVector force)
|
public void doForce(Vector3 force)
|
||||||
{
|
{
|
||||||
if (!collidelock)
|
if (!collidelock)
|
||||||
{
|
{
|
||||||
|
@ -881,7 +872,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -908,9 +899,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
//PidStatus = true;
|
//PidStatus = true;
|
||||||
|
|
||||||
d.Vector3 localpos = d.BodyGetPosition(Body);
|
d.Vector3 localpos = d.BodyGetPosition(Body);
|
||||||
PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z);
|
Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z);
|
||||||
|
|
||||||
if (!PhysicsVector.isFinite(localPos))
|
if (!localPos.IsFinite())
|
||||||
{
|
{
|
||||||
|
|
||||||
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
|
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
|
||||||
|
@ -946,7 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicsVector vec = new PhysicsVector();
|
Vector3 vec = Vector3.Zero;
|
||||||
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
||||||
|
|
||||||
float movementdivisor = 1f;
|
float movementdivisor = 1f;
|
||||||
|
@ -1059,12 +1050,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
// end add Kitto Flora
|
// end add Kitto Flora
|
||||||
}
|
}
|
||||||
if (PhysicsVector.isFinite(vec))
|
if (vec.IsFinite())
|
||||||
{
|
{
|
||||||
doForce(vec);
|
doForce(vec);
|
||||||
if (!_zeroFlag)
|
if (!_zeroFlag)
|
||||||
{
|
{
|
||||||
AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(vec.X, vec.Y, vec.Z));
|
AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1197,7 +1188,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget { set { return; } }
|
public override Vector3 PIDTarget { set { return; } }
|
||||||
public override bool PIDActive { set { return; } }
|
public override bool PIDActive { set { return; } }
|
||||||
public override float PIDTau { set { return; } }
|
public override float PIDTau { set { return; } }
|
||||||
|
|
||||||
|
@ -1311,7 +1302,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.GeomDestroy(Shell);
|
d.GeomDestroy(Shell);
|
||||||
AvatarGeomAndBodyCreation(_position.X, _position.Y,
|
AvatarGeomAndBodyCreation(_position.X, _position.Y,
|
||||||
_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
|
_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
|
||||||
Velocity = new PhysicsVector(0f, 0f, 0f);
|
Velocity = Vector3.Zero;
|
||||||
|
|
||||||
_parent_scene.geom_name_map[Shell] = m_name;
|
_parent_scene.geom_name_map[Shell] = m_name;
|
||||||
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
|
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
|
||||||
|
@ -1325,7 +1316,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_taintPosition.IsIdentical(_position, 0.05f))
|
if (!m_taintPosition.ApproxEquals(_position, 0.05f))
|
||||||
{
|
{
|
||||||
if (Body != IntPtr.Zero)
|
if (Body != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,16 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces
|
|
||||||
* ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
|
|
||||||
* ODEPrim.cs contains methods dealing with Prim editing, Prim
|
|
||||||
* characteristics and Kinetic motion.
|
|
||||||
* ODEDynamics.cs contains methods dealing with Prim Physical motion
|
|
||||||
* (dynamics) and the associated settings. Old Linear and angular
|
|
||||||
* motors for dynamic motion have been replace with MoveLinear()
|
|
||||||
* and MoveAngular(); 'Physical' is used only to switch ODE dynamic
|
|
||||||
* simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to
|
|
||||||
* switch between 'VEHICLE' parameter use and general dynamics
|
|
||||||
* settings use.
|
|
||||||
*
|
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
@ -37,6 +25,19 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces
|
||||||
|
* ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
|
||||||
|
* ODEPrim.cs contains methods dealing with Prim editing, Prim
|
||||||
|
* characteristics and Kinetic motion.
|
||||||
|
* ODEDynamics.cs contains methods dealing with Prim Physical motion
|
||||||
|
* (dynamics) and the associated settings. Old Linear and angular
|
||||||
|
* motors for dynamic motion have been replace with MoveLinear()
|
||||||
|
* and MoveAngular(); 'Physical' is used only to switch ODE dynamic
|
||||||
|
* simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to
|
||||||
|
* switch between 'VEHICLE' parameter use and general dynamics
|
||||||
|
* settings use.
|
||||||
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -231,7 +232,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
}//end ProcessFloatVehicleParam
|
}//end ProcessFloatVehicleParam
|
||||||
|
|
||||||
internal void ProcessVectorVehicleParam(Vehicle pParam, PhysicsVector pValue)
|
internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
|
||||||
{
|
{
|
||||||
switch (pParam)
|
switch (pParam)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,18 +1,5 @@
|
||||||
/*
|
/* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces
|
|
||||||
* ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
|
|
||||||
* ODEPrim.cs contains methods dealing with Prim editing, Prim
|
|
||||||
* characteristics and Kinetic motion.
|
|
||||||
* ODEDynamics.cs contains methods dealing with Prim Physical motion
|
|
||||||
* (dynamics) and the associated settings. Old Linear and angular
|
|
||||||
* motors for dynamic motion have been replace with MoveLinear()
|
|
||||||
* and MoveAngular(); 'Physical' is used only to switch ODE dynamic
|
|
||||||
* simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to
|
|
||||||
* switch between 'VEHICLE' parameter use and general dynamics
|
|
||||||
* settings use.
|
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
@ -35,6 +22,20 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces
|
||||||
|
* ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
|
||||||
|
* ODEPrim.cs contains methods dealing with Prim editing, Prim
|
||||||
|
* characteristics and Kinetic motion.
|
||||||
|
* ODEDynamics.cs contains methods dealing with Prim Physical motion
|
||||||
|
* (dynamics) and the associated settings. Old Linear and angular
|
||||||
|
* motors for dynamic motion have been replace with MoveLinear()
|
||||||
|
* and MoveAngular(); 'Physical' is used only to switch ODE dynamic
|
||||||
|
* simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to
|
||||||
|
* switch between 'VEHICLE' parameter use and general dynamics
|
||||||
|
* settings use.
|
||||||
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -56,44 +57,43 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private PhysicsVector _position;
|
private Vector3 _position;
|
||||||
private PhysicsVector _velocity;
|
private Vector3 _velocity;
|
||||||
private PhysicsVector _torque = new PhysicsVector(0,0,0);
|
private Vector3 _torque;
|
||||||
private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
private Vector3 m_lastVelocity;
|
||||||
private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
private Vector3 m_lastposition;
|
||||||
private Quaternion m_lastorientation = new Quaternion();
|
private Quaternion m_lastorientation = new Quaternion();
|
||||||
private PhysicsVector m_rotationalVelocity;
|
private Vector3 m_rotationalVelocity;
|
||||||
private PhysicsVector _size;
|
private Vector3 _size;
|
||||||
private PhysicsVector _acceleration;
|
private Vector3 _acceleration;
|
||||||
// private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
|
// private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
|
||||||
private Quaternion _orientation;
|
private Quaternion _orientation;
|
||||||
private PhysicsVector m_taintposition;
|
private Vector3 m_taintposition;
|
||||||
private PhysicsVector m_taintsize;
|
private Vector3 m_taintsize;
|
||||||
private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0);
|
private Vector3 m_taintVelocity;
|
||||||
private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0);
|
private Vector3 m_taintTorque;
|
||||||
private Quaternion m_taintrot;
|
private Quaternion m_taintrot;
|
||||||
private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f);
|
private Vector3 m_angularlock = Vector3.One;
|
||||||
private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f);
|
private Vector3 m_taintAngularLock = Vector3.One;
|
||||||
private IntPtr Amotor = IntPtr.Zero;
|
private IntPtr Amotor = IntPtr.Zero;
|
||||||
|
|
||||||
private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0);
|
private Vector3 m_PIDTarget;
|
||||||
// private PhysicsVector m_taintPIDTarget = new PhysicsVector(0, 0, 0);
|
private float m_PIDTau;
|
||||||
private float m_PIDTau = 0f;
|
|
||||||
private float PID_D = 35f;
|
private float PID_D = 35f;
|
||||||
private float PID_G = 25f;
|
private float PID_G = 25f;
|
||||||
private bool m_usePID = false;
|
private bool m_usePID;
|
||||||
|
|
||||||
// KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
|
// KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
|
||||||
// and are for non-VEHICLES only.
|
// and are for non-VEHICLES only.
|
||||||
|
|
||||||
private float m_PIDHoverHeight = 0f;
|
private float m_PIDHoverHeight;
|
||||||
private float m_PIDHoverTau = 0f;
|
private float m_PIDHoverTau;
|
||||||
private bool m_useHoverPID = false;
|
private bool m_useHoverPID;
|
||||||
private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
|
private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
|
||||||
private float m_targetHoverHeight = 0f;
|
private float m_targetHoverHeight;
|
||||||
private float m_groundHeight = 0f;
|
private float m_groundHeight;
|
||||||
private float m_waterHeight = 0f;
|
private float m_waterHeight;
|
||||||
private float m_buoyancy = 0f; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
|
private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
|
||||||
|
|
||||||
// private float m_tensor = 5f;
|
// private float m_tensor = 5f;
|
||||||
private int body_autodisable_frames = 20;
|
private int body_autodisable_frames = 20;
|
||||||
|
@ -104,11 +104,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
| CollisionCategories.Body
|
| CollisionCategories.Body
|
||||||
| CollisionCategories.Character
|
| CollisionCategories.Character
|
||||||
);
|
);
|
||||||
private bool m_taintshape = false;
|
private bool m_taintshape;
|
||||||
private bool m_taintPhysics = false;
|
private bool m_taintPhysics;
|
||||||
private bool m_collidesLand = true;
|
private bool m_collidesLand = true;
|
||||||
private bool m_collidesWater = false;
|
private bool m_collidesWater;
|
||||||
public bool m_returnCollisions = false;
|
public bool m_returnCollisions;
|
||||||
|
|
||||||
// Default we're a Geometry
|
// Default we're a Geometry
|
||||||
private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
|
private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
|
||||||
|
@ -116,85 +116,83 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// Default, Collide with Other Geometries, spaces and Bodies
|
// Default, Collide with Other Geometries, spaces and Bodies
|
||||||
private CollisionCategories m_collisionFlags = m_default_collisionFlags;
|
private CollisionCategories m_collisionFlags = m_default_collisionFlags;
|
||||||
|
|
||||||
public bool m_taintremove = false;
|
public bool m_taintremove;
|
||||||
public bool m_taintdisable = false;
|
public bool m_taintdisable;
|
||||||
public bool m_disabled = false;
|
public bool m_disabled;
|
||||||
public bool m_taintadd = false;
|
public bool m_taintadd;
|
||||||
public bool m_taintselected = false;
|
public bool m_taintselected;
|
||||||
public bool m_taintCollidesWater = false;
|
public bool m_taintCollidesWater;
|
||||||
|
|
||||||
public uint m_localID = 0;
|
public uint m_localID;
|
||||||
|
|
||||||
//public GCHandle gc;
|
//public GCHandle gc;
|
||||||
private CollisionLocker ode;
|
private CollisionLocker ode;
|
||||||
|
|
||||||
private bool m_taintforce = false;
|
private bool m_taintforce = false;
|
||||||
private bool m_taintaddangularforce = false;
|
private bool m_taintaddangularforce = false;
|
||||||
private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
private Vector3 m_force;
|
||||||
private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
|
private List<Vector3> m_forcelist = new List<Vector3>();
|
||||||
private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>();
|
private List<Vector3> m_angularforcelist = new List<Vector3>();
|
||||||
|
|
||||||
private IMesh _mesh;
|
private IMesh _mesh;
|
||||||
private PrimitiveBaseShape _pbs;
|
private PrimitiveBaseShape _pbs;
|
||||||
private OdeScene _parent_scene;
|
private OdeScene _parent_scene;
|
||||||
public IntPtr m_targetSpace = (IntPtr) 0;
|
public IntPtr m_targetSpace = IntPtr.Zero;
|
||||||
public IntPtr prim_geom;
|
public IntPtr prim_geom;
|
||||||
public IntPtr prev_geom;
|
public IntPtr prev_geom;
|
||||||
public IntPtr _triMeshData;
|
public IntPtr _triMeshData;
|
||||||
|
|
||||||
private IntPtr _linkJointGroup = (IntPtr)0;
|
private IntPtr _linkJointGroup = IntPtr.Zero;
|
||||||
private PhysicsActor _parent = null;
|
private PhysicsActor _parent;
|
||||||
private PhysicsActor m_taintparent = null;
|
private PhysicsActor m_taintparent;
|
||||||
|
|
||||||
private List<OdePrim> childrenPrim = new List<OdePrim>();
|
private List<OdePrim> childrenPrim = new List<OdePrim>();
|
||||||
|
|
||||||
private bool iscolliding = false;
|
private bool iscolliding;
|
||||||
private bool m_isphysical = false;
|
private bool m_isphysical;
|
||||||
private bool m_isSelected = false;
|
private bool m_isSelected;
|
||||||
|
|
||||||
internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively
|
internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
|
||||||
|
|
||||||
private bool m_throttleUpdates = false;
|
private bool m_throttleUpdates;
|
||||||
private int throttleCounter = 0;
|
private int throttleCounter;
|
||||||
public int m_interpenetrationcount = 0;
|
public int m_interpenetrationcount;
|
||||||
public float m_collisionscore = 0;
|
public float m_collisionscore;
|
||||||
public int m_roundsUnderMotionThreshold = 0;
|
public int m_roundsUnderMotionThreshold;
|
||||||
private int m_crossingfailures = 0;
|
private int m_crossingfailures;
|
||||||
|
|
||||||
public bool outofBounds = false;
|
public bool outofBounds;
|
||||||
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
||||||
|
|
||||||
public bool _zeroFlag = false;
|
public bool _zeroFlag;
|
||||||
private bool m_lastUpdateSent = false;
|
private bool m_lastUpdateSent;
|
||||||
|
|
||||||
public IntPtr Body = (IntPtr) 0;
|
public IntPtr Body = IntPtr.Zero;
|
||||||
public String m_primName;
|
public String m_primName;
|
||||||
// private String m_primName;
|
private Vector3 _target_velocity;
|
||||||
private PhysicsVector _target_velocity;
|
|
||||||
public d.Mass pMass;
|
public d.Mass pMass;
|
||||||
|
|
||||||
public int m_eventsubscription = 0;
|
public int m_eventsubscription;
|
||||||
private CollisionEventUpdate CollisionEventsThisFrame = null;
|
private CollisionEventUpdate CollisionEventsThisFrame;
|
||||||
|
|
||||||
private IntPtr m_linkJoint = (IntPtr)0;
|
private IntPtr m_linkJoint = IntPtr.Zero;
|
||||||
|
|
||||||
public volatile bool childPrim = false;
|
public volatile bool childPrim;
|
||||||
|
|
||||||
private ODEDynamics m_vehicle;
|
private ODEDynamics m_vehicle;
|
||||||
|
|
||||||
internal int m_material = (int)Material.Wood;
|
internal int m_material = (int)Material.Wood;
|
||||||
|
|
||||||
public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size,
|
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
|
||||||
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
|
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
|
||||||
{
|
{
|
||||||
_target_velocity = new PhysicsVector(0, 0, 0);
|
|
||||||
m_vehicle = new ODEDynamics();
|
m_vehicle = new ODEDynamics();
|
||||||
//gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
|
//gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
|
||||||
ode = dode;
|
ode = dode;
|
||||||
_velocity = new PhysicsVector();
|
if (!pos.IsFinite())
|
||||||
if (!PhysicsVector.isFinite(pos))
|
|
||||||
{
|
{
|
||||||
pos = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f)) + 0.5f);
|
pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f),
|
||||||
|
parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f);
|
||||||
m_log.Warn("[PHYSICS]: Got nonFinite Object create Position");
|
m_log.Warn("[PHYSICS]: Got nonFinite Object create Position");
|
||||||
}
|
}
|
||||||
_position = pos;
|
_position = pos;
|
||||||
|
@ -209,9 +207,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
prim_geom = IntPtr.Zero;
|
prim_geom = IntPtr.Zero;
|
||||||
prev_geom = IntPtr.Zero;
|
prev_geom = IntPtr.Zero;
|
||||||
|
|
||||||
if (!PhysicsVector.isFinite(pos))
|
if (!pos.IsFinite())
|
||||||
{
|
{
|
||||||
size = new PhysicsVector(0.5f, 0.5f, 0.5f);
|
size = new Vector3(0.5f, 0.5f, 0.5f);
|
||||||
m_log.Warn("[PHYSICS]: Got nonFinite Object create Size");
|
m_log.Warn("[PHYSICS]: Got nonFinite Object create Size");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,8 +219,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
_size = size;
|
_size = size;
|
||||||
m_taintsize = _size;
|
m_taintsize = _size;
|
||||||
_acceleration = new PhysicsVector();
|
|
||||||
m_rotationalVelocity = PhysicsVector.Zero;
|
|
||||||
|
|
||||||
if (!QuaternionIsFinite(rotation))
|
if (!QuaternionIsFinite(rotation))
|
||||||
{
|
{
|
||||||
|
@ -387,7 +383,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_disabled = false;
|
m_disabled = false;
|
||||||
|
|
||||||
// The body doesn't already have a finite rotation mode set here
|
// The body doesn't already have a finite rotation mode set here
|
||||||
if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
|
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null)
|
||||||
{
|
{
|
||||||
createAMotor(m_angularlock);
|
createAMotor(m_angularlock);
|
||||||
}
|
}
|
||||||
|
@ -800,6 +796,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_collisionscore = 0;
|
m_collisionscore = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>();
|
||||||
|
|
||||||
public void setMesh(OdeScene parent_scene, IMesh mesh)
|
public void setMesh(OdeScene parent_scene, IMesh mesh)
|
||||||
{
|
{
|
||||||
// This sleeper is there to moderate how long it takes between
|
// This sleeper is there to moderate how long it takes between
|
||||||
|
@ -831,19 +829,24 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
|
mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
|
||||||
|
|
||||||
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
|
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
|
||||||
|
if (m_MeshToTriMeshMap.ContainsKey(mesh))
|
||||||
|
{
|
||||||
|
_triMeshData = m_MeshToTriMeshMap[mesh];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_triMeshData = d.GeomTriMeshDataCreate();
|
||||||
|
|
||||||
_triMeshData = d.GeomTriMeshDataCreate();
|
d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
||||||
|
d.GeomTriMeshDataPreprocess(_triMeshData);
|
||||||
d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
m_MeshToTriMeshMap[mesh] = _triMeshData;
|
||||||
d.GeomTriMeshDataPreprocess(_triMeshData);
|
}
|
||||||
|
|
||||||
_parent_scene.waitForSpaceUnlock(m_targetSpace);
|
_parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (prim_geom == IntPtr.Zero)
|
if (prim_geom == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
//Console.WriteLine(" setMesh 1");
|
|
||||||
SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null));
|
SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -853,6 +856,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (IsPhysical && Body == (IntPtr) 0)
|
// if (IsPhysical && Body == (IntPtr) 0)
|
||||||
// {
|
// {
|
||||||
// Recreate the body
|
// Recreate the body
|
||||||
|
@ -873,7 +877,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
if (prim_geom != IntPtr.Zero)
|
if (prim_geom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
if (!_position.IsIdentical(m_taintposition,0f))
|
if (!_position.ApproxEquals(m_taintposition, 0f))
|
||||||
changemove(timestep);
|
changemove(timestep);
|
||||||
|
|
||||||
if (m_taintrot != _orientation)
|
if (m_taintrot != _orientation)
|
||||||
|
@ -898,7 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
changePhysicsStatus(timestep);
|
changePhysicsStatus(timestep);
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!_size.IsIdentical(m_taintsize,0))
|
if (!_size.ApproxEquals(m_taintsize,0f))
|
||||||
changesize(timestep);
|
changesize(timestep);
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -912,7 +916,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (m_taintaddangularforce)
|
if (m_taintaddangularforce)
|
||||||
changeAddAngularForce(timestep);
|
changeAddAngularForce(timestep);
|
||||||
|
|
||||||
if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f))
|
if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
|
||||||
changeSetTorque(timestep);
|
changeSetTorque(timestep);
|
||||||
|
|
||||||
if (m_taintdisable)
|
if (m_taintdisable)
|
||||||
|
@ -921,7 +925,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (m_taintselected != m_isSelected)
|
if (m_taintselected != m_isSelected)
|
||||||
changeSelectedStatus(timestep);
|
changeSelectedStatus(timestep);
|
||||||
|
|
||||||
if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f))
|
if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
|
||||||
changevelocity(timestep);
|
changevelocity(timestep);
|
||||||
|
|
||||||
if (m_taintparent != _parent)
|
if (m_taintparent != _parent)
|
||||||
|
@ -930,7 +934,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (m_taintCollidesWater != m_collidesWater)
|
if (m_taintCollidesWater != m_collidesWater)
|
||||||
changefloatonwater(timestep);
|
changefloatonwater(timestep);
|
||||||
|
|
||||||
if (!m_angularlock.IsIdentical(m_taintAngularLock,0))
|
if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
|
||||||
changeAngularLock(timestep);
|
changeAngularLock(timestep);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -950,7 +954,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
//If we have a parent then we're not authorative here
|
//If we have a parent then we're not authorative here
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
{
|
{
|
||||||
if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f,1f,1f), 0))
|
if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f))
|
||||||
{
|
{
|
||||||
//d.BodySetFiniteRotationMode(Body, 0);
|
//d.BodySetFiniteRotationMode(Body, 0);
|
||||||
//d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
|
//d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
|
||||||
|
@ -967,7 +971,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Store this for later in case we get turned into a separate body
|
// Store this for later in case we get turned into a separate body
|
||||||
m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z);
|
m_angularlock = m_taintAngularLock;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1111,7 +1115,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
prm.m_disabled = false;
|
prm.m_disabled = false;
|
||||||
|
|
||||||
// The body doesn't already have a finite rotation mode set here
|
// The body doesn't already have a finite rotation mode set here
|
||||||
if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
|
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||||
{
|
{
|
||||||
prm.createAMotor(m_angularlock);
|
prm.createAMotor(m_angularlock);
|
||||||
}
|
}
|
||||||
|
@ -1154,7 +1158,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_disabled = false;
|
m_disabled = false;
|
||||||
|
|
||||||
// The body doesn't already have a finite rotation mode set here
|
// The body doesn't already have a finite rotation mode set here
|
||||||
if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
|
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||||
{
|
{
|
||||||
createAMotor(m_angularlock);
|
createAMotor(m_angularlock);
|
||||||
}
|
}
|
||||||
|
@ -1338,7 +1342,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_taintshape = false;
|
m_taintshape = false;
|
||||||
m_taintforce = false;
|
m_taintforce = false;
|
||||||
m_taintdisable = false;
|
m_taintdisable = false;
|
||||||
m_taintVelocity = PhysicsVector.Zero;
|
m_taintVelocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
|
public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
|
||||||
|
@ -1567,7 +1571,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
//Console.WriteLine("Move " + m_primName);
|
//Console.WriteLine("Move " + m_primName);
|
||||||
if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
|
if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
|
||||||
// NON-'VEHICLES' are dealt with here
|
// NON-'VEHICLES' are dealt with here
|
||||||
if (d.BodyIsEnabled(Body) && !m_angularlock.IsIdentical(PhysicsVector.Zero, 0.003f))
|
if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
|
||||||
{
|
{
|
||||||
d.Vector3 avel2 = d.BodyGetAngularVel(Body);
|
d.Vector3 avel2 = d.BodyGetAngularVel(Body);
|
||||||
if (m_angularlock.X == 1)
|
if (m_angularlock.X == 1)
|
||||||
|
@ -1624,7 +1628,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
|
|
||||||
d.Vector3 pos = d.BodyGetPosition(Body);
|
d.Vector3 pos = d.BodyGetPosition(Body);
|
||||||
_target_velocity =
|
_target_velocity =
|
||||||
new PhysicsVector(
|
new Vector3(
|
||||||
(m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
|
(m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
|
||||||
(m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
|
(m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
|
||||||
(m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
|
(m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
|
||||||
|
@ -1632,7 +1636,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
|
|
||||||
// if velocity is zero, use position control; otherwise, velocity control
|
// if velocity is zero, use position control; otherwise, velocity control
|
||||||
|
|
||||||
if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f))
|
if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f))
|
||||||
{
|
{
|
||||||
// keep track of where we stopped. No more slippin' & slidin'
|
// keep track of where we stopped. No more slippin' & slidin'
|
||||||
|
|
||||||
|
@ -1717,13 +1721,13 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
|
|
||||||
|
|
||||||
_target_velocity =
|
_target_velocity =
|
||||||
new PhysicsVector(0.0f, 0.0f,
|
new Vector3(0.0f, 0.0f,
|
||||||
(m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
|
(m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
|
||||||
);
|
);
|
||||||
|
|
||||||
// if velocity is zero, use position control; otherwise, velocity control
|
// if velocity is zero, use position control; otherwise, velocity control
|
||||||
|
|
||||||
if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f))
|
if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
|
||||||
{
|
{
|
||||||
// keep track of where we stopped. No more slippin' & slidin'
|
// keep track of where we stopped. No more slippin' & slidin'
|
||||||
|
|
||||||
|
@ -1812,7 +1816,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
d.BodySetQuaternion(Body, ref myrot);
|
d.BodySetQuaternion(Body, ref myrot);
|
||||||
if (m_isphysical)
|
if (m_isphysical)
|
||||||
{
|
{
|
||||||
if (!m_angularlock.IsIdentical(new PhysicsVector(1, 1, 1), 0))
|
if (!m_angularlock.ApproxEquals(Vector3.One, 0f))
|
||||||
createAMotor(m_angularlock);
|
createAMotor(m_angularlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2121,7 +2125,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||||
if (IsPhysical)
|
if (IsPhysical)
|
||||||
{
|
{
|
||||||
PhysicsVector iforce = new PhysicsVector();
|
Vector3 iforce = Vector3.Zero;
|
||||||
for (int i = 0; i < m_forcelist.Count; i++)
|
for (int i = 0; i < m_forcelist.Count; i++)
|
||||||
{
|
{
|
||||||
iforce = iforce + (m_forcelist[i] * 100);
|
iforce = iforce + (m_forcelist[i] * 100);
|
||||||
|
@ -2152,7 +2156,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_taintTorque = new PhysicsVector(0, 0, 0);
|
m_taintTorque = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeAddAngularForce(float timestamp)
|
public void changeAddAngularForce(float timestamp)
|
||||||
|
@ -2164,7 +2168,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||||
if (IsPhysical)
|
if (IsPhysical)
|
||||||
{
|
{
|
||||||
PhysicsVector iforce = new PhysicsVector();
|
Vector3 iforce = Vector3.Zero;
|
||||||
for (int i = 0; i < m_angularforcelist.Count; i++)
|
for (int i = 0; i < m_angularforcelist.Count; i++)
|
||||||
{
|
{
|
||||||
iforce = iforce + (m_angularforcelist[i] * 100);
|
iforce = iforce + (m_angularforcelist[i] * 100);
|
||||||
|
@ -2198,7 +2202,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
|
|
||||||
//resetCollisionAccounting();
|
//resetCollisionAccounting();
|
||||||
}
|
}
|
||||||
m_taintVelocity = PhysicsVector.Zero;
|
m_taintVelocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsPhysical
|
public override bool IsPhysical
|
||||||
|
@ -2207,7 +2211,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
set {
|
set {
|
||||||
m_isphysical = value;
|
m_isphysical = value;
|
||||||
if (!m_isphysical) // Zero the remembered last velocity
|
if (!m_isphysical) // Zero the remembered last velocity
|
||||||
m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
m_lastVelocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2252,7 +2256,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
get { return _zeroFlag; }
|
get { return _zeroFlag; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
|
|
||||||
|
@ -2261,12 +2265,12 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return _size; }
|
get { return _size; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
_size = value;
|
_size = value;
|
||||||
}
|
}
|
||||||
|
@ -2282,13 +2286,13 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
get { return CalculateMass(); }
|
get { return CalculateMass(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
//get { return PhysicsVector.Zero; }
|
//get { return Vector3.Zero; }
|
||||||
get { return m_force; }
|
get { return m_force; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
m_force = value;
|
m_force = value;
|
||||||
}
|
}
|
||||||
|
@ -2310,7 +2314,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value);
|
m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value);
|
m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value);
|
||||||
}
|
}
|
||||||
|
@ -2328,14 +2332,14 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PrimitiveBaseShape Shape
|
public override PrimitiveBaseShape Shape
|
||||||
|
@ -2347,13 +2351,13 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// Averate previous velocity with the new one so
|
// Averate previous velocity with the new one so
|
||||||
// client object interpolation works a 'little' better
|
// client object interpolation works a 'little' better
|
||||||
PhysicsVector returnVelocity = new PhysicsVector();
|
Vector3 returnVelocity = Vector3.Zero;
|
||||||
returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2;
|
returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2;
|
||||||
returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2;
|
returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2;
|
||||||
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2;
|
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2;
|
||||||
|
@ -2361,7 +2365,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
_velocity = value;
|
_velocity = value;
|
||||||
|
|
||||||
|
@ -2376,19 +2380,19 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!m_isphysical || Body == IntPtr.Zero)
|
if (!m_isphysical || Body == IntPtr.Zero)
|
||||||
return new PhysicsVector(0,0,0);
|
return Vector3.Zero;
|
||||||
|
|
||||||
return _torque;
|
return _torque;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
m_taintTorque = value;
|
m_taintTorque = value;
|
||||||
_parent_scene.AddPhysicsActorTaint(this);
|
_parent_scene.AddPhysicsActorTaint(this);
|
||||||
|
@ -2440,20 +2444,20 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetAcceleration(PhysicsVector accel)
|
public void SetAcceleration(Vector3 accel)
|
||||||
{
|
{
|
||||||
_acceleration = accel;
|
_acceleration = accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(force))
|
if (force.IsFinite())
|
||||||
{
|
{
|
||||||
m_forcelist.Add(force);
|
m_forcelist.Add(force);
|
||||||
m_taintforce = true;
|
m_taintforce = true;
|
||||||
|
@ -2465,9 +2469,9 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
//m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
|
//m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(force))
|
if (force.IsFinite())
|
||||||
{
|
{
|
||||||
m_angularforcelist.Add(force);
|
m_angularforcelist.Add(force);
|
||||||
m_taintaddangularforce = true;
|
m_taintaddangularforce = true;
|
||||||
|
@ -2478,23 +2482,23 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
Vector3 pv = Vector3.Zero;
|
||||||
if (_zeroFlag)
|
if (_zeroFlag)
|
||||||
return pv;
|
return pv;
|
||||||
m_lastUpdateSent = false;
|
m_lastUpdateSent = false;
|
||||||
|
|
||||||
if (m_rotationalVelocity.IsIdentical(pv, 0.2f))
|
if (m_rotationalVelocity.ApproxEquals(pv, 0.2f))
|
||||||
return pv;
|
return pv;
|
||||||
|
|
||||||
return m_rotationalVelocity;
|
return m_rotationalVelocity;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
m_rotationalVelocity = value;
|
m_rotationalVelocity = value;
|
||||||
}
|
}
|
||||||
|
@ -2535,16 +2539,16 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
m_taintparent = null;
|
m_taintparent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
// reverse the zero/non zero values for ODE.
|
// reverse the zero/non zero values for ODE.
|
||||||
if (PhysicsVector.isFinite(axis))
|
if (axis.IsFinite())
|
||||||
{
|
{
|
||||||
axis.X = (axis.X > 0) ? 1f : 0f;
|
axis.X = (axis.X > 0) ? 1f : 0f;
|
||||||
axis.Y = (axis.Y > 0) ? 1f : 0f;
|
axis.Y = (axis.Y > 0) ? 1f : 0f;
|
||||||
axis.Z = (axis.Z > 0) ? 1f : 0f;
|
axis.Z = (axis.Z > 0) ? 1f : 0f;
|
||||||
m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
|
m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
|
||||||
m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z);
|
m_taintAngularLock = axis;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2557,7 +2561,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
||||||
if (_parent == null)
|
if (_parent == null)
|
||||||
{
|
{
|
||||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
Vector3 pv = Vector3.Zero;
|
||||||
bool lastZeroFlag = _zeroFlag;
|
bool lastZeroFlag = _zeroFlag;
|
||||||
if (Body != (IntPtr)0) // FIXME -> or if it is a joint
|
if (Body != (IntPtr)0) // FIXME -> or if it is a joint
|
||||||
{
|
{
|
||||||
|
@ -2566,9 +2570,9 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
||||||
d.Vector3 rotvel = d.BodyGetAngularVel(Body);
|
d.Vector3 rotvel = d.BodyGetAngularVel(Body);
|
||||||
d.Vector3 torque = d.BodyGetTorque(Body);
|
d.Vector3 torque = d.BodyGetTorque(Body);
|
||||||
_torque.setValues(torque.X, torque.Y, torque.Z);
|
_torque = new Vector3(torque.X, torque.Y, torque.Z);
|
||||||
PhysicsVector l_position = new PhysicsVector();
|
Vector3 l_position = Vector3.Zero;
|
||||||
Quaternion l_orientation = new Quaternion();
|
Quaternion l_orientation = Quaternion.Identity;
|
||||||
|
|
||||||
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
|
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
|
||||||
//if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); }
|
//if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); }
|
||||||
|
@ -2703,16 +2707,16 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
_velocity.Z = vel.Z;
|
_velocity.Z = vel.Z;
|
||||||
|
|
||||||
_acceleration = ((_velocity - m_lastVelocity) / 0.1f);
|
_acceleration = ((_velocity - m_lastVelocity) / 0.1f);
|
||||||
_acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f);
|
_acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f);
|
||||||
//m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
|
//m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
|
||||||
|
|
||||||
if (_velocity.IsIdentical(pv, 0.5f))
|
if (_velocity.ApproxEquals(pv, 0.5f))
|
||||||
{
|
{
|
||||||
m_rotationalVelocity = pv;
|
m_rotationalVelocity = pv;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z);
|
m_rotationalVelocity = new Vector3(rotvel.X, rotvel.Y, rotvel.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
|
//m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
|
||||||
|
@ -2760,15 +2764,15 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget
|
public override Vector3 PIDTarget
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (PhysicsVector.isFinite(value))
|
if (value.IsFinite())
|
||||||
{
|
{
|
||||||
m_PIDTarget = value;
|
m_PIDTarget = value;
|
||||||
}
|
}
|
||||||
|
@ -2784,7 +2788,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } }
|
public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } }
|
||||||
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
|
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
|
||||||
|
|
||||||
private void createAMotor(PhysicsVector axis)
|
private void createAMotor(Vector3 axis)
|
||||||
{
|
{
|
||||||
if (Body == IntPtr.Zero)
|
if (Body == IntPtr.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -239,6 +239,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>();
|
private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>();
|
||||||
private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
|
private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
|
||||||
private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>();
|
private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>();
|
||||||
|
private readonly Object _taintedPrimLock = new Object();
|
||||||
private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>();
|
private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>();
|
||||||
private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>();
|
private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>();
|
||||||
private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
|
private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
|
||||||
|
@ -683,7 +684,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
/// <returns>Returns which split up space the given position is in.</returns>
|
/// <returns>Returns which split up space the given position is in.</returns>
|
||||||
public string whichspaceamIin(PhysicsVector pos)
|
public string whichspaceamIin(Vector3 pos)
|
||||||
{
|
{
|
||||||
return calculateSpaceForGeom(pos).ToString();
|
return calculateSpaceForGeom(pos).ToString();
|
||||||
}
|
}
|
||||||
|
@ -962,7 +963,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
//p2.CollidingObj = true;
|
//p2.CollidingObj = true;
|
||||||
contacts[i].depth = 0.00000003f;
|
contacts[i].depth = 0.00000003f;
|
||||||
p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f);
|
p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f);
|
||||||
contacts[i].pos =
|
contacts[i].pos =
|
||||||
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
|
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
|
||||||
contacts[i].pos.Y + (p1.Size.Y/2),
|
contacts[i].pos.Y + (p1.Size.Y/2),
|
||||||
|
@ -980,7 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
//p2.CollidingObj = true;
|
//p2.CollidingObj = true;
|
||||||
contacts[i].depth = 0.00000003f;
|
contacts[i].depth = 0.00000003f;
|
||||||
p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f);
|
p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f);
|
||||||
contacts[i].pos =
|
contacts[i].pos =
|
||||||
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
|
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
|
||||||
contacts[i].pos.Y + (p1.Size.Y/2),
|
contacts[i].pos.Y + (p1.Size.Y/2),
|
||||||
|
@ -1645,9 +1646,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
#region Add/Remove Entities
|
#region Add/Remove Entities
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
PhysicsVector pos = new PhysicsVector();
|
Vector3 pos;
|
||||||
pos.X = position.X;
|
pos.X = position.X;
|
||||||
pos.Y = position.Y;
|
pos.Y = position.Y;
|
||||||
pos.Z = position.Z;
|
pos.Z = position.Z;
|
||||||
|
@ -1697,18 +1698,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
|
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
|
||||||
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
|
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
|
||||||
{
|
{
|
||||||
|
|
||||||
PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
|
Vector3 pos = position;
|
||||||
//pos.X = position.X;
|
Vector3 siz = size;
|
||||||
//pos.Y = position.Y;
|
|
||||||
//pos.Z = position.Z;
|
|
||||||
PhysicsVector siz = new PhysicsVector();
|
|
||||||
siz.X = size.X;
|
|
||||||
siz.Y = size.Y;
|
|
||||||
siz.Z = size.Z;
|
|
||||||
Quaternion rot = rotation;
|
Quaternion rot = rotation;
|
||||||
|
|
||||||
OdePrim newPrim;
|
OdePrim newPrim;
|
||||||
|
@ -1735,14 +1730,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation) //To be removed
|
Vector3 size, Quaternion rotation) //To be removed
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||||
{
|
{
|
||||||
PhysicsActor result;
|
PhysicsActor result;
|
||||||
IMesh mesh = null;
|
IMesh mesh = null;
|
||||||
|
@ -1975,7 +1970,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// this joint will just be added to a waiting list that is NOT processed during the main
|
// this joint will just be added to a waiting list that is NOT processed during the main
|
||||||
// Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests.
|
// Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests.
|
||||||
|
|
||||||
public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position,
|
public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
|
||||||
Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
|
Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1983,7 +1978,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
OdePhysicsJoint joint = new OdePhysicsJoint();
|
OdePhysicsJoint joint = new OdePhysicsJoint();
|
||||||
joint.ObjectNameInScene = objectNameInScene;
|
joint.ObjectNameInScene = objectNameInScene;
|
||||||
joint.Type = jointType;
|
joint.Type = jointType;
|
||||||
joint.Position = new PhysicsVector(position.X, position.Y, position.Z);
|
joint.Position = position;
|
||||||
joint.Rotation = rotation;
|
joint.Rotation = rotation;
|
||||||
joint.RawParams = parms;
|
joint.RawParams = parms;
|
||||||
joint.BodyNames = new List<string>(bodyNames);
|
joint.BodyNames = new List<string>(bodyNames);
|
||||||
|
@ -2035,7 +2030,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
|
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
|
||||||
public override PhysicsVector GetJointAnchor(PhysicsJoint joint)
|
public override Vector3 GetJointAnchor(PhysicsJoint joint)
|
||||||
{
|
{
|
||||||
Debug.Assert(joint.IsInPhysicsEngine);
|
Debug.Assert(joint.IsInPhysicsEngine);
|
||||||
d.Vector3 pos = new d.Vector3();
|
d.Vector3 pos = new d.Vector3();
|
||||||
|
@ -2057,14 +2052,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PhysicsVector(pos.X, pos.Y, pos.Z);
|
return new Vector3(pos.X, pos.Y, pos.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
|
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
|
||||||
// WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
|
// WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
|
||||||
// appears to be unreliable. Fortunately we can compute the joint axis ourselves by
|
// appears to be unreliable. Fortunately we can compute the joint axis ourselves by
|
||||||
// keeping track of the joint's original orientation relative to one of the involved bodies.
|
// keeping track of the joint's original orientation relative to one of the involved bodies.
|
||||||
public override PhysicsVector GetJointAxis(PhysicsJoint joint)
|
public override Vector3 GetJointAxis(PhysicsJoint joint)
|
||||||
{
|
{
|
||||||
Debug.Assert(joint.IsInPhysicsEngine);
|
Debug.Assert(joint.IsInPhysicsEngine);
|
||||||
d.Vector3 axis = new d.Vector3();
|
d.Vector3 axis = new d.Vector3();
|
||||||
|
@ -2086,7 +2081,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PhysicsVector(axis.X, axis.Y, axis.Z);
|
return new Vector3(axis.X, axis.Y, axis.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2254,7 +2249,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// <param name="pos">the position that the geom moved to</param>
|
/// <param name="pos">the position that the geom moved to</param>
|
||||||
/// <param name="currentspace">a pointer to the space it was in before it was moved.</param>
|
/// <param name="currentspace">a pointer to the space it was in before it was moved.</param>
|
||||||
/// <returns>a pointer to the new space it's in</returns>
|
/// <returns>a pointer to the new space it's in</returns>
|
||||||
public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace)
|
public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace)
|
||||||
{
|
{
|
||||||
// Called from setting the Position and Size of an ODEPrim so
|
// Called from setting the Position and Size of an ODEPrim so
|
||||||
// it's already in locked space.
|
// it's already in locked space.
|
||||||
|
@ -2401,7 +2396,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
/// <returns>a pointer to the space. This could be a new space or reused space.</returns>
|
/// <returns>a pointer to the space. This could be a new space or reused space.</returns>
|
||||||
public IntPtr calculateSpaceForGeom(PhysicsVector pos)
|
public IntPtr calculateSpaceForGeom(Vector3 pos)
|
||||||
{
|
{
|
||||||
int[] xyspace = calculateSpaceArrayItemFromPos(pos);
|
int[] xyspace = calculateSpaceArrayItemFromPos(pos);
|
||||||
//m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString());
|
//m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString());
|
||||||
|
@ -2413,7 +2408,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
/// <returns>an array item based on the position</returns>
|
/// <returns>an array item based on the position</returns>
|
||||||
public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos)
|
public int[] calculateSpaceArrayItemFromPos(Vector3 pos)
|
||||||
{
|
{
|
||||||
int[] returnint = new int[2];
|
int[] returnint = new int[2];
|
||||||
|
|
||||||
|
@ -2572,7 +2567,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (prim is OdePrim)
|
if (prim is OdePrim)
|
||||||
{
|
{
|
||||||
OdePrim taintedprim = ((OdePrim) prim);
|
OdePrim taintedprim = ((OdePrim) prim);
|
||||||
lock (_taintedPrimH)
|
lock (_taintedPrimLock)
|
||||||
{
|
{
|
||||||
if (!(_taintedPrimH.Contains(taintedprim)))
|
if (!(_taintedPrimH.Contains(taintedprim)))
|
||||||
{
|
{
|
||||||
|
@ -2700,24 +2695,28 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// Modify other objects in the scene.
|
// Modify other objects in the scene.
|
||||||
processedtaints = false;
|
processedtaints = false;
|
||||||
|
|
||||||
lock (_taintedPrimL)
|
lock (_taintedPrimLock)
|
||||||
{
|
{
|
||||||
foreach (OdePrim prim in _taintedPrimL)
|
foreach (OdePrim prim in _taintedPrimL)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (prim.m_taintremove)
|
if (prim.m_taintremove)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("Simulate calls RemovePrimThreadLocked");
|
//Console.WriteLine("Simulate calls RemovePrimThreadLocked");
|
||||||
RemovePrimThreadLocked(prim);
|
RemovePrimThreadLocked(prim);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Console.WriteLine("Simulate calls ProcessTaints");
|
//Console.WriteLine("Simulate calls ProcessTaints");
|
||||||
prim.ProcessTaints(timeStep);
|
prim.ProcessTaints(timeStep);
|
||||||
}
|
}
|
||||||
processedtaints = true;
|
processedtaints = true;
|
||||||
prim.m_collisionscore = 0;
|
prim.m_collisionscore = 0;
|
||||||
|
|
||||||
|
// This loop can block up the Heartbeat for a very long time on large regions.
|
||||||
|
// We need to let the Watchdog know that the Heartbeat is not dead
|
||||||
|
// NOTE: This is currently commented out, but if things like OAR loading are
|
||||||
|
// timing the heartbeat out we will need to uncomment it
|
||||||
|
//Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SupportsNINJAJoints)
|
if (SupportsNINJAJoints)
|
||||||
|
|
|
@ -76,8 +76,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
public void CreateAndDropPhysicalCube()
|
public void CreateAndDropPhysicalCube()
|
||||||
{
|
{
|
||||||
PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
|
PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
|
||||||
PhysicsVector position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
|
Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
|
||||||
PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f);
|
Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
|
||||||
Quaternion rot = Quaternion.Identity;
|
Quaternion rot = Quaternion.Identity;
|
||||||
PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true);
|
PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true);
|
||||||
OdePrim oprim = (OdePrim)prim;
|
OdePrim oprim = (OdePrim)prim;
|
||||||
|
|
|
@ -36,20 +36,17 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
{
|
{
|
||||||
public class POSCharacter : PhysicsActor
|
public class POSCharacter : PhysicsActor
|
||||||
{
|
{
|
||||||
private PhysicsVector _position;
|
private Vector3 _position;
|
||||||
public PhysicsVector _velocity;
|
public Vector3 _velocity;
|
||||||
public PhysicsVector _target_velocity = PhysicsVector.Zero;
|
public Vector3 _target_velocity = Vector3.Zero;
|
||||||
public PhysicsVector _size = PhysicsVector.Zero;
|
public Vector3 _size = Vector3.Zero;
|
||||||
private PhysicsVector _acceleration;
|
private Vector3 _acceleration;
|
||||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
private Vector3 m_rotationalVelocity = Vector3.Zero;
|
||||||
private bool flying;
|
private bool flying;
|
||||||
private bool isColliding;
|
private bool isColliding;
|
||||||
|
|
||||||
public POSCharacter()
|
public POSCharacter()
|
||||||
{
|
{
|
||||||
_velocity = new PhysicsVector();
|
|
||||||
_position = new PhysicsVector();
|
|
||||||
_acceleration = new PhysicsVector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int PhysicsActorType
|
public override int PhysicsActorType
|
||||||
|
@ -58,7 +55,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return m_rotationalVelocity; }
|
get { return m_rotationalVelocity; }
|
||||||
set { m_rotationalVelocity = value; }
|
set { m_rotationalVelocity = value; }
|
||||||
|
@ -137,13 +134,13 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
set { _position = value; }
|
set { _position = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return _size; }
|
get { return _size; }
|
||||||
set
|
set
|
||||||
|
@ -158,9 +155,9 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
get { return 0f; }
|
get { return 0f; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -190,14 +187,14 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PrimitiveBaseShape Shape
|
public override PrimitiveBaseShape Shape
|
||||||
|
@ -205,15 +202,15 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return _velocity; }
|
get { return _velocity; }
|
||||||
set { _target_velocity = value; }
|
set { _target_velocity = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +226,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
@ -248,24 +245,24 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAcceleration(PhysicsVector accel)
|
public void SetAcceleration(Vector3 accel)
|
||||||
{
|
{
|
||||||
_acceleration = accel;
|
_acceleration = accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget
|
public override Vector3 PIDTarget
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,19 +36,16 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
{
|
{
|
||||||
public class POSPrim : PhysicsActor
|
public class POSPrim : PhysicsActor
|
||||||
{
|
{
|
||||||
private PhysicsVector _position;
|
private Vector3 _position;
|
||||||
private PhysicsVector _velocity;
|
private Vector3 _velocity;
|
||||||
private PhysicsVector _acceleration;
|
private Vector3 _acceleration;
|
||||||
private PhysicsVector _size;
|
private Vector3 _size;
|
||||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
private Vector3 m_rotationalVelocity = Vector3.Zero;
|
||||||
private Quaternion _orientation;
|
private Quaternion _orientation;
|
||||||
private bool iscolliding;
|
private bool iscolliding;
|
||||||
|
|
||||||
public POSPrim()
|
public POSPrim()
|
||||||
{
|
{
|
||||||
_velocity = new PhysicsVector();
|
|
||||||
_position = new PhysicsVector();
|
|
||||||
_acceleration = new PhysicsVector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int PhysicsActorType
|
public override int PhysicsActorType
|
||||||
|
@ -57,7 +54,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return m_rotationalVelocity; }
|
get { return m_rotationalVelocity; }
|
||||||
set { m_rotationalVelocity = value; }
|
set { m_rotationalVelocity = value; }
|
||||||
|
@ -98,13 +95,13 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
set { _position = value; }
|
set { _position = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return _size; }
|
get { return _size; }
|
||||||
set { _size = value; }
|
set { _size = value; }
|
||||||
|
@ -115,9 +112,9 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
get { return 0f; }
|
get { return 0f; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +129,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -147,14 +144,14 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PrimitiveBaseShape Shape
|
public override PrimitiveBaseShape Shape
|
||||||
|
@ -173,7 +170,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return _velocity; }
|
get { return _velocity; }
|
||||||
set { _velocity = value; }
|
set { _velocity = value; }
|
||||||
|
@ -191,7 +188,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { _orientation = value; }
|
set { _orientation = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
@ -202,26 +199,26 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAcceleration(PhysicsVector accel)
|
public void SetAcceleration(Vector3 accel)
|
||||||
{
|
{
|
||||||
_acceleration = accel;
|
_acceleration = accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +252,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +265,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget
|
public override Vector3 PIDTarget
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
POSCharacter act = new POSCharacter();
|
POSCharacter act = new POSCharacter();
|
||||||
act.Position = position;
|
act.Position = position;
|
||||||
|
@ -84,20 +84,20 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation)
|
Vector3 size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||||
{
|
{
|
||||||
POSPrim prim = new POSPrim();
|
POSPrim prim = new POSPrim();
|
||||||
prim.Position = position;
|
prim.Position = position;
|
||||||
|
@ -152,23 +152,25 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
character._target_velocity.Z += gravity * timeStep;
|
character._target_velocity.Z += gravity * timeStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
character.Position.X += character._target_velocity.X * timeStep;
|
Vector3 characterPosition = character.Position;
|
||||||
character.Position.Y += character._target_velocity.Y * timeStep;
|
|
||||||
|
|
||||||
character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
|
characterPosition.X += character._target_velocity.X * timeStep;
|
||||||
character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
|
characterPosition.Y += character._target_velocity.Y * timeStep;
|
||||||
|
|
||||||
|
characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
|
||||||
|
characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
|
||||||
|
|
||||||
bool forcedZ = false;
|
bool forcedZ = false;
|
||||||
|
|
||||||
float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X];
|
float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X];
|
||||||
if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2)
|
if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2)
|
||||||
{
|
{
|
||||||
character.Position.Z = terrainheight + character.Size.Z;
|
characterPosition.Z = terrainheight + character.Size.Z;
|
||||||
forcedZ = true;
|
forcedZ = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
character.Position.Z += character._target_velocity.Z*timeStep;
|
characterPosition.Z += character._target_velocity.Z*timeStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// this is it -- the magic you've all been waiting for! Ladies and gentlemen --
|
/// this is it -- the magic you've all been waiting for! Ladies and gentlemen --
|
||||||
|
@ -177,29 +179,29 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
|
|
||||||
if (isCollidingWithPrim(character))
|
if (isCollidingWithPrim(character))
|
||||||
{
|
{
|
||||||
character.Position.Z = oldposZ; // first try Z axis
|
characterPosition.Z = oldposZ; // first try Z axis
|
||||||
if (isCollidingWithPrim(character))
|
if (isCollidingWithPrim(character))
|
||||||
{
|
{
|
||||||
character.Position.Z = oldposZ + character.Size.Z / 4.4f; // try harder
|
characterPosition.Z = oldposZ + character.Size.Z / 4.4f; // try harder
|
||||||
if (isCollidingWithPrim(character))
|
if (isCollidingWithPrim(character))
|
||||||
{
|
{
|
||||||
character.Position.Z = oldposZ + character.Size.Z / 2.2f; // try very hard
|
characterPosition.Z = oldposZ + character.Size.Z / 2.2f; // try very hard
|
||||||
if (isCollidingWithPrim(character))
|
if (isCollidingWithPrim(character))
|
||||||
{
|
{
|
||||||
character.Position.X = oldposX;
|
characterPosition.X = oldposX;
|
||||||
character.Position.Y = oldposY;
|
characterPosition.Y = oldposY;
|
||||||
character.Position.Z = oldposZ;
|
characterPosition.Z = oldposZ;
|
||||||
|
|
||||||
character.Position.X += character._target_velocity.X * timeStep;
|
characterPosition.X += character._target_velocity.X * timeStep;
|
||||||
if (isCollidingWithPrim(character))
|
if (isCollidingWithPrim(character))
|
||||||
{
|
{
|
||||||
character.Position.X = oldposX;
|
characterPosition.X = oldposX;
|
||||||
}
|
}
|
||||||
|
|
||||||
character.Position.Y += character._target_velocity.Y * timeStep;
|
characterPosition.Y += character._target_velocity.Y * timeStep;
|
||||||
if (isCollidingWithPrim(character))
|
if (isCollidingWithPrim(character))
|
||||||
{
|
{
|
||||||
character.Position.Y = oldposY;
|
characterPosition.Y = oldposY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -218,8 +220,10 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
|
characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
|
||||||
character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
|
characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
|
||||||
|
|
||||||
|
character.Position = characterPosition;
|
||||||
|
|
||||||
character._velocity.X = (character.Position.X - oldposX)/timeStep;
|
character._velocity.X = (character.Position.X - oldposX)/timeStep;
|
||||||
character._velocity.Y = (character.Position.Y - oldposY)/timeStep;
|
character._velocity.Y = (character.Position.Y - oldposY)/timeStep;
|
||||||
|
|
|
@ -34,6 +34,7 @@ using PhysXWrapper;
|
||||||
using Quaternion=OpenMetaverse.Quaternion;
|
using Quaternion=OpenMetaverse.Quaternion;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.PhysXPlugin
|
namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
{
|
{
|
||||||
|
@ -106,7 +107,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
Vec3 pos = new Vec3();
|
Vec3 pos = new Vec3();
|
||||||
pos.X = position.X;
|
pos.X = position.X;
|
||||||
|
@ -127,7 +128,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||||
{
|
{
|
||||||
Vec3 pos = new Vec3();
|
Vec3 pos = new Vec3();
|
||||||
pos.X = position.X;
|
pos.X = position.X;
|
||||||
|
@ -142,14 +143,14 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation) //To be removed
|
Vector3 size, Quaternion rotation) //To be removed
|
||||||
{
|
{
|
||||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||||
{
|
{
|
||||||
return AddPrim(position, size, rotation);
|
return AddPrim(position, size, rotation);
|
||||||
}
|
}
|
||||||
|
@ -219,10 +220,10 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
public class PhysXCharacter : PhysicsActor
|
public class PhysXCharacter : PhysicsActor
|
||||||
{
|
{
|
||||||
private PhysicsVector _position;
|
private Vector3 _position;
|
||||||
private PhysicsVector _velocity;
|
private Vector3 _velocity;
|
||||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
private Vector3 m_rotationalVelocity = Vector3.Zero;
|
||||||
private PhysicsVector _acceleration;
|
private Vector3 _acceleration;
|
||||||
private NxCharacter _character;
|
private NxCharacter _character;
|
||||||
private bool flying;
|
private bool flying;
|
||||||
private bool iscolliding = false;
|
private bool iscolliding = false;
|
||||||
|
@ -230,9 +231,6 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
public PhysXCharacter(NxCharacter character)
|
public PhysXCharacter(NxCharacter character)
|
||||||
{
|
{
|
||||||
_velocity = new PhysicsVector();
|
|
||||||
_position = new PhysicsVector();
|
|
||||||
_acceleration = new PhysicsVector();
|
|
||||||
_character = character;
|
_character = character;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +308,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return m_rotationalVelocity; }
|
get { return m_rotationalVelocity; }
|
||||||
set { m_rotationalVelocity = value; }
|
set { m_rotationalVelocity = value; }
|
||||||
|
@ -321,7 +319,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get { return _position; }
|
||||||
set
|
set
|
||||||
|
@ -335,9 +333,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,9 +344,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
get { return 0f; }
|
get { return 0f; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +361,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -379,17 +377,17 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return _velocity; }
|
get { return _velocity; }
|
||||||
set { _velocity = value; }
|
set { _velocity = value; }
|
||||||
|
@ -413,25 +411,25 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAcceleration(PhysicsVector accel)
|
public void SetAcceleration(Vector3 accel)
|
||||||
{
|
{
|
||||||
_acceleration = accel;
|
_acceleration = accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,12 +443,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +490,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget { set { return; } }
|
public override Vector3 PIDTarget { set { return; } }
|
||||||
public override bool PIDActive { set { return; } }
|
public override bool PIDActive { set { return; } }
|
||||||
public override float PIDTau { set { return; } }
|
public override float PIDTau { set { return; } }
|
||||||
|
|
||||||
|
@ -518,15 +516,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
public class PhysXPrim : PhysicsActor
|
public class PhysXPrim : PhysicsActor
|
||||||
{
|
{
|
||||||
private PhysicsVector _velocity;
|
private Vector3 _velocity;
|
||||||
private PhysicsVector _acceleration;
|
private Vector3 _acceleration;
|
||||||
private PhysicsVector m_rotationalVelocity;
|
private Vector3 m_rotationalVelocity;
|
||||||
private NxActor _prim;
|
private NxActor _prim;
|
||||||
|
|
||||||
public PhysXPrim(NxActor prim)
|
public PhysXPrim(NxActor prim)
|
||||||
{
|
{
|
||||||
_velocity = new PhysicsVector();
|
_velocity = Vector3.Zero;
|
||||||
_acceleration = new PhysicsVector();
|
_acceleration = Vector3.Zero;
|
||||||
_prim = prim;
|
_prim = prim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +578,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
get { return m_rotationalVelocity; }
|
get { return m_rotationalVelocity; }
|
||||||
set { m_rotationalVelocity = value; }
|
set { m_rotationalVelocity = value; }
|
||||||
|
@ -616,11 +614,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Position
|
public override Vector3 Position
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsVector pos = new PhysicsVector();
|
Vector3 pos = Vector3.Zero;
|
||||||
Vec3 vec = _prim.Position;
|
Vec3 vec = _prim.Position;
|
||||||
pos.X = vec.X;
|
pos.X = vec.X;
|
||||||
pos.Y = vec.Y;
|
pos.Y = vec.Y;
|
||||||
|
@ -629,7 +627,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
PhysicsVector vec = value;
|
Vector3 vec = value;
|
||||||
Vec3 pos = new Vec3();
|
Vec3 pos = new Vec3();
|
||||||
pos.X = vec.X;
|
pos.X = vec.X;
|
||||||
pos.Y = vec.Y;
|
pos.Y = vec.Y;
|
||||||
|
@ -643,15 +641,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
get { return _velocity; }
|
get { return _velocity; }
|
||||||
set { _velocity = value; }
|
set { _velocity = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Torque
|
public override Vector3 Torque
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,31 +680,31 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Acceleration
|
public override Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get { return _acceleration; }
|
get { return _acceleration; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAcceleration(PhysicsVector accel)
|
public void SetAcceleration(Vector3 accel)
|
||||||
{
|
{
|
||||||
_acceleration = accel;
|
_acceleration = accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
public override void AddForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetMomentum(PhysicsVector momentum)
|
public override void SetMomentum(Vector3 momentum)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Size
|
public override Vector3 Size
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,7 +716,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LockAngularMotion(PhysicsVector axis)
|
public override void LockAngularMotion(Vector3 axis)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -728,9 +726,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
get { return 0f; }
|
get { return 0f; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector Force
|
public override Vector3 Force
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,7 +743,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
public override void VehicleVectorParam(int param, Vector3 value)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -760,21 +758,21 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector CenterOfMass
|
public override Vector3 CenterOfMass
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector GeometricCenter
|
public override Vector3 GeometricCenter
|
||||||
{
|
{
|
||||||
get { return PhysicsVector.Zero; }
|
get { return Vector3.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CrossingFailure()
|
public override void CrossingFailure()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PhysicsVector PIDTarget { set { return; } }
|
public override Vector3 PIDTarget { set { return; } }
|
||||||
public override bool PIDActive { set { return; } }
|
public override bool PIDActive { set { return; } }
|
||||||
public override float PIDTau { set { return; } }
|
public override float PIDTau { set { return; } }
|
||||||
|
|
||||||
|
|
|
@ -132,12 +132,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
EventQueueThread = new Thread(EventQueueThreadLoop);
|
EventQueueThread = Watchdog.StartThread(EventQueueThreadLoop, "EventQueueManagerThread_" + ThreadCount, MyThreadPriority, true);
|
||||||
EventQueueThread.IsBackground = true;
|
|
||||||
|
|
||||||
EventQueueThread.Priority = MyThreadPriority;
|
|
||||||
EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount;
|
|
||||||
EventQueueThread.Start();
|
|
||||||
|
|
||||||
// Look at this... Don't you wish everyone did that solid
|
// Look at this... Don't you wish everyone did that solid
|
||||||
// coding everywhere? :P
|
// coding everywhere? :P
|
||||||
|
@ -184,6 +179,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
DoProcessQueue();
|
DoProcessQueue();
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ThreadAbortException)
|
catch (ThreadAbortException)
|
||||||
|
@ -214,6 +210,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
m_log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString());
|
m_log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString());
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ThreadAbortException)
|
catch (ThreadAbortException)
|
||||||
|
@ -226,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
"[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}",
|
"[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}",
|
||||||
ScriptEngineName, e);
|
ScriptEngineName, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoProcessQueue()
|
public void DoProcessQueue()
|
||||||
|
|
|
@ -93,10 +93,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
{
|
{
|
||||||
if (MaintenanceThreadThread == null)
|
if (MaintenanceThreadThread == null)
|
||||||
{
|
{
|
||||||
MaintenanceThreadThread = new Thread(MaintenanceLoop);
|
MaintenanceThreadThread = Watchdog.StartThread(MaintenanceLoop, "ScriptMaintenanceThread", ThreadPriority.Normal, true);
|
||||||
MaintenanceThreadThread.Name = "ScriptMaintenanceThread";
|
|
||||||
MaintenanceThreadThread.IsBackground = true;
|
|
||||||
MaintenanceThreadThread.Start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,56 +161,54 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
MaintenanceLoopTicks_ScriptLoadUnload_Count++;
|
MaintenanceLoopTicks_ScriptLoadUnload_Count++;
|
||||||
MaintenanceLoopTicks_Other_Count++;
|
MaintenanceLoopTicks_Other_Count++;
|
||||||
|
|
||||||
|
foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines))
|
||||||
//lock (ScriptEngine.ScriptEngines)
|
{
|
||||||
//{
|
// lastScriptEngine = m_ScriptEngine;
|
||||||
foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines))
|
// Re-reading config every x seconds
|
||||||
|
if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other)
|
||||||
{
|
{
|
||||||
// lastScriptEngine = m_ScriptEngine;
|
MaintenanceLoopTicks_Other_ResetCount = true;
|
||||||
// Re-reading config every x seconds
|
if (m_ScriptEngine.RefreshConfigFilens > 0)
|
||||||
if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other)
|
|
||||||
{
|
{
|
||||||
MaintenanceLoopTicks_Other_ResetCount = true;
|
// Check if its time to re-read config
|
||||||
if (m_ScriptEngine.RefreshConfigFilens > 0)
|
if (DateTime.Now.Ticks - Last_ReReadConfigFilens >
|
||||||
|
m_ScriptEngine.RefreshConfigFilens)
|
||||||
{
|
{
|
||||||
// Check if its time to re-read config
|
//m_log.Debug("Time passed: " + (DateTime.Now.Ticks - Last_ReReadConfigFilens) + ">" + m_ScriptEngine.RefreshConfigFilens);
|
||||||
if (DateTime.Now.Ticks - Last_ReReadConfigFilens >
|
// Its time to re-read config file
|
||||||
m_ScriptEngine.RefreshConfigFilens)
|
m_ScriptEngine.ReadConfig();
|
||||||
|
Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Adjust number of running script threads if not correct
|
||||||
|
if (m_ScriptEngine.m_EventQueueManager != null)
|
||||||
|
m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
|
||||||
|
|
||||||
|
// Check if any script has exceeded its max execution time
|
||||||
|
if (EventQueueManager.EnforceMaxExecutionTime)
|
||||||
|
{
|
||||||
|
// We are enforcing execution time
|
||||||
|
if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
|
||||||
|
EventQueueManager.maxFunctionExecutionTimens)
|
||||||
{
|
{
|
||||||
//m_log.Debug("Time passed: " + (DateTime.Now.Ticks - Last_ReReadConfigFilens) + ">" + m_ScriptEngine.RefreshConfigFilens);
|
// Its time to check again
|
||||||
// Its time to re-read config file
|
m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
|
||||||
m_ScriptEngine.ReadConfig();
|
Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
|
||||||
Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Adjust number of running script threads if not correct
|
|
||||||
if (m_ScriptEngine.m_EventQueueManager != null)
|
|
||||||
m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
|
|
||||||
|
|
||||||
// Check if any script has exceeded its max execution time
|
|
||||||
if (EventQueueManager.EnforceMaxExecutionTime)
|
|
||||||
{
|
|
||||||
// We are enforcing execution time
|
|
||||||
if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
|
|
||||||
EventQueueManager.maxFunctionExecutionTimens)
|
|
||||||
{
|
|
||||||
// Its time to check again
|
|
||||||
m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
|
|
||||||
Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload)
|
|
||||||
{
|
|
||||||
MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = true;
|
|
||||||
// LOAD / UNLOAD SCRIPTS
|
|
||||||
if (m_ScriptEngine.m_ScriptManager != null)
|
|
||||||
m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//}
|
if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload)
|
||||||
|
{
|
||||||
|
MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = true;
|
||||||
|
// LOAD / UNLOAD SCRIPTS
|
||||||
|
if (m_ScriptEngine.m_ScriptManager != null)
|
||||||
|
m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(ThreadAbortException)
|
catch(ThreadAbortException)
|
||||||
|
@ -225,6 +220,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
m_log.ErrorFormat("Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: {0}", ex.ToString());
|
m_log.ErrorFormat("Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: {0}", ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -137,11 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (cmdHandlerThread == null)
|
if (cmdHandlerThread == null)
|
||||||
{
|
{
|
||||||
// Start the thread that will be doing the work
|
// Start the thread that will be doing the work
|
||||||
cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
|
cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true);
|
||||||
cmdHandlerThread.Name = "AsyncLSLCmdHandlerThread";
|
|
||||||
cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
|
|
||||||
cmdHandlerThread.IsBackground = true;
|
|
||||||
cmdHandlerThread.Start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
Thread.Sleep(cmdHandlerThreadCycleSleepms);
|
Thread.Sleep(cmdHandlerThreadCycleSleepms);
|
||||||
|
|
||||||
DoOneCmdHandlerPass();
|
DoOneCmdHandlerPass();
|
||||||
|
|
||||||
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
@ -1267,12 +1267,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
protected void SetScale(SceneObjectPart part, LSL_Vector scale)
|
protected void SetScale(SceneObjectPart part, LSL_Vector scale)
|
||||||
{
|
{
|
||||||
// TODO: this needs to trigger a persistance save as well
|
// TODO: this needs to trigger a persistance save as well
|
||||||
|
|
||||||
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
||||||
return;
|
return;
|
||||||
|
if (scale.x < 0.01)
|
||||||
if (scale.x < 0.01 || scale.y < 0.01 || scale.z < 0.01)
|
scale.x = 0.01;
|
||||||
return;
|
if (scale.y < 0.01)
|
||||||
|
scale.y = 0.01;
|
||||||
|
if (scale.z < 0.01)
|
||||||
|
scale.z = 0.01;
|
||||||
|
|
||||||
if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical)
|
if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical)
|
||||||
{
|
{
|
||||||
|
@ -1283,12 +1285,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (scale.z > World.m_maxPhys)
|
if (scale.z > World.m_maxPhys)
|
||||||
scale.z = World.m_maxPhys;
|
scale.z = World.m_maxPhys;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scale.x > World.m_maxNonphys)
|
if (scale.x > World.m_maxNonphys)
|
||||||
scale.x = World.m_maxNonphys;
|
scale.x = World.m_maxNonphys;
|
||||||
if (scale.y > World.m_maxNonphys)
|
if (scale.y > World.m_maxNonphys)
|
||||||
scale.y = World.m_maxNonphys;
|
scale.y = World.m_maxNonphys;
|
||||||
if (scale.z > World.m_maxNonphys)
|
if (scale.z > World.m_maxNonphys)
|
||||||
scale.z = World.m_maxNonphys;
|
scale.z = World.m_maxNonphys;
|
||||||
|
|
||||||
Vector3 tmp = part.Scale;
|
Vector3 tmp = part.Scale;
|
||||||
tmp.X = (float)scale.x;
|
tmp.X = (float)scale.x;
|
||||||
tmp.Y = (float)scale.y;
|
tmp.Y = (float)scale.y;
|
||||||
|
@ -2043,7 +2047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (local != 0)
|
if (local != 0)
|
||||||
force *= llGetRot();
|
force *= llGetRot();
|
||||||
|
|
||||||
m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z));
|
m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2058,7 +2062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
if (!m_host.ParentGroup.IsDeleted)
|
if (!m_host.ParentGroup.IsDeleted)
|
||||||
{
|
{
|
||||||
PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce();
|
Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
|
||||||
force.x = tmpForce.X;
|
force.x = tmpForce.X;
|
||||||
force.y = tmpForce.Y;
|
force.y = tmpForce.Y;
|
||||||
force.z = tmpForce.Z;
|
force.z = tmpForce.Z;
|
||||||
|
@ -4176,7 +4180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
applied_linear_impulse *= m_host.GetWorldRotation();
|
applied_linear_impulse *= m_host.GetWorldRotation();
|
||||||
}
|
}
|
||||||
pusheeav.PhysicsActor.AddForce(new PhysicsVector(applied_linear_impulse.X, applied_linear_impulse.Y, applied_linear_impulse.Z), true);
|
pusheeav.PhysicsActor.AddForce(applied_linear_impulse, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6084,7 +6088,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (!m_host.ParentGroup.IsDeleted)
|
if (!m_host.ParentGroup.IsDeleted)
|
||||||
{
|
{
|
||||||
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
|
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
|
||||||
new PhysicsVector((float)vec.x, (float)vec.y, (float)vec.z));
|
new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7223,13 +7227,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llGetNumberOfPrims()
|
public LSL_Integer llGetNumberOfPrims()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
List<ScenePresence> presences = World.GetScenePresences();
|
ScenePresence[] presences = World.GetScenePresences();
|
||||||
if (presences.Count == 0)
|
if (presences.Length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int avatarCount = 0;
|
int avatarCount = 0;
|
||||||
foreach (ScenePresence presence in presences)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presences[i];
|
||||||
|
|
||||||
if (!presence.IsChildAgent && presence.ParentID != 0)
|
if (!presence.IsChildAgent && presence.ParentID != 0)
|
||||||
{
|
{
|
||||||
if (m_host.ParentGroup.HasChildPrim(presence.ParentID))
|
if (m_host.ParentGroup.HasChildPrim(presence.ParentID))
|
||||||
|
|
|
@ -404,7 +404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
|
|
||||||
private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
|
private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
|
||||||
{
|
{
|
||||||
List<ScenePresence> Presences;
|
List<ScenePresence> presences;
|
||||||
List<SensedEntity> sensedEntities = new List<SensedEntity>();
|
List<SensedEntity> sensedEntities = new List<SensedEntity>();
|
||||||
|
|
||||||
// If this is an avatar sense by key try to get them directly
|
// If this is an avatar sense by key try to get them directly
|
||||||
|
@ -414,16 +414,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID);
|
ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID);
|
||||||
if (p == null)
|
if (p == null)
|
||||||
return sensedEntities;
|
return sensedEntities;
|
||||||
Presences = new List<ScenePresence>();
|
presences = new List<ScenePresence>();
|
||||||
Presences.Add(p);
|
presences.Add(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Presences = m_CmdManager.m_ScriptEngine.World.GetScenePresences();
|
presences = new List<ScenePresence>(m_CmdManager.m_ScriptEngine.World.GetScenePresences());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If nobody about quit fast
|
// If nobody about quit fast
|
||||||
if (Presences.Count == 0)
|
if (presences.Count == 0)
|
||||||
return sensedEntities;
|
return sensedEntities;
|
||||||
|
|
||||||
SceneObjectPart SensePoint = ts.host;
|
SceneObjectPart SensePoint = ts.host;
|
||||||
|
@ -440,8 +440,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
Vector3 toRegionPos;
|
Vector3 toRegionPos;
|
||||||
double dis;
|
double dis;
|
||||||
|
|
||||||
foreach (ScenePresence presence in Presences)
|
for (int i = 0; i < presences.Count; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presences[i];
|
||||||
bool keep = true;
|
bool keep = true;
|
||||||
|
|
||||||
if (presence.IsDeleted)
|
if (presence.IsDeleted)
|
||||||
|
@ -515,16 +516,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
{
|
{
|
||||||
List<Object> data = new List<Object>();
|
List<Object> data = new List<Object>();
|
||||||
|
|
||||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
lock (SenseRepeatListLock)
|
||||||
{
|
{
|
||||||
if (ts.itemID == itemID)
|
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||||
{
|
{
|
||||||
data.Add(ts.interval);
|
if (ts.itemID == itemID)
|
||||||
data.Add(ts.name);
|
{
|
||||||
data.Add(ts.keyID);
|
data.Add(ts.interval);
|
||||||
data.Add(ts.type);
|
data.Add(ts.name);
|
||||||
data.Add(ts.range);
|
data.Add(ts.keyID);
|
||||||
data.Add(ts.arc);
|
data.Add(ts.type);
|
||||||
|
data.Add(ts.range);
|
||||||
|
data.Add(ts.arc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data.ToArray();
|
return data.ToArray();
|
||||||
|
|
|
@ -68,11 +68,11 @@ namespace OpenSim.Region.UserStatistics
|
||||||
HTMLUtil.OL_O(ref output, "");
|
HTMLUtil.OL_O(ref output, "");
|
||||||
foreach (Scene scene in all_scenes)
|
foreach (Scene scene in all_scenes)
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatarInScene = scene.GetScenePresences();
|
ScenePresence[] avatarInScene = scene.GetScenePresences();
|
||||||
|
|
||||||
HTMLUtil.LI_O(ref output, "");
|
HTMLUtil.LI_O(ref output, String.Empty);
|
||||||
output.Append(scene.RegionInfo.RegionName);
|
output.Append(scene.RegionInfo.RegionName);
|
||||||
HTMLUtil.OL_O(ref output, "");
|
HTMLUtil.OL_O(ref output, String.Empty);
|
||||||
foreach (ScenePresence av in avatarInScene)
|
foreach (ScenePresence av in avatarInScene)
|
||||||
{
|
{
|
||||||
Dictionary<string,string> queues = new Dictionary<string, string>();
|
Dictionary<string,string> queues = new Dictionary<string, string>();
|
||||||
|
@ -81,7 +81,7 @@ namespace OpenSim.Region.UserStatistics
|
||||||
IStatsCollector isClient = (IStatsCollector) av.ControllingClient;
|
IStatsCollector isClient = (IStatsCollector) av.ControllingClient;
|
||||||
queues = decodeQueueReport(isClient.Report());
|
queues = decodeQueueReport(isClient.Report());
|
||||||
}
|
}
|
||||||
HTMLUtil.LI_O(ref output, "");
|
HTMLUtil.LI_O(ref output, String.Empty);
|
||||||
output.Append(av.Name);
|
output.Append(av.Name);
|
||||||
output.Append(" ");
|
output.Append(" ");
|
||||||
output.Append((av.IsChildAgent ? "Child" : "Root"));
|
output.Append((av.IsChildAgent ? "Child" : "Root"));
|
||||||
|
@ -97,11 +97,11 @@ namespace OpenSim.Region.UserStatistics
|
||||||
}
|
}
|
||||||
Dictionary<string, int> throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1));
|
Dictionary<string, int> throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1));
|
||||||
|
|
||||||
HTMLUtil.UL_O(ref output, "");
|
HTMLUtil.UL_O(ref output, String.Empty);
|
||||||
|
|
||||||
foreach (string throttlename in throttles.Keys)
|
foreach (string throttlename in throttles.Keys)
|
||||||
{
|
{
|
||||||
HTMLUtil.LI_O(ref output, "");
|
HTMLUtil.LI_O(ref output, String.Empty);
|
||||||
output.Append(throttlename);
|
output.Append(throttlename);
|
||||||
output.Append(":");
|
output.Append(":");
|
||||||
output.Append(throttles[throttlename].ToString());
|
output.Append(throttles[throttlename].ToString());
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace OpenSim.Server
|
||||||
if (port != 0)
|
if (port != 0)
|
||||||
server = m_Server.GetHttpServer(port);
|
server = m_Server.GetHttpServer(port);
|
||||||
|
|
||||||
if (port != m_Server.DefaultPort)
|
if (port != m_Server.DefaultPort && port != 0)
|
||||||
m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port);
|
m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port);
|
||||||
else
|
else
|
||||||
m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName);
|
m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName);
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* 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.Net;
|
||||||
|
using System.Reflection;
|
||||||
|
using Nini.Config;
|
||||||
|
using log4net;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Data;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.PresenceService
|
||||||
|
{
|
||||||
|
public class PresenceService : PresenceServiceBase, IPresenceService
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public PresenceService(IConfigSource config)
|
||||||
|
: base(config)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* 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.Reflection;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Data;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Services.Base;
|
||||||
|
|
||||||
|
namespace OpenSim.Services.PresenceService
|
||||||
|
{
|
||||||
|
public class PresenceServiceBase : ServiceBase
|
||||||
|
{
|
||||||
|
protected IPresenceData m_Database = null;
|
||||||
|
|
||||||
|
public PresenceServiceBase(IConfigSource config)
|
||||||
|
: base(config)
|
||||||
|
{
|
||||||
|
string dllName = String.Empty;
|
||||||
|
string connString = String.Empty;
|
||||||
|
string realm = "agents";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Try reading the [DatabaseService] section, if it exists
|
||||||
|
//
|
||||||
|
IConfig dbConfig = config.Configs["DatabaseService"];
|
||||||
|
if (dbConfig != null)
|
||||||
|
{
|
||||||
|
if (dllName == String.Empty)
|
||||||
|
dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
||||||
|
if (connString == String.Empty)
|
||||||
|
connString = dbConfig.GetString("ConnectionString", String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// [PresenceService] section overrides [DatabaseService], if it exists
|
||||||
|
//
|
||||||
|
IConfig presenceConfig = config.Configs["PresenceService"];
|
||||||
|
if (presenceConfig != null)
|
||||||
|
{
|
||||||
|
dllName = presenceConfig.GetString("StorageProvider", dllName);
|
||||||
|
connString = presenceConfig.GetString("ConnectionString", connString);
|
||||||
|
realm = presenceConfig.GetString("Realm", realm);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// We tried, but this doesn't exist. We can't proceed.
|
||||||
|
//
|
||||||
|
if (dllName.Equals(String.Empty))
|
||||||
|
throw new Exception("No StorageProvider configured");
|
||||||
|
|
||||||
|
m_Database = LoadPlugin<IPresenceData>(dllName, new Object[] { connString, realm });
|
||||||
|
if (m_Database == null)
|
||||||
|
throw new Exception("Could not find a storage interface in the given module");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -154,7 +154,7 @@ namespace pCampBot
|
||||||
client.Network.OnConnected += new NetworkManager.ConnectedCallback(this.Network_OnConnected);
|
client.Network.OnConnected += new NetworkManager.ConnectedCallback(this.Network_OnConnected);
|
||||||
client.Network.OnSimConnected += new NetworkManager.SimConnectedCallback(this.Network_OnConnected);
|
client.Network.OnSimConnected += new NetworkManager.SimConnectedCallback(this.Network_OnConnected);
|
||||||
client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(this.Network_OnDisconnected);
|
client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(this.Network_OnDisconnected);
|
||||||
client.Objects.OnNewPrim += Objects_NewPrim;
|
client.Objects.ObjectUpdate += Objects_NewPrim;
|
||||||
//client.Assets.OnAssetReceived += Asset_ReceivedCallback;
|
//client.Assets.OnAssetReceived += Asset_ReceivedCallback;
|
||||||
if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name"))
|
if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name"))
|
||||||
{
|
{
|
||||||
|
@ -369,8 +369,10 @@ namespace pCampBot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Objects_NewPrim(Simulator simulator, Primitive prim, ulong regionHandle, ushort timeDilation)
|
public void Objects_NewPrim(object sender, PrimEventArgs args)
|
||||||
{
|
{
|
||||||
|
Primitive prim = args.Prim;
|
||||||
|
|
||||||
if (prim != null)
|
if (prim != null)
|
||||||
{
|
{
|
||||||
if (prim.Textures != null)
|
if (prim.Textures != null)
|
||||||
|
@ -396,7 +398,6 @@ namespace pCampBot
|
||||||
client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture);
|
client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,10 @@ namespace Prebuild.Core.Nodes
|
||||||
/// .NET 3.5
|
/// .NET 3.5
|
||||||
/// </summary>
|
/// </summary>
|
||||||
v3_5,
|
v3_5,
|
||||||
|
/// <summary>
|
||||||
|
/// .NET 4.0
|
||||||
|
/// </summary>
|
||||||
|
v4_0,
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Node object representing /Prebuild/Solution/Project elements
|
/// The Node object representing /Prebuild/Solution/Project elements
|
||||||
|
|
|
@ -120,7 +120,7 @@ namespace Prebuild.Core.Targets
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
|
/// Initializes a new instance of the <see cref="VS2008Target"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VS2008Target()
|
public VS2008Target()
|
||||||
: base()
|
: base()
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Prebuild.Core.Attributes;
|
||||||
|
using Prebuild.Core.Interfaces;
|
||||||
|
using Prebuild.Core.Nodes;
|
||||||
|
using Prebuild.Core.Utilities;
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
|
|
||||||
|
namespace Prebuild.Core.Targets
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[Target("vs2010")]
|
||||||
|
public class VS2010Target : VSGenericTarget
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
string solutionVersion = "11.00";
|
||||||
|
string productVersion = "9.0.21022";
|
||||||
|
string schemaVersion = "2.0";
|
||||||
|
string versionName = "Visual Studio 2010";
|
||||||
|
string name = "vs2008";
|
||||||
|
VSVersion version = VSVersion.VS10;
|
||||||
|
|
||||||
|
Hashtable tools;
|
||||||
|
Kernel kernel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the solution version.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The solution version.</value>
|
||||||
|
public override string SolutionVersion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return solutionVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the product version.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The product version.</value>
|
||||||
|
public override string ProductVersion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return productVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the schema version.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The schema version.</value>
|
||||||
|
public override string SchemaVersion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return schemaVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the version.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name of the version.</value>
|
||||||
|
public override string VersionName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return versionName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the version.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The version.</value>
|
||||||
|
public override VSVersion Version
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name.</value>
|
||||||
|
public override string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
|
||||||
|
{
|
||||||
|
switch (frameworkVersion)
|
||||||
|
{
|
||||||
|
case FrameworkVersion.v4_0:
|
||||||
|
return "ToolsVersion=\"4.0\"";
|
||||||
|
case FrameworkVersion.v3_5:
|
||||||
|
return "ToolsVersion=\"3.5\"";
|
||||||
|
case FrameworkVersion.v3_0:
|
||||||
|
return "ToolsVersion=\"3.0\"";
|
||||||
|
default:
|
||||||
|
return "ToolsVersion=\"2.0\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string SolutionTag
|
||||||
|
{
|
||||||
|
get { return "# Visual Studio 2010"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="VS2010Target"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public VS2010Target()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -173,7 +173,7 @@ namespace Prebuild.Core.Targets
|
||||||
#region Project File
|
#region Project File
|
||||||
using (ps)
|
using (ps)
|
||||||
{
|
{
|
||||||
ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion));
|
ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"{0}\">", this.Version == VSVersion.VS10 ? "4.0" : "3.5");
|
||||||
ps.WriteLine(" <PropertyGroup>");
|
ps.WriteLine(" <PropertyGroup>");
|
||||||
ps.WriteLine(" <ProjectType>Local</ProjectType>");
|
ps.WriteLine(" <ProjectType>Local</ProjectType>");
|
||||||
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
|
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
|
||||||
|
|
|
@ -45,6 +45,10 @@ namespace Prebuild.Core.Targets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visual Studio 2008
|
/// Visual Studio 2008
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VS90
|
VS90,
|
||||||
|
/// <summary>
|
||||||
|
/// Visual Studio 2010
|
||||||
|
/// </summary>
|
||||||
|
VS10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,7 +499,11 @@ namespace Amib.Threading
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new thread
|
// Create a new thread
|
||||||
Thread workerThread = new Thread(new ThreadStart(ProcessQueuedItems), _stpStartInfo.StackSize);
|
Thread workerThread;
|
||||||
|
if (_stpStartInfo.StackSize > 0)
|
||||||
|
workerThread = new Thread(ProcessQueuedItems, _stpStartInfo.StackSize);
|
||||||
|
else
|
||||||
|
workerThread = new Thread(ProcessQueuedItems);
|
||||||
|
|
||||||
// Configure the new thread and start it
|
// Configure the new thread and start it
|
||||||
workerThread.Name = "STP " + Name + " Thread #" + _threadCounter;
|
workerThread.Name = "STP " + Name + " Thread #" + _threadCounter;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -38,8 +38,22 @@
|
||||||
|
|
||||||
; Sets the method that OpenSim will use to fire asynchronous
|
; Sets the method that OpenSim will use to fire asynchronous
|
||||||
; events. Valid values are UnsafeQueueUserWorkItem,
|
; events. Valid values are UnsafeQueueUserWorkItem,
|
||||||
; QueueUserWorkItem, BeginInvoke, SmartThreadPool, and Thread
|
; QueueUserWorkItem, BeginInvoke, SmartThreadPool, and Thread.
|
||||||
; async_call_method = SmartThreadPool
|
; SmartThreadPool is reported to work well on Mono/Linux, but
|
||||||
|
; UnsafeQueueUserWorkItem has been benchmarked with better
|
||||||
|
; performance on .NET/Windows
|
||||||
|
;async_call_method = SmartThreadPool
|
||||||
|
|
||||||
|
; There are several operations on large collections (such as
|
||||||
|
; the current avatar list) that can be run synchronously or
|
||||||
|
; in parallel. Running in parallel should increase performance
|
||||||
|
; on a multi-core system, but will make debugging more
|
||||||
|
; difficult if something deadlocks or times out
|
||||||
|
use_async_when_possible = false
|
||||||
|
|
||||||
|
; Max threads to allocate on the FireAndForget thread pool
|
||||||
|
; when running with the SmartThreadPool option above
|
||||||
|
MaxPoolThreads = 15
|
||||||
|
|
||||||
; ##
|
; ##
|
||||||
; ## CLIENTS
|
; ## CLIENTS
|
||||||
|
@ -51,9 +65,6 @@
|
||||||
; Set this to the DLL containing the client stack to use.
|
; Set this to the DLL containing the client stack to use.
|
||||||
clientstack_plugin="OpenSim.Region.ClientStack.LindenUDP.dll"
|
clientstack_plugin="OpenSim.Region.ClientStack.LindenUDP.dll"
|
||||||
|
|
||||||
; Max threads to allocate on the FireAndForget pool
|
|
||||||
MaxPoolThreads = 15
|
|
||||||
|
|
||||||
; ##
|
; ##
|
||||||
; ## REGIONS
|
; ## REGIONS
|
||||||
; ##
|
; ##
|
||||||
|
@ -351,7 +362,8 @@
|
||||||
; already separated from packet handling with a queue, so this will only
|
; already separated from packet handling with a queue, so this will only
|
||||||
; affect whether networking internals such as packet decoding and
|
; affect whether networking internals such as packet decoding and
|
||||||
; acknowledgement accounting are done synchronously or asynchronously
|
; acknowledgement accounting are done synchronously or asynchronously
|
||||||
async_packet_handling = false
|
;
|
||||||
|
;async_packet_handling = false
|
||||||
|
|
||||||
; The client socket receive buffer size determines how many
|
; The client socket receive buffer size determines how many
|
||||||
; incoming requests we can process; the default on .NET is 8192
|
; incoming requests we can process; the default on .NET is 8192
|
||||||
|
@ -367,22 +379,26 @@
|
||||||
; by the system's settings for the maximum client receive buffer
|
; by the system's settings for the maximum client receive buffer
|
||||||
; size (on linux systems you can set that with "sysctl -w
|
; size (on linux systems you can set that with "sysctl -w
|
||||||
; net.core.rmem_max=X")
|
; net.core.rmem_max=X")
|
||||||
|
;
|
||||||
;client_socket_rcvbuf_size = 8388608
|
;client_socket_rcvbuf_size = 8388608
|
||||||
|
|
||||||
; Maximum outbound bytes per second for a single scene. This can be used to
|
; Maximum outbound bytes per second for a single scene. This can be used to
|
||||||
; throttle total outbound UDP traffic for a simulator. The default value is
|
; throttle total outbound UDP traffic for a simulator. The default value is
|
||||||
; 0, meaning no throttling at the scene level. The example given here is
|
; 0, meaning no throttling at the scene level. The example given here is
|
||||||
; 20 megabits
|
; 20 megabits
|
||||||
|
;
|
||||||
;scene_throttle_max_bps = 2621440
|
;scene_throttle_max_bps = 2621440
|
||||||
|
|
||||||
; Maximum bits per second to send to any single client. This will override
|
; Maximum bits per second to send to any single client. This will override
|
||||||
; the user's viewer preference settings. The default value is 0, meaning no
|
; the user's viewer preference settings. The default value is 0, meaning no
|
||||||
; aggregate throttling on clients (only per-category throttling). The
|
; aggregate throttling on clients (only per-category throttling). The
|
||||||
; example given here is 1.5 megabits
|
; example given here is 1.5 megabits
|
||||||
|
;
|
||||||
;client_throttle_max_bps = 196608
|
;client_throttle_max_bps = 196608
|
||||||
|
|
||||||
; Per-client bytes per second rates for the various throttle categories.
|
; Per-client bytes per second rates for the various throttle categories.
|
||||||
; These are default values that will be overriden by clients
|
; These are default values that will be overriden by clients
|
||||||
|
;
|
||||||
;resend_default = 12500
|
;resend_default = 12500
|
||||||
;land_default = 500
|
;land_default = 500
|
||||||
;wind_default = 500
|
;wind_default = 500
|
||||||
|
@ -395,6 +411,7 @@
|
||||||
; Per-client maximum burst rates in bytes per second for the various
|
; Per-client maximum burst rates in bytes per second for the various
|
||||||
; throttle categories. These are default values that will be overriden by
|
; throttle categories. These are default values that will be overriden by
|
||||||
; clients
|
; clients
|
||||||
|
;
|
||||||
;resend_limit = 18750
|
;resend_limit = 18750
|
||||||
;land_limit = 29750
|
;land_limit = 29750
|
||||||
;wind_limit = 18750
|
;wind_limit = 18750
|
||||||
|
@ -404,6 +421,28 @@
|
||||||
;asset_limit = 27500
|
;asset_limit = 27500
|
||||||
;state_limit = 37000
|
;state_limit = 37000
|
||||||
|
|
||||||
|
; Configures how ObjectUpdates are aggregated. These numbers
|
||||||
|
; do not literally mean how many updates will be put in each
|
||||||
|
; packet that goes over the wire, as packets are
|
||||||
|
; automatically split on a 1400 byte boundary. These control
|
||||||
|
; the balance between responsiveness of interest list updates
|
||||||
|
; and total throughput. Higher numbers will ensure more full-
|
||||||
|
; sized packets and faster sending of data, but more delay in
|
||||||
|
; updating interest lists
|
||||||
|
;
|
||||||
|
;PrimTerseUpdatesPerPacket = 25
|
||||||
|
;AvatarTerseUpdatesPerPacket = 10
|
||||||
|
;PrimFullUpdatesPerPacket = 100
|
||||||
|
|
||||||
|
; TextureSendLimit determines how many packets will be put on
|
||||||
|
; the outgoing queue each cycle. Like the settings above, this
|
||||||
|
; is a balance between responsiveness to priority updates and
|
||||||
|
; total throughput. Higher numbers will give a better
|
||||||
|
; throughput at the cost of reduced responsiveness to client
|
||||||
|
; priority changes or transfer aborts
|
||||||
|
;
|
||||||
|
;TextureSendLimit = 20
|
||||||
|
|
||||||
[Chat]
|
[Chat]
|
||||||
; Controls whether the chat module is enabled. Default is true.
|
; Controls whether the chat module is enabled. Default is true.
|
||||||
enabled = true;
|
enabled = true;
|
||||||
|
@ -1361,43 +1400,14 @@
|
||||||
;RecycleDataBlocks = true;
|
;RecycleDataBlocks = true;
|
||||||
|
|
||||||
|
|
||||||
[LLClient]
|
|
||||||
; Resend packets markes as reliable until they are received
|
|
||||||
;
|
|
||||||
;ReliableIsImportant = false
|
|
||||||
|
|
||||||
; Maximum number of times to resend packets marked reliable
|
|
||||||
;
|
|
||||||
;MaxReliableResends = 3
|
|
||||||
|
|
||||||
; Configures how ObjectUpdates are compressed.
|
|
||||||
;
|
|
||||||
;TerseUpdatesPerPacket=10
|
|
||||||
;FullUpdatesPerPacket=14
|
|
||||||
;TerseUpdateRate=10
|
|
||||||
;FullUpdateRate=14
|
|
||||||
|
|
||||||
;PacketMTU = 1400
|
|
||||||
|
|
||||||
; TextureSendLimit determines how many different textures
|
|
||||||
; will be considered on each cycle. Textures are selected
|
|
||||||
; by priority. The old mechanism specified a value of 10 for
|
|
||||||
; this parameter.
|
|
||||||
;
|
|
||||||
;TextureSendLimit = 10
|
|
||||||
|
|
||||||
; TextureDataLimit determines how many packets will be sent for
|
|
||||||
; each of the selected textures. Default is 5.
|
|
||||||
;
|
|
||||||
;TextureDataLimit = 5
|
|
||||||
|
|
||||||
[InterestManagement]
|
[InterestManagement]
|
||||||
; This section controls how state updates are prioritized for each client
|
; This section controls how state updates are prioritized for each client
|
||||||
UpdatePrioritizationScheme = Distance
|
; Valid values are Time, Distance, SimpleAngularDistance, and FrontBack
|
||||||
ReprioritizeUpdate = true
|
UpdatePrioritizationScheme = FrontBack
|
||||||
RootUpdateReprioritizationDistance = 10.0
|
ReprioritizationEnabled = true
|
||||||
ChildUpdateReprioritizationDistance = 20.0
|
ReprioritizationInterval = 2000.0
|
||||||
ReprioritizeUpdatesInterval = 5000.0
|
RootReprioritizationDistance = 10.0
|
||||||
|
ChildReprioritizationDistance = 20.0
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; These are defaults that are overwritten below in [Architecture].
|
;; These are defaults that are overwritten below in [Architecture].
|
||||||
|
|
BIN
bin/Prebuild.exe
BIN
bin/Prebuild.exe
Binary file not shown.
35
prebuild.xml
35
prebuild.xml
|
@ -588,6 +588,7 @@
|
||||||
<ReferencePath>../../../../bin/</ReferencePath>
|
<ReferencePath>../../../../bin/</ReferencePath>
|
||||||
<Reference name="System"/>
|
<Reference name="System"/>
|
||||||
<Reference name="System.Drawing"/>
|
<Reference name="System.Drawing"/>
|
||||||
|
<Reference name="CSJ2K.dll"/>
|
||||||
<Reference name="OpenMetaverseTypes.dll"/>
|
<Reference name="OpenMetaverseTypes.dll"/>
|
||||||
<Reference name="OpenMetaverse.dll"/>
|
<Reference name="OpenMetaverse.dll"/>
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
|
@ -747,6 +748,7 @@
|
||||||
|
|
||||||
<ReferencePath>../../../bin/</ReferencePath>
|
<ReferencePath>../../../bin/</ReferencePath>
|
||||||
<Reference name="System"/>
|
<Reference name="System"/>
|
||||||
|
<Reference name="System.Core"/>
|
||||||
<Reference name="System.Xml"/>
|
<Reference name="System.Xml"/>
|
||||||
<Reference name="System.Drawing"/>
|
<Reference name="System.Drawing"/>
|
||||||
<Reference name="System.Web"/>
|
<Reference name="System.Web"/>
|
||||||
|
@ -1411,6 +1413,37 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
<Project frameworkVersion="v3_5" name="OpenSim.Services.PresenceService" path="OpenSim/Services/PresenceService" 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="OpenMetaverseTypes.dll"/>
|
||||||
|
<Reference name="OpenMetaverse.dll"/>
|
||||||
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
|
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||||
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
|
<Reference name="OpenSim.Services.Base"/>
|
||||||
|
<Reference name="OpenSim.Services.Connectors"/>
|
||||||
|
<Reference name="OpenSim.Data"/>
|
||||||
|
<Reference name="Nini.dll" />
|
||||||
|
<Reference name="log4net.dll"/>
|
||||||
|
|
||||||
|
<Files>
|
||||||
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
</Files>
|
||||||
|
</Project>
|
||||||
|
|
||||||
<Project frameworkVersion="v3_5" name="OpenSim.Services.InventoryService" path="OpenSim/Services/InventoryService" type="Library">
|
<Project frameworkVersion="v3_5" name="OpenSim.Services.InventoryService" path="OpenSim/Services/InventoryService" type="Library">
|
||||||
<Configuration name="Debug">
|
<Configuration name="Debug">
|
||||||
<Options>
|
<Options>
|
||||||
|
@ -3135,7 +3168,7 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
<Project name="OpenSim.Tools.lslc" path="OpenSim/Tools/Compiler" type="Exe">
|
<Project frameworkVersion="v3_5" name="OpenSim.Tools.lslc" path="OpenSim/Tools/Compiler" type="Exe">
|
||||||
<Configuration name="Debug">
|
<Configuration name="Debug">
|
||||||
<Options>
|
<Options>
|
||||||
<OutputPath>../../../bin/</OutputPath>
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue