net.minecraft.client.renderer.vertex.DefaultVertexFormats Java Examples

The following examples show how to use net.minecraft.client.renderer.vertex.DefaultVertexFormats. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Render.java    From XRay-Mod with GNU General Public License v3.0 7 votes vote down vote up
static void renderBlocks(RenderWorldLastEvent event) {
       Vector3d view = XRay.mc.gameRenderer.getActiveRenderInfo().getProjectedView();

       MatrixStack stack = event.getMatrixStack();
       stack.translate(-view.x, -view.y, -view.z); // translate

       RenderSystem.pushMatrix();
       RenderSystem.multMatrix(stack.getLast().getMatrix());

       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder buffer = tessellator.getBuffer();
       Profile.BLOCKS.apply(); // Sets GL state for block drawing

       syncRenderList.forEach(blockProps -> {
           buffer.begin( GL_LINES, DefaultVertexFormats.POSITION_COLOR );
           renderBlockBounding(buffer, blockProps);
           tessellator.draw();
       } );

       Profile.BLOCKS.clean();
       RenderSystem.popMatrix();
}
 
Example #2
Source File: FacadeItemModel.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderItem(ItemStack rawStack, TransformType transformType) {
    ItemStack itemStack = ModCompatibility.getRealItemStack(rawStack);
    if (!(itemStack.getItem() instanceof MetaItem<?>)) {
        return;
    }
    ItemStack facadeStack = FacadeItem.getFacadeStack(itemStack);
    CCRenderState renderState = CCRenderState.instance();
    renderState.reset();
    renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    try {
        FacadeRenderer.renderItemCover(renderState, EnumFacing.NORTH.getIndex(), facadeStack, ICoverable.getCoverPlateBox(EnumFacing.NORTH, 2.0 / 16.0));
    } catch (Throwable ignored) {
    }
    renderState.draw();
}
 
Example #3
Source File: Camera.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
public void render(float x, float y, float w, float h) {
    if (OpenGlHelper.isFramebufferEnabled()) {
        GlStateManager.pushMatrix();
        GlStateManager.enableTexture2D();
        GlStateManager.disableLighting();
        GlStateManager.disableAlpha();
        GlStateManager.disableBlend();
        GlStateManager.enableColorMaterial();

        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        frameBuffer.bindFramebufferTexture();

        final Tessellator tessellator = Tessellator.getInstance();
        final BufferBuilder bufferbuilder = tessellator.getBuffer();
        bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        bufferbuilder.pos(x, h, 0).tex(0, 0).endVertex();
        bufferbuilder.pos(w, h, 0).tex(1, 0).endVertex();
        bufferbuilder.pos(w, y, 0).tex(1, 1).endVertex();
        bufferbuilder.pos(x, y, 0).tex(0, 1).endVertex();
        tessellator.draw();

        frameBuffer.unbindFramebufferTexture();

        GlStateManager.popMatrix();
    }
}
 
Example #4
Source File: FWTileRenderer.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderTileEntityAt(FWTile te, double x, double y, double z, float partialTicks, int destroyStage) {
	Block block = te.getBlock();
	Optional<DynamicRenderer> opRenderer = block.components.getOp(DynamicRenderer.class);
	if (opRenderer.isPresent()) {
		BWModel model = new BWModel();
		model.matrix.translate(x + 0.5, y + 0.5, z + 0.5);
		opRenderer.get().onRender.accept(model);
		bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
		RenderUtility.enableBlending();
		Tessellator.getInstance().getBuffer().begin(GL_QUADS, DefaultVertexFormats.BLOCK);
		model.render(te.getWorld());
		Tessellator.getInstance().draw();
		RenderUtility.disableBlending();
	}
}
 
Example #5
Source File: Utils.java    From SkyblockAddons with MIT License 6 votes vote down vote up
/**
 * Draws a textured rectangle at z = 0. Args: x, y, u, v, width, height, textureWidth, textureHeight
 */
public void drawModalRectWithCustomSizedTexture(float x, float y, float u, float v, float width, float height, float textureWidth, float textureHeight, boolean linearTexture) {
    if (linearTexture) {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    }

    float f = 1.0F / textureWidth;
    float f1 = 1.0F / textureHeight;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    worldrenderer.pos(x, y + height, 0.0D).tex(u * f, (v + height) * f1).endVertex();
    worldrenderer.pos(x + width, y + height, 0.0D).tex((u + width) * f, (v + height) * f1).endVertex();
    worldrenderer.pos(x + width, y, 0.0D).tex((u + width) * f, v * f1).endVertex();
    worldrenderer.pos(x, y, 0.0D).tex(u * f, v * f1).endVertex();
    tessellator.draw();

    if (linearTexture) {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    }
}
 
Example #6
Source File: RenderUtil.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
public static void drawRect(float x, float y, float w, float h, int color) {
    float alpha = (float) (color >> 24 & 255) / 255.0F;
    float red = (float) (color >> 16 & 255) / 255.0F;
    float green = (float) (color >> 8 & 255) / 255.0F;
    float blue = (float) (color & 255) / 255.0F;
    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder bufferbuilder = tessellator.getBuffer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
    bufferbuilder.pos((double) x, (double) h, 0.0D).color(red, green, blue, alpha).endVertex();
    bufferbuilder.pos((double) w, (double) h, 0.0D).color(red, green, blue, alpha).endVertex();
    bufferbuilder.pos((double) w, (double) y, 0.0D).color(red, green, blue, alpha).endVertex();
    bufferbuilder.pos((double) x, (double) y, 0.0D).color(red, green, blue, alpha).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example #7
Source File: PhasedBlockRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static BufferBuilder beginRender() {
	GlStateManager.enableAlpha();
	GlStateManager.enableBlend();
	GlStateManager.disableTexture2D();
	GlStateManager.enableCull();
	GlStateManager.cullFace(GlStateManager.CullFace.BACK);
	GlStateManager.depthMask(false);
	GlStateManager.enablePolygonOffset();
	GlStateManager.doPolygonOffset(-0.1f, -1000f);
	GlStateManager.enableColorMaterial();

	GlStateManager.color(1, 1, 1, 1);
	GlStateManager.shadeModel(GL11.GL_SMOOTH);

	GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
	GL14.glBlendEquation(GL14.GL_FUNC_SUBTRACT);

	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
	buffer.setTranslation(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ);

	return buffer;
}
 
Example #8
Source File: WavefrontObject.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void renderAll()
{
    BufferBuilder buffer = Tessellator.getInstance().getBuffer();

    if (currentGroupObject != null)
    {
    	buffer.begin(currentGroupObject.glDrawingMode, DefaultVertexFormats.POSITION_TEX_NORMAL);
    }
    else
    {
    	buffer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX_NORMAL);
    }
    
    tessellateAll(buffer);

    Tessellator.getInstance().draw();
}
 
Example #9
Source File: FluidStackRenderer.java    From YouTubeModdingTutorial with MIT License 6 votes vote down vote up
private static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite) {
    double uMin = textureSprite.getMinU();
    double uMax = textureSprite.getMaxU();
    double vMin = textureSprite.getMinV();
    double vMax = textureSprite.getMaxV();
    double zLevel = 100;

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder vertexBuffer = tessellator.getBuffer();
    vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
    vertexBuffer.pos(xCoord + 16, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
    vertexBuffer.pos(xCoord + 16, yCoord, zLevel).tex(uMax, vMin).endVertex();
    vertexBuffer.pos(xCoord, yCoord, zLevel).tex(uMin, vMin).endVertex();
    tessellator.draw();
}
 
Example #10
Source File: RuneFX.java    From AgriCraft with MIT License 6 votes vote down vote up
@Override
public void renderParticle(BufferBuilder worldRenderer, Entity entity, float partialTicks, float f0, float f1, float f2, float f3, float f4) {
    ITessellator tessellator = TessellatorVertexBuffer.getInstance(worldRenderer);
    tessellator.draw();
    tessellator.startDrawingQuads(DefaultVertexFormats.BLOCK);

    float f6 = uMin;
    float f7 = uMax;
    float f8 = vMin;
    float f9 = vMax;
    float f10 = 0.1F * this.particleScale;
    float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) f0 - interpPosX);
    float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) f0 - interpPosY);
    float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) f0 - interpPosZ);

    Minecraft.getMinecraft().renderEngine.bindTexture(this.texture);
    tessellator.setColorRGBA(1, 1, 1, 1);

    tessellator.addVertexWithUV((f11 - f1 * f10 - f4 * f10), (f12 - f2 * f10), (f13 - f3 * f10 - f6 * f10), f7, f9);
    tessellator.addVertexWithUV((f11 - f1 * f10 + f4 * f10), (f12 + f2 * f10), (f13 - f3 * f10 + f6 * f10), f7, f8);
    tessellator.addVertexWithUV((f11 + f1 * f10 + f4 * f10), (f12 + f2 * f10), (f13 + f3 * f10 + f6 * f10), f6, f8);
    tessellator.addVertexWithUV((f11 + f1 * f10 - f4 * f10), (f12 - f2 * f10), (f13 + f3 * f10 - f6 * f10), f6, f9);

    tessellator.draw();
    tessellator.startDrawingQuads(DefaultVertexFormats.BLOCK);
}
 
Example #11
Source File: RenderUtils.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public static void drawFilledBox(AxisAlignedBB box, float r, float g, float b, float a) {
gl11Setup();

Vec3d ren = renderPos();

      /* Fill */
      Tessellator tessellator = Tessellator.getInstance();
      BufferBuilder buffer = tessellator.getBuffer();
      buffer.begin(5, DefaultVertexFormats.POSITION_COLOR);
      WorldRenderer.addChainedFilledBoxVertices(buffer,
      		box.minX - ren.x, box.minY - ren.y, box.minZ - ren.z,
      		box.maxX - ren.x, box.maxY - ren.y, box.maxZ - ren.z, r, g, b, a/2f);
      tessellator.draw();
      
      /* Outline */
      WorldRenderer.drawSelectionBoundingBox(new AxisAlignedBB(
      		box.minX - ren.x, box.minY - ren.y, box.minZ - ren.z,
      		box.maxX - ren.x, box.maxY - ren.y, box.maxZ - ren.z), r, g, b, a);

      gl11Cleanup();
  }
 
Example #12
Source File: RenderUtilsLiving.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public static void drawText(String str, double x, double y, double z, double scale) {
	glSetup(x, y, z);
	
	GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale);
      
	int i = mc.fontRenderer.getStringWidth(str) / 2;
	GL11.glDisable(GL11.GL_TEXTURE_2D);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
    float f = Minecraft.getInstance().gameSettings.func_216840_a(0.25F);
    bufferbuilder.pos(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).endVertex();
    bufferbuilder.pos(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).endVertex();
    bufferbuilder.pos(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).endVertex();
    bufferbuilder.pos(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).endVertex();
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
      
    mc.fontRenderer.drawString(str, -i, 0, 553648127);
    mc.fontRenderer.drawString(str, -i, 0, -1);
      
    glCleanup();
}
 
Example #13
Source File: WidgetFluidFilter.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    if(fluid != null) {
        ResourceLocation icon = fluid.getStill();
        if(icon != null) {
            GL11.glColor4d(1, 1, 1, 1);
            GL11.glPushMatrix();
            GL11.glTranslated(x, y, 0);
            Minecraft.getMinecraft().getTextureManager().bindTexture(icon);
            BufferBuilder wr = Tessellator.getInstance().getBuffer();
            wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
            wr.pos(0, 0, 0).tex(0, 0).endVertex();
            wr.pos(0, 16, 0).tex(0, 1).endVertex();
            wr.pos(16, 16, 0).tex(1, 1).endVertex();
            wr.pos(16, 0, 0).tex(1, 0).endVertex();
            Tessellator.getInstance().draw();
            GL11.glPopMatrix();
        }
    }
}
 
Example #14
Source File: GuiAddBlock.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
static void renderPreview(int x, int y, float r, float g, float b) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder tessellate = tessellator.getBuffer();
    RenderSystem.enableBlend();
    RenderSystem.disableTexture();
    RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    RenderSystem.color4f(r/255, g/255, b/255, 1);
    tessellate.begin(7, DefaultVertexFormats.POSITION);
    tessellate.pos(x, y, 0.0D).endVertex();
    tessellate.pos(x, y + 45, 0.0D).endVertex();
    tessellate.pos(x + 202, y + 45, 0.0D).endVertex();
    tessellate.pos(x + 202, y, 0.0D).endVertex();
    tessellator.draw();
    RenderSystem.enableTexture();
    RenderSystem.disableBlend();
}
 
Example #15
Source File: GuiUtils.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
    float startAlpha = (float) (startColor >> 24 & 255) / 255.0F;
    float startRed = (float) (startColor >> 16 & 255) / 255.0F;
    float startGreen = (float) (startColor >> 8 & 255) / 255.0F;
    float startBlue = (float) (startColor & 255) / 255.0F;
    float endAlpha = (float) (endColor >> 24 & 255) / 255.0F;
    float endRed = (float) (endColor >> 16 & 255) / 255.0F;
    float endGreen = (float) (endColor >> 8 & 255) / 255.0F;
    float endBlue = (float) (endColor & 255) / 255.0F;

    GlStateManager.disableTexture2D();
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager.shadeModel(GL11.GL_SMOOTH);

    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
    worldrenderer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
    worldrenderer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
    worldrenderer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
    tessellator.draw();

    GlStateManager.shadeModel(GL11.GL_FLAT);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
Example #16
Source File: RenderSphere.java    From YouTubeModdingTutorial with MIT License 5 votes vote down vote up
private void renderBillboardQuad(double scale, float vAdd1, float vAdd2) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    buffer.pos(-scale, -scale, 0).tex(0, 0 + vAdd1).endVertex();
    buffer.pos(-scale, +scale, 0).tex(0, 0 + vAdd1 + vAdd2).endVertex();
    buffer.pos(+scale, +scale, 0).tex(1, 0 + vAdd1 + vAdd2).endVertex();
    buffer.pos(+scale, -scale, 0).tex(1, 0 + vAdd1).endVertex();
    tessellator.draw();
}
 
Example #17
Source File: GlyphPageFontRenderer.java    From ClientBase with MIT License 5 votes vote down vote up
private void doDraw(float f, GlyphPage glyphPage) {
    if (this.strikethroughStyle) {
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        GlStateManager.disableTexture2D();
        worldrenderer.begin(7, DefaultVertexFormats.POSITION);
        worldrenderer.pos((double) this.posX, (double) (this.posY + (float) (glyphPage.getMaxFontHeight() / 2)), 0.0D).endVertex();
        worldrenderer.pos((double) (this.posX + f), (double) (this.posY + (float) (glyphPage.getMaxFontHeight() / 2)), 0.0D).endVertex();
        worldrenderer.pos((double) (this.posX + f), (double) (this.posY + (float) (glyphPage.getMaxFontHeight() / 2) - 1.0F), 0.0D).endVertex();
        worldrenderer.pos((double) this.posX, (double) (this.posY + (float) (glyphPage.getMaxFontHeight() / 2) - 1.0F), 0.0D).endVertex();
        tessellator.draw();
        GlStateManager.enableTexture2D();
    }

    if (this.underlineStyle) {
        Tessellator tessellator1 = Tessellator.getInstance();
        WorldRenderer worldrenderer1 = tessellator1.getWorldRenderer();
        GlStateManager.disableTexture2D();
        worldrenderer1.begin(7, DefaultVertexFormats.POSITION);
        int l = this.underlineStyle ? -1 : 0;
        worldrenderer1.pos((double) (this.posX + (float) l), (double) (this.posY + (float) glyphPage.getMaxFontHeight()), 0.0D).endVertex();
        worldrenderer1.pos((double) (this.posX + f), (double) (this.posY + (float) glyphPage.getMaxFontHeight()), 0.0D).endVertex();
        worldrenderer1.pos((double) (this.posX + f), (double) (this.posY + (float) glyphPage.getMaxFontHeight() - 1.0F), 0.0D).endVertex();
        worldrenderer1.pos((double) (this.posX + (float) l), (double) (this.posY + (float) glyphPage.getMaxFontHeight() - 1.0F), 0.0D).endVertex();
        tessellator1.draw();
        GlStateManager.enableTexture2D();
    }

    this.posX += f;
}
 
Example #18
Source File: RenderOverlayHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void drawTexturedModalRect(float xCoord, float yCoord, int minU, int minV, int maxU, int maxV)
{
	float f = 0.00390625F;
	float f1 = 0.00390625F;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vb = tessellator.getBuffer();
	vb.begin(7, DefaultVertexFormats.POSITION_TEX);
	vb.pos(xCoord + 0.0F, yCoord + maxV, 0).tex((minU + 0) * f, (minV + maxV) * f1).endVertex();
	vb.pos(xCoord + maxU, yCoord + maxV, 0).tex((minU + maxU) * f, (minV + maxV) * f1).endVertex();
	vb.pos(xCoord + maxU, yCoord + 0.0F, 0).tex((minU + maxU) * f, (minV + 0) * f1).endVertex();
	vb.pos(xCoord + 0.0F, yCoord + 0.0F, 0).tex((minU + 0) * f, (minV + 0) * f1).endVertex();
	tessellator.draw();
}
 
Example #19
Source File: GuiKnappingButton.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
protected void drawLocal()
{
	float f = 0.00390625F;
	float f1 = 0.00390625F;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexBuffer = tessellator.getBuffer();
	vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
	vertexBuffer.pos(xPosition + 0, yPosition + 16, this.zLevel).tex(0, 1).endVertex();
	vertexBuffer.pos(xPosition + 16, yPosition + 16, this.zLevel).tex(1, 1).endVertex();
	vertexBuffer.pos(xPosition + 16, yPosition + 0, this.zLevel).tex(1, 0).endVertex();
	vertexBuffer.pos(xPosition + 0, yPosition + 0, this.zLevel).tex(0, 0).endVertex();
	tessellator.draw();
}
 
Example #20
Source File: Notification.java    From ClientBase with MIT License 5 votes vote down vote up
public static void drawRect(double left, double top, double right, double bottom, int color) {
    if (left < right) {
        double i = left;
        left = right;
        right = i;
    }

    if (top < bottom) {
        double 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();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION);
    worldrenderer.pos(left, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, top, 0.0D).endVertex();
    worldrenderer.pos(left, top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example #21
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 5 votes vote down vote up
private void renderMapFirstPerson(ItemStack stack)
{
	GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.scale(0.38F, 0.38F, 0.38F);
	GlStateManager.disableLighting();
	this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexbuffer = tessellator.getBuffer();
	GlStateManager.translate(-0.5F, -0.5F, 0.0F);
	GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F);
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
	vertexbuffer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex();
	vertexbuffer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex();
	vertexbuffer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex();
	vertexbuffer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
	tessellator.draw();
	
	if (stack != null)
	{
		MapData mapdata = Items.FILLED_MAP.getMapData(stack, Minecraft.getMinecraft().theWorld);

		if (mapdata != null)
		{
			this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false);
		}
	}

	GlStateManager.enableLighting();
}
 
Example #22
Source File: GuiInventoryButton.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void drawIcon(int x, int y, int textureX, int textureY, int width, int height)
{
	float f = 0.00390625F;
	float f1 = 0.00390625F;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexbuffer = tessellator.getBuffer();
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
	vertexbuffer.pos((double)(x + 0), (double)(y + 16), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 16), (double)(y + 16), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 16), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 0), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
	tessellator.draw();
}
 
Example #23
Source File: UIStringComponent.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public UIStringComponent(String text, double x, double y, double z, float scale, int zLevel, int color) 
{
	super(DefaultVertexFormats.POSITION_TEX);
	this.scale = scale;
	UIText = text;
	float toNextChar = 0;
	this.color = color;
	for (int i = 0; i < UIText.length(); ++i)
	{
		char c = UIText.charAt(i);
		UICharComponent ui = new UICharComponent(DefaultVertexFormats.POSITION_TEX, x+toNextChar, y, z, zLevel, this.scale);
		toNextChar += ui.setupChar(c)*this.scale;
		charCompList.add(ui);
	}
}
 
Example #24
Source File: CustomCrosshairGraphics.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawFilledRectangle(int x1, int y1, int x2, int y2, final Color colour) {
    if (x1 < x2) {
        final int tempX = x1;
        x1 = x2;
        x2 = tempX;
    }
    if (y1 < y2) {
        final int tempY = y1;
        y1 = y2;
        y2 = tempY;
    }
    final Tessellator tessellator = Tessellator.getInstance();
    final WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager
        .color(colour.getRed() / 255.0f, colour.getGreen() / 255.0f, colour.getBlue() / 255.0f,
            colour.getAlpha() / 255.0f);
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldrenderer.pos(x1, y2, 0.0).endVertex();
    worldrenderer.pos(x2, y2, 0.0).endVertex();
    worldrenderer.pos(x2, y1, 0.0).endVertex();
    worldrenderer.pos(x1, y1, 0.0).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example #25
Source File: RenderUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void drawBoundingBoxEdges(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, Color4f colorX, Color4f colorY, Color4f colorZ)
{
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);

    drawBoundingBoxLinesX(bufferbuilder, minX, minY, minZ, maxX, maxY, maxZ, colorX);
    drawBoundingBoxLinesY(bufferbuilder, minX, minY, minZ, maxX, maxY, maxZ, colorY);
    drawBoundingBoxLinesZ(bufferbuilder, minX, minY, minZ, maxX, maxY, maxZ, colorZ);

    tessellator.draw();
}
 
Example #26
Source File: ToolRenderHandler.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void drawBlockDamageTexture(Minecraft mc, Tessellator tessellator, Entity viewEntity, float partialTicks, List<BlockPos> blocksToRender, int partialBlockDamage) {
    double d3 = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
    double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
    double d5 = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    BlockRendererDispatcher rendererDispatcher = mc.getBlockRendererDispatcher();

    mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    preRenderDamagedBlocks();
    bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    bufferBuilder.setTranslation(-d3, -d4, -d5);
    bufferBuilder.noColor();

    for (BlockPos blockPos : blocksToRender) {
        IBlockState blockState = mc.world.getBlockState(blockPos);
        TileEntity tileEntity = mc.world.getTileEntity(blockPos);
        boolean hasBreak = tileEntity != null && tileEntity.canRenderBreaking();
        if (!hasBreak && blockState.getMaterial() != Material.AIR) {
            TextureAtlasSprite textureAtlasSprite = this.destroyBlockIcons[partialBlockDamage];
            rendererDispatcher.renderBlockDamage(blockState, blockPos, textureAtlasSprite, mc.world);
        }
    }

    tessellator.draw();
    bufferBuilder.setTranslation(0.0D, 0.0D, 0.0D);
    postRenderDamagedBlocks();
}
 
Example #27
Source File: RenderStarUIEntity.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
protected void renderATMIndicator(BufferBuilder buffer, float percent) {
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
	
	float maxUV = (1-percent)*0.406f + .578f;
	//Offset by 15 for Y
	RenderHelper.renderNorthFaceWithUV(buffer, 0, 6, 20 + (1-percent)*33, 39, 53, .5624f, .984f, .984f, maxUV);
	Tessellator.getInstance().draw();
}
 
Example #28
Source File: RectRenderer.java    From Signals with GNU General Public License v3.0 5 votes vote down vote up
public void render(BufferBuilder buffer){
    GL11.glColor3f(r, g, b);
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    bakedRenderer.render(buffer);
    Tessellator.getInstance().draw();
    GL11.glColor3f(1, 1, 1);
}
 
Example #29
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 5 votes vote down vote up
public EndPortalRenderType(int idx, double posY, Vec3d projectedView, Matrix4 mat, RenderType.State state) {
    super("enderstorage:end_portal", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, false, true, null, null);
    this.idx = idx;
    this.projectedView = projectedView;
    this.mat = mat;
    this.state = state;
    f5 = idx == 0 ? 65F : 16 - idx;
    f6 = idx == 0 ? 0.125F : (idx == 1 ? 0.5F : 0.0625F);
    f7 = idx == 0 ? 0.1F : 1.0F / (16 - idx + 1.0F);
    f8 = (float) (-(posY + surfaceY));
    f9 = (float) (f8 + projectedView.y);
    f10 = (float) (f8 + f5 + projectedView.y);
    f11 = (float) (posY + surfaceY) + (f9 / f10);
}
 
Example #30
Source File: AboveHeadRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void renderName(RenderPlayerEvent event, LevelheadTag tag, EntityPlayer player, double x, double y, double z) {
    FontRenderer fontrenderer = event.getRenderManager().getFontRenderer();
    float f = (float) (1.6F * Levelhead.getInstance().getDisplayManager().getMasterConfig().getFontSize());
    float f1 = 0.016666668F * f;
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x + 0.0F, (float) y + player.height + 0.5F, (float) z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-event.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(event.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
    GlStateManager.scale(-f1, -f1, f1);
    GlStateManager.disableLighting();
    GlStateManager.depthMask(false);
    GlStateManager.disableDepth();
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    int i = 0;

    int j = fontrenderer.getStringWidth(tag.getString()) / 2;
    GlStateManager.disableTexture2D();
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();

    renderString(fontrenderer, tag);

    GlStateManager.enableLighting();
    GlStateManager.disableBlend();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
}