EffectRenderer.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:BetterNutritionMod 作者:
/**
 * Renders all current particles. Args player, partialTickTime
 */
public void renderParticles(Entity par1Entity, float par2)
{
    float f1 = ActiveRenderInfo.rotationX;
    float f2 = ActiveRenderInfo.rotationZ;
    float f3 = ActiveRenderInfo.rotationYZ;
    float f4 = ActiveRenderInfo.rotationXY;
    float f5 = ActiveRenderInfo.rotationXZ;
    EntityFX.interpPosX = par1Entity.lastTickPosX + (par1Entity.posX - par1Entity.lastTickPosX) * (double)par2;
    EntityFX.interpPosY = par1Entity.lastTickPosY + (par1Entity.posY - par1Entity.lastTickPosY) * (double)par2;
    EntityFX.interpPosZ = par1Entity.lastTickPosZ + (par1Entity.posZ - par1Entity.lastTickPosZ) * (double)par2;

    for (int i = 0; i < 3; ++i)
    {
        if (!this.fxLayers[i].isEmpty())
        {
            switch (i)
            {
                case 0:
                default:
                    this.renderer.bindTexture(particleTextures);
                    break;
                case 1:
                    this.renderer.bindTexture(TextureMap.locationBlocksTexture);
                    break;
                case 2:
                    this.renderer.bindTexture(TextureMap.locationItemsTexture);
            }

            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glDepthMask(false);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
            Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();

            for (int j = 0; j < this.fxLayers[i].size(); ++j)
            {
                EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j);
                if (entityfx == null) continue;
                tessellator.setBrightness(entityfx.getBrightnessForRender(par2));
                entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4);
            }

            tessellator.draw();
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glDepthMask(true);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号