java类net.minecraft.client.renderer.ActiveRenderInfo的实例源码

ParticleEngine.java 文件源码 项目:ExPetrum 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void renderTick(float partialTicks)
{
    Minecraft.getMinecraft().mcProfiler.startSection("expParticleDraw");
    Minecraft.getMinecraft().renderEngine.bindTexture(ExPTextures.PARTICLES);
    BufferBuilder bb = Tessellator.getInstance().getBuffer();
    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();
    bb.begin(GL11.GL_QUADS, this.getDrawFormat());
    particles.get(BlockRenderLayer.SOLID).forEach(p -> p.draw(bb, partialTicks, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationYZ(), ActiveRenderInfo.getRotationXY()));
    Tessellator.getInstance().draw();
    GlStateManager.enableAlpha();
    GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
    bb.begin(GL11.GL_QUADS, this.getDrawFormat());
    particles.get(BlockRenderLayer.CUTOUT).forEach(p -> p.draw(bb, partialTicks, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationYZ(), ActiveRenderInfo.getRotationXY()));
    Tessellator.getInstance().draw();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    bb.begin(GL11.GL_QUADS, this.getDrawFormat());
    particles.get(BlockRenderLayer.TRANSLUCENT).forEach(p -> p.draw(bb, partialTicks, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationYZ(), ActiveRenderInfo.getRotationXY()));
    Tessellator.getInstance().draw();
    Minecraft.getMinecraft().mcProfiler.endSection();
}
ClientEventHandler.java 文件源码 项目:Possessed 阅读 26 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onRenderFog(EntityViewRenderEvent.FogDensity event) {
    if (event.getEntity() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntity();
        PossessivePlayer possessivePlayer = PossessHandler.get(player);
        if (possessivePlayer != null && (possessivePlayer.getPossessing().canBreatheUnderwater() || possessivePlayer.getPossessing() instanceof EntityGuardian)) {
            if (ActiveRenderInfo.getBlockStateAtEntityViewpoint(ClientEventHandler.MINECRAFT.theWorld, player, (float) event.getRenderPartialTicks()).getMaterial() != Material.WATER) {
                GlStateManager.setFog(GlStateManager.FogMode.EXP);
                event.setDensity(0.125F);
                event.setCanceled(true);
            } else {
                GlStateManager.setFog(GlStateManager.FogMode.EXP);
                event.setDensity(0.02F);
                event.setCanceled(true);
            }
        }
    }
}
FogEffectHandler.java 文件源码 项目:DynamicSurroundings 阅读 32 收藏 0 点赞 0 评论 0
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void fogColorEvent(final EntityViewRenderEvent.FogColors event) {
    if (doFog()) {
        final IBlockState block = ActiveRenderInfo.getBlockStateAtEntityViewpoint(event.getEntity().world,
                event.getEntity(), (float) event.getRenderPartialTicks());
        if (block.getMaterial() == Material.LAVA || block.getMaterial() == Material.WATER)
            return;

        final Color color = this.scanner.getFogColor(EnvironState.getWorld(),
                (float) event.getRenderPartialTicks());
        if (color != null) {
            event.setRed(color.red);
            event.setGreen(color.green);
            event.setBlue(color.blue);
        }
    }
}
RenderParticle.java 文件源码 项目:Translocators 阅读 19 收藏 0 点赞 0 评论 0
public static void render(double x, double y, double z, Colour colour, double s, double u1, double v1, double u2, double v2) {
    x -= Particle.interpPosX;
    y -= Particle.interpPosY;
    z -= Particle.interpPosZ;

    float par3 = ActiveRenderInfo.getRotationX();
    float par4 = ActiveRenderInfo.getRotationXZ();
    float par5 = ActiveRenderInfo.getRotationZ();
    float par6 = ActiveRenderInfo.getRotationYZ();
    float par7 = ActiveRenderInfo.getRotationXY();

    VertexBuffer b = Tessellator.getInstance().getBuffer();
    b.pos((x - par3 * s - par6 * s), (y - par4 * s), (z - par5 * s - par7 * s)).tex(u2, v2).color(colour.r & 0xFF, colour.g & 0xFF, colour.b & 0xFF, colour.a & 0xFF).endVertex();
    b.pos((x - par3 * s + par6 * s), (y + par4 * s), (z - par5 * s + par7 * s)).tex(u2, v1).color(colour.r & 0xFF, colour.g & 0xFF, colour.b & 0xFF, colour.a & 0xFF).endVertex();
    b.pos((x + par3 * s + par6 * s), (y + par4 * s), (z + par5 * s + par7 * s)).tex(u1, v1).color(colour.r & 0xFF, colour.g & 0xFF, colour.b & 0xFF, colour.a & 0xFF).endVertex();
    b.pos((x + par3 * s - par6 * s), (y - par4 * s), (z + par5 * s - par7 * s)).tex(u1, v2).color(colour.r & 0xFF, colour.g & 0xFF, colour.b & 0xFF, colour.a & 0xFF).endVertex();
}
EntityRenderer.java 文件源码 项目:RuneCraftery 阅读 20 收藏 0 点赞 0 评论 0
private float func_78481_a(float p_78481_1_, boolean p_78481_2_) {
   if(this.field_78532_q > 0) {
      return 90.0F;
   } else {
      EntityPlayer var3 = (EntityPlayer)this.field_78531_r.field_71451_h;
      float var4 = 70.0F;
      if(p_78481_2_) {
         var4 += this.field_78531_r.field_71474_y.field_74334_X * 40.0F;
         var4 *= this.field_78506_S + (this.field_78507_R - this.field_78506_S) * p_78481_1_;
      }

      if(var3.func_110143_aJ() <= 0.0F) {
         float var5 = (float)var3.field_70725_aQ + p_78481_1_;
         var4 /= (1.0F - 500.0F / (var5 + 500.0F)) * 2.0F + 1.0F;
      }

      int var6 = ActiveRenderInfo.func_74584_a(this.field_78531_r.field_71441_e, var3, p_78481_1_);
      if(var6 != 0 && Block.field_71973_m[var6].field_72018_cp == Material.field_76244_g) {
         var4 = var4 * 60.0F / 70.0F;
      }

      return var4 + this.field_78494_N + (this.field_78493_M - this.field_78494_N) * p_78481_1_;
   }
}
ParticleRenderer.java 文件源码 项目:EndermanEvolution 阅读 25 收藏 0 点赞 0 评论 0
public void renderParticles(EntityPlayer dumbplayer, float partialTicks) {
    float f = ActiveRenderInfo.getRotationX();
    float f1 = ActiveRenderInfo.getRotationZ();
    float f2 = ActiveRenderInfo.getRotationYZ();
    float f3 = ActiveRenderInfo.getRotationXY();
    float f4 = ActiveRenderInfo.getRotationXZ();
    EntityPlayer player = EasyMappings.player();
    if (player != null) {
        Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
        Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
        Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;

        Particle.cameraViewDir = player.getLook(partialTicks);
        //GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
        //GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
        GlStateManager.enableAlpha();
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
        //GlStateManager.alphaFunc(GL11.GL_GREATER, 0F);
        GlStateManager.disableCull();

        GlStateManager.depthMask(false);

        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        Tessellator tess = Tessellator.getInstance();
        BufferBuilder buffer = tess.getBuffer();
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
        for (int i = 0; i < particles.size(); i++) {
            particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
        }
        tess.draw();

        GlStateManager.enableCull();
        GlStateManager.depthMask(true);
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.disableBlend();
        //GlStateManager.alphaFunc(516, 0.1F);
    }
}
FogEventHandler.java 文件源码 项目:Proxys-Lib 阅读 20 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onGetFogColor(EntityViewRenderEvent.FogColors event)
{
    if (event.getEntity() instanceof EntityPlayer)
    {
        EntityPlayer player = (EntityPlayer) event.getEntity();
        World world = player.world;

        int x = MathHelper.floor(player.posX);
        int y = MathHelper.floor(player.posY);
        int z = MathHelper.floor(player.posZ);

        IBlockState stateAtEyes = ActiveRenderInfo.getBlockStateAtEntityViewpoint(world, event.getEntity(), (float) event.getRenderPartialTicks());
        if (stateAtEyes.getMaterial() == Material.LAVA)
        {
            return;
        }

        Vec3d mixedColor;
        if (stateAtEyes.getMaterial() == Material.WATER)
        {
            mixedColor = getFogBlendColorWater(world, player, x, y, z, event.getRenderPartialTicks());
        } else
        {
            mixedColor = getFogBlendColour(world, player, x, y, z, event.getRed(), event.getGreen(), event.getBlue(), event.getRenderPartialTicks());
        }

        event.setRed((float) mixedColor.x);
        event.setGreen((float) mixedColor.y);
        event.setBlue((float) mixedColor.z);
    }
}
PlanetEventHandler.java 文件源码 项目:AdvancedRocketry 阅读 28 收藏 0 点赞 0 评论 0
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void fogColor(net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event) {



    Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(event.entity.worldObj, event.entity, (float)event.renderPartialTicks);
    if(block.getMaterial() == Material.water)
        return;

    DimensionProperties properties = DimensionManager.getInstance().getDimensionProperties(event.entity.dimension);
    if(properties != null) {
        float fog = properties.getAtmosphereDensityAtHeight(event.entity.posY);

        if(event.entity.worldObj.provider instanceof IPlanetaryProvider) {
            Vec3 color = event.entity.worldObj.provider.getSkyColor(event.entity, 0f);
            event.red = (float) Math.min(color.xCoord*1.4f,1f);
            event.green = (float) Math.min(color.yCoord*1.4f, 1f);
            event.blue = (float) Math.min(color.zCoord*1.4f, 1f);
        }

        if(endTime > 0) {
            double amt = (endTime - Minecraft.getMinecraft().theWorld.getTotalWorldTime()) / (double)duration;
            if(amt < 0) {
                endTime = 0;
            }
            else
                event.green = event.blue = event.red = (float)amt;

        } else {
            event.red *= fog;
            event.green *= fog;
            event.blue *= fog;
        }
    }
}
ItemRenderFamiliar.java 文件源码 项目:Gadomancy 阅读 17 收藏 0 点赞 0 评论 0
private void cleanActiveRenderInfo(ItemRenderType renderType) {
    renderInfo[0] = ActiveRenderInfo.rotationX;
    renderInfo[1] = ActiveRenderInfo.rotationXZ;
    renderInfo[2] = ActiveRenderInfo.rotationZ;
    renderInfo[3] = ActiveRenderInfo.rotationYZ;
    renderInfo[4] = ActiveRenderInfo.rotationXY;
    switch (renderType) {
        case ENTITY:
            break;
        case EQUIPPED:
            ActiveRenderInfo.rotationX = 0.85535365F;
            ActiveRenderInfo.rotationXZ = 0.9868404F;
            ActiveRenderInfo.rotationZ = -0.51804453F;
            ActiveRenderInfo.rotationYZ = 0.083717324F;
            ActiveRenderInfo.rotationXY = 0.13822734F;
            break;
        case EQUIPPED_FIRST_PERSON:
            ActiveRenderInfo.rotationX = -0.4186075F;
            ActiveRenderInfo.rotationXZ = 0.99932945F;
            ActiveRenderInfo.rotationZ = -0.90816724F;
            ActiveRenderInfo.rotationYZ = 0.033253096F;
            ActiveRenderInfo.rotationXY = -0.015327567F;
            break;
        case INVENTORY:
            ActiveRenderInfo.rotationX = -0.71445745F;
            ActiveRenderInfo.rotationXZ = 0.9573291F;
            ActiveRenderInfo.rotationZ = 0.69967884F;
            ActiveRenderInfo.rotationYZ = -0.20220716F;
            ActiveRenderInfo.rotationXY = -0.20647818F;
            break;
        case FIRST_PERSON_MAP:
            break;
    }
}
ItemRenderFamiliar.java 文件源码 项目:Gadomancy 阅读 19 收藏 0 点赞 0 评论 0
private void restoreActiveRenderInfo() {
    if(renderInfo[0] != -1) ActiveRenderInfo.rotationX = renderInfo[0];
    if(renderInfo[1] != -1) ActiveRenderInfo.rotationXZ = renderInfo[1];
    if(renderInfo[2] != -1) ActiveRenderInfo.rotationZ = renderInfo[2];
    if(renderInfo[3] != -1) ActiveRenderInfo.rotationYZ = renderInfo[3];
    if(renderInfo[4] != -1) ActiveRenderInfo.rotationXY = renderInfo[4];
    for (int i = 0; i < renderInfo.length; i++) {
        renderInfo[i] = -1;
    }
}
PrivateAccessor.java 文件源码 项目:mineshot 阅读 25 收藏 0 点赞 0 评论 0
default void setRotationX(float rotationX) {
    try {
        ReflectionHelper.setPrivateValue(ActiveRenderInfo.class, null, rotationX, ACTIVERENDERINFO_ROTATIONX);
    } catch (Exception ex) {
        L.error("setRotationX() failed", ex);
    }
}
PrivateAccessor.java 文件源码 项目:mineshot 阅读 21 收藏 0 点赞 0 评论 0
default void setRotationXZ(float rotationXZ) {
    try {
        ReflectionHelper.setPrivateValue(ActiveRenderInfo.class, null, rotationXZ, ACTIVERENDERINFO_ROTATIONXZ);
    } catch (Exception ex) {
        L.error("setRotationXZ() failed", ex);
    }
}
PrivateAccessor.java 文件源码 项目:mineshot 阅读 20 收藏 0 点赞 0 评论 0
default void setRotationZ(float rotationZ) {
    try {
        ReflectionHelper.setPrivateValue(ActiveRenderInfo.class, null, rotationZ, ACTIVERENDERINFO_ROTATIONZ);
    } catch (Exception ex) {
        L.error("setRotationZ() failed", ex);
    }
}
PrivateAccessor.java 文件源码 项目:mineshot 阅读 21 收藏 0 点赞 0 评论 0
default void setRotationYZ(float rotationYZ) {
    try {
        ReflectionHelper.setPrivateValue(ActiveRenderInfo.class, null, rotationYZ, ACTIVERENDERINFO_ROTATIONYZ);
    } catch (Exception ex) {
        L.error("setRotationYZ() failed", ex);
    }
}
PrivateAccessor.java 文件源码 项目:mineshot 阅读 22 收藏 0 点赞 0 评论 0
default void setRotationXY(float rotationXY) {
    try {
        ReflectionHelper.setPrivateValue(ActiveRenderInfo.class, null, rotationXY, ACTIVERENDERINFO_ROTATIONXY);
    } catch (Exception ex) {
        L.error("setRotationXY() failed", ex);
    }
}
VectorUtils.java 文件源码 项目:ForgeHax 阅读 37 收藏 0 点赞 0 评论 0
/**
 * Convert 3D coord into 2D coordinate projected onto the screen
 */
public static Plane toScreen(double x, double y, double z) {
    Entity view = MC.getRenderViewEntity();

    if(view == null) return new Plane(0.D, 0.D, false);

    Vec3d camPos = FastReflection.Fields.ActiveRenderInfo_position.getStatic();
    Vec3d eyePos = ActiveRenderInfo.projectViewFromEntity(view, MC.getRenderPartialTicks());

    float vecX = (float) ((camPos.x + eyePos.x) - (float)x);
    float vecY = (float) ((camPos.y + eyePos.y) - (float)y);
    float vecZ = (float) ((camPos.z + eyePos.z) - (float)z);

    Vector4f pos = new Vector4f(vecX, vecY, vecZ, 1.f);

    modelMatrix.load(FastReflection.Fields.ActiveRenderInfo_MODELVIEW.getStatic().asReadOnlyBuffer());
    projectionMatrix.load(FastReflection.Fields.ActiveRenderInfo_PROJECTION.getStatic().asReadOnlyBuffer());

    VecTransformCoordinate(pos, modelMatrix);
    VecTransformCoordinate(pos, projectionMatrix);

    if (pos.w > 0.f) {
        pos.x *= -100000;
        pos.y *= -100000;
    } else {
        float invert = 1.f / pos.w;
        pos.x *= invert;
        pos.y *= invert;
    }

    ScaledResolution res = new ScaledResolution(MC);
    float halfWidth = (float)res.getScaledWidth() / 2.f;
    float halfHeight = (float)res.getScaledHeight() / 2.f;

    pos.x = halfWidth + (0.5f * pos.x * res.getScaledWidth() + 0.5f);
    pos.y = halfHeight - (0.5f * pos.y * res.getScaledHeight() + 0.5f);

    boolean bVisible = true;

    if(pos.x < 0 || pos.y < 0 || pos.x > res.getScaledWidth() || pos.y > res.getScaledHeight())
        bVisible = false;

    return new Plane(pos.x, pos.y, bVisible);
}
ParticleRenderer.java 文件源码 项目:Melodium 阅读 23 收藏 0 点赞 0 评论 0
public void renderParticles(EntityPlayer dumbplayer, float partialTicks) {
    float f = ActiveRenderInfo.getRotationX();
       float f1 = ActiveRenderInfo.getRotationZ();
       float f2 = ActiveRenderInfo.getRotationYZ();
       float f3 = ActiveRenderInfo.getRotationXY();
       float f4 = ActiveRenderInfo.getRotationXZ();
       EntityPlayer player = Minecraft.getMinecraft().player;
       if (player != null){
        Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
        Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
        Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
        Particle.cameraViewDir = player.getLook(partialTicks);
        GlStateManager.enableAlpha();
        GlStateManager.enableBlend();
        GlStateManager.alphaFunc(516, 0.003921569F);
           GlStateManager.disableCull();

        GlStateManager.depthMask(false);

        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        Tessellator tess = Tessellator.getInstance();
        VertexBuffer buffer = tess.getBuffer();

        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
        for (int i = 0; i < particles.size(); i ++){
            if (particles.get(i) instanceof IParticle){
                if (!((IParticle)particles.get(i)).isAdditive()){
                    particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
                }
            }
        }
        tess.draw();

        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
        for (int i = 0; i < particles.size(); i ++){
            if (particles.get(i) != null){
                if (((IParticle)particles.get(i)).isAdditive()){
                    particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
                }
            }
        }
        tess.draw();

        GlStateManager.disableDepth();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
        for (int i = 0; i < particles.size(); i ++){
            if (particles.get(i) instanceof IParticle){
                if (!((IParticle)particles.get(i)).isAdditive() && ((IParticle)particles.get(i)).renderThroughBlocks()){
                    particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
                }
            }
        }
        tess.draw();

        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
        for (int i = 0; i < particles.size(); i ++){
            if (particles.get(i) != null){
                if (((IParticle)particles.get(i)).isAdditive() && ((IParticle)particles.get(i)).renderThroughBlocks()){
                    particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
                }
            }
        }
        tess.draw();
        GlStateManager.enableDepth();

           GlStateManager.enableCull();
           GlStateManager.depthMask(true);
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.disableBlend();
        GlStateManager.alphaFunc(516, 0.1F);
       }
}
ParticleRenderer.java 文件源码 项目:LP2 阅读 21 收藏 0 点赞 0 评论 0
public void renderParticles(EntityPlayer aPlayer, float pTicks) {
    float f = ActiveRenderInfo.getRotationX();
       float f1 = ActiveRenderInfo.getRotationZ();
       float f2 = ActiveRenderInfo.getRotationYZ();
       float f3 = ActiveRenderInfo.getRotationXY();
       float f4 = ActiveRenderInfo.getRotationXZ();
       EntityPlayer player = Minecraft.getMinecraft().player;
       if(player!=null) {
        Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * pTicks;
        Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * pTicks;
        Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * pTicks;
        Particle.cameraViewDir = player.getLook(pTicks);
        GlStateManager.enableAlpha();
        GlStateManager.enableBlend();
        GlStateManager.alphaFunc(516, 0.003921569F);
           GlStateManager.disableCull();

           GlStateManager.depthMask(false);

           Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        Tessellator tess = Tessellator.getInstance();
        VertexBuffer buffer = tess.getBuffer();

        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
            buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
            for(int i = 0; i < particles.size(); i ++) {
                if(!((ILP2Particle) particles.get(i)).isAdditive()) {
                    particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3);
                }
            }
            tess.draw();

        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
            buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
            for(int i = 0; i < particles.size(); i ++) {
                if(((ILP2Particle) particles.get(i)).isAdditive()) {
                    particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3);
                }
            }
            tess.draw();

        GlStateManager.enableCull();
           GlStateManager.depthMask(true);
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.disableBlend();
        GlStateManager.alphaFunc(516, 0.1F);
       }
}
FXVortex.java 文件源码 项目:Gadomancy 阅读 22 收藏 0 点赞 0 评论 0
private void render(Tessellator tessellator, float pTicks) {
    float arX = ActiveRenderInfo.rotationX;
    float arXZ = ActiveRenderInfo.rotationXZ;
    float arZ = ActiveRenderInfo.rotationZ;
    float arYZ = ActiveRenderInfo.rotationYZ;
    float arXY = ActiveRenderInfo.rotationXY;

    GL11.glPushMatrix();
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    float agescale = (float) (ClientHandler.ticks % 800) / 400F;
    if(agescale >= 1.0F) agescale = 2 - agescale;
    float size = 0.2F + 0.1F * agescale;
    if(parent != null) {
        size += size * (((float) parent.getSizeStage()) * 0.04F);
    }

    float anglePerc = (float) (ClientHandler.ticks % 300) / 300F;
    float angle = RAD - RAD * anglePerc;

    Vector3 iV = MiscUtils.interpolateEntityPosition(Minecraft.getMinecraft().renderViewEntity, pTicks);
    if(parent != null && parent.getSizeStage() > 4) {
        float mult = 0.001F * (parent.getSizeStage() - 4F);
        Vector3 shake = new Vector3(
                RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1),
                RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1),
                RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1));
        iV.add(shake);
    }

    GL11.glTranslated(-iV.getX(), -iV.getY(), -iV.getZ());

    UtilsFX.bindTexture(TC_VORTEX_TEXTURE);

    tessellator.startDrawingQuads();
    tessellator.setBrightness(220);
    tessellator.setColorRGBA_F(1F, 1F, 1F, 1F);

    Vec3 v1 = Vec3.createVectorHelper(-arX * size - arYZ * size, -arXZ * size, -arZ * size - arXY * size);
    Vec3 v2 = Vec3.createVectorHelper(-arX * size + arYZ * size, arXZ * size, -arZ * size + arXY * size);
    Vec3 v3 = Vec3.createVectorHelper(arX * size + arYZ * size, arXZ * size, arZ * size + arXY * size);
    Vec3 v4 = Vec3.createVectorHelper(arX * size - arYZ * size, -arXZ * size, arZ * size - arXY * size);
    if (angle != 0.0F) {
        Vec3 pvec = Vec3.createVectorHelper(iV.getX(), iV.getY(), iV.getZ());
        Vec3 tvec = Vec3.createVectorHelper(x, y, z);
        Vec3 qvec = pvec.subtract(tvec).normalize();
        QuadHelper.setAxis(qvec, angle).rotate(v1);
        QuadHelper.setAxis(qvec, angle).rotate(v2);
        QuadHelper.setAxis(qvec, angle).rotate(v3);
        QuadHelper.setAxis(qvec, angle).rotate(v4);
    }
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    tessellator.addVertexWithUV(x + v1.xCoord, y + v1.yCoord, z + v1.zCoord, 0, 1);
    tessellator.addVertexWithUV(x + v2.xCoord, y + v2.yCoord, z + v2.zCoord, 1, 1);
    tessellator.addVertexWithUV(x + v3.xCoord, y + v3.yCoord, z + v3.zCoord, 1, 0);
    tessellator.addVertexWithUV(x + v4.xCoord, y + v4.yCoord, z + v4.zCoord, 0, 0);
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glPopMatrix();
}
CustomEffectRenderer.java 文件源码 项目:Runes-And-Silver 阅读 28 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
OrthoViewHandler.java 文件源码 项目:mineshot 阅读 20 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onFogDensity(EntityViewRenderEvent.FogDensity evt) {
    if (!enabled) {
        return;
    }

    // update zoom and rotation
    if (!modifierKeyPressed()) {
        int ticksElapsed = tick - tickPrevious;
        double partial = evt.getRenderPartialTicks();
        double elapsed = ticksElapsed + (partial - partialPrevious);
        elapsed *= SECONDS_PER_TICK * ROTATE_SPEED;
        updateZoomAndRotation(elapsed);

        tickPrevious = tick;
        partialPrevious = partial;
    }

    float width = zoom * (MC.displayWidth / (float) MC.displayHeight);
    float height = zoom;

    // override projection matrix
    GlStateManager.matrixMode(GL_PROJECTION);
    GlStateManager.loadIdentity();

    Projection.ortho(-width, width, -height, height, clip ? 0 : -9999, 9999);

    // rotate the orthographic camera with the player view
    if (freeCam) {
        xRot = MC.player.rotationPitch;
        yRot = MC.player.rotationYaw - 180;
    }

    // override camera view matrix
    GlStateManager.matrixMode(GL_MODELVIEW);
    GlStateManager.loadIdentity();
    GlStateManager.rotate(xRot, 1, 0, 0);
    GlStateManager.rotate(yRot, 0, 1, 0);

    // fix particle rotation if the camera isn't following the player view
    if (!freeCam) {
        float pitch = xRot;
        float yaw = yRot + 180;
        setRotationX(MathHelper.cos(yaw * (float) Math.PI / 180f));
        setRotationZ(MathHelper.sin(yaw * (float) Math.PI / 180f));
        setRotationYZ(-ActiveRenderInfo.getRotationZ() * MathHelper.sin(pitch * (float) Math.PI / 180f));
        setRotationXY(ActiveRenderInfo.getRotationX() * MathHelper.sin(pitch * (float) Math.PI / 180f));
        setRotationXZ(MathHelper.cos(pitch * (float) Math.PI / 180f));
    }
}
EffectRenderer.java 文件源码 项目:Cauldron 阅读 19 收藏 0 点赞 0 评论 0
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);
        }
    }
}
EffectRenderer.java 文件源码 项目:Cauldron 阅读 26 收藏 0 点赞 0 评论 0
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);
        }
    }
}
ParticleEngine.java 文件源码 项目:magistics 阅读 19 收藏 0 点赞 0 评论 0
@SubscribeEvent
public static void onPostRender(RenderWorldLastEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    TextureManager renderer = mc.renderEngine;
    int dim = mc.world.provider.getDimension();
    EntityPlayerSP player = mc.player;
    float frame = event.getPartialTicks();

    renderer.bindTexture(SPRITE_SHEET_ALT);

    GL11.glPushMatrix();
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GlStateManager.enableBlend();
    GL11.glEnable(GL11.GL_BLEND); // 3042 = 0xBE2 = GL_BLEND (redundant?)
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.004F);
    GlStateManager.depthMask(false); // isTransparent (therefore calls unnecessary in particle classes)

    boolean rebound = false;

    for (int layer = 3; layer >= 0; --layer) {
        if (particles[layer].containsKey(dim)) {
            ArrayList<Particle> fx = (ArrayList) particles[layer].get(dim);

            if (!fx.isEmpty()) {
                if (!rebound && layer < 2) {
                    renderer.bindTexture(SPRITE_SHEET);
                    rebound = true;
                }

                GL11.glPushMatrix();

                switch (layer) {
                case 0: case 2:
                    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_CURRENT_BIT);
                    break;
                case 1: case 3:
                    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                    break;
                }

                float f1 = ActiveRenderInfo.getRotationX();
                float f2 = ActiveRenderInfo.getRotationZ();
                float f3 = ActiveRenderInfo.getRotationYZ();
                float f4 = ActiveRenderInfo.getRotationXY();
                float f5 = ActiveRenderInfo.getRotationXZ();

                Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * frame;
                Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * frame;
                Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * frame;

                Tessellator tessellator = Tessellator.getInstance();
                BufferBuilder worldRenderer = tessellator.getBuffer();

                worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);

                for (final Particle effect : fx) {
                    if (effect != null) {
                        try {
                            effect.renderParticle(worldRenderer, player, frame, f1, f5, f2, f3, f4);
                        } catch (Exception err) {
                            crashParticle(err, effect);
                        }
                    }
                }

                tessellator.draw();
                GL11.glPopMatrix();
            }
        }
    }

    GlStateManager.depthMask(true);
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.disableBlend();
    GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glPopMatrix();
}
EffectRenderer.java 文件源码 项目:RuneCraftery 阅读 22 收藏 0 点赞 0 评论 0
public void func_78874_a(Entity p_78874_1_, float p_78874_2_) {
   float var3 = ActiveRenderInfo.field_74588_d;
   float var4 = ActiveRenderInfo.field_74586_f;
   float var5 = ActiveRenderInfo.field_74587_g;
   float var6 = ActiveRenderInfo.field_74596_h;
   float var7 = ActiveRenderInfo.field_74589_e;
   EntityFX.field_70556_an = p_78874_1_.field_70142_S + (p_78874_1_.field_70165_t - p_78874_1_.field_70142_S) * (double)p_78874_2_;
   EntityFX.field_70554_ao = p_78874_1_.field_70137_T + (p_78874_1_.field_70163_u - p_78874_1_.field_70137_T) * (double)p_78874_2_;
   EntityFX.field_70555_ap = p_78874_1_.field_70136_U + (p_78874_1_.field_70161_v - p_78874_1_.field_70136_U) * (double)p_78874_2_;

   for(int var8 = 0; var8 < 3; ++var8) {
      if(!this.field_78876_b[var8].isEmpty()) {
         switch(var8) {
         case 0:
         default:
            this.field_78877_c.func_110577_a(field_110737_b);
            break;
         case 1:
            this.field_78877_c.func_110577_a(TextureMap.field_110575_b);
            break;
         case 2:
            this.field_78877_c.func_110577_a(TextureMap.field_110576_c);
         }

         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
         GL11.glDepthMask(false);
         GL11.glEnable(3042);
         GL11.glBlendFunc(770, 771);
         GL11.glAlphaFunc(516, 0.003921569F);
         Tessellator var9 = Tessellator.field_78398_a;
         var9.func_78382_b();

         for(int var10 = 0; var10 < this.field_78876_b[var8].size(); ++var10) {
            EntityFX var11 = (EntityFX)this.field_78876_b[var8].get(var10);
            var9.func_78380_c(var11.func_70070_b(p_78874_2_));
            var11.func_70539_a(var9, p_78874_2_, var3, var7, var4, var5, var6);
         }

         var9.func_78381_a();
         GL11.glDisable(3042);
         GL11.glDepthMask(true);
         GL11.glAlphaFunc(516, 0.1F);
      }
   }

}
EffectRenderer.java 文件源码 项目:RuneCraftery 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
EffectRenderer.java 文件源码 项目:BetterNutritionMod 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
RenderEnergyPacket.java 文件源码 项目:Quantum-Anomalies 阅读 27 收藏 0 点赞 0 评论 0
@Override
public void doRender(Entity entity, double x, double y, double z, float fq, float ptt) {
    EntityEnergyPacket ent = (EntityEnergyPacket) entity;

    Tessellator tess = Tessellator.instance;

    glPushMatrix();

    glDepthMask(false);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    Minecraft.getMinecraft().renderEngine.bindTexture(tex);

    float scale = 0.1F;

    float[] pos = {(float) x, (float) y, (float) z};
    float[] rot = new float[] {ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationYZ, ActiveRenderInfo.rotationXY};

    tess.startDrawingQuads();
    tess.setBrightness(240);

    //tess.setColorRGBA_F(1F, 0F, 1F, 0.5F);

    Colourizer colour = ent.getColour();

    tess.setColorRGBA_F(colour.rgb[0], colour.rgb[1], colour.rgb[2], 0.3F);

    FXHelper.drawTrackingParticle(tess, pos, scale, rot);

    tess.draw();

    glDisable(GL_BLEND);
    glDepthMask(true);

    glPopMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(FXHelper.getParticleTexture());

}


问题


面经


文章

微信
公众号

扫码关注公众号