Ejemplo n.º 1
0
        void Render3D(double delta, float t)
        {
            if (SkyboxRenderer.ShouldRender)
            {
                SkyboxRenderer.Render(delta);
            }
            AxisLinesRenderer.Render(delta);
            Entities.RenderModels(Graphics, delta, t);
            Entities.RenderNames(Graphics, delta);

            ParticleManager.Render(delta, t);
            Camera.GetPickedBlock(SelectedPos);             // TODO: only pick when necessary
            EnvRenderer.Render(delta);
            MapRenderer.Update(delta);
            MapRenderer.RenderNormal(delta);
            MapBordersRenderer.RenderSides(delta);

            if (SelectedPos.Valid && !HideGui)
            {
                Picking.UpdateState(SelectedPos);
                Picking.Render(delta);
            }

            // Render water over translucent blocks when underwater for proper alpha blending
            Vector3 pos = LocalPlayer.Position;

            if (CurrentCameraPos.Y < World.Env.EdgeHeight &&
                (pos.X < 0 || pos.Z < 0 || pos.X > World.Width || pos.Z > World.Length))
            {
                MapRenderer.RenderTranslucent(delta);
                MapBordersRenderer.RenderEdges(delta);
            }
            else
            {
                MapBordersRenderer.RenderEdges(delta);
                MapRenderer.RenderTranslucent(delta);
            }

            // Need to render again over top of translucent block, as the selection outline
            // is drawn without writing to the depth buffer
            if (SelectedPos.Valid && !HideGui &&
                BlockInfo.Draw[SelectedPos.Block] == DrawType.Translucent)
            {
                Picking.Render(delta);
            }

            Entities.DrawShadows();
            SelectionManager.Render(delta);
            Entities.RenderHoveredNames(Graphics, delta);

            bool left   = IsMousePressed(MouseButton.Left);
            bool middle = IsMousePressed(MouseButton.Middle);
            bool right  = IsMousePressed(MouseButton.Right);

            Input.PickBlocks(true, left, middle, right);
            if (!HideGui)
            {
                HeldBlockRenderer.Render(delta);
            }
        }
Ejemplo n.º 2
0
        void Render3D(double delta, float t)
        {
            CurrentCameraPos = Camera.GetCameraPos(LocalPlayer.EyePosition);
            if (SkyboxRenderer.ShouldRender)
            {
                SkyboxRenderer.Render(delta);
            }
            AxisLinesRenderer.Render(delta);
            Entities.RenderModels(Graphics, delta, t);
            Entities.RenderNames(Graphics, delta, t);

            ParticleManager.Render(delta, t);
            Camera.GetPickedBlock(SelectedPos);               // TODO: only pick when necessary
            EnvRenderer.Render(delta);
            MapRenderer.Render(delta);
            MapBordersRenderer.RenderSides(delta);

            if (SelectedPos.Valid && !HideGui)
            {
                Picking.Render(delta, SelectedPos);
            }
            MapBordersRenderer.RenderEdges(delta);
            MapRenderer.RenderTranslucent(delta);

            Entities.DrawShadows();
            SelectionManager.Render(delta);
            Entities.RenderHoveredNames(Graphics, delta, 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(delta, t);
            }
        }