From 101413ddd9e8a2a0d82f4e789ccd8f3bb1832666 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 16 Jul 2017 00:48:04 +0100 Subject: make KFM use scheduled terse updates. This may increase some rubber band, but is needed, and should work better with recent changes on sop terseupdates control --- OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 26 ++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/KeyframeMotion.cs') diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index d81d8a2..60f5791 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -483,8 +483,8 @@ namespace OpenSim.Region.Framework.Scenes m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.AngularVelocity = Vector3.Zero; - m_group.SendGroupRootTerseUpdate(); -// m_group.RootPart.ScheduleTerseUpdate(); +// m_group.SendGroupRootTerseUpdate(); + m_group.RootPart.ScheduleTerseUpdate(); m_frames.Clear(); } @@ -496,8 +496,8 @@ namespace OpenSim.Region.Framework.Scenes m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.AngularVelocity = Vector3.Zero; m_skippedUpdates = 1000; - m_group.SendGroupRootTerseUpdate(); -// m_group.RootPart.ScheduleTerseUpdate(); +// m_group.SendGroupRootTerseUpdate(); + m_group.RootPart.ScheduleTerseUpdate(); } public void Suspend() @@ -644,8 +644,8 @@ namespace OpenSim.Region.Framework.Scenes m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.AngularVelocity = Vector3.Zero; - m_group.SendGroupRootTerseUpdate(); - +// m_group.SendGroupRootTerseUpdate(); + m_group.RootPart.ScheduleTerseUpdate(); m_frames.Clear(); } @@ -673,7 +673,8 @@ namespace OpenSim.Region.Framework.Scenes { m_group.RootPart.Velocity = Vector3.Zero; m_skippedUpdates = 1000; - m_group.SendGroupRootTerseUpdate(); +// m_group.SendGroupRootTerseUpdate(); + m_group.RootPart.ScheduleTerseUpdate(); } return; } @@ -797,7 +798,8 @@ namespace OpenSim.Region.Framework.Scenes m_lastPosUpdate = m_nextPosition; m_lastRotationUpdate = m_group.GroupRotation; m_skippedUpdates = 0; - m_group.SendGroupRootTerseUpdate(); +// m_group.SendGroupRootTerseUpdate(); + m_group.RootPart.ScheduleTerseUpdate(); } } @@ -842,8 +844,8 @@ namespace OpenSim.Region.Framework.Scenes { m_group.RootPart.Velocity = Vector3.Zero; m_skippedUpdates = 1000; - m_group.SendGroupRootTerseUpdate(); -// m_group.RootPart.ScheduleTerseUpdate(); +// m_group.SendGroupRootTerseUpdate(); + m_group.RootPart.ScheduleTerseUpdate(); } } @@ -855,8 +857,8 @@ namespace OpenSim.Region.Framework.Scenes { m_group.RootPart.Velocity = Vector3.Zero; m_skippedUpdates = 1000; - m_group.SendGroupRootTerseUpdate(); -// m_group.RootPart.ScheduleTerseUpdate(); +// m_group.SendGroupRootTerseUpdate(); + m_group.RootPart.ScheduleTerseUpdate(); if (m_running) { -- cgit v1.1 From 4ef64d4425479667c5f7a0b8239efe0215045235 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 16 Jul 2017 01:10:27 +0100 Subject: trigger moving_end also KFM stop and pause --- OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/KeyframeMotion.cs') diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 60f5791..110805c 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -486,6 +486,7 @@ namespace OpenSim.Region.Framework.Scenes // m_group.SendGroupRootTerseUpdate(); m_group.RootPart.ScheduleTerseUpdate(); m_frames.Clear(); + m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); } public void Pause() @@ -498,6 +499,7 @@ namespace OpenSim.Region.Framework.Scenes m_skippedUpdates = 1000; // m_group.SendGroupRootTerseUpdate(); m_group.RootPart.ScheduleTerseUpdate(); + m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); } public void Suspend() -- cgit v1.1 From cd15de628df3af968e3445a7cf22e741a23dc41f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 16 Jul 2017 01:31:37 +0100 Subject: don't start moving KFM things on region start that where stopped on last shutdown --- OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/KeyframeMotion.cs') diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 110805c..712ae01 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -326,8 +326,8 @@ namespace OpenSim.Region.Framework.Scenes newMotion.m_selected = true; } - newMotion.m_timerStopped = false; - newMotion.m_running = true; +// newMotion.m_timerStopped = false; +// newMotion.m_running = true; newMotion.m_isCrossing = false; newMotion.m_waitingCrossing = false; } -- cgit v1.1 From 9ae26fc5afc96c793186b79e80ac8f1a8a040d5b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 16 Jul 2017 05:19:27 +0100 Subject: store kfm on inventory. this may still be a bit confusing on rez --- OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/KeyframeMotion.cs') diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 712ae01..c64a0f8 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -755,7 +755,8 @@ namespace OpenSim.Region.Framework.Scenes } else { - bool lastSteps = remainingSteps < 4; +// bool lastSteps = remainingSteps < 4; + Vector3 currentPosition = m_group.AbsolutePosition; Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition; motionThisFrame /= (float)remainingSteps; @@ -776,13 +777,13 @@ namespace OpenSim.Region.Framework.Scenes } m_group.AbsolutePosition = m_nextPosition; - if(lastSteps) - m_group.RootPart.Velocity = Vector3.Zero; - else +// if(lastSteps) +// m_group.RootPart.Velocity = Vector3.Zero; +// else m_group.RootPart.Velocity = m_currentVel; if(!update && ( - lastSteps || +// lastSteps || m_skippedUpdates * tickDuration > 0.5 || Math.Abs(m_nextPosition.X - currentPosition.X) > 5f || Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f || -- cgit v1.1 From f921ad005f85fd05fa0a88df0268336f60e22d8d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Jul 2017 00:58:35 +0100 Subject: KFM: changes on update method implies other changes. Still not that good. Note: objects motion timing can't be done using timers. On windows at least, those can have jitter of tens of ms --- OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 38 +++++++++++++++-------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/KeyframeMotion.cs') diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index c64a0f8..80ee510 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -295,6 +295,7 @@ namespace OpenSim.Region.Framework.Scenes lock (m_frames) { KeyframeTimer.Add(this); + m_lasttickMS = Util.GetTimeStampMS(); m_timerStopped = false; } } @@ -651,10 +652,11 @@ namespace OpenSim.Region.Framework.Scenes m_frames.Clear(); } - Vector3 m_lastPosUpdate; - Quaternion m_lastRotationUpdate; - Vector3 m_currentVel; - int m_skippedUpdates; + [NonSerialized()] Vector3 m_lastPosUpdate; + [NonSerialized()] Quaternion m_lastRotationUpdate; + [NonSerialized()] Vector3 m_currentVel; + [NonSerialized()] int m_skippedUpdates; + [NonSerialized()] double m_lasttickMS; private void DoOnTimer(double tickDuration) { @@ -699,6 +701,8 @@ namespace OpenSim.Region.Framework.Scenes return; } + double nowMS = Util.GetTimeStampMS(); + if (m_frames.Count == 0) { lock (m_frames) @@ -719,10 +723,16 @@ namespace OpenSim.Region.Framework.Scenes m_currentVel /= (m_currentFrame.TimeMS * 0.001f); m_currentFrame.TimeMS += (int)tickDuration; + m_lasttickMS = nowMS - 50f; update = true; } - m_currentFrame.TimeMS -= (int)tickDuration; + int elapsed = (int)(nowMS - m_lasttickMS); + if( elapsed > 3 * tickDuration) + elapsed = (int)tickDuration; + + m_currentFrame.TimeMS -= elapsed; + m_lasttickMS = nowMS; // Do the frame processing double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; @@ -770,10 +780,12 @@ namespace OpenSim.Region.Framework.Scenes Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); step.Normalize(); m_group.RootPart.RotationOffset = step; +/* if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f) update = true; +*/ } m_group.AbsolutePosition = m_nextPosition; @@ -781,7 +793,7 @@ namespace OpenSim.Region.Framework.Scenes // m_group.RootPart.Velocity = Vector3.Zero; // else m_group.RootPart.Velocity = m_currentVel; - +/* if(!update && ( // lastSteps || m_skippedUpdates * tickDuration > 0.5 || @@ -794,16 +806,16 @@ namespace OpenSim.Region.Framework.Scenes } else m_skippedUpdates++; - +*/ } - if(update) - { - m_lastPosUpdate = m_nextPosition; - m_lastRotationUpdate = m_group.GroupRotation; - m_skippedUpdates = 0; +// if(update) +// { +// m_lastPosUpdate = m_nextPosition; +// m_lastRotationUpdate = m_group.GroupRotation; +// m_skippedUpdates = 0; // m_group.SendGroupRootTerseUpdate(); m_group.RootPart.ScheduleTerseUpdate(); - } +// } } public Byte[] Serialize() -- cgit v1.1