Make keyframes use the sim's frame timer
parent
e31bc8dc96
commit
e85a6237bf
|
@ -27,12 +27,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private static Dictionary<Scene, KeyframeTimer>m_timers =
|
private static Dictionary<Scene, KeyframeTimer>m_timers =
|
||||||
new Dictionary<Scene, KeyframeTimer>();
|
new Dictionary<Scene, KeyframeTimer>();
|
||||||
|
|
||||||
private Timer m_timer;
|
|
||||||
private Dictionary<KeyframeMotion, object> m_motions = new Dictionary<KeyframeMotion, object>();
|
private Dictionary<KeyframeMotion, object> m_motions = new Dictionary<KeyframeMotion, object>();
|
||||||
private object m_lockObject = new object();
|
private object m_lockObject = new object();
|
||||||
private object m_timerLock = new object();
|
|
||||||
private const double m_tickDuration = 50.0;
|
private const double m_tickDuration = 50.0;
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
private int m_prevTick;
|
||||||
|
|
||||||
public double TickDuration
|
public double TickDuration
|
||||||
{
|
{
|
||||||
|
@ -41,20 +40,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public KeyframeTimer(Scene scene)
|
public KeyframeTimer(Scene scene)
|
||||||
{
|
{
|
||||||
m_timer = new Timer();
|
m_prevTick = Util.EnvironmentTickCount();
|
||||||
m_timer.Interval = TickDuration;
|
|
||||||
m_timer.AutoReset = true;
|
|
||||||
m_timer.Elapsed += OnTimer;
|
|
||||||
|
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
|
||||||
m_timer.Start();
|
m_scene.EventManager.OnFrame += OnTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTimer(object sender, ElapsedEventArgs ea)
|
private void OnTimer()
|
||||||
{
|
{
|
||||||
if (!Monitor.TryEnter(m_timerLock))
|
int thisTick = Util.EnvironmentTickCount();
|
||||||
return;
|
int tickdiff = Util.EnvironmentTickCountSubtract(thisTick, m_prevTick);
|
||||||
|
m_prevTick = thisTick;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -69,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m.OnTimer(TickDuration);
|
m.OnTimer(tickdiff);
|
||||||
}
|
}
|
||||||
catch (Exception inner)
|
catch (Exception inner)
|
||||||
{
|
{
|
||||||
|
@ -81,10 +78,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// Keep running no matter what
|
// Keep running no matter what
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(m_timerLock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Add(KeyframeMotion motion)
|
public static void Add(KeyframeMotion motion)
|
||||||
|
|
Loading…
Reference in New Issue