EffectRenderer.java 文件源码

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

项目:Cauldron 作者:
public void renderParticles(Entity p_78874_1_, float p_78874_2_)
{
    float f1 = ActiveRenderInfo.rotationX;
    float f2 = ActiveRenderInfo.rotationZ;
    float f3 = ActiveRenderInfo.rotationYZ;
    float f4 = ActiveRenderInfo.rotationXY;
    float f5 = ActiveRenderInfo.rotationXZ;
    EntityFX.interpPosX = p_78874_1_.lastTickPosX + (p_78874_1_.posX - p_78874_1_.lastTickPosX) * (double)p_78874_2_;
    EntityFX.interpPosY = p_78874_1_.lastTickPosY + (p_78874_1_.posY - p_78874_1_.lastTickPosY) * (double)p_78874_2_;
    EntityFX.interpPosZ = p_78874_1_.lastTickPosZ + (p_78874_1_.posZ - p_78874_1_.lastTickPosZ) * (double)p_78874_2_;

    for (int k = 0; k < 3; ++k)
    {
        final int i = k;

        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)
            {
                final EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j);
                if (entityfx == null) continue;
                tessellator.setBrightness(entityfx.getBrightnessForRender(p_78874_2_));

                try
                {
                    entityfx.renderParticle(tessellator, p_78874_2_, f1, f5, f2, f3, f4);
                }
                catch (Throwable throwable)
                {
                    CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Particle");
                    CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being rendered");
                    crashreportcategory.addCrashSectionCallable("Particle", new Callable()
                    {
                        private static final String __OBFID = "CL_00000918";
                        public String call()
                        {
                            return entityfx.toString();
                        }
                    });
                    crashreportcategory.addCrashSectionCallable("Particle Type", new Callable()
                    {
                        private static final String __OBFID = "CL_00000919";
                        public String call()
                        {
                            return i == 0 ? "MISC_TEXTURE" : (i == 1 ? "TERRAIN_TEXTURE" : (i == 2 ? "ITEM_TEXTURE" : (i == 3 ? "ENTITY_PARTICLE_TEXTURE" : "Unknown - " + i)));
                        }
                    });
                    throw new ReportedException(crashreport);
                }
            }

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


问题


面经


文章

微信
公众号

扫码关注公众号