change SOP updates throttles again. Small values of omega on llSetTargetOmega where skiped

BulletSim2017
UbitUmarov 2017-08-19 22:44:18 +01:00
parent 1fdd56f987
commit 539c006cb8
2 changed files with 74 additions and 58 deletions

View File

@ -3042,11 +3042,14 @@ namespace OpenSim.Region.Framework.Scenes
if (!IsSelected) if (!IsSelected)
RootPart.UpdateLookAt(); RootPart.UpdateLookAt();
double now = Util.GetTimeStampMS();
RootPart.SendScheduledUpdates(now);
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
SceneObjectPart part = parts[i]; SceneObjectPart part = parts[i];
part.SendScheduledUpdates(); if(part != RootPart)
part.SendScheduledUpdates(now);
} }
} }
@ -3113,7 +3116,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
RootPart.SendFullUpdateToAllClientsInternal(); RootPart.SendFullUpdateToAllClientsInternal();
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {

View File

@ -3256,10 +3256,16 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null) if (ParentGroup == null)
return; return;
if (ParentGroup.Scene == null)
return;
if(ParentGroup.Scene.GetNumberOfClients() == 0)
return;
ParentGroup.QueueForUpdateCheck(); // just in case
lock(UpdateFlagLock) lock(UpdateFlagLock)
{ {
ParentGroup.QueueForUpdateCheck(); // just in case
if(UpdateFlag != UpdateRequired.FULL) if(UpdateFlag != UpdateRequired.FULL)
{ {
UpdateFlag = UpdateRequired.FULL; UpdateFlag = UpdateRequired.FULL;
@ -3268,10 +3274,9 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}",
// UUID, Name, TimeStampFull); // UUID, Name, TimeStampFull);
if (ParentGroup.Scene != null)
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true);
} }
} }
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true);
} }
/// <summary> /// <summary>
@ -3282,6 +3287,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (ParentGroup == null) if (ParentGroup == null)
return; return;
if (ParentGroup.Scene == null)
return;
ParentGroup.HasGroupChanged = true;
if(ParentGroup.Scene.GetNumberOfClients() == 0)
return;
// This was pulled from SceneViewer. Attachments always receive full updates. // This was pulled from SceneViewer. Attachments always receive full updates.
// This is needed because otherwise if only the root prim changes position, then // This is needed because otherwise if only the root prim changes position, then
@ -3292,23 +3304,19 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
ParentGroup.QueueForUpdateCheck();
lock(UpdateFlagLock) lock(UpdateFlagLock)
{ {
if (UpdateFlag == UpdateRequired.NONE) if (UpdateFlag == UpdateRequired.NONE)
{ {
ParentGroup.HasGroupChanged = true;
ParentGroup.QueueForUpdateCheck();
UpdateFlag = UpdateRequired.TERSE; UpdateFlag = UpdateRequired.TERSE;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}", // "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1}",
// UUID, Name, TimeStampTerse); // UUID, Name);
} }
if (ParentGroup.Scene != null)
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false);
} }
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false);
} }
public void ScriptSetPhysicsStatus(bool UsePhysics) public void ScriptSetPhysicsStatus(bool UsePhysics)
@ -3428,34 +3436,30 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); ParentGroup.Scene.StatsReporter.AddObjectUpdates(1);
} }
private const float ROTATION_TOLERANCE = 0.01f; private const float ROTATION_TOLERANCE = 0.01f;
private const float VELOCITY_TOLERANCE = 0.1f; // terse update vel has low resolution private const float VELOCITY_TOLERANCE = 0.1f;
private const float ANGVELOCITY_TOLERANCE = 0.005f;
private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
private const double TIME_MS_TOLERANCE = 200f; //llSetPos has a 200ms delay. This should NOT be 3 seconds. private const double TIME_MS_TOLERANCE = 200.0; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
/// <summary> /// <summary>
/// Tell all the prims which have had updates scheduled /// Tell all the prims which have had updates scheduled
/// </summary> /// </summary>
public void SendScheduledUpdates() public void SendScheduledUpdates(double now)
{ {
UpdateRequired currentUpdate; bool sendterse = false;
bool sendfull = false;
lock(UpdateFlagLock) lock(UpdateFlagLock)
{ {
currentUpdate = UpdateFlag; switch (UpdateFlag)
ClearUpdateSchedule(); {
} case UpdateRequired.NONE:
break;
switch (currentUpdate) case UpdateRequired.TERSE:
{ sendterse = true;
case UpdateRequired.NONE:
break;
case UpdateRequired.TERSE:
bool needupdate = true;
lock(UpdateFlagLock)
{
double now = Util.GetTimeStampMS();
Vector3 curvel = Velocity; Vector3 curvel = Velocity;
Vector3 curacc = Acceleration; Vector3 curacc = Acceleration;
Vector3 angvel = AngularVelocity; Vector3 angvel = AngularVelocity;
@ -3471,7 +3475,6 @@ namespace OpenSim.Region.Framework.Scenes
Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE) Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE)
break; break;
// velocity change is also direction not only norm)
if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE ||
Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE ||
Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE) Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE)
@ -3507,12 +3510,12 @@ namespace OpenSim.Region.Framework.Scenes
break; break;
} }
if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > VELOCITY_TOLERANCE || if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > ANGVELOCITY_TOLERANCE ||
Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > VELOCITY_TOLERANCE || Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > ANGVELOCITY_TOLERANCE ||
Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > VELOCITY_TOLERANCE) Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > ANGVELOCITY_TOLERANCE)
break; break;
// viewer interpolators have a limit of 128m/s // viewer interpolators have a limit of 64rad/s
float ax = Math.Abs(angvel.X); float ax = Math.Abs(angvel.X);
if(ax > 64.0) if(ax > 64.0)
break; break;
@ -3524,20 +3527,19 @@ namespace OpenSim.Region.Framework.Scenes
break; break;
if ( if (
ax < VELOCITY_TOLERANCE && ax < ANGVELOCITY_TOLERANCE &&
ay < VELOCITY_TOLERANCE && ay < ANGVELOCITY_TOLERANCE &&
az < VELOCITY_TOLERANCE && az < ANGVELOCITY_TOLERANCE &&
!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) !RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)
) )
break; break;
needupdate = false; sendterse = false;
break; break;
} }
if(needupdate) if(sendterse)
{ {
// Update the "last" values // Update the "last" values
m_lastPosition = AbsolutePosition; m_lastPosition = AbsolutePosition;
m_lastRotation = RotationOffset; m_lastRotation = RotationOffset;
@ -3545,25 +3547,38 @@ namespace OpenSim.Region.Framework.Scenes
m_lastAcceleration = curacc; m_lastAcceleration = curacc;
m_lastAngularVelocity = angvel; m_lastAngularVelocity = angvel;
m_lastUpdateSentTime = now; m_lastUpdateSentTime = now;
ClearUpdateSchedule();
} }
} break;
if(needupdate) case UpdateRequired.FULL:
{ m_lastPosition = AbsolutePosition;
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) m_lastRotation = RotationOffset;
{ m_lastVelocity = Velocity;
SendTerseUpdateToClient(client); m_lastAcceleration = Acceleration;
}); m_lastAngularVelocity = AngularVelocity;
} m_lastUpdateSentTime = now;
break; ClearUpdateSchedule();
sendfull = true;
case UpdateRequired.FULL: break;
SendFullUpdateToAllClientsInternal(); }
break; }
if(sendterse)
{
ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
{
SendTerseUpdateToClient(client);
});
}
else if(sendfull)
{
ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
SendFullUpdate(avatar.ControllingClient);
});
} }
} }
/// <summary> /// <summary>
/// Send a terse update to all clients /// Send a terse update to all clients
/// </summary> /// </summary>
@ -3571,7 +3586,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (ParentGroup == null || ParentGroup.Scene == null) if (ParentGroup == null || ParentGroup.Scene == null)
return; return;
lock(UpdateFlagLock) lock(UpdateFlagLock)
{ {
if(UpdateFlag != UpdateRequired.NONE) if(UpdateFlag != UpdateRequired.NONE)