static void RenderTick() { using (new PerfSample("render")) { ++RenderFrame; // Prepare renderables (i.e. render voxels) before calling BeginFrame using (new PerfSample("render_prepare")) { Renderer.WorldModelRenderer.BeginFrame(); // World rendering is disabled while the loading screen is displayed if (worldRenderer != null && !worldRenderer.World.IsLoadingGameSave) { worldRenderer.Viewport.Tick(); worldRenderer.PrepareRenderables(); } Ui.PrepareRenderables(); Renderer.WorldModelRenderer.EndFrame(); } // worldRenderer is null during the initial install/download screen // World rendering is disabled while the loading screen is displayed // Use worldRenderer.World instead of OrderManager.World to avoid a rendering mismatch while processing orders if (worldRenderer != null && !worldRenderer.World.IsLoadingGameSave) { Renderer.BeginWorld(worldRenderer.Viewport.Rectangle); Sound.SetListenerPosition(worldRenderer.Viewport.CenterPosition); using (new PerfSample("render_world")) worldRenderer.Draw(); } using (new PerfSample("render_widgets")) { Renderer.BeginUI(); if (worldRenderer != null && !worldRenderer.World.IsLoadingGameSave) { worldRenderer.DrawAnnotations(); } Ui.Draw(); if (ModData != null && ModData.CursorProvider != null) { if (HideCursor) { Cursor.SetCursor(null); } else { Cursor.SetCursor(Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default"); Cursor.Render(Renderer); } } } using (new PerfSample("render_flip")) Renderer.EndFrame(new DefaultInputHandler(OrderManager.World)); if (takeScreenshot) { takeScreenshot = false; TakeScreenshotInner(); } } PerfHistory.Items["render"].Tick(); PerfHistory.Items["batches"].Tick(); PerfHistory.Items["render_world"].Tick(); PerfHistory.Items["render_widgets"].Tick(); PerfHistory.Items["render_flip"].Tick(); PerfHistory.Items["terrain_lighting"].Tick(); }