public void Render(double delta)
        {
            if (game.Camera.IsThirdPerson || !game.ShowBlockInHand)
            {
                return;
            }

            Vector3 last = anim.pos;

            anim.pos          = Vector3.Zero;
            type              = game.Inventory.HeldBlock;
            block.CosX        = 1; block.SinX = 0;
            block.SwitchOrder = false;
            if (anim.doAnim)
            {
                anim.Update(delta, last);
            }

            SetMatrix();
            game.Graphics.SetMatrixMode(MatrixType.Projection);
            game.Graphics.LoadMatrix(ref heldBlockProj);
            bool translucent = game.BlockInfo.IsTranslucent[type];

            game.Graphics.Texturing = true;
            if (translucent)
            {
                game.Graphics.AlphaBlending = true;
            }
            else
            {
                game.Graphics.AlphaTest = true;
            }
            game.Graphics.DepthTest = false;

            SetPos();
            block.Render(held);

            game.Graphics.LoadMatrix(ref game.Projection);
            game.Graphics.SetMatrixMode(MatrixType.Modelview);
            game.Graphics.LoadMatrix(ref game.View);

            game.Graphics.Texturing = false;
            if (translucent)
            {
                game.Graphics.AlphaBlending = false;
            }
            else
            {
                game.Graphics.AlphaTest = false;
            }
            game.Graphics.DepthTest = true;
        }
Exemplo n.º 2
0
        public void Render(double delta)
        {
            if (game.Camera.IsThirdPerson || !game.ShowBlockInHand)
            {
                return;
            }

            Vector3 last = anim.pos;

            anim.pos          = Vector3.Zero;
            type              = game.Inventory.Selected;
            block.CosX        = 1; block.SinX = 0;
            block.SwitchOrder = false;
            if (anim.doAnim)
            {
                anim.Update(delta, last);
            }

            game.Graphics.SetMatrixMode(MatrixType.Projection);
            game.Graphics.LoadMatrix(ref heldBlockProj);
            game.Graphics.SetMatrixMode(MatrixType.Modelview);
            SetMatrix();

            game.Graphics.Texturing = true;
            game.Graphics.SetupAlphaState(game.BlockInfo.Draw[type]);
            game.Graphics.DepthTest = false;

            SetPos();
            block.Render(held);

            game.Graphics.LoadMatrix(ref game.View);
            game.Graphics.SetMatrixMode(MatrixType.Projection);
            game.Graphics.LoadMatrix(ref game.Projection);
            game.Graphics.SetMatrixMode(MatrixType.Modelview);

            game.Graphics.Texturing = false;
            game.Graphics.RestoreAlphaState(game.BlockInfo.Draw[type]);
            game.Graphics.DepthTest = true;
        }