Search in sources :

Example 66 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project IDEProgram by Itay2805.

the class GLCanvas method drawRectWithFullTexture.

protected static void drawRectWithFullTexture(double x, double y, float u, float v, int width, int height) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    buffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    buffer.pos(x, y + height, 0).tex(0, 1).endVertex();
    buffer.pos(x + width, y + height, 0).tex(1, 1).endVertex();
    buffer.pos(x + width, y, 0).tex(1, 0).endVertex();
    buffer.pos(x, y, 0).tex(0, 0).endVertex();
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Example 67 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project Cavern2 by kegare.

the class GuiDownloadCaveTerrain method rotateAndBlurSkybox.

private void rotateAndBlurSkybox(float ticks) {
    mc.getTextureManager().bindTexture(panoramaBackground);
    GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GlStateManager.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.colorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    GlStateManager.disableAlpha();
    byte b0 = 3;
    for (int i = 0; i < b0; ++i) {
        float f = 1.0F / (i + 1);
        int j = width;
        int k = height;
        float f1 = (i - b0 / 2) / 256.0F;
        buffer.pos(j, k, 0.0D).tex(0.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(j, 0.0D, 0.0D).tex(1.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(0.0D, 0.0D, 0.0D).tex(1.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(0.0D, k, 0.0D).tex(0.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
    }
    tessellator.draw();
    GlStateManager.enableAlpha();
    GlStateManager.colorMask(true, true, true, true);
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Example 68 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project Cavern2 by kegare.

the class GuiDownloadCaveTerrain method drawPanorama.

private void drawPanorama(float ticks) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.pushMatrix();
    GlStateManager.loadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.pushMatrix();
    GlStateManager.loadIdentity();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.disableCull();
    GlStateManager.depthMask(false);
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    byte b0 = 8;
    for (int k = 0; k < b0 * b0; ++k) {
        GlStateManager.pushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GlStateManager.translate(f1, f2, f3);
        GlStateManager.rotate(MathHelper.sin((panoramaTimer + ticks) / 400.0F) * 15.0F + 10.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(-(panoramaTimer + ticks) * 0.08F, 0.0F, 1.0F, 0.0F);
        for (int l = 0; l < 6; ++l) {
            GlStateManager.pushMatrix();
            switch(l) {
                case 1:
                    GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 2:
                    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 3:
                    GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 4:
                    GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
                    break;
                case 5:
                    GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
                    break;
            }
            mc.getTextureManager().bindTexture(getPanoramaPaths().getPath(l));
            buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            int i = 255 / (k + 1);
            buffer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, i).endVertex();
            tessellator.draw();
            GlStateManager.popMatrix();
        }
        GlStateManager.popMatrix();
        GlStateManager.colorMask(true, true, true, false);
    }
    buffer.setTranslation(0.0D, 0.0D, 0.0D);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.popMatrix();
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.popMatrix();
    GlStateManager.depthMask(true);
    GlStateManager.enableCull();
    GlStateManager.enableDepth();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Example 69 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project BetterQuesting by Funwayguy.

the class GuiElement method drawTexturedModelRectFromIcon.

public void drawTexturedModelRectFromIcon(int x, int y, TextureAtlasSprite sprite, int w, int h) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos((double) (x + 0), (double) (y + h), (double) this.zLevel).tex((double) sprite.getMinU(), (double) sprite.getMaxV()).endVertex();
    vertexbuffer.pos((double) (x + w), (double) (y + h), (double) this.zLevel).tex((double) sprite.getMaxU(), (double) sprite.getMaxV()).endVertex();
    vertexbuffer.pos((double) (x + w), (double) (y + 0), (double) this.zLevel).tex((double) sprite.getMaxU(), (double) sprite.getMinV()).endVertex();
    vertexbuffer.pos((double) (x + 0), (double) (y + 0), (double) this.zLevel).tex((double) sprite.getMinU(), (double) sprite.getMinV()).endVertex();
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Example 70 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project BetterQuesting by Funwayguy.

the class GuiElement method drawRect.

public void drawRect(int left, int top, int right, int bottom, int color) {
    if (left < right) {
        int i = left;
        left = right;
        right = i;
    }
    if (top < bottom) {
        int j = top;
        top = bottom;
        bottom = j;
    }
    float f3 = (float) (color >> 24 & 255) / 255.0F;
    float f = (float) (color >> 16 & 255) / 255.0F;
    float f1 = (float) (color >> 8 & 255) / 255.0F;
    float f2 = (float) (color & 255) / 255.0F;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder vertexbuffer = tessellator.getBuffer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.color(f, f1, f2, f3);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION);
    vertexbuffer.pos((double) left, (double) bottom, 0.0D).endVertex();
    vertexbuffer.pos((double) right, (double) bottom, 0.0D).endVertex();
    vertexbuffer.pos((double) right, (double) top, 0.0D).endVertex();
    vertexbuffer.pos((double) left, (double) top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Aggregations

BufferBuilder (net.minecraft.client.renderer.BufferBuilder)319 Tessellator (net.minecraft.client.renderer.Tessellator)251 BlockPos (net.minecraft.util.math.BlockPos)35 Vec3d (net.minecraft.util.math.Vec3d)27 ResourceLocation (net.minecraft.util.ResourceLocation)25 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)23 IBlockState (net.minecraft.block.state.IBlockState)21 EnumFacing (net.minecraft.util.EnumFacing)21 Minecraft (net.minecraft.client.Minecraft)14 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)14 EntityPlayer (net.minecraft.entity.player.EntityPlayer)11 ItemStack (net.minecraft.item.ItemStack)11 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)11 ArrayList (java.util.ArrayList)10 BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)10 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)9 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)9 World (net.minecraft.world.World)8 Random (java.util.Random)7 FontRenderer (net.minecraft.client.gui.FontRenderer)7