some sop cleanup

0.9.1.0-post-fixes
UbitUmarov 2019-01-25 20:57:48 +00:00
parent 61fb39e49b
commit df568b1a66
1 changed files with 32 additions and 31 deletions

View File

@ -1093,7 +1093,7 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition =
m_reprioritizationLastPosition = ControllingClient.StartPos; m_reprioritizationLastPosition = ControllingClient.StartPos;
m_reprioritizationLastDrawDistance = DrawDistance; m_reprioritizationLastDrawDistance = -1000;
// disable updates workjobs for now // disable updates workjobs for now
m_childUpdatesBusy = true; m_childUpdatesBusy = true;
@ -2928,21 +2928,18 @@ namespace OpenSim.Region.Framework.Scenes
float distanceToTarget; float distanceToTarget;
if(Flying && !LandAtTarget) if(Flying && !LandAtTarget)
{
distanceToTarget = LocalVectorToTarget3D.Length(); distanceToTarget = LocalVectorToTarget3D.LengthSquared();
}
else else
{ distanceToTarget = (LocalVectorToTarget3D.X * LocalVectorToTarget3D.X) + (LocalVectorToTarget3D.Y * LocalVectorToTarget3D.Y);
distanceToTarget = (float)Math.Sqrt(LocalVectorToTarget3D.X * LocalVectorToTarget3D.X +
LocalVectorToTarget3D.Y * LocalVectorToTarget3D.Y);
}
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}", // "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
// Check the error term of the current position in relation to the target position // Check the error term of the current position in relation to the target position
if (distanceToTarget <= tolerance) if (distanceToTarget <= tolerance * tolerance)
{ {
// We are close enough to the target // We are close enough to the target
Velocity = Vector3.Zero; Velocity = Vector3.Zero;
@ -2964,8 +2961,9 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
if(m_moveToSpeed > 0 && distanceToTarget <= m_moveToSpeed * Scene.FrameTime) if (m_moveToSpeed > 0 &&
m_moveToSpeed = distanceToTarget / Scene.FrameTime; distanceToTarget <= m_moveToSpeed * m_moveToSpeed * Scene.FrameTime * Scene.FrameTime)
m_moveToSpeed = (float)Math.Sqrt(distanceToTarget) / Scene.FrameTime;
try try
{ {
@ -3857,13 +3855,8 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 vel = Velocity; Vector3 vel = Velocity;
Vector3 dpos = m_pos - m_lastPosition; Vector3 dpos = m_pos - m_lastPosition;
if( State != m_lastState || if( State != m_lastState ||
Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || !vel.ApproxEquals(m_lastVelocity) ||
Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || !m_bodyRot.ApproxEquals(m_lastRotation) ||
Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE ||
Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE ||
Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE ||
Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE ||
(vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) || (vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) ||
@ -4028,18 +4021,22 @@ namespace OpenSim.Region.Framework.Scenes
{ {
landch.sendClientInitialLandInfo(ControllingClient); landch.sendClientInitialLandInfo(ControllingClient);
} }
m_reprioritizationLastPosition = AbsolutePosition;
m_reprioritizationLastDrawDistance = DrawDistance;
m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it
}
else
{
m_reprioritizationLastPosition = AbsolutePosition;
m_reprioritizationLastDrawDistance = -1000;
m_reprioritizationLastTime = Util.EnvironmentTickCount() + 2000; // delay it
} }
SendOtherAgentsAvatarFullToMe(); SendOtherAgentsAvatarFullToMe();
if(m_scene.ObjectsCullingByDistance)
{
m_reprioritizationBusy = true;
m_reprioritizationLastPosition = AbsolutePosition;
m_reprioritizationLastDrawDistance = DrawDistance;
ControllingClient.ReprioritizeUpdates();
m_reprioritizationLastTime = Util.EnvironmentTickCount();
m_reprioritizationBusy = false;
return;
}
EntityBase[] entities = Scene.Entities.GetEntities(); EntityBase[] entities = Scene.Entities.GetEntities();
foreach (EntityBase e in entities) foreach (EntityBase e in entities)
{ {
@ -4047,6 +4044,10 @@ namespace OpenSim.Region.Framework.Scenes
((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient);
} }
m_reprioritizationLastPosition = AbsolutePosition;
m_reprioritizationLastDrawDistance = DrawDistance;
m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it
m_reprioritizationBusy = false; m_reprioritizationBusy = false;
}); });
@ -4268,9 +4269,9 @@ namespace OpenSim.Region.Framework.Scenes
bool byDrawdistance = Scene.ObjectsCullingByDistance; bool byDrawdistance = Scene.ObjectsCullingByDistance;
if(byDrawdistance) if(byDrawdistance)
{ {
float minregionSize = (float)Scene.RegionInfo.RegionSizeX; float minregionSize = Scene.RegionInfo.RegionSizeX;
if(minregionSize > (float)Scene.RegionInfo.RegionSizeY) if(minregionSize > Scene.RegionInfo.RegionSizeY)
minregionSize = (float)Scene.RegionInfo.RegionSizeY; minregionSize = Scene.RegionInfo.RegionSizeY;
minregionSize *= 0.5f; minregionSize *= 0.5f;
if(DrawDistance > minregionSize && m_reprioritizationLastDrawDistance > minregionSize) if(DrawDistance > minregionSize && m_reprioritizationLastDrawDistance > minregionSize)
byDrawdistance = false; byDrawdistance = false;
@ -5945,7 +5946,7 @@ namespace OpenSim.Region.Framework.Scenes
// returns true it local teleport allowed and sets the destiny position into pos // returns true it local teleport allowed and sets the destiny position into pos
private bool CheckLocalTPLandingPoint(ref Vector3 pos) public bool CheckLocalTPLandingPoint(ref Vector3 pos)
{ {
// Never constrain lures // Never constrain lures
if ((TeleportFlags & TeleportFlags.ViaLure) != 0) if ((TeleportFlags & TeleportFlags.ViaLure) != 0)