net.minecraft.client.renderer.BufferBuilder Java Examples
The following examples show how to use
net.minecraft.client.renderer.BufferBuilder.
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: RenderUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
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 #2
Source File: GeometryTessellator.java From LunatriusCore with MIT License | 6 votes |
private static void drawCuboid(final BufferBuilder buffer, final BlockPos begin, final BlockPos end, final int sides, final int argb, final double delta) { if (buffer.getDrawMode() == -1 || sides == 0) { return; } final double x0 = begin.getX() - delta; final double y0 = begin.getY() - delta; final double z0 = begin.getZ() - delta; final double x1 = end.getX() + 1 + delta; final double y1 = end.getY() + 1 + delta; final double z1 = end.getZ() + 1 + delta; switch (buffer.getDrawMode()) { case GL11.GL_QUADS: drawQuads(buffer, x0, y0, z0, x1, y1, z1, sides, argb); break; case GL11.GL_LINES: drawLines(buffer, x0, y0, z0, x1, y1, z1, sides, argb); break; default: throw new IllegalStateException("Unsupported mode!"); } }
Example #3
Source File: RuneFX.java From AgriCraft with MIT License | 6 votes |
@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 #4
Source File: InvPipeRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setBrightness(world, pos); IVertexOperation[] pipeline = {new Translation(pos)}; BlockInventoryPipe block = (BlockInventoryPipe) state.getBlock(); TileEntityInventoryPipe tileEntity = (TileEntityInventoryPipe) block.getPipeTileEntity(world, pos); if (tileEntity == null) { return false; } int paintingColor = tileEntity.getInsulationColor(); int connectedSidesMask = block.getActualConnections(tileEntity, world); BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer(); if (renderLayer == BlockRenderLayer.SOLID) { renderPipe(renderState, pipeline, paintingColor, connectedSidesMask); } ICoverable coverable = tileEntity.getCoverableImplementation(); coverable.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer); return true; }
Example #5
Source File: CableRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setPipeline(new Vector3(new Vec3d(pos)).translation(), new IconTransformation(sprite)); BlockCable blockCable = (BlockCable) state.getBlock(); IPipeTile<Insulation, WireProperties> tileEntityCable = blockCable.getPipeTileEntity(world, pos); if (tileEntityCable == null) { return; } Insulation insulation = tileEntityCable.getPipeType(); if (insulation == null) { return; } float thickness = insulation.getThickness(); int connectedSidesMask = blockCable.getActualConnections(tileEntityCable, world); Cuboid6 baseBox = BlockCable.getSideBox(null, thickness); BlockRenderer.renderCuboid(renderState, baseBox, 0); for (EnumFacing renderSide : EnumFacing.VALUES) { if ((connectedSidesMask & (1 << renderSide.getIndex())) > 0) { Cuboid6 sideBox = BlockCable.getSideBox(renderSide, thickness); BlockRenderer.renderCuboid(renderState, sideBox, 0); } } }
Example #6
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
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 #7
Source File: FluidStackRenderer.java From YouTubeModdingTutorial with MIT License | 6 votes |
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 #8
Source File: WidgetFluidFilter.java From Signals with GNU General Public License v3.0 | 6 votes |
@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 #9
Source File: Hud.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
/** * Draws a solid color rectangle with the specified coordinates and color. */ public static 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(); }
Example #10
Source File: GeometryTessellator.java From ForgeHax with MIT License | 5 votes |
private static void drawCuboid( final BufferBuilder buffer, final BlockPos begin, final BlockPos end, final int sides, final int argb, final double delta) { if (buffer.getDrawMode() == -1 || sides == 0) { return; } final double x0 = begin.getX() - delta; final double y0 = begin.getY() - delta; final double z0 = begin.getZ() - delta; final double x1 = end.getX() + 1 + delta; final double y1 = end.getY() + 1 + delta; final double z1 = end.getZ() + 1 + delta; switch (buffer.getDrawMode()) { case GL11.GL_QUADS: drawQuads(buffer, x0, y0, z0, x1, y1, z1, sides, argb); break; case GL11.GL_LINES: drawLines(buffer, x0, y0, z0, x1, y1, z1, sides, argb); break; default: throw new IllegalStateException("Unsupported mode!"); } }
Example #11
Source File: ParticlePortal.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
/** * Renders the particle */ public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { /*float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; f = MathHelper.clamp(f, 0.0F, 1.0F); this.particleScale = this.oSize * f;*/ super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); }
Example #12
Source File: GeometryTessellator.java From ForgeHax with MIT License | 5 votes |
public static void drawCuboid( final BufferBuilder buffer, final BlockPos begin, final BlockPos end, final int sides, final int argb) { drawCuboid(buffer, begin, end, sides, argb, GeometryTessellator.deltaS); }
Example #13
Source File: RenderUtil.java From seppuku with GNU General Public License v3.0 | 5 votes |
public static void drawTexture(float x, float y, float textureX, float textureY, float width, float height) { float f = 0.00390625F; float f1 = 0.00390625F; final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(x, (y + height), 0.0D).tex((textureX * f), ((textureY + height) * f1)).endVertex(); bufferbuilder.pos((x + width), (y + height), 0.0D).tex(((textureX + width) * f), ((textureY + height) * f1)).endVertex(); bufferbuilder.pos((x + width), y, 0.0D).tex(((textureX + width) * f), (textureY * f1)).endVertex(); bufferbuilder.pos(x, y, 0.0D).tex((textureX * f), (textureY * f1)).endVertex(); tessellator.draw(); }
Example #14
Source File: WavefrontObject.java From AdvancedRocketry with MIT License | 5 votes |
@SideOnly(Side.CLIENT) public void tessellateOnly(BufferBuilder buffer, String... groupNames) { for (GroupObject groupObject : groupObjects) { for (String groupName : groupNames) { if (groupName.equalsIgnoreCase(groupObject.name)) { groupObject.render(buffer); } } } }
Example #15
Source File: VBORenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void finish(BufferBuilder buffer, int cameraX, int cameraY, int cameraZ) { buffer.finishDrawing();//We dont care about this, but we need to tell it to finish. buffer.getNextBuffer(); setupRenderState(); parent.render(); clearRenderState(); }
Example #16
Source File: GuiTextureResource.java From WearableBackpacks with MIT License | 5 votes |
/** Draws part of the texture to the screen. */ public void drawQuad(int x, int y, int u, int v, int w, int h, float zLevel) { float scaleX = 1.0F / defaultWidth; float scaleY = 1.0F / defaultHeight; Tessellator tess = Tessellator.getInstance(); BufferBuilder vb = tess.getBuffer(); vb.begin(7, DefaultVertexFormats.POSITION_TEX); vb.pos(x + 0, y + h, zLevel).tex((u + 0) * scaleX, (v + h) * scaleY).endVertex(); vb.pos(x + w, y + h, zLevel).tex((u + w) * scaleX, (v + h) * scaleY).endVertex(); vb.pos(x + w, y + 0, zLevel).tex((u + w) * scaleX, (v + 0) * scaleY).endVertex(); vb.pos(x + 0, y + 0, zLevel).tex((u + 0) * scaleX, (v + 0) * scaleY).endVertex(); tess.draw(); }
Example #17
Source File: GuiElementBase.java From WearableBackpacks with MIT License | 5 votes |
public static void drawColoredRectARGB(int x, int y, int width, int height, int colorTL, int colorTR, int colorBL, int colorBR) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(x , y , 0).color(colorTL >> 16 & 0xFF, colorTL >> 8 & 0xFF, colorTL & 0xFF, colorTL >> 24 & 0xFF).endVertex(); buffer.pos(x , y + height, 0).color(colorBL >> 16 & 0xFF, colorBL >> 8 & 0xFF, colorBL & 0xFF, colorBL >> 24 & 0xFF).endVertex(); buffer.pos(x + width, y + height, 0).color(colorBR >> 16 & 0xFF, colorBR >> 8 & 0xFF, colorBR & 0xFF, colorBR >> 24 & 0xFF).endVertex(); buffer.pos(x + width, y , 0).color(colorTR >> 16 & 0xFF, colorTR >> 8 & 0xFF, colorTR & 0xFF, colorTR >> 24 & 0xFF).endVertex(); tessellator.draw(); }
Example #18
Source File: RenderFallTofu.java From TofuCraftReload with MIT License | 5 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityFallTofu entity, double x, double y, double z, float entityYaw, float partialTicks) { IBlockState iblockstate = BlockLoader.tofuTerrain.getDefaultState(); if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL) { World world = entity.getWorldObj(); if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) { this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } bufferbuilder.begin(7, DefaultVertexFormats.BLOCK); BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ); GlStateManager.translate((float) (x - (double) blockpos.getX() - 0.5D), (float) (y - (double) blockpos.getY()), (float) (z - (double) blockpos.getZ() - 0.5D)); BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, bufferbuilder, false); tessellator.draw(); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } } }
Example #19
Source File: DirectionalityRenderer.java From Signals with GNU General Public License v3.0 | 5 votes |
public void render(int dimensionID, BufferBuilder b){ BakedRenderer bakedRenderer = bakedRenderers.get(dimensionID); if(bakedRenderer != null) { b.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION); bakedRenderer.render(b); Tessellator.getInstance().draw(); } }
Example #20
Source File: TessellatorPool.java From OpenModsLib with MIT License | 5 votes |
public void startDrawing(int primitive, VertexFormat vertexFormat, WorldRendererUser user) { final Tessellator tes = reserveTessellator(); final BufferBuilder wr = tes.getBuffer(); wr.begin(primitive, vertexFormat); user.execute(wr); tes.draw(); pool.add(tes); }
Example #21
Source File: GuiContainerLargeStacks.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
public void drawQuad(BufferBuilder vertexBuffer, int x, int y, int width, int height, int red, int green, int blue, int alpha) { vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); vertexBuffer.pos(x + 0, y + 0, 0.0d).color(red, green, blue, alpha).endVertex(); vertexBuffer.pos(x + 0, y + height, 0.0d).color(red, green, blue, alpha).endVertex(); vertexBuffer.pos(x + width, y + height, 0.0d).color(red, green, blue, alpha).endVertex(); vertexBuffer.pos(x + width, y + 0, 0.0d).color(red, green, blue, alpha).endVertex(); Tessellator.getInstance().draw(); }
Example #22
Source File: StoneRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setPipeline(new Vector3(new Vec3d(pos)).translation(), new IconTransformation(sprite)); Cuboid6 baseBox = new Cuboid6(state.getBoundingBox(world, pos)); BlockRenderer.renderCuboid(renderState, baseBox, 0); }
Example #23
Source File: RenderUtils.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
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 #24
Source File: OptionScrollPane.java From NotEnoughItems with MIT License | 5 votes |
public static void drawOverlayTex(int x, int y, int w, int h, float zLevel) { GlStateManager.color(1, 1, 1, 1); Minecraft.getMinecraft().renderEngine.bindTexture(Gui.OPTIONS_BACKGROUND); CCRenderState ccrs = CCRenderState.instance(); BufferBuilder buffer = ccrs.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); buffer.pos(x, y, zLevel).tex(0, 0).endVertex(); buffer.pos(x, y + h, zLevel).tex(0, h / 16D).endVertex(); buffer.pos(x + w, y + h, zLevel).tex(w / 16D, h / 16D).endVertex(); buffer.pos(x + w, y, zLevel).tex(w / 16D, 0).endVertex(); ccrs.draw(); }
Example #25
Source File: BuildersWandRenderer.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private void renderModel(final IBlockState state, final IBakedModel model, final BlockPos pos, final int alpha) { final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); for (final EnumFacing facing : EnumFacing.values()) { this.renderQuads(state, pos, buffer, model.getQuads(state, facing, 0), alpha); } this.renderQuads(state, pos, buffer, model.getQuads(state, null, 0), alpha); tessellator.draw(); }
Example #26
Source File: RenderUtils.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
/** * Assumes a BufferBuilder in the GL_LINES mode has been initialized */ public static void drawBlockModelOutlinesBatched(IBakedModel model, IBlockState state, BlockPos pos, Color4f color, BufferBuilder buffer) { long rand = MathHelper.getPositionRandom(pos); for (final EnumFacing side : PositionUtils.FACING_ALL) { renderModelQuadOutlines(pos, buffer, color, model.getQuads(state, side, rand)); } renderModelQuadOutlines(pos, buffer, color, model.getQuads(state, null, rand)); }
Example #27
Source File: RenderUtils.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private static void renderQuadOutlinesBatched(BlockPos pos, BufferBuilder buffer, Color4f color, int[] vertexData) { final int x = pos.getX(); final int y = pos.getY(); final int z = pos.getZ(); float fx[] = new float[4]; float fy[] = new float[4]; float fz[] = new float[4]; for (int index = 0; index < 4; ++index) { fx[index] = x + Float.intBitsToFloat(vertexData[index * 7 + 0]); fy[index] = y + Float.intBitsToFloat(vertexData[index * 7 + 1]); fz[index] = z + Float.intBitsToFloat(vertexData[index * 7 + 2]); } buffer.pos(fx[0], fy[0], fz[0]).color(color.r, color.g, color.b, color.a).endVertex(); buffer.pos(fx[1], fy[1], fz[1]).color(color.r, color.g, color.b, color.a).endVertex(); buffer.pos(fx[1], fy[1], fz[1]).color(color.r, color.g, color.b, color.a).endVertex(); buffer.pos(fx[2], fy[2], fz[2]).color(color.r, color.g, color.b, color.a).endVertex(); buffer.pos(fx[2], fy[2], fz[2]).color(color.r, color.g, color.b, color.a).endVertex(); buffer.pos(fx[3], fy[3], fz[3]).color(color.r, color.g, color.b, color.a).endVertex(); buffer.pos(fx[3], fy[3], fz[3]).color(color.r, color.g, color.b, color.a).endVertex(); buffer.pos(fx[0], fy[0], fz[0]).color(color.r, color.g, color.b, color.a).endVertex(); }
Example #28
Source File: RenderUtils.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
public static void drawBlockModelQuadOverlayBatched(IBakedModel model, IBlockState state, BlockPos pos, Color4f color, double expand, BufferBuilder buffer) { long rand = MathHelper.getPositionRandom(pos); for (final EnumFacing side : PositionUtils.FACING_ALL) { renderModelQuadOverlayBatched(pos, buffer, color, model.getQuads(state, side, rand)); } renderModelQuadOverlayBatched(pos, buffer, color, model.getQuads(state, null, rand)); }
Example #29
Source File: ToroGuiUtils.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder worldrenderer = tessellator.getBuffer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(x + 0, y + height, 0.0D).tex((textureX + 0) * TEXTURE_HEIGHT_SCALER, (textureY + height) * TEXTURE_WIDTH_SCALER) .endVertex(); ; worldrenderer.pos(x + width, y + height, 0.0D).tex((textureX + width) * TEXTURE_HEIGHT_SCALER, (textureY + height) * TEXTURE_WIDTH_SCALER) .endVertex(); worldrenderer.pos(x + width, y + 0, 0.0D).tex((textureX + width) * TEXTURE_HEIGHT_SCALER, (textureY + 0) * TEXTURE_WIDTH_SCALER).endVertex(); worldrenderer.pos(x + 0, y + 0, 0.0D).tex((textureX + 0) * TEXTURE_HEIGHT_SCALER, (textureY + 0) * TEXTURE_WIDTH_SCALER).endVertex(); tessellator.draw(); }
Example #30
Source File: GuiHelper.java From LunatriusCore with MIT License | 5 votes |
public static void drawHorizontalGradientRectangle(final BufferBuilder buffer, final double x0, final double y0, final double x1, final double y1, final double z, final int startColor, final int endColor) { final int sa = (startColor >> 24) & 255; final int sr = (startColor >> 16) & 255; final int sg = (startColor >> 8) & 255; final int sb = startColor & 255; final int ea = (endColor >> 24) & 255; final int er = (endColor >> 16) & 255; final int eg = (endColor >> 8) & 255; final int eb = endColor & 255; drawHorizontalGradientRectangle(buffer, x0, y0, x1, y1, z, sr, sg, sb, sa, er, eg, eb, ea); }