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

LSLKeyTest
Diva Canto 2015-11-29 09:48:48 -08:00
commit 55a9bbc6ce
8 changed files with 63 additions and 30 deletions

View File

@ -2315,7 +2315,7 @@ namespace OpenSim.Framework
// It's possible that the thread won't abort. To make sure the thread pool isn't // It's possible that the thread won't abort. To make sure the thread pool isn't
// depleted, increase the pool size. // depleted, increase the pool size.
m_ThreadPool.MaxThreads++; // m_ThreadPool.MaxThreads++;
} }
} }
} }
@ -2430,6 +2430,7 @@ namespace OpenSim.Framework
long numQueued = Interlocked.Increment(ref numQueuedThreadFuncs); long numQueued = Interlocked.Increment(ref numQueuedThreadFuncs);
try try
{ {
/*
long numRunning = numRunningThreadFuncs; long numRunning = numRunningThreadFuncs;
if (m_ThreadPool != null && LogOverloads) if (m_ThreadPool != null && LogOverloads)
@ -2462,6 +2463,7 @@ namespace OpenSim.Framework
} }
} }
else else
*/
{ {
// Since we didn't log "Queue threadfunc", don't log "Run threadfunc" or "End threadfunc" either. // Since we didn't log "Queue threadfunc", don't log "Run threadfunc" or "End threadfunc" either.
// Those log lines aren't useful when we don't know which function is running in the thread. // Those log lines aren't useful when we don't know which function is running in the thread.

View File

@ -1028,9 +1028,7 @@ namespace OpenSim.Region.ClientStack.Linden
// for now viwers do send fixed defaults // for now viwers do send fixed defaults
// but this may change // but this may change
// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); // int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger();
byte physicsShapeType = (byte)PhysShapeType.prim; // default for mesh is simple convex byte physicsShapeType = (byte)PhysShapeType.convex; // default is simple convex
if(hasmesh)
physicsShapeType = (byte) PhysShapeType.convex; // default for mesh is simple convex
// int material = inner_instance_list["material"].AsInteger(); // int material = inner_instance_list["material"].AsInteger();
byte material = (byte)Material.Wood; byte material = (byte)Material.Wood;

View File

@ -158,11 +158,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (Double.IsNaN(value) || Double.IsInfinity(value)) if (Double.IsNaN(value) || Double.IsInfinity(value))
return; return;
if (value < 0)
value = 0;
else
if (value > 655.35)
value = 655.35;
m_terrainData[x, y] = (float)value; m_terrainData[x, y] = (float)value;
} }
} }

View File

@ -485,13 +485,20 @@ public abstract class BSPhysObject : PhysicsActor
CollisionsLastTick = new CollisionEventUpdate(); CollisionsLastTick = new CollisionEventUpdate();
CollisionsLastTickStep = PhysScene.SimulationStep; CollisionsLastTickStep = PhysScene.SimulationStep;
} }
CollisionsLastTick.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); CollisionsLastTick.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
// If someone has subscribed for collision events log the collision so it will be reported up // If someone has subscribed for collision events log the collision so it will be reported up
if (SubscribedEvents()) { if (SubscribedEvents()) {
ContactPoint newContact = new ContactPoint(contactPoint, contactNormal, pentrationDepth);
// make collision sound work just setting a speed
// see ubOde
newContact.RelativeSpeed = 2.0f;
lock (PhysScene.CollisionLock) lock (PhysScene.CollisionLock)
{ {
CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); CollisionCollection.AddCollider(collidingWith, newContact);
} }
DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}", DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving); LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);

View File

@ -279,7 +279,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
public override bool IsPhysical public override bool IsPhysical
{ {
get { return false; } get { return m_isPhysical; }
set { return; } set { return; }
} }

View File

@ -125,6 +125,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
/// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82] /// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82]
/// </remarks> /// </remarks>
internal static Object UniversalColliderSyncObject = new Object(); internal static Object UniversalColliderSyncObject = new Object();
internal static Object SimulationLock = new Object();
/// <summary> /// <summary>
/// Is stats collecting enabled for this ODE scene? /// Is stats collecting enabled for this ODE scene?
@ -647,7 +648,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0);
physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false);
m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); // m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false);
minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f);
maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f); maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f);
} }
@ -1441,9 +1442,28 @@ namespace OpenSim.Region.PhysicsModule.ODE
obj2LocalID = 0; obj2LocalID = 0;
//ctype = 0; //ctype = 0;
//cStartStop = 0; //cStartStop = 0;
if (!p2.SubscribedEvents() && !p1.SubscribedEvents()) // if (!p2.SubscribedEvents() && !p1.SubscribedEvents())
// return;
bool p1events = p1.SubscribedEvents();
bool p2events = p2.SubscribedEvents();
if (p1.IsVolumeDtc)
p2events = false;
if (p2.IsVolumeDtc)
p1events = false;
if (!p2events && !p1events)
return; return;
Vector3 vel = Vector3.Zero;
if (p2 != null && p2.IsPhysical)
vel = p2.Velocity;
if (p1 != null && p1.IsPhysical)
vel -= p1.Velocity;
contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal);
switch ((ActorTypes)p2.PhysicsActorType) switch ((ActorTypes)p2.PhysicsActorType)
{ {
case ActorTypes.Agent: case ActorTypes.Agent:
@ -2714,6 +2734,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
} }
lock (OdeLock) lock (OdeLock)
{ {
d.AllocateODEDataForThread(~0U); d.AllocateODEDataForThread(~0U);
@ -2867,6 +2888,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
tempTick = tempTick2; tempTick = tempTick2;
} }
lock(SimulationLock)
d.WorldQuickStep(world, ODE_STEPSIZE); d.WorldQuickStep(world, ODE_STEPSIZE);
if (CollectStats) if (CollectStats)
@ -3377,7 +3399,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public override void Dispose() public override void Dispose()
{ {
lock (OdeLock) lock(SimulationLock)
lock(OdeLock)
{ {
if(world == IntPtr.Zero) if(world == IntPtr.Zero)
return; return;
@ -3425,7 +3448,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
{ {
m_log.ErrorFormat("[ODE SCENE]: exception {0}", e.Message); m_log.ErrorFormat("[ODE SCENE]: exception {0}", e.Message);
} }
//d.CloseODE();
} }
} }

View File

@ -3550,19 +3550,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Get the normalized vector to the target // Get the normalized vector to the target
LSL_Vector d1 = llVecNorm(target - llGetPos()); LSL_Vector from = llGetPos();
// Get the bearing (yaw) // normalized direction to target
LSL_Vector a1 = new LSL_Vector(0,0,0); LSL_Vector dir = llVecNorm(target - from);
a1.z = llAtan2(d1.y, d1.x);
// Get the elevation (pitch) // use vertical to help compute left axis
LSL_Vector a2 = new LSL_Vector(0,0,0); // LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);
a2.y= -llAtan2(d1.z, llSqrt((d1.x * d1.x) + (d1.y * d1.y))); // find normalized left axis parallel to horizon
// LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));
LSL_Rotation r1 = llEuler2Rot(a1); LSL_Vector left = new LSL_Vector(-dir.y, dir.x, 0.0f);
LSL_Rotation r2 = llEuler2Rot(a2); left = llVecNorm(left);
LSL_Rotation r3 = new LSL_Rotation(0.000000, 0.707107, 0.000000, 0.707107); // make up orthogonal to left and dir
LSL_Vector up = LSL_Vector.Cross(dir, left);
// compute rotation based on orthogonal axes
// and rotate so Z points to target with X below horizont
LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical)
{ {
@ -3570,17 +3575,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (strength <= 0.0 || damping <= 0.0) if (strength <= 0.0 || damping <= 0.0)
return; return;
llSetRot(r3 * r2 * r1); llSetRot(rot);
} }
else else
{ {
if (strength == 0) if (strength == 0)
{ {
llSetRot(r3 * r2 * r1); llSetRot(rot);
return; return;
} }
m_host.StartLookAt((Quaternion)(r3 * r2 * r1), (float)strength, (float)damping); m_host.StartLookAt(rot, (float)strength, (float)damping);
} }
} }

View File

@ -871,6 +871,9 @@
;; Time a thread must be idle (in seconds) before it dies ;; Time a thread must be idle (in seconds) before it dies
; IdleTimeout = 60 ; IdleTimeout = 60
;; llSetTimerEvent minimum value. Default 0.5s, 0.05s whould be more resonable
; MinTimerInterval = 0.5
;# {Priority} {Enabled:true} {Priority for script engine threads?} {Lowest BelowNormal Normal AboveNormal Highest} BelowNormal ;# {Priority} {Enabled:true} {Priority for script engine threads?} {Lowest BelowNormal Normal AboveNormal Highest} BelowNormal
;; Thread priority ("Lowest", "BelowNormal", "Normal", "AboveNormal", ;; Thread priority ("Lowest", "BelowNormal", "Normal", "AboveNormal",
;; "Highest") ;; "Highest")