コード例 #1
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);
        }
コード例 #2
0
        /// <summary>
        /// loads the specified downloadable texture or alternative built in texture
        /// </summary>
        protected virtual bool LoadDownloadableImageTexture(string par1Str, string par2Str)
        {
            RenderEngine renderengine = RenderManager.RenderEngine;
            string       i            = renderengine.GetTextureForDownloadableImage(par1Str, par2Str);

            if (i == "")
            {
                renderengine.BindTexture(i);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        private float Func_50111_a(char par1, bool par2)
        {
            if (glyphWidth[par1] == 0)
            {
                return(0.0F);
            }

            int i = par1 / 256;

            if (glyphTextureName[i] == "")
            {
                LoadGlyphTexture(i);
            }

            if (boundTextureName != glyphTextureName[i])
            {
                //GL.BindTexture(TextureTarget.Texture2D, glyphTextureName[i]);
                renderEngine.BindTexture(glyphTextureName[i]);
                boundTextureName = glyphTextureName[i];
            }

            int   j  = (int)((uint)glyphWidth[par1] >> 4);
            int   k  = glyphWidth[par1] & 0xf;
            float f  = j;
            float f1 = k + 1;
            float f2 = (float)((par1 % 16) * 16) + f;
            float f3 = ((par1 & 0xff) / 16) * 16;
            float f4 = f1 - f - 0.02F;
            float f5 = par2 ? 1.0F : 0.0F;/*
                                           * GL.Begin(BeginMode.TriangleStrip);
                                           * GL.TexCoord2(f2 / 256F, f3 / 256F);
                                           * GL.Vertex3(posX + f5, posY, 0.0F);
                                           * GL.TexCoord2(f2 / 256F, (f3 + 15.98F) / 256F);
                                           * GL.Vertex3(posX - f5, posY + 7.99F, 0.0F);
                                           * GL.TexCoord2((f2 + f4) / 256F, f3 / 256F);
                                           * GL.Vertex3(posX + f4 / 2.0F + f5, posY, 0.0F);
                                           * GL.TexCoord2((f2 + f4) / 256F, (f3 + 15.98F) / 256F);
                                           * GL.Vertex3((posX + f4 / 2.0F) - f5, posY + 7.99F, 0.0F);
                                           * GL.End();*/

            renderEngine.RenderSprite(new Rectangle((int)posX, (int)posY, (int)f5, 8), new RectangleF(f2, f3, f4, 16));

            return((f1 - f) / 2.0F + 1.0F);
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
        /// <summary>
        /// loads the specified texture
        /// </summary>
        protected virtual void LoadTexture(string par1Str)
        {
            RenderEngine renderengine = RenderManager.RenderEngine;

            renderengine.BindTexture(par1Str);
        }
コード例 #6
0
        /// <summary>
        /// Renders the entity shadows at the position, shadow alpha and partialTickTime. Args: entity, x, y, z, shadowAlpha,
        /// partialTickTime
        /// </summary>
        private void RenderShadow(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
        {
            //GL.Enable(EnableCap.Blend);
            //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            RenderEngine renderengine = RenderManager.RenderEngine;

            renderengine.BindTexture("misc.shadow.png", TextureMode.Clamp);
            World world = GetWorldFromRenderManager();
            //GL.DepthMask(false);
            float f = ShadowSize;

            if (par1Entity is EntityLiving)
            {
                EntityLiving entityliving = (EntityLiving)par1Entity;
                f *= entityliving.GetRenderSizeModifier();

                if (entityliving is EntityAnimal)
                {
                    EntityAnimal entityanimal = (EntityAnimal)entityliving;

                    if (entityanimal.IsChild())
                    {
                        f *= 0.5F;
                    }
                }
            }

            double      d           = par1Entity.LastTickPosX + (par1Entity.PosX - par1Entity.LastTickPosX) * (double)par9;
            double      d1          = par1Entity.LastTickPosY + (par1Entity.PosY - par1Entity.LastTickPosY) * (double)par9 + (double)par1Entity.GetShadowSize();
            double      d2          = par1Entity.LastTickPosZ + (par1Entity.PosZ - par1Entity.LastTickPosZ) * (double)par9;
            int         i           = MathHelper2.Floor_double(d - (double)f);
            int         j           = MathHelper2.Floor_double(d + (double)f);
            int         k           = MathHelper2.Floor_double(d1 - (double)f);
            int         l           = MathHelper2.Floor_double(d1);
            int         i1          = MathHelper2.Floor_double(d2 - (double)f);
            int         j1          = MathHelper2.Floor_double(d2 + (double)f);
            double      d3          = par2 - d;
            double      d4          = par4 - d1;
            double      d5          = par6 - d2;
            Tessellator tessellator = Tessellator.Instance;

            tessellator.StartDrawingQuads();

            for (int k1 = i; k1 <= j; k1++)
            {
                for (int l1 = k; l1 <= l; l1++)
                {
                    for (int i2 = i1; i2 <= j1; i2++)
                    {
                        int j2 = world.GetBlockId(k1, l1 - 1, i2);

                        if (j2 > 0 && world.GetBlockLightValue(k1, l1, i2) > 3)
                        {
                            RenderShadowOnBlock(Block.BlocksList[j2], par2, par4 + (double)par1Entity.GetShadowSize(), par6, k1, l1, i2, par8, f, d3, d4 + (double)par1Entity.GetShadowSize(), d5);
                        }
                    }
                }
            }

            tessellator.Draw();
            //GL.Color4(1.0F, 1.0F, 1.0F, 1.0F);
            //GL.Disable(EnableCap.Blend);
            //GL.DepthMask(true);
        }