Пример #1
0
        public void Render(double delta, float t)
        {
            if (game.Camera.IsThirdPerson || !game.ShowBlockInHand)
            {
                return;
            }

            Vector3 last = fakeP.Position;

            fakeP.Position = Vector3.Zero;
            type           = game.Inventory.HeldBlock;
            if (playAnimation)
            {
                DoAnimation(delta, last);
            }
            PerformViewBobbing(t);
            SetupMatrices();

            if (game.BlockInfo.IsSprite[type])
            {
                game.Graphics.LoadMatrix(ref spriteMat);
            }
            else
            {
                game.Graphics.LoadMatrix(ref normalMat);
            }
            game.Graphics.SetMatrixMode(MatrixType.Projection);
            game.Graphics.LoadMatrix(ref game.HeldBlockProjection);
            bool translucent = game.BlockInfo.IsTranslucent[type];

            game.Graphics.Texturing = true;
            game.Graphics.DepthTest = false;
            if (translucent)
            {
                game.Graphics.AlphaBlending = true;
            }
            else
            {
                game.Graphics.AlphaTest = true;
            }
            fakeP.Block = type;
            block.Render(fakeP);

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

            game.Graphics.Texturing = false;
            game.Graphics.DepthTest = true;
            if (translucent)
            {
                game.Graphics.AlphaBlending = false;
            }
            else
            {
                game.Graphics.AlphaTest = false;
            }
        }
        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;
        }
Пример #3
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;
        }