* Implement llGetRegionFPS()
* Thanks idb
0.6.0-stable
Justin Clarke Casey 2008-10-16 13:17:31 +00:00
parent 68d85497ad
commit 6789234335
3 changed files with 24 additions and 2 deletions

View File

@ -196,6 +196,14 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_timedilation; }
}
/// <summary>
/// This is for llGetRegionFPS
/// </summary>
public float SimulatorFPS
{
get { return m_statsReporter.getLastReportedSimFPS(); }
}
public int TimePhase
{
get { return m_timePhase; }

View File

@ -73,6 +73,8 @@ namespace OpenSim.Region.Environment.Scenes
private float statsUpdateFactor = 0;
private float m_timeDilation = 0;
private int m_fps = 0;
// saved last reported value so there is something available for llGetRegionFPS
private float lastReportedSimFPS = 0;
private float m_pfps = 0;
private int m_agentUpdates = 0;
@ -155,6 +157,8 @@ namespace OpenSim.Region.Environment.Scenes
// Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
// 0-50 is pretty close to 0-45
float simfps = (int) ((m_fps * 5));
// save the reported value so there is something available for llGetRegionFPS
lastReportedSimFPS = (float)simfps / statsUpdateFactor;
//if (simfps > 45)
//simfps = simfps - (simfps - 45);
@ -397,6 +401,14 @@ namespace OpenSim.Region.Environment.Scenes
objectCapacity = objects;
}
/// <summary>
/// This is for llGetRegionFPS
/// </summary>
public float getLastReportedSimFPS()
{
return lastReportedSimFPS;
}
#endregion
}
}

View File

@ -4842,11 +4842,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return (double)World.TimeDilation;
}
/// <summary>
/// Returns the value reported in the client Statistics window
/// </summary>
public LSL_Float llGetRegionFPS()
{
m_host.AddScriptLPS(1);
//TODO: return actual FPS
return 10.0f;
return World.SimulatorFPS;
}
/* particle system rules should be coming into this routine as doubles, that is