//This renders the frame
protected override void OnRenderFrame(FrameEventArgs e)
{
Game.InfoFrameRate = RenderFrequency;
GL.ClearColor(0.75f, 0.75f, 0.75f, 1.0f);
//Do not do anything whilst loading
if (currentlyLoading)
{
System.Threading.Thread.Sleep(10);
return;
}
ProcessEvents();
double TimeElapsed = CPreciseTimer.GetElapsedTime();
if (Program.CpuReducedMode)
{
System.Threading.Thread.Sleep(250);
}
else
{
System.Threading.Thread.Sleep(1);
if (ReducedModeEnteringTime == 0)
{
ReducedModeEnteringTime = 2500;
}
if (World.CameraAlignmentDirection.Position.X != 0.0 | World.CameraAlignmentDirection.Position.Y != 0.0 | World.CameraAlignmentDirection.Position.Z != 0.0 | World.CameraAlignmentDirection.Pitch != 0.0 | World.CameraAlignmentDirection.Yaw != 0.0 | World.CameraAlignmentDirection.Roll != 0.0 | World.CameraAlignmentDirection.TrackPosition != 0.0 | World.CameraAlignmentDirection.Zoom != 0.0)
{
ReducedModeEnteringTime = 2500;
}
//Automatically enter reduced CPU mode if appropriate
if (Program.CpuAutomaticMode && Program.CpuReducedMode == false)
{
ReducedModeEnteringTime -= TimeElapsed;
if (ReducedModeEnteringTime <= 0)
{
Program.CpuReducedMode = true;
ReducedModeEnteringTime = 0;
}
}
}
DateTime d = DateTime.Now;
Game.SecondsSinceMidnight = (double)(3600 * d.Hour + 60 * d.Minute + d.Second) + 0.001 * (double)d.Millisecond;
ObjectManager.UpdateAnimatedWorldObjects(TimeElapsed, false);
World.UpdateAbsoluteCamera(TimeElapsed);
ObjectManager.UpdateVisibility(World.CameraTrackFollower.TrackPosition + World.CameraCurrentAlignment.Position.Z);
TextureManager.Update(TimeElapsed);
SoundManager.Update(TimeElapsed);
Renderer.RenderScene(TimeElapsed);
SwapBuffers();
}