Merge commit 'f54b398540698e6e09022fe77b6405624b532f5c' into careminster

avinationmerge
Melanie 2013-01-16 01:13:14 +00:00
commit 70fa41863d
18 changed files with 414 additions and 60 deletions

View File

@ -77,6 +77,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// protected HttpListener m_httpListener; // protected HttpListener m_httpListener;
protected CoolHTTPListener m_httpListener2; protected CoolHTTPListener m_httpListener2;
protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
protected Dictionary<string, JsonRPCMethod> jsonRpcHandlers = new Dictionary<string, JsonRPCMethod>();
protected Dictionary<string, bool> m_rpcHandlersKeepAlive = new Dictionary<string, bool>(); protected Dictionary<string, bool> m_rpcHandlersKeepAlive = new Dictionary<string, bool>();
protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/ protected DefaultLLSDMethod m_defaultLlsdHandler = null; // <-- Moving away from the monolithic.. and going to /registered/
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>(); protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
@ -217,6 +218,37 @@ namespace OpenSim.Framework.Servers.HttpServer
return new List<string>(m_rpcHandlers.Keys); return new List<string>(m_rpcHandlers.Keys);
} }
// JsonRPC
public bool AddJsonRPCHandler(string method, JsonRPCMethod handler)
{
lock(jsonRpcHandlers)
{
jsonRpcHandlers.Add(method, handler);
}
return true;
}
public JsonRPCMethod GetJsonRPCHandler(string method)
{
lock (jsonRpcHandlers)
{
if (jsonRpcHandlers.ContainsKey(method))
{
return jsonRpcHandlers[method];
}
else
{
return null;
}
}
}
public List<string> GetJsonRpcHandlerKeys()
{
lock (jsonRpcHandlers)
return new List<string>(jsonRpcHandlers.Keys);
}
public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
{ {
//m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);
@ -557,10 +589,18 @@ namespace OpenSim.Framework.Servers.HttpServer
buffer = HandleLLSDRequests(request, response); buffer = HandleLLSDRequests(request, response);
break; break;
case "application/json-rpc":
if (DebugLevel >= 3)
LogIncomingToContentTypeHandler(request);
buffer = HandleJsonRpcRequests(request, response);
break;
case "text/xml": case "text/xml":
case "application/xml": case "application/xml":
case "application/json": case "application/json":
default: default:
//m_log.Info("[Debug BASE HTTP SERVER]: in default handler"); //m_log.Info("[Debug BASE HTTP SERVER]: in default handler");
// Point of note.. the DoWeHaveA methods check for an EXACT path // Point of note.. the DoWeHaveA methods check for an EXACT path
@ -986,6 +1026,74 @@ namespace OpenSim.Framework.Servers.HttpServer
return buffer; return buffer;
} }
// JsonRpc (v2.0 only)
private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response)
{
Stream requestStream = request.InputStream;
JsonRpcResponse jsonRpcResponse = new JsonRpcResponse();
OSDMap jsonRpcRequest = null;
try
{
jsonRpcRequest = (OSDMap)OSDParser.DeserializeJson(requestStream);
}
catch (LitJson.JsonException e)
{
jsonRpcResponse.Error.Code = ErrorCode.InternalError;
jsonRpcResponse.Error.Message = e.Message;
}
requestStream.Close();
if (jsonRpcRequest != null)
{
if (jsonRpcRequest.ContainsKey("jsonrpc") || jsonRpcRequest["jsonrpc"].AsString() == "2.0")
{
jsonRpcResponse.JsonRpc = "2.0";
// If we have no id, then it's a "notification"
if (jsonRpcRequest.ContainsKey("id"))
{
jsonRpcResponse.Id = jsonRpcRequest["id"].AsString();
}
string methodname = jsonRpcRequest["method"];
JsonRPCMethod method;
if (jsonRpcHandlers.ContainsKey(methodname))
{
lock(jsonRpcHandlers)
{
jsonRpcHandlers.TryGetValue(methodname, out method);
}
method(jsonRpcRequest, ref jsonRpcResponse);
}
else // Error no hanlder defined for requested method
{
jsonRpcResponse.Error.Code = ErrorCode.InvalidRequest;
jsonRpcResponse.Error.Message = string.Format ("No handler defined for {0}", methodname);
}
}
else // not json-rpc 2.0 could be v1
{
jsonRpcResponse.Error.Code = ErrorCode.InvalidRequest;
jsonRpcResponse.Error.Message = "Must be valid json-rpc 2.0 see: http://www.jsonrpc.org/specification";
if (jsonRpcRequest.ContainsKey("id"))
jsonRpcResponse.Id = jsonRpcRequest["id"].AsString();
}
}
response.KeepAlive = true;
string responseData = string.Empty;
responseData = jsonRpcResponse.Serialize();
byte[] buffer = Encoding.UTF8.GetBytes(responseData);
return buffer;
}
private byte[] HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response) private byte[] HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response)
{ {
//m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request"); //m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request");

View File

@ -97,6 +97,8 @@ namespace OpenSim.Framework.Servers.HttpServer
bool AddXmlRPCHandler(string method, XmlRpcMethod handler); bool AddXmlRPCHandler(string method, XmlRpcMethod handler);
bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive);
bool AddJsonRPCHandler(string method, JsonRPCMethod handler);
/// <summary> /// <summary>
/// Gets the XML RPC handler for given method name /// Gets the XML RPC handler for given method name
/// </summary> /// </summary>

View File

@ -0,0 +1,34 @@
/*
* 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.Net;
using OpenMetaverse.StructuredData;
namespace OpenSim.Framework.Servers.HttpServer
{
public delegate void JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response);
}

View File

@ -0,0 +1,150 @@
/*
* 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.Net;
using OpenMetaverse.StructuredData;
namespace OpenSim.Framework.Servers.HttpServer
{
public sealed class ErrorCode
{
private ErrorCode() {}
public const int ParseError = -32700;
public const int InvalidRequest = -32600;
public const int MethodNotFound = -32601;
public const int InvalidParams = -32602;
public const int InternalError = -32604;
}
public class JsonRpcError
{
internal OSDMap Error = new OSDMap();
public int Code
{
get
{
if (Error.ContainsKey("code"))
return Error["code"].AsInteger();
else
return 0;
}
set
{
Error["code"] = OSD.FromInteger(value);
}
}
public string Message
{
get
{
if (Error.ContainsKey("message"))
return Error["message"].AsString();
else
return null;
}
set
{
Error["message"] = OSD.FromString(value);
}
}
public OSD Data
{
get; set;
}
}
public class JsonRpcResponse
{
public string JsonRpc
{
get
{
return Reply["jsonrpc"].AsString();
}
set
{
Reply["jsonrpc"] = OSD.FromString(value);
}
}
public string Id
{
get
{
return Reply["id"].AsString();
}
set
{
Reply["id"] = OSD.FromString(value);
}
}
public OSD Result
{
get; set;
}
public JsonRpcError Error
{
get; set;
}
public OSDMap Reply = new OSDMap();
public JsonRpcResponse()
{
Error = new JsonRpcError();
}
public string Serialize()
{
if (Result != null)
Reply["result"] = Result;
if (Error.Code != 0)
{
Reply["error"] = (OSD)Error.Error;
}
string result = string.Empty;
try
{
result = OSDParser.SerializeJsonString(Reply);
}
catch
{
}
return result;
}
}
}

View File

@ -230,6 +230,10 @@ namespace OpenSim.Framework.Servers
List<String> poll = httpServer.GetPollServiceHandlerKeys(); List<String> poll = httpServer.GetPollServiceHandlerKeys();
foreach (String s in httpServer.GetHTTPHandlerKeys()) foreach (String s in httpServer.GetHTTPHandlerKeys())
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
handlers.AppendFormat("* JSONRPC:\n");
foreach (String s in httpServer.GetJsonRpcHandlerKeys())
handlers.AppendFormat("\t{0}\n", s);
// handlers.AppendFormat("* Agent:\n"); // handlers.AppendFormat("* Agent:\n");
// foreach (String s in httpServer.GetAgentHandlerKeys()) // foreach (String s in httpServer.GetAgentHandlerKeys())

View File

@ -6600,19 +6600,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion #endregion
AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit;
if (handlerAgentRequestSit != null)
if (!(agentRequestSit.AgentData == null
|| agentRequestSit.TargetObject == null
|| agentRequestSit.TargetObject.TargetID == null
|| agentRequestSit.TargetObject.Offset == null))
{
var sp = m_scene.GetScenePresence(agentRequestSit.AgentData.AgentID);
if (sp == null || sp.ParentID != 0) // ignore packet if agent is already sitting
return true;
handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, if (handlerAgentRequestSit != null)
agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
} agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
} }
return true; return true;
} }

View File

@ -2197,6 +2197,10 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentID != 0) if (ParentID != 0)
{ {
var targetPart = m_scene.GetSceneObjectPart(targetID);
if (targetPart != null && targetPart.LocalId == ParentID)
return; // already sitting here, ignore
StandUp(); StandUp();
} }

View File

@ -166,7 +166,7 @@ public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParamet
// If Debug logging level, enable logging from the unmanaged code // If Debug logging level, enable logging from the unmanaged code
m_DebugLogCallbackHandle = null; m_DebugLogCallbackHandle = null;
if (BSScene.m_log.IsDebugEnabled || PhysicsScene.PhysicsLogging.Enabled) if (BSScene.m_log.IsDebugEnabled && PhysicsScene.PhysicsLogging.Enabled)
{ {
BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader); BSScene.m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", BSScene.LogHeader);
if (PhysicsScene.PhysicsLogging.Enabled) if (PhysicsScene.PhysicsLogging.Enabled)
@ -202,7 +202,7 @@ private void BulletLoggerPhysLog(string msg)
} }
public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, public override int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
out int updatedEntityCount, out int collidersCount) out int updatedEntityCount, out int collidersCount)
{ {
BulletWorldUnman worldu = world as BulletWorldUnman; BulletWorldUnman worldu = world as BulletWorldUnman;
return BSAPICPP.PhysicsStep2(worldu.ptr, timeStep, maxSubSteps, fixedTimeStep, out updatedEntityCount, out collidersCount); return BSAPICPP.PhysicsStep2(worldu.ptr, timeStep, maxSubSteps, fixedTimeStep, out updatedEntityCount, out collidersCount);
@ -212,6 +212,19 @@ public override void Shutdown(BulletWorld world)
{ {
BulletWorldUnman worldu = world as BulletWorldUnman; BulletWorldUnman worldu = world as BulletWorldUnman;
BSAPICPP.Shutdown2(worldu.ptr); BSAPICPP.Shutdown2(worldu.ptr);
if (m_paramsHandle.IsAllocated)
{
m_paramsHandle.Free();
}
if (m_collisionArrayPinnedHandle.IsAllocated)
{
m_collisionArrayPinnedHandle.Free();
}
if (m_updateArrayPinnedHandle.IsAllocated)
{
m_updateArrayPinnedHandle.Free();
}
} }
public override bool PushUpdate(BulletBody obj) public override bool PushUpdate(BulletBody obj)

View File

@ -126,9 +126,9 @@ public sealed class BSCharacter : BSPhysObject
DetailLog("{0},BSCharacter.Destroy", LocalID); DetailLog("{0},BSCharacter.Destroy", LocalID);
PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() PhysicsScene.TaintedObject("BSCharacter.destroy", delegate()
{ {
PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null); PhysicsScene.Shapes.DereferenceBody(PhysBody, true /* inTaintTime */, null /* bodyCallback */);
PhysBody.Clear(); PhysBody.Clear();
PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null); PhysicsScene.Shapes.DereferenceShape(PhysShape, true /* inTaintTime */, null /* bodyCallback */);
PhysShape.Clear(); PhysShape.Clear();
}); });
} }

View File

@ -124,9 +124,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
static readonly float PIOverTwo = ((float)Math.PI) / 2f; static readonly float PIOverTwo = ((float)Math.PI) / 2f;
// For debugging, flags to turn on and off individual corrections. // For debugging, flags to turn on and off individual corrections.
private bool enableAngularVerticalAttraction = true; private bool enableAngularVerticalAttraction;
private bool enableAngularDeflection = true; private bool enableAngularDeflection;
private bool enableAngularBanking = true; private bool enableAngularBanking;
public BSDynamics(BSScene myScene, BSPrim myPrim) public BSDynamics(BSScene myScene, BSPrim myPrim)
{ {
@ -141,8 +141,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
public void SetupVehicleDebugging() public void SetupVehicleDebugging()
{ {
enableAngularVerticalAttraction = true; enableAngularVerticalAttraction = true;
enableAngularDeflection = true; enableAngularDeflection = false;
enableAngularBanking = true; enableAngularBanking = false;
if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse)
{ {
enableAngularVerticalAttraction = false; enableAngularVerticalAttraction = false;
@ -649,6 +649,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
private Quaternion m_knownOrientation; private Quaternion m_knownOrientation;
private Vector3 m_knownRotationalVelocity; private Vector3 m_knownRotationalVelocity;
private Vector3 m_knownRotationalForce; private Vector3 m_knownRotationalForce;
private Vector3 m_knownRotationalImpulse;
private Vector3 m_knownForwardVelocity; // vehicle relative forward speed private Vector3 m_knownForwardVelocity; // vehicle relative forward speed
private const int m_knownChangedPosition = 1 << 0; private const int m_knownChangedPosition = 1 << 0;
@ -658,9 +659,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
private const int m_knownChangedOrientation = 1 << 4; private const int m_knownChangedOrientation = 1 << 4;
private const int m_knownChangedRotationalVelocity = 1 << 5; private const int m_knownChangedRotationalVelocity = 1 << 5;
private const int m_knownChangedRotationalForce = 1 << 6; private const int m_knownChangedRotationalForce = 1 << 6;
private const int m_knownChangedTerrainHeight = 1 << 7; private const int m_knownChangedRotationalImpulse = 1 << 7;
private const int m_knownChangedWaterLevel = 1 << 8; private const int m_knownChangedTerrainHeight = 1 << 8;
private const int m_knownChangedForwardVelocity = 1 << 9; private const int m_knownChangedWaterLevel = 1 << 9;
private const int m_knownChangedForwardVelocity = 1 <<10;
private void ForgetKnownVehicleProperties() private void ForgetKnownVehicleProperties()
{ {
@ -700,6 +702,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity); PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity);
} }
if ((m_knownChanged & m_knownChangedRotationalImpulse) != 0)
Prim.ApplyTorqueImpulse((Vector3)m_knownRotationalImpulse, true /*inTaintTime*/);
if ((m_knownChanged & m_knownChangedRotationalForce) != 0) if ((m_knownChanged & m_knownChangedRotationalForce) != 0)
{ {
Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/); Prim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/);
@ -843,6 +848,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin
m_knownChanged |= m_knownChangedRotationalForce; m_knownChanged |= m_knownChangedRotationalForce;
m_knownHas |= m_knownChangedRotationalForce; m_knownHas |= m_knownChangedRotationalForce;
} }
private void VehicleAddRotationalImpulse(Vector3 pImpulse)
{
if ((m_knownHas & m_knownChangedRotationalImpulse) == 0)
{
m_knownRotationalImpulse = Vector3.Zero;
m_knownHas |= m_knownChangedRotationalImpulse;
}
m_knownRotationalImpulse += pImpulse;
m_knownChanged |= m_knownChangedRotationalImpulse;
}
// Vehicle relative forward velocity // Vehicle relative forward velocity
private Vector3 VehicleForwardVelocity private Vector3 VehicleForwardVelocity
{ {
@ -1031,16 +1047,32 @@ namespace OpenSim.Region.Physics.BulletSPlugin
else else
{ {
// Error is positive if below the target and negative if above. // Error is positive if below the target and negative if above.
float verticalError = m_VhoverTargetHeight - VehiclePosition.Z; Vector3 hpos = VehiclePosition;
float verticalCorrectionVelocity = verticalError / m_VhoverTimescale * pTimestep; float verticalError = m_VhoverTargetHeight - hpos.Z;
float verticalCorrection = verticalError / m_VhoverTimescale;
verticalCorrection *= m_VhoverEfficiency;
hpos.Z += verticalCorrection;
VehiclePosition = hpos;
// Since we are hovering, we need to do the opposite of falling -- get rid of world Z
Vector3 vel = VehicleVelocity;
vel.Z = 0f;
VehicleVelocity = vel;
/*
float verticalCorrectionVelocity = verticalError / m_VhoverTimescale;
Vector3 verticalCorrection = new Vector3(0f, 0f, verticalCorrectionVelocity);
verticalCorrection *= m_vehicleMass;
// TODO: implement m_VhoverEfficiency correctly // TODO: implement m_VhoverEfficiency correctly
VehicleAddForceImpulse(new Vector3(0f, 0f, verticalCorrectionVelocity)); VehicleAddForceImpulse(verticalCorrection);
*/
VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corrVel={7}", VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},err={6},corr={7}",
Prim.LocalID, VehiclePosition, m_VhoverEfficiency, Prim.LocalID, VehiclePosition, m_VhoverEfficiency,
m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight,
verticalError, verticalCorrectionVelocity); verticalError, verticalCorrection);
} }
} }

View File

@ -195,8 +195,11 @@ public sealed class BSLinksetCompound : BSLinkset
&& PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition)) && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
{ {
// TODO: replace this with are calculation of the child prim's orientation and pos. // TODO: replace this with are calculation of the child prim's orientation and pos.
updated.LinksetInfo = null; // TODO: for the moment, don't rebuild the compound shape.
ScheduleRebuild(updated); // This is often just the car turning its wheels. When we can just reorient the one
// member shape of the compound shape, the overhead of rebuilding won't be a problem.
// updated.LinksetInfo = null;
// ScheduleRebuild(updated);
} }
} }

View File

@ -318,13 +318,13 @@ public static class BSParam
(s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); },
(s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ),
new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ,
0f, // set to zero to disable 0.3f, // set to zero to disable
(s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); },
(s) => { return CcdMotionThreshold; }, (s) => { return CcdMotionThreshold; },
(s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); },
(s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ),
new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
0f, 0.2f,
(s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); },
(s) => { return CcdSweptSphereRadius; }, (s) => { return CcdSweptSphereRadius; },
(s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); },
@ -465,7 +465,7 @@ public static class BSParam
(s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; },
(s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ),
new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching",
ConfigurationParameters.numericFalse, ConfigurationParameters.numericTrue,
(s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
(s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; },
(s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ),

View File

@ -382,10 +382,13 @@ public abstract class BSPhysObject : PhysicsActor
{ {
string identifier = op + "-" + id.ToString(); string identifier = op + "-" + id.ToString();
// Clean out any existing action lock (RegisteredActions)
UnRegisterPreStepAction(op, id); {
// Clean out any existing action
UnRegisterPreStepAction(op, id);
RegisteredActions[identifier] = actn; RegisteredActions[identifier] = actn;
}
PhysicsScene.BeforeStep += actn; PhysicsScene.BeforeStep += actn;
DetailLog("{0},BSPhysObject.RegisterPreStepAction,id={1}", LocalID, identifier); DetailLog("{0},BSPhysObject.RegisterPreStepAction,id={1}", LocalID, identifier);
} }
@ -395,22 +398,28 @@ public abstract class BSPhysObject : PhysicsActor
{ {
string identifier = op + "-" + id.ToString(); string identifier = op + "-" + id.ToString();
bool removed = false; bool removed = false;
if (RegisteredActions.ContainsKey(identifier)) lock (RegisteredActions)
{ {
PhysicsScene.BeforeStep -= RegisteredActions[identifier]; if (RegisteredActions.ContainsKey(identifier))
RegisteredActions.Remove(identifier); {
removed = true; PhysicsScene.BeforeStep -= RegisteredActions[identifier];
RegisteredActions.Remove(identifier);
removed = true;
}
} }
DetailLog("{0},BSPhysObject.UnRegisterPreStepAction,id={1},removed={2}", LocalID, identifier, removed); DetailLog("{0},BSPhysObject.UnRegisterPreStepAction,id={1},removed={2}", LocalID, identifier, removed);
} }
protected void UnRegisterAllPreStepActions() protected void UnRegisterAllPreStepActions()
{ {
foreach (KeyValuePair<string, BSScene.PreStepAction> kvp in RegisteredActions) lock (RegisteredActions)
{ {
PhysicsScene.BeforeStep -= kvp.Value; foreach (KeyValuePair<string, BSScene.PreStepAction> kvp in RegisteredActions)
{
PhysicsScene.BeforeStep -= kvp.Value;
}
RegisteredActions.Clear();
} }
RegisteredActions.Clear();
DetailLog("{0},BSPhysObject.UnRegisterAllPreStepActions,", LocalID); DetailLog("{0},BSPhysObject.UnRegisterAllPreStepActions,", LocalID);
} }

View File

@ -379,7 +379,7 @@ public sealed class BSPrim : BSPhysObject
// If the object is below ground it just has to be moved up because pushing will // If the object is below ground it just has to be moved up because pushing will
// not get it through the terrain // not get it through the terrain
_position.Z = targetHeight; _position.Z = targetHeight;
if (!inTaintTime) if (inTaintTime)
ForcePosition = _position; ForcePosition = _position;
ret = true; ret = true;
} }

View File

@ -387,12 +387,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
if (!m_initialized) return null; if (!m_initialized) return null;
BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying); BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying);
lock (PhysObjects) PhysObjects.Add(localID, actor); lock (PhysObjects)
PhysObjects.Add(localID, actor);
// TODO: Remove kludge someday. // TODO: Remove kludge someday.
// We must generate a collision for avatars whether they collide or not. // We must generate a collision for avatars whether they collide or not.
// This is required by OpenSim to update avatar animations, etc. // This is required by OpenSim to update avatar animations, etc.
lock (m_avatars) m_avatars.Add(actor); lock (m_avatars)
m_avatars.Add(actor);
return actor; return actor;
} }
@ -408,9 +410,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
{ {
try try
{ {
lock (PhysObjects) PhysObjects.Remove(actor.LocalID); lock (PhysObjects)
PhysObjects.Remove(bsactor.LocalID);
// Remove kludge someday // Remove kludge someday
lock (m_avatars) m_avatars.Remove(bsactor); lock (m_avatars)
m_avatars.Remove(bsactor);
} }
catch (Exception e) catch (Exception e)
{ {
@ -419,6 +423,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
bsactor.Destroy(); bsactor.Destroy();
// bsactor.dispose(); // bsactor.dispose();
} }
else
{
m_log.ErrorFormat("{0}: Requested to remove avatar that is not a BSCharacter. ID={1}, type={2}",
LogHeader, actor.LocalID, actor.GetType().Name);
}
} }
public override void RemovePrim(PhysicsActor prim) public override void RemovePrim(PhysicsActor prim)

View File

@ -280,8 +280,11 @@ namespace OpenSim.Server.Base
{ {
if (!(e is System.MissingMethodException)) if (!(e is System.MissingMethodException))
{ {
m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}", m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}, {3}",
interfaceName, dllName, e.InnerException == null ? e.Message : e.InnerException.Message); interfaceName,
dllName,
e.InnerException == null ? e.Message : e.InnerException.Message,
e.StackTrace);
} }
return null; return null;
} }

View File

@ -1,4 +1,4 @@
=== The Quick Guide to OpenSim Unit Testing === ===== The Quick Guide to OpenSim Unit Testing ===
== Running Tests == == Running Tests ==

View File

@ -925,18 +925,10 @@
MaxObjectMass = 10000.01 MaxObjectMass = 10000.01
; Dynamic parameters
LinearDamping = 0.0
AngularDamping = 0.0
DeactivationTime = 0.2
CollisionMargin = 0.04 CollisionMargin = 0.04
; Linkset constraint parameters ; Linkset constraint parameters
LinkImplementation = 1 ; 0=constraint, 1=compound LinkImplementation = 1 ; 0=constraint, 1=compound
LinkConstraintUseFrameOffset = False
LinkConstraintEnableTransMotor = True
LinkConstraintTransMotorMaxVel = 5.0
LinkConstraintTransMotorMaxForce = 0.1
; Whether to mesh sculpties ; Whether to mesh sculpties
MeshSculptedPrim = true MeshSculptedPrim = true