internal void RenderFrame(double delta) { frameTimer.Reset(); frameTimer.Start(); Graphics.BeginFrame(this); Graphics.BindIb(Graphics.defaultIb); accumulator += delta; Vertices = 0; Camera.UpdateMouse(); if (!window.Focused && !Gui.ActiveScreen.HandlesAllInput) { Gui.SetNewScreen(new PauseScreen(this)); } bool allowZoom = Gui.activeScreen == null && !Gui.hudScreen.HandlesAllInput; if (allowZoom && IsKeyDown(KeyBind.ZoomScrolling)) { Input.SetFOV(ZoomFov, false); } DoScheduledTasks(delta); float t = (float)(entTask.Accumulator / entTask.Interval); LocalPlayer.SetInterpPosition(t); if (!SkipClear) { Graphics.Clear(); } CurrentCameraPos = Camera.GetPosition(t); UpdateViewMatrix(); bool visible = Gui.activeScreen == null || !Gui.activeScreen.BlocksWorld; if (!World.HasBlocks) { visible = false; } if (visible) { Render3D(delta, t); } else { SelectedPos.SetAsInvalid(); } Gui.Render(delta); if (screenshotRequested) { TakeScreenshot(); } Graphics.EndFrame(this); LimitFPS(); }
internal void RenderFrame(double delta) { frameTimer.Reset(); frameTimer.Start(); Graphics.BeginFrame(this); Graphics.BindIb(defaultIb); accumulator += delta; Vertices = 0; Mode.BeginFrame(delta); Graphics.UpdateLightsEntity(); Camera.UpdateMouse(); if (!Focused && !Gui.ActiveScreen.HandlesAllInput) { Gui.SetNewScreen(new PauseScreen(this)); } CheckZoomFov(); DoScheduledTasks(delta); float t = (float)(entTask.Accumulator / entTask.Interval); LocalPlayer.SetInterpPosition(t); if (!SkipClear) { Graphics.Clear(); } CurrentCameraPos = Camera.GetCameraPos(t); UpdateViewMatrix(); bool visible = Gui.activeScreen == null || !Gui.activeScreen.BlocksWorld; if (!World.HasBlocks) { visible = false; } if (visible) { Render3D(delta, t); } else { SelectedPos.SetAsInvalid(); } Gui.Render(delta); if (screenshotRequested) { TakeScreenshot(); } Mode.EndFrame(delta); Graphics.EndFrame(this); LimitFPS(); }
internal void RenderFrame(double delta) { frameTimer.Reset(); frameTimer.Start(); Graphics.BeginFrame(this); Graphics.BindIb(defaultIb); accumulator += delta; Vertices = 0; if (!Focused && !ActiveScreen.HandlesAllInput) { SetNewScreen(new PauseScreen(this)); } CheckZoomFov(); CheckScheduledTasks(delta); float t = (float)(ticksAccumulator / ticksPeriod); LocalPlayer.SetInterpPosition(t); Graphics.Clear(); UpdateViewMatrix(delta); bool visible = activeScreen == null || !activeScreen.BlocksWorld; if (World.IsNotLoaded) { visible = false; } if (visible) { Render3D(delta, t); } else { SelectedPos.SetAsInvalid(); } RenderGui(delta); if (screenshotRequested) { TakeScreenshot(); } Graphics.EndFrame(this); LimitFPS(); }
protected override void OnRenderFrame(FrameEventArgs e) { PerformFpsElapsed(e.Time * 1000); Graphics.BeginFrame(this); Graphics.BindIb(defaultIb); accumulator += e.Time; Vertices = 0; if (!Focused && !ScreenLockedInput) { SetNewScreen(new PauseScreen(this)); } base.OnRenderFrame(e); CheckScheduledTasks(e.Time); float t = (float)(ticksAccumulator / ticksPeriod); LocalPlayer.SetInterpPosition(t); Graphics.Clear(); Graphics.SetMatrixMode(MatrixType.Modelview); Matrix4 modelView = Camera.GetView(e.Time); View = modelView; Graphics.LoadMatrix(ref modelView); Culling.CalcFrustumEquations(ref Projection, ref modelView); bool visible = activeScreen == null || !activeScreen.BlocksWorld; if (visible) { AxisLinesRenderer.Render(e.Time); Players.RenderModels(Graphics, e.Time, t); Players.RenderNames(Graphics, e.Time, t); CurrentCameraPos = Camera.GetCameraPos(LocalPlayer.EyePosition); ParticleManager.Render(e.Time, t); Camera.GetPickedBlock(SelectedPos); // TODO: only pick when necessary EnvRenderer.Render(e.Time); if (SelectedPos.Valid && !HideGui) { Picking.Render(e.Time, SelectedPos); } MapRenderer.Render(e.Time); SelectionManager.Render(e.Time); WeatherRenderer.Render(e.Time); Players.RenderHoveredNames(Graphics, e.Time, t); bool left = IsMousePressed(MouseButton.Left); bool middle = IsMousePressed(MouseButton.Middle); bool right = IsMousePressed(MouseButton.Right); InputHandler.PickBlocks(true, left, middle, right); if (!HideGui) { BlockHandRenderer.Render(e.Time, t); } } else { SelectedPos.SetAsInvalid(); } Graphics.Mode2D(Width, Height, EnvRenderer is StandardEnvRenderer); fpsScreen.Render(e.Time); if (activeScreen == null || !activeScreen.HidesHud) { hudScreen.Render(e.Time); } if (activeScreen != null) { activeScreen.Render(e.Time); } Graphics.Mode3D(EnvRenderer is StandardEnvRenderer); if (screenshotRequested) { TakeScreenshot(); } Graphics.EndFrame(this); }