Exemplo n.º 1
0
        /// <summary>
        /// Draws a rectangle with a vertical gradient between the specified colors.
        /// </summary>
        protected virtual void DrawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6)
        {
            float f  = (float)(par5 >> 24 & 0xff) / 255F;
            float f1 = (float)(par5 >> 16 & 0xff) / 255F;
            float f2 = (float)(par5 >> 8 & 0xff) / 255F;
            float f3 = (float)(par5 & 0xff) / 255F;
            float f4 = (float)(par6 >> 24 & 0xff) / 255F;
            float f5 = (float)(par6 >> 16 & 0xff) / 255F;
            float f6 = (float)(par6 >> 8 & 0xff) / 255F;
            float f7 = (float)(par6 & 0xff) / 255F;
            //GL.Disable(EnableCap.Texture2D);
            //GL.Enable(EnableCap.Blend);
            //GL.Disable(EnableCap.AlphaTest);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.ShadeModel(ShadingModel.Smooth);
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_F(f1, f2, f3, f);
            tessellator.AddVertex(par3, par2, ZLevel);
            tessellator.AddVertex(par1, par2, ZLevel);
            tessellator.SetColorRGBA_F(f5, f6, f7, f4);
            tessellator.AddVertex(par1, par4, ZLevel);
            tessellator.AddVertex(par3, par4, ZLevel);
            tessellator.Draw();
            //GL.ShadeModel(ShadingModel.Flat);
            //GL.Disable(EnableCap.Blend);
            //GL.Enable(EnableCap.AlphaTest);
            //GL.Enable(EnableCap.Texture2D);
        }
        /// <summary>
        /// Rotate and blurs the skybox view in the main menu
        /// </summary>
        private void RotateAndBlurSkybox(float par1)
        {
            //GL.BindTexture(TextureTarget.Texture2D, ViewportTexture);
            RenderEngine.Instance.BindTexture(ViewportTexture);
            //GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, 256, 256);
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            //GL.ColorMask(true, true, true, false);
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();
            byte byte0 = 3;

            for (int i = 0; i < byte0; i++)
            {
                tessellator.SetColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float)(i + 1));
                int   j = Width;
                int   k = Height;
                float f = (float)(i - byte0 / 2) / 256F;
                tessellator.AddVertexWithUV(j, k, ZLevel, 0.0F + f, 0.0F);
                tessellator.AddVertexWithUV(j, 0.0F, ZLevel, 1.0F + f, 0.0F);
                tessellator.AddVertexWithUV(0.0F, 0.0F, ZLevel, 1.0F + f, 1.0D);
                tessellator.AddVertexWithUV(0.0F, k, ZLevel, 0.0F + f, 1.0D);
            }

            tessellator.Draw();
            //GL.ColorMask(true, true, true, true);
        }
Exemplo n.º 3
0
        public override void RenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            float f = ((float)Field_27018_a + par2) / (float)Field_27020_o;

            f *= f;
            float f1 = 2.0F - f * 2.0F;

            if (f1 > 1.0F)
            {
                f1 = 1.0F;
            }

            f1 *= 0.2F;
            //GL.Disable(EnableCap.Lighting);
            float f2 = 0.125F;
            float f3 = (float)(PosX - InterpPosX);
            float f4 = (float)(PosY - InterpPosY);
            float f5 = (float)(PosZ - InterpPosZ);
            float f6 = WorldObj.GetLightBrightness(MathHelper2.Floor_double(PosX), MathHelper2.Floor_double(PosY), MathHelper2.Floor_double(PosZ));

            //CurrentFootSteps.BindTexture(CurrentFootSteps.GetTexture("/misc/footprint.png"));
            CurrentFootSteps.BindTexture("misc.footprint.png");
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            par1Tessellator.StartDrawingQuads();
            par1Tessellator.SetColorRGBA_F(f6, f6, f6, f1);
            par1Tessellator.AddVertexWithUV(f3 - f2, f4, f5 + f2, 0.0F, 1.0D);
            par1Tessellator.AddVertexWithUV(f3 + f2, f4, f5 + f2, 1.0D, 1.0D);
            par1Tessellator.AddVertexWithUV(f3 + f2, f4, f5 - f2, 1.0D, 0.0F);
            par1Tessellator.AddVertexWithUV(f3 - f2, f4, f5 - f2, 0.0F, 0.0F);
            par1Tessellator.Draw();
            //GL.Disable(EnableCap.Blend);
            //GL.Enable(EnableCap.Lighting);
        }
Exemplo n.º 4
0
        private void Func_41040_b(int par1, int par2, float par3)
        {
            Tessellator tessellator = Tessellator.Instance;

            //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("%blur%/gui/background.png"));
            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
            int   i  = Width;
            float f  = 0.0F - ((float)UpdateCounter + par3) * 0.5F * Field_41043_e;
            float f1 = (float)Height - ((float)UpdateCounter + par3) * 0.5F * Field_41043_e;
            float f2 = 0.015625F;
            float f3 = (((float)UpdateCounter + par3) - 0.0F) * 0.02F;
            float f4 = (float)(Field_41042_d + Height + Height + 24) / Field_41043_e;
            float f5 = (f4 - 20F - ((float)UpdateCounter + par3)) * 0.005F;

            if (f5 < f3)
            {
                f3 = f5;
            }

            if (f3 > 1.0F)
            {
                f3 = 1.0F;
            }

            f3 *= f3;
            f3  = (f3 * 96F) / 255F;
            tessellator.SetColorOpaque_F(f3, f3, f3);
            tessellator.AddVertexWithUV(0.0F, Height, ZLevel, 0.0F, f * f2);
            tessellator.AddVertexWithUV(i, Height, ZLevel, (float)i * f2, f * f2);
            tessellator.AddVertexWithUV(i, 0.0F, ZLevel, (float)i * f2, f1 * f2);
            tessellator.AddVertexWithUV(0.0F, 0.0F, ZLevel, 0.0F, f1 * f2);
            tessellator.Draw();
        }
        /// <summary>
        /// Used to render a player's name above their head
        /// </summary>
        protected virtual void RenderName(EntityPlayer par1EntityPlayer, double par2, double par4, double par6)
        {
            if (Minecraft.IsGuiEnabled() && par1EntityPlayer != RenderManager.LivingPlayer)
            {
                float f  = 1.6F;
                float f1 = 0.01666667F * f;
                float f2 = par1EntityPlayer.GetDistanceToEntity(RenderManager.LivingPlayer);
                float f3 = par1EntityPlayer.IsSneaking() ? 32F : 64F;

                if (f2 < f3)
                {
                    string s = par1EntityPlayer.Username;

                    if (!par1EntityPlayer.IsSneaking())
                    {
                        if (par1EntityPlayer.IsPlayerSleeping())
                        {
                            RenderLivingLabel(par1EntityPlayer, s, par2, par4 - 1.5D, par6, 64);
                        }
                        else
                        {
                            RenderLivingLabel(par1EntityPlayer, s, par2, par4, par6, 64);
                        }
                    }
                    else
                    {
                        FontRenderer fontrenderer = GetFontRendererFromRenderManager();
                        //GL.PushMatrix();
                        //GL.Translate((float)par2 + 0.0F, (float)par4 + 2.3F, (float)par6);
                        //GL.Normal3(0.0F, 1.0F, 0.0F);
                        //GL.Rotate(-RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F);
                        //GL.Rotate(RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F);
                        //GL.Scale(-f1, -f1, f1);
                        //GL.Disable(EnableCap.Lighting);
                        //GL.Translate(0.0F, 0.25F / f1, 0.0F);
                        //GL.DepthMask(false);
                        //GL.Enable(EnableCap.Blend);
                        //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                        Tessellator tessellator = Tessellator.Instance;
                        //GL.Disable(EnableCap.Texture2D);
                        tessellator.StartDrawingQuads();
                        int i = fontrenderer.GetStringWidth(s) / 2;
                        tessellator.SetColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
                        tessellator.AddVertex(-i - 1, -1D, 0.0F);
                        tessellator.AddVertex(-i - 1, 8D, 0.0F);
                        tessellator.AddVertex(i + 1, 8D, 0.0F);
                        tessellator.AddVertex(i + 1, -1D, 0.0F);
                        tessellator.Draw();
                        //GL.Enable(EnableCap.Texture2D);
                        //GL.DepthMask(true);
                        fontrenderer.DrawString(s, -fontrenderer.GetStringWidth(s) / 2, 0, 0x20ffffff);
                        //GL.Enable(EnableCap.Lighting);
                        //GL.Disable(EnableCap.Blend);
                        //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                        //GL.PopMatrix();
                    }
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Draws the debug or playername text above a living
        /// </summary>
        protected virtual void RenderLivingLabel(EntityLiving par1EntityLiving, string par2Str, double par3, double par5, double par7, int par9)
        {
            float f = par1EntityLiving.GetDistanceToEntity(RenderManager.LivingPlayer);

            if (f > (float)par9)
            {
                return;
            }

            FontRenderer fontrenderer = GetFontRendererFromRenderManager();
            float        f1           = 1.6F;
            float        f2           = 0.01666667F * f1;
            //GL.PushMatrix();
            //GL.Translate((float)par3 + 0.0F, (float)par5 + 2.3F, (float)par7);
            //GL.Normal3(0.0F, 1.0F, 0.0F);
            //GL.Rotate(-RenderManager.PlayerViewY, 0.0F, 1.0F, 0.0F);
            //GL.Rotate(RenderManager.PlayerViewX, 1.0F, 0.0F, 0.0F);
            //GL.Scale(-f2, -f2, f2);
            //GL.Disable(EnableCap.Lighting);
            //GL.DepthMask(false);
            //GL.Disable(EnableCap.DepthTest);
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            Tessellator tessellator = Tessellator.Instance;
            sbyte       byte0       = 0;

            if (par2Str.Equals("deadmau5"))
            {
                byte0 = -10;
            }

            //GL.Disable(EnableCap.Texture2D);
            tessellator.StartDrawingQuads();
            int i = fontrenderer.GetStringWidth(par2Str) / 2;

            tessellator.SetColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
            tessellator.AddVertex(-i - 1, -1 + byte0, 0.0F);
            tessellator.AddVertex(-i - 1, 8 + byte0, 0.0F);
            tessellator.AddVertex(i + 1, 8 + byte0, 0.0F);
            tessellator.AddVertex(i + 1, -1 + byte0, 0.0F);
            tessellator.Draw();
            //GL.Enable(EnableCap.Texture2D);
            fontrenderer.DrawString(par2Str, -fontrenderer.GetStringWidth(par2Str) / 2, byte0, 0x20ffffff);
            //GL.Enable(EnableCap.DepthTest);
            //GL.DepthMask(true);
            fontrenderer.DrawString(par2Str, -fontrenderer.GetStringWidth(par2Str) / 2, byte0, -1);
            //GL.Enable(EnableCap.Lighting);
            //GL.Disable(EnableCap.Blend);
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.PopMatrix();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Renders a shadow projected down onto the specified block. Brightness of the block plus how far away on the Y axis
        /// determines the alpha of the shadow.  Args: block, centerX, centerY, centerZ, blockX, blockY, blockZ, baseAlpha,
        /// shadowSize, xOffset, yOffset, zOffset
        /// </summary>
        private void RenderShadowOnBlock(Block par1Block, double par2, double par4, double par6, int par8, int par9, int par10, float par11, float par12, double par13, double par15, double par17)
        {
            Tessellator tessellator = Tessellator.Instance;

            if (!par1Block.RenderAsNormalBlock())
            {
                return;
            }

            double d = ((double)par11 - (par4 - ((double)par9 + par15)) / 2D) * 0.5D * (double)GetWorldFromRenderManager().GetLightBrightness(par8, par9, par10);

            if (d < 0.0F)
            {
                return;
            }

            if (d > 1.0D)
            {
                d = 1.0D;
            }

            tessellator.SetColorRGBA_F(1.0F, 1.0F, 1.0F, (float)d);
            double d1 = (double)par8 + par1Block.MinX + par13;
            double d2 = (double)par8 + par1Block.MaxX + par13;
            double d3 = (double)par9 + par1Block.MinY + par15 + 0.015625D;
            double d4 = (double)par10 + par1Block.MinZ + par17;
            double d5 = (double)par10 + par1Block.MaxZ + par17;
            float  f  = (float)((par2 - d1) / 2D / (double)par12 + 0.5D);
            float  f1 = (float)((par2 - d2) / 2D / (double)par12 + 0.5D);
            float  f2 = (float)((par6 - d4) / 2D / (double)par12 + 0.5D);
            float  f3 = (float)((par6 - d5) / 2D / (double)par12 + 0.5D);

            tessellator.AddVertexWithUV(d1, d3, d4, f, f2);
            tessellator.AddVertexWithUV(d1, d3, d5, f, f3);
            tessellator.AddVertexWithUV(d2, d3, d5, f1, f3);
            tessellator.AddVertexWithUV(d2, d3, d4, f1, f2);
        }
        public override void RenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
        {
            int i = (int)((((float)Field_35130_a + par2) * 15F) / (float)Field_35129_ay);

            if (i > 15)
            {
                return;
            }
            else
            {
                Field_35128_az.BindTexture("misc.explosion.png");
                float f  = (float)(i % 4) / 4F;
                float f1 = f + 0.24975F;
                float f2 = (float)(i / 4) / 4F;
                float f3 = f2 + 0.24975F;
                float f4 = 2.0F * Field_35131_aA;
                float f5 = (float)((PrevPosX + (PosX - PrevPosX) * (double)par2) - InterpPosX);
                float f6 = (float)((PrevPosY + (PosY - PrevPosY) * (double)par2) - InterpPosY);
                float f7 = (float)((PrevPosZ + (PosZ - PrevPosZ) * (double)par2) - InterpPosZ);
                //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
                //GL.Disable(EnableCap.Lighting);
                RenderHelper.DisableStandardItemLighting();
                par1Tessellator.StartDrawingQuads();
                par1Tessellator.SetColorRGBA_F(ParticleRed, ParticleGreen, ParticleBlue, 1.0F);
                par1Tessellator.SetNormal(0.0F, 1.0F, 0.0F);
                par1Tessellator.SetBrightness(240);
                par1Tessellator.AddVertexWithUV(f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3);
                par1Tessellator.AddVertexWithUV((f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2);
                par1Tessellator.AddVertexWithUV(f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2);
                par1Tessellator.AddVertexWithUV((f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3);
                par1Tessellator.Draw();
                //GL.PolygonOffset(0.0F, 0.0F);
                //GL.Enable(EnableCap.Lighting);
                return;
            }
        }
        public virtual void Func_40446_a(TileEntityEndPortal par1TileEntityEndPortal, double par2, double par4, double par6, float par8)
        {
            float f  = (float)TileEntityRenderer.PlayerX;
            float f1 = (float)TileEntityRenderer.PlayerY;
            float f2 = (float)TileEntityRenderer.PlayerZ;
            //GL.Disable(EnableCap.Lighting);
            Random random = new Random(31100);
            float  f3     = 0.75F;

            for (int i = 0; i < 16; i++)
            {
                //GL.PushMatrix();
                float f4 = 16 - i;
                float f5 = 0.0625F;
                float f6 = 1.0F / (f4 + 1.0F);

                if (i == 0)
                {
                    BindTextureByName("/misc/tunnel.png");
                    f6 = 0.1F;
                    f4 = 65F;
                    f5 = 0.125F;
                    //GL.Enable(EnableCap.Blend);
                    //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                }

                if (i == 1)
                {
                    BindTextureByName("/misc/particlefield.png");
                    //GL.Enable(EnableCap.Blend);
                    //GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
                    f5 = 0.5F;
                }

                float f7  = (float)(-(par4 + (double)f3));
                float f8  = f7 + ActiveRenderInfo.ObjectY;
                float f9  = f7 + f4 + ActiveRenderInfo.ObjectY;
                float f10 = f8 / f9;
                f10 = (float)(par4 + (double)f3) + f10;
                //GL.Translate(f, f10, f2);
                //GL.TexGen(TextureCoordName.S, TextureGenParameter.TextureGenMode, (int)TextureGenMode.ObjectLinear);
                //GL.TexGen(TextureCoordName.T, TextureGenParameter.TextureGenMode, (int)TextureGenMode.ObjectLinear);
                //GL.TexGen(TextureCoordName.R, TextureGenParameter.TextureGenMode, (int)TextureGenMode.ObjectLinear);
                //GL.TexGen(TextureCoordName.Q, TextureGenParameter.TextureGenMode, (int)TextureGenMode.EyeLinear);/*
                //GL.TexGen(TextureCoordName.S, TextureGenParameter.ObjectPlane, Func_40447_a(1.0F, 0.0F, 0.0F, 0.0F));
                //GL.TexGen(TextureCoordName.T, TextureGenParameter.ObjectPlane, Func_40447_a(0.0F, 0.0F, 1.0F, 0.0F));
                //GL.TexGen(TextureCoordName.R, TextureGenParameter.ObjectPlane, Func_40447_a(0.0F, 0.0F, 0.0F, 1.0F));
                //GL.TexGen(TextureCoordName.Q, TextureGenParameter.EyePlane, Func_40447_a(0.0F, 1.0F, 0.0F, 0.0F));*/
                //GL.Enable(EnableCap.TextureGenS);
                //GL.Enable(EnableCap.TextureGenT);
                //GL.Enable(EnableCap.TextureGenR);
                //GL.Enable(EnableCap.TextureGenQ);
                //GL.PopMatrix();
                //GL.MatrixMode(MatrixMode.Texture);
                //GL.PushMatrix();
                //GL.LoadIdentity();
                //GL.Translate(0.0F, (float)(JavaHelper.CurrentTimeMillis() % 0xaae60L) / 700000F, 0.0F);
                //GL.Scale(f5, f5, f5);
                //GL.Translate(0.5F, 0.5F, 0.0F);
                //GL.Rotate((float)(i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
                //GL.Translate(-0.5F, -0.5F, 0.0F);
                //GL.Translate(-f, -f2, -f1);
                f8 = f7 + ActiveRenderInfo.ObjectY;
                //GL.Translate((ActiveRenderInfo.ObjectX * f4) / f8, (ActiveRenderInfo.ObjectZ * f4) / f8, -f1);
                Tessellator tessellator = Tessellator.Instance;
                tessellator.StartDrawingQuads();
                f10 = random.NextFloat() * 0.5F + 0.1F;
                float f11 = random.NextFloat() * 0.5F + 0.4F;
                float f12 = random.NextFloat() * 0.5F + 0.5F;

                if (i == 0)
                {
                    f10 = f11 = f12 = 1.0F;
                }

                tessellator.SetColorRGBA_F(f10 * f6, f11 * f6, f12 * f6, 1.0F);
                tessellator.AddVertex(par2, par4 + (double)f3, par6);
                tessellator.AddVertex(par2, par4 + (double)f3, par6 + 1.0D);
                tessellator.AddVertex(par2 + 1.0D, par4 + (double)f3, par6 + 1.0D);
                tessellator.AddVertex(par2 + 1.0D, par4 + (double)f3, par6);
                tessellator.Draw();
                //GL.PopMatrix();
                //GL.MatrixMode(MatrixMode.Modelview);
            }

            //GL.Disable(EnableCap.Blend);
            //GL.Disable(EnableCap.TextureGenS);
            //GL.Disable(EnableCap.TextureGenT);
            //GL.Disable(EnableCap.TextureGenR);
            //GL.Disable(EnableCap.TextureGenQ);
            //GL.Enable(EnableCap.Lighting);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Draws the screen and all the components in it.
        /// </summary>
        public override void DrawScreen(int par1, int par2, float par3)
        {
            Func_41040_b(par1, par2, par3);
            Tessellator tessellator = Tessellator.Instance;
            int         c           = 274;
            int         i           = Width / 2 - c / 2;
            int         j           = Height + 50;
            float       f           = -((float)UpdateCounter + par3) * Field_41043_e;

            //GL.PushMatrix();
            //GL.Translate(0.0F, f, 0.0F);
            //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("/title/mclogo.png"));
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            DrawTexturedModalRect(i, j, 0, 0, 155, 44);
            DrawTexturedModalRect(i + 155, j, 0, 45, 155, 44);
            tessellator.SetColorOpaque_I(0xffffff);
            int k = j + 200;

            for (int l = 0; l < Lines.Count; l++)
            {
                if (l == Lines.Count - 1)
                {
                    float f1 = ((float)k + f) - (float)(Height / 2 - 6);

                    if (f1 < 0.0F)
                    {
                        //GL.Translate(0.0F, -f1, 0.0F);
                    }
                }

                if ((float)k + f + 12F + 8F > 0.0F && (float)k + f < (float)Height)
                {
                    string s = (string)Lines[l];

                    if (s.StartsWith("[C]"))
                    {
                        FontRenderer.DrawStringWithShadow(s.Substring(3), i + (c - (int)FontRenderer.GetStringWidth(s.Substring(3))) / 2, k, 0xffffff);
                    }
                    else
                    {
                        FontRenderer.FontRandom.SetSeed((int)l * (int)0xfca9953 + (UpdateCounter / 4));
                        FontRenderer.Func_50101_a(s, i + 1, k + 1, 0xffffff, true);
                        FontRenderer.FontRandom.SetSeed((int)l * (int)0xfca9953 + (UpdateCounter / 4));
                        FontRenderer.Func_50101_a(s, i, k, 0xffffff, false);
                    }
                }

                k += 12;
            }

            //GL.PopMatrix();
            //GL.BindTexture(TextureTarget.Texture2D, Mc.RenderEngineOld.GetTexture("%blur%/misc/vignette.png"));
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.Zero, BlendingFactorDest.OneMinusSrcColor);
            tessellator.StartDrawingQuads();
            tessellator.SetColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
            int i1 = Width;
            int j1 = Height;

            tessellator.AddVertexWithUV(0.0F, j1, ZLevel, 0.0F, 1.0D);
            tessellator.AddVertexWithUV(i1, j1, ZLevel, 1.0D, 1.0D);
            tessellator.AddVertexWithUV(i1, 0.0F, ZLevel, 1.0D, 0.0F);
            tessellator.AddVertexWithUV(0.0F, 0.0F, ZLevel, 0.0F, 0.0F);
            tessellator.Draw();
            //GL.Disable(EnableCap.Blend);
            base.DrawScreen(par1, par2, par3);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Actually renders the lightning bolt. This method is called through the doRender method.
        /// </summary>
        public virtual void DoRenderLightningBolt(EntityLightningBolt par1EntityLightningBolt, double par2, double par4, double par6, float par8, float par9)
        {
            Tessellator tessellator = Tessellator.Instance;

            //GL.Disable(EnableCap.Texture2D);
            //GL.Disable(EnableCap.Lighting);
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One);
            double[] ad     = new double[8];
            double[] ad1    = new double[8];
            double   d      = 0.0F;
            double   d1     = 0.0F;
            Random   random = new Random((int)par1EntityLightningBolt.BoltVertex);

            for (int j = 7; j >= 0; j--)
            {
                ad[j]  = d;
                ad1[j] = d1;
                d     += random.Next(11) - 5;
                d1    += random.Next(11) - 5;
            }

            for (int i = 0; i < 4; i++)
            {
                Random random1 = new Random((int)par1EntityLightningBolt.BoltVertex);

                for (int k = 0; k < 3; k++)
                {
                    int l  = 7;
                    int i1 = 0;

                    if (k > 0)
                    {
                        l = 7 - k;
                    }

                    if (k > 0)
                    {
                        i1 = l - 2;
                    }

                    double d2 = ad[l] - d;
                    double d3 = ad1[l] - d1;

                    for (int j1 = l; j1 >= i1; j1--)
                    {
                        double d4 = d2;
                        double d5 = d3;

                        if (k == 0)
                        {
                            d2 += random1.Next(11) - 5;
                            d3 += random1.Next(11) - 5;
                        }
                        else
                        {
                            d2 += random1.Next(31) - 15;
                            d3 += random1.Next(31) - 15;
                        }

                        tessellator.StartDrawing(5);
                        float f = 0.5F;
                        tessellator.SetColorRGBA_F(0.9F * f, 0.9F * f, 1.0F * f, 0.3F);
                        double d6 = 0.10000000000000001D + (double)i * 0.20000000000000001D;

                        if (k == 0)
                        {
                            d6 *= (double)j1 * 0.10000000000000001D + 1.0D;
                        }

                        double d7 = 0.10000000000000001D + (double)i * 0.20000000000000001D;

                        if (k == 0)
                        {
                            d7 *= (double)(j1 - 1) * 0.10000000000000001D + 1.0D;
                        }

                        for (int k1 = 0; k1 < 5; k1++)
                        {
                            double d8 = (par2 + 0.5D) - d6;
                            double d9 = (par6 + 0.5D) - d6;

                            if (k1 == 1 || k1 == 2)
                            {
                                d8 += d6 * 2D;
                            }

                            if (k1 == 2 || k1 == 3)
                            {
                                d9 += d6 * 2D;
                            }

                            double d10 = (par2 + 0.5D) - d7;
                            double d11 = (par6 + 0.5D) - d7;

                            if (k1 == 1 || k1 == 2)
                            {
                                d10 += d7 * 2D;
                            }

                            if (k1 == 2 || k1 == 3)
                            {
                                d11 += d7 * 2D;
                            }

                            tessellator.AddVertex(d10 + d2, par4 + (double)(j1 * 16), d11 + d3);
                            tessellator.AddVertex(d8 + d4, par4 + (double)((j1 + 1) * 16), d9 + d5);
                        }

                        tessellator.Draw();
                    }
                }
            }

            //GL.Disable(EnableCap.Blend);
            //GL.Enable(EnableCap.Lighting);
            //GL.Enable(EnableCap.Texture2D);
        }