Search in sources :

Example 81 with Tessellator

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

the class AMGuiHelper method DrawIconAtXY.

public static void DrawIconAtXY(IIcon IIcon, float x, float y, float zLevel, int w, int h, boolean semitransparent) {
    if (IIcon == null)
        return;
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glPushMatrix();
    if (semitransparent) {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(rl_items);
    Tessellator tessellator = Tessellator.instance;
    boolean drawing = ReflectionHelper.getPrivateValue(Tessellator.class, tessellator, "field_78415_z", "isDrawing");
    if (drawing)
        tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(x, y + h, zLevel, IIcon.getMinU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(x + w, y + h, zLevel, IIcon.getMaxU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(x + w, y, zLevel, IIcon.getMaxU(), IIcon.getMinV());
    tessellator.addVertexWithUV(x, y, zLevel, IIcon.getMinU(), IIcon.getMinV());
    tessellator.draw();
    if (semitransparent) {
        GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    if (drawing)
        tessellator.startDrawingQuads();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 82 with Tessellator

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

the class AMGuiHelper method drawGradientRect.

protected static void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
    float f = (par5 >> 24 & 255) / 255.0F;
    float f1 = (par5 >> 16 & 255) / 255.0F;
    float f2 = (par5 >> 8 & 255) / 255.0F;
    float f3 = (par5 & 255) / 255.0F;
    float f4 = (par6 >> 24 & 255) / 255.0F;
    float f5 = (par6 >> 16 & 255) / 255.0F;
    float f6 = (par6 >> 8 & 255) / 255.0F;
    float f7 = (par6 & 255) / 255.0F;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.setColorRGBA_F(f1, f2, f3, f);
    tessellator.addVertex(par3, par2, zLevel);
    tessellator.addVertex(par1, par2, zLevel);
    tessellator.setColorRGBA_F(f5, f6, f7, f4);
    tessellator.addVertex(par1, par4, zLevel);
    tessellator.addVertex(par3, par4, zLevel);
    tessellator.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 83 with Tessellator

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

the class GuiArcaneCompendium method drawTexturedModalRect_Classic.

public void drawTexturedModalRect_Classic(int dst_x, int dst_y, int src_x, int src_y, int dst_width, int dst_height, int src_width, int src_height) {
    float var7 = 0.00390625F;
    float var8 = 0.00390625F;
    Tessellator var9 = Tessellator.instance;
    var9.startDrawingQuads();
    var9.addVertexWithUV(dst_x + 0, dst_y + dst_height, this.zLevel, (src_x + 0) * var7, (src_y + src_height) * var8);
    var9.addVertexWithUV(dst_x + dst_width, dst_y + dst_height, this.zLevel, (src_x + src_width) * var7, (src_y + src_height) * var8);
    var9.addVertexWithUV(dst_x + dst_width, dst_y + 0, this.zLevel, (src_x + src_width) * var7, (src_y + 0) * var8);
    var9.addVertexWithUV(dst_x + 0, dst_y + 0, this.zLevel, (src_x + 0) * var7, (src_y + 0) * var8);
    var9.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 84 with Tessellator

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

the class GuiArcaneCompendium method DrawIconAtXY.

private void DrawIconAtXY(IIcon icon, float x, float y, int w, int h) {
    if (icon == null)
        return;
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(x, y + h, this.zLevel, icon.getMinU(), icon.getMaxV());
    tessellator.addVertexWithUV(x + w, y + h, this.zLevel, icon.getMaxU(), icon.getMaxV());
    tessellator.addVertexWithUV(x + w, y, this.zLevel, icon.getMaxU(), icon.getMinV());
    tessellator.addVertexWithUV(x, y, this.zLevel, icon.getMinU(), icon.getMinV());
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 85 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project OpenModularTurrets by OpenModularTurretsTeam.

the class RocketRenderer method renderRocket.

@SuppressWarnings("unused")
private void renderRocket(RocketProjectile par1EntityRocket, double x, double y, double z, float entityYaw, float partialTicks) {
    if (par1EntityRocket.getFramesRendered() <= 1) {
        par1EntityRocket.setFramesRendered(par1EntityRocket.getFramesRendered() + 1);
        return;
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.pushMatrix();
    GlStateManager.disableLighting();
    GlStateManager.translate((float) x, (float) y, (float) z);
    GlStateManager.rotate(par1EntityRocket.prevRotationYaw + (par1EntityRocket.rotationYaw - par1EntityRocket.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(par1EntityRocket.prevRotationPitch + (par1EntityRocket.rotationPitch - par1EntityRocket.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    GlStateManager.enableRescaleNormal();
    float f9 = (float) par1EntityRocket.arrowShake - partialTicks;
    if (f9 > 0.0F) {
        float f10 = -MathHelper.sin(f9 * 3.0F) * f9;
        GlStateManager.rotate(f10, 0.0F, 0.0F, 1.0F);
    }
    GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.scale(0.05625F, 0.05625F, 0.05625F);
    GlStateManager.translate(-4.0F, 0.0F, 0.0F);
    GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex();
    vertexbuffer.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex();
    vertexbuffer.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex();
    vertexbuffer.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex();
    tessellator.draw();
    GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex();
    vertexbuffer.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex();
    vertexbuffer.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex();
    vertexbuffer.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex();
    tessellator.draw();
    for (int j = 0; j < 4; ++j) {
        GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F);
        vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
        vertexbuffer.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
        vertexbuffer.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex();
        vertexbuffer.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex();
        vertexbuffer.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex();
        tessellator.draw();
    }
    GlStateManager.disableRescaleNormal();
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer)

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