Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

mb-throttle-test
Diva Canto 2014-11-21 08:54:30 -08:00
commit 8d3cb424a8
19 changed files with 432 additions and 34 deletions

View File

@ -69,6 +69,7 @@ namespace OpenSim.Groups
GroupPowers.DeleteRole |
GroupPowers.Eject |
GroupPowers.FindPlaces |
GroupPowers.HostEvent |
GroupPowers.Invite |
GroupPowers.JoinChat |
GroupPowers.LandChangeIdentity |

View File

@ -0,0 +1,149 @@
/*
* 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 OpenSim.Region.CoreModules.World.Terrain;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.CoreModules.World.Terrain.Features
{
public class RectangleFeature : TerrainFeature
{
public RectangleFeature(ITerrainModule module) : base(module)
{
}
public override string CreateFeature(ITerrainChannel map, string[] args)
{
string val;
string result;
if (args.Length < 7)
{
result = "Usage: " + GetUsage();
}
else
{
result = String.Empty;
float targetElevation;
val = base.parseFloat(args[3], out targetElevation);
if (val != String.Empty)
{
result = val;
}
int xOrigin;
val = base.parseInt(args[4], out xOrigin);
if (val != String.Empty)
{
result = val;
}
else if (xOrigin < 0 || xOrigin >= map.Width)
{
result = "x-origin must be within the region";
}
int yOrigin;
val = base.parseInt(args[5], out yOrigin);
if (val != String.Empty)
{
result = val;
}
else if (yOrigin < 0 || yOrigin >= map.Height)
{
result = "y-origin must be within the region";
}
int xDelta;
val = base.parseInt(args[6], out xDelta);
if (val != String.Empty)
{
result = val;
}
else if (xDelta <= 0)
{
result = "x-size must be greater than zero";
}
int yDelta;
if (args.Length > 7)
{
val = base.parseInt(args[7], out yDelta);
if (val != String.Empty)
{
result = val;
}
else if (yDelta <= 0)
{
result = "y-size must be greater than zero";
}
}
else
{
// no y-size.. make it square
yDelta = xDelta;
}
// slightly more complex validation, if required.
if (result == String.Empty)
{
if (xOrigin + xDelta > map.Width)
{
result = "(x-origin + x-size) must be within the region size";
}
else if (yOrigin + yDelta > map.Height)
{
result = "(y-origin + y-size) must be within the region size";
}
}
// if it's all good, then do the work
if (result == String.Empty)
{
int yPos = yOrigin + yDelta;
while(--yPos >= yOrigin)
{
int xPos = xOrigin + xDelta;
while(--xPos >= xOrigin)
{
map[xPos, yPos] = (double)targetElevation;
}
}
}
}
return result;
}
public override string GetUsage()
{
return "rectangle <height> <x-origin> <y-origin> <x-size> [<y-size>]";
}
}
}

View File

@ -0,0 +1,60 @@
/*
* 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 OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.CoreModules.World.Terrain
{
public interface ITerrainFeature
{
/// <summary>
/// Creates the feature.
/// </summary>
/// <returns>
/// Empty string if successful, otherwise error message.
/// </returns>
/// <param name='map'>
/// ITerrainChannel holding terrain data.
/// </param>
/// <param name='args'>
/// command-line arguments from console.
/// </param>
string CreateFeature(ITerrainChannel map, string[] args);
/// <summary>
/// Gets a string describing the usage.
/// </summary>
/// <returns>
/// A string describing parameters for creating the feature.
/// Format is "feature-name <arg1> <arg2> ..."
/// </returns>
string GetUsage();
}
}

View File

@ -0,0 +1,89 @@
/*
* 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 OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.CoreModules.World.Terrain
{
public abstract class TerrainFeature : ITerrainFeature
{
protected ITerrainModule m_module;
protected TerrainFeature(ITerrainModule module)
{
m_module = module;
}
public abstract string CreateFeature(ITerrainChannel map, string[] args);
public abstract string GetUsage();
protected string parseFloat(String s, out float f)
{
string result;
double d;
if (Double.TryParse(s, out d))
{
try
{
f = (float)d;
result = String.Empty;
}
catch(InvalidCastException)
{
result = String.Format("{0} is invalid", s);
f = -1.0f;
}
}
else
{
f = -1.0f;
result = String.Format("{0} is invalid", s);
}
return result;
}
protected string parseInt(String s, out int i)
{
string result;
if (Int32.TryParse(s, out i))
{
result = String.Empty;
}
else
{
result = String.Format("{0} is invalid", s);
}
return result;
}
}
}

View File

@ -42,6 +42,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
using OpenSim.Region.CoreModules.World.Terrain.FileLoaders;
using OpenSim.Region.CoreModules.World.Terrain.Features;
using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes;
using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes;
using OpenSim.Region.Framework.Interfaces;
@ -74,6 +75,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain
#endregion
/// <summary>
/// Terrain Features
/// </summary>
public enum TerrainFeatures: byte
{
Rectangle = 1,
}
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#pragma warning disable 414
@ -90,8 +99,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects =
new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>();
private ITerrainChannel m_channel;
private Dictionary<string, ITerrainEffect> m_plugineffects;
private Dictionary<string, ITerrainFeature> m_featureEffects =
new Dictionary<string, ITerrainFeature>();
private ITerrainChannel m_channel;
private ITerrainChannel m_revert;
private Scene m_scene;
private volatile bool m_tainted;
@ -648,6 +661,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea();
m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_revert);
// Terrain Feature effects
m_featureEffects["rectangle"] = new RectangleFeature(this);
// Filesystem load/save loaders
m_loaders[".r32"] = new RAW32();
m_loaders[".f32"] = m_loaders[".r32"];
@ -1648,9 +1664,46 @@ namespace OpenSim.Region.CoreModules.World.Terrain
// Add this to our scene so scripts can call these functions
m_scene.RegisterModuleCommander(m_commander);
// Add Feature command to Scene, since Command object requires fixed-length arglists
m_scene.AddCommand("Terrain", this, "terrain feature",
"terrain feature <type> <parameters...>", "Constructs a feature of the requested type.", FeatureCommand);
}
public void FeatureCommand(string module, string[] cmd)
{
string result;
if (cmd.Length > 2)
{
string featureType = cmd[2];
ITerrainFeature feature;
if (!m_featureEffects.TryGetValue(featureType, out feature))
{
result = String.Format("Terrain Feature \"{0}\" not found.", featureType);
}
else if ((cmd.Length > 3) && (cmd[3] == "usage"))
{
result = "Usage: " + feature.GetUsage();
}
else
{
result = feature.CreateFeature(m_channel, cmd);
}
if(result == String.Empty)
{
result = "Created Feature";
m_log.DebugFormat("Created terrain feature {0}", featureType);
}
}
else
{
result = "Usage: <feature-name> <arg1> <arg2>...";
}
MainConsole.Instance.Output(result);
}
#endregion
}

View File

@ -1886,16 +1886,15 @@ namespace OpenSim.Region.Framework.Scenes
return Vector3.Zero;
}
public void moveToTarget(Vector3 target, float tau)
public void MoveToTarget(Vector3 target, float tau)
{
if (IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null)
{
avatar.MoveToTarget(target, false, false);
}
}
else
{
PhysicsActor pa = RootPart.PhysActor;
@ -1909,12 +1908,26 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void stopMoveToTarget()
public void StopMoveToTarget()
{
if (IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null)
avatar.ResetMoveToTarget();
}
else
{
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
if (pa != null && pa.PIDActive)
{
pa.PIDActive = false;
ScheduleGroupForTerseUpdate();
}
}
}
/// <summary>

View File

@ -2229,7 +2229,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (tau > 0)
{
ParentGroup.moveToTarget(target, tau);
ParentGroup.MoveToTarget(target, tau);
}
else
{
@ -3279,10 +3279,7 @@ namespace OpenSim.Region.Framework.Scenes
public void StopMoveToTarget()
{
ParentGroup.stopMoveToTarget();
ParentGroup.ScheduleGroupForTerseUpdate();
//ParentGroup.ScheduleGroupForFullUpdate();
ParentGroup.StopMoveToTarget();
}
public void StoreUndoState()

View File

@ -238,6 +238,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override bool PIDActive
{
get { return false; }
set { return; }
}

View File

@ -251,6 +251,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override bool PIDActive
{
get { return false; }
set { return; }
}

View File

@ -614,9 +614,9 @@ public sealed class BSCharacter : BSPhysObject
public override OMV.Vector3 PIDTarget {
set { _PIDTarget = value; }
}
public override bool PIDActive {
set { _usePID = value; }
}
public override bool PIDActive { get; set; }
public override float PIDTau {
set { _PIDTau = value; }
}

View File

@ -246,7 +246,12 @@ public abstract class BSPhysObject : PhysicsActor
public virtual bool ForceBodyShapeRebuild(bool inTaintTime) { return false; }
public override bool PIDActive { set { MoveToTargetActive = value; } }
public override bool PIDActive
{
get { return MoveToTargetActive; }
set { MoveToTargetActive = value; }
}
public override OMV.Vector3 PIDTarget { set { MoveToTargetTarget = value; } }
public override float PIDTau { set { MoveToTargetTau = value; } }

View File

@ -1087,9 +1087,17 @@ public class BSPrim : BSPhysObject
}
}
public override bool PIDActive {
set {
base.MoveToTargetActive = value;
public override bool PIDActive
{
get
{
return MoveToTargetActive;
}
set
{
MoveToTargetActive = value;
EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate()
{
return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName);

View File

@ -291,7 +291,7 @@ namespace OpenSim.Region.Physics.Manager
// Used for MoveTo
public abstract Vector3 PIDTarget { set; }
public abstract bool PIDActive { set;}
public abstract bool PIDActive { get; set; }
public abstract float PIDTau { set; }
// Used for llSetHoverHeight and maybe vehicle height
@ -545,7 +545,13 @@ namespace OpenSim.Region.Physics.Manager
}
public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override bool PIDActive
{
get { return false; }
set { return; }
}
public override float PIDTau { set { return; } }
public override float PIDHoverHeight { set { return; } }

View File

@ -1245,7 +1245,11 @@ namespace OpenSim.Region.Physics.OdePlugin
}
public override Vector3 PIDTarget { set { return; } }
public override bool PIDActive { set { return; } }
public override bool PIDActive
{
get { return false; }
set { return; }
}
public override float PIDTau { set { return; } }
public override float PIDHoverHeight { set { return; } }

View File

@ -114,7 +114,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private float m_PIDTau;
private float PID_D = 35f;
private float PID_G = 25f;
private bool m_usePID;
// KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
// and are for non-VEHICLES only.
@ -1723,7 +1722,7 @@ Console.WriteLine(" JointCreateFixed");
// gravityz multiplier = 1 - m_buoyancy
fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass;
if (m_usePID)
if (PIDActive)
{
//Console.WriteLine("PID " + Name);
// KF - this is for object move? eg. llSetPos() ?
@ -1792,10 +1791,10 @@ Console.WriteLine(" JointCreateFixed");
fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass);
}
} // end if (m_usePID)
} // end if (PIDActive)
// Hover PID Controller needs to be mutually exlusive to MoveTo PID controller
if (m_useHoverPID && !m_usePID)
if (m_useHoverPID && !PIDActive)
{
//Console.WriteLine("Hover " + Name);
@ -2866,7 +2865,7 @@ Console.WriteLine(" JointCreateFixed");
// it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large.
// reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles
// adding these logical exclusion situations to maintain this where I think it was intended to be.
if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero))
if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero))
{
m_minvelocity = 0.5f;
}
@ -2947,7 +2946,7 @@ Console.WriteLine(" JointCreateFixed");
m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name);
}
}
public override bool PIDActive { set { m_usePID = value; } }
public override bool PIDActive { get; set; }
public override float PIDTau { set { m_PIDTau = value; } }
public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } }

View File

@ -275,6 +275,7 @@ namespace OpenSim.Region.Physics.POSPlugin
public override bool PIDActive
{
get { return false; }
set { return; }
}

View File

@ -270,6 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin
public override bool PIDActive
{
get { return false; }
set { return; }
}

View File

@ -1431,6 +1431,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
public static bool operator true(key k)
{
return (Boolean)k;
}
public static bool operator false(key k)
{
return !(Boolean)k;
}
static public implicit operator key(string s)
{
return new key(s);

View File

@ -615,7 +615,7 @@ namespace OpenSim.Services.LLLoginService
// e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34
where = "url";
GridRegion region = null;
Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+[.]?\d*)&(?<y>\d+[.]?\d*)&(?<z>\d+[.]?\d*)$");
Match uriMatch = reURI.Match(startLocation);
if (uriMatch == null)
{