Search in sources :

Example 91 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class ParticleRenderer method renderRadiants.

private void renderRadiants(float partialTicks) {
    float rotationX = ActiveRenderInfo.rotationX;
    float rotationZ = ActiveRenderInfo.rotationZ;
    float rotationYZ = ActiveRenderInfo.rotationYZ;
    float rotationXY = ActiveRenderInfo.rotationXY;
    float rotationXZ = ActiveRenderInfo.rotationXZ;
    // save the old gl state
    GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    // gl states/settings for drawing
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    Tessellator tessellator = Tessellator.instance;
    for (EntityFX particle : radiants) {
        tessellator.setBrightness(particle.getBrightnessForRender(partialTicks));
        particle.renderParticle(tessellator, partialTicks, rotationX, rotationXZ, rotationZ, rotationYZ, rotationXY);
    }
    // restore previous gl state
    GL11.glPopAttrib();
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) EntityFX(net.minecraft.client.particle.EntityFX)

Example 92 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class ParticleRenderer method renderArcs.

private void renderArcs(float partialTicks) {
    float rotationX = ActiveRenderInfo.rotationX;
    float rotationZ = ActiveRenderInfo.rotationZ;
    float rotationYZ = ActiveRenderInfo.rotationYZ;
    float rotationXY = ActiveRenderInfo.rotationXY;
    float rotationXZ = ActiveRenderInfo.rotationXZ;
    Tessellator tessellator = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 1);
    //2884
    GL11.glDisable(2884);
    for (EntityFX particle : arcs) {
        tessellator.setBrightness(15728864);
        particle.renderParticle(tessellator, partialTicks, rotationX, rotationXZ, rotationZ, rotationYZ, rotationXY);
    }
    GL11.glEnable(2884);
    GL11.glDisable(3042);
    GL11.glDepthMask(true);
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) EntityFX(net.minecraft.client.particle.EntityFX)

Example 93 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class ParticleRenderer method renderStandardParticles.

private void renderStandardParticles(float partialTicks) {
    float rotationX = ActiveRenderInfo.rotationX;
    float rotationZ = ActiveRenderInfo.rotationZ;
    float rotationYZ = ActiveRenderInfo.rotationYZ;
    float rotationXY = ActiveRenderInfo.rotationXY;
    float rotationXZ = ActiveRenderInfo.rotationXZ;
    // save the old gl state
    GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    // gl states/settings for drawing
    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);
    GL11.glDisable(32826);
    //GL11.glRotatef(180F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
    //GL11.glRotatef(-RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    for (EntityFX particle : particles) {
        tessellator.setBrightness(particle.getBrightnessForRender(partialTicks));
        particle.renderParticle(tessellator, partialTicks, rotationX, rotationXZ, rotationZ, rotationYZ, rotationXY);
    }
    tessellator.draw();
    // restore previous gl state
    GL11.glPopAttrib();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) EntityFX(net.minecraft.client.particle.EntityFX)

Example 94 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Minechem by iopleke.

the class GuiElement method drawTexturedModalRect.

/**
     * Draws a textured rectangle at the current zLevel.
     *
     * @param x            x pos
     * @param y            y pos
     * @param u            u pos of texture
     * @param v            v pos of texture
     * @param actualWidth  width of texture
     * @param actualHeight height of texture
     * @param drawWidth    width to draw on
     * @param drawHeight   height to draw on
     */
protected void drawTexturedModalRect(int x, int y, int u, int v, int actualWidth, int actualHeight, int drawWidth, int drawHeight) {
    float f = 0.00390625F;
    float f1 = 0.00390625F;
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV((double) x, (double) (y + drawHeight), (double) this.zLevel, (double) ((float) u * f), (double) ((float) (v + actualHeight) * f1));
    tessellator.addVertexWithUV((double) (x + drawWidth), (double) (y + drawHeight), (double) this.zLevel, (double) ((float) (u + actualWidth) * f), (double) ((float) (v + actualHeight) * f1));
    tessellator.addVertexWithUV((double) (x + drawWidth), (double) (y), (double) this.zLevel, (double) ((float) (u + actualWidth) * f), (double) ((float) (v) * f1));
    tessellator.addVertexWithUV((double) (x), (double) (y), (double) this.zLevel, (double) ((float) (u) * f), (double) ((float) (v) * f1));
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 95 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Minechem by iopleke.

the class EnhancedFontRenderer method renderStringAtPos.

/**
     * Render a single line string at the current (posX,posY) and update posX
     */
private void renderStringAtPos(String sting, boolean p_78255_2_) {
    for (int i = 0; i < sting.length(); ++i) {
        char c0 = sting.charAt(i);
        int j;
        int k;
        if (c0 == 167 && i + 1 < sting.length()) {
            j = "0123456789abcdefklmnor".indexOf(sting.toLowerCase().charAt(i + 1));
            if (j < 16) {
                this.resetStyles();
                if (j < 0 || j > 15) {
                    j = 15;
                }
                if (p_78255_2_) {
                    j += 16;
                }
                k = this.colorCode[j];
                this.textColor = k;
                GL11.glColor4f((float) (k >> 16) / 255.0F, (float) (k >> 8 & 255) / 255.0F, (float) (k & 255) / 255.0F, this.alpha);
            } else if (j == 16) {
                this.randomStyle = true;
            } else if (j == 17) {
                this.boldStyle = true;
            } else if (j == 18) {
                this.strikethroughStyle = true;
            } else if (j == 19) {
                this.underlineStyle = true;
            } else if (j == 20) {
                this.italicStyle = true;
            } else if (j == 21) {
                this.resetStyles();
                GL11.glColor4f(this.red, this.blue, this.green, this.alpha);
            }
            ++i;
        } else {
            j = UNICHARS.indexOf(c0);
            if (this.randomStyle && j != -1) {
                do {
                    k = this.fontRandom.nextInt(this.charWidth.length);
                } while (this.charWidth[j] != this.charWidth[k]);
                j = k;
            }
            float f1 = this.unicodeFlag ? 0.5F : 1.0F;
            boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_;
            if (flag1) {
                this.posX -= f1;
                this.posY -= f1;
            }
            float f = this.renderCharAtPos(j, c0, this.italicStyle);
            if (flag1) {
                this.posX += f1;
                this.posY += f1;
            }
            if (this.boldStyle) {
                this.posX += f1;
                if (flag1) {
                    this.posX -= f1;
                    this.posY -= f1;
                }
                this.renderCharAtPos(j, c0, this.italicStyle);
                this.posX -= f1;
                if (flag1) {
                    this.posX += f1;
                    this.posY += f1;
                }
                ++f;
            }
            Tessellator tessellator;
            if (this.strikethroughStyle) {
                tessellator = Tessellator.instance;
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                tessellator.startDrawingQuads();
                tessellator.addVertex((double) this.posX, (double) (this.posY + (float) (this.FONT_HEIGHT / 2)), 0.0D);
                tessellator.addVertex((double) (this.posX + f), (double) (this.posY + (float) (this.FONT_HEIGHT / 2)), 0.0D);
                tessellator.addVertex((double) (this.posX + f), (double) (this.posY + (float) (this.FONT_HEIGHT / 2) - 1.0F), 0.0D);
                tessellator.addVertex((double) this.posX, (double) (this.posY + (float) (this.FONT_HEIGHT / 2) - 1.0F), 0.0D);
                tessellator.draw();
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }
            if (this.underlineStyle) {
                tessellator = Tessellator.instance;
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                tessellator.startDrawingQuads();
                int l = this.underlineStyle ? -1 : 0;
                tessellator.addVertex((double) (this.posX + (float) l), (double) (this.posY + (float) this.FONT_HEIGHT), 0.0D);
                tessellator.addVertex((double) (this.posX + f), (double) (this.posY + (float) this.FONT_HEIGHT), 0.0D);
                tessellator.addVertex((double) (this.posX + f), (double) (this.posY + (float) this.FONT_HEIGHT - 1.0F), 0.0D);
                tessellator.addVertex((double) (this.posX + (float) l), (double) (this.posY + (float) this.FONT_HEIGHT - 1.0F), 0.0D);
                tessellator.draw();
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }
            this.posX += (float) ((int) f);
        }
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Aggregations

Tessellator (net.minecraft.client.renderer.Tessellator)298 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)50 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)49 ResourceLocation (net.minecraft.util.ResourceLocation)15 Block (net.minecraft.block.Block)13 IIcon (net.minecraft.util.IIcon)13 BlockPos (net.minecraft.util.math.BlockPos)12 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)10 Vec3d (net.minecraft.util.math.Vec3d)9 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)8 EnumFacing (net.minecraft.util.EnumFacing)8 Icon (net.minecraft.util.Icon)8 Random (java.util.Random)7 FontRenderer (net.minecraft.client.gui.FontRenderer)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)7 World (net.minecraft.world.World)7 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)6 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)6 SideOnly (cpw.mods.fml.relauncher.SideOnly)5 IBlockState (net.minecraft.block.state.IBlockState)5