Java Code Examples for net.minecraft.client.renderer.Tessellator
The following examples show how to use
net.minecraft.client.renderer.Tessellator. These examples are extracted from open source projects.
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 Project: GardenCollection Source File: RenderHelperLL.java License: MIT License | 6 votes |
private void renderXYZUVAO (int[][] index) { Tessellator tessellator = Tessellator.instance; int[] tl = index[TL]; int[] bl = index[BL]; int[] br = index[BR]; int[] tr = index[TR]; tessellator.setColorOpaque_F(state.colorTopLeft[0], state.colorTopLeft[1], state.colorTopLeft[2]); tessellator.setBrightness(state.brightnessTopLeft); tessellator.addVertexWithUV(xyz[tl[0]], xyz[tl[1]], xyz[tl[2]], uv[tl[3]], uv[tl[4]]); tessellator.setColorOpaque_F(state.colorBottomLeft[0], state.colorBottomLeft[1], state.colorBottomLeft[2]); tessellator.setBrightness(state.brightnessBottomLeft); tessellator.addVertexWithUV(xyz[bl[0]], xyz[bl[1]], xyz[bl[2]], uv[bl[3]], uv[bl[4]]); tessellator.setColorOpaque_F(state.colorBottomRight[0], state.colorBottomRight[1], state.colorBottomRight[2]); tessellator.setBrightness(state.brightnessBottomRight); tessellator.addVertexWithUV(xyz[br[0]], xyz[br[1]], xyz[br[2]], uv[br[3]], uv[br[4]]); tessellator.setColorOpaque_F(state.colorTopRight[0], state.colorTopRight[1], state.colorTopRight[2]); tessellator.setBrightness(state.brightnessTopRight); tessellator.addVertexWithUV(xyz[tr[0]], xyz[tr[1]], xyz[tr[2]], uv[tr[3]], uv[tr[4]]); }
Example 2
Source Project: Gadomancy Source File: MultiTickEffectDispatcher.java License: GNU Lesser General Public License v3.0 | 6 votes |
private static void handleWispyLineEffects(World currentRenderWorld, float partialTicks) { Tessellator tessellator; Iterator<FloatyLineInfo> it = floatyLineInfos.iterator(); while(it.hasNext()) { FloatyLineInfo info = it.next(); if(info.dimId != currentRenderWorld.provider.dimensionId) { it.remove(); continue; } info.renderTicks++; if(info.renderTicks > info.tickCap) { it.remove(); continue; } if(info.randomOffset == -1) { info.randomOffset = currentRenderWorld.rand.nextInt(20); } float ticks = Minecraft.getMinecraft().renderViewEntity.ticksExisted + info.randomOffset + partialTicks; UtilsFX.drawFloatyLine(info.pedestalX, info.pedestalY, info.pedestalZ, info.originX, info.originY, info.originZ, partialTicks, info.colorAsInt, "textures/misc/wispy.png", -0.02F, Math.min(ticks, 10.0F) / 10.0F); } }
Example 3
Source Project: NOVA-Core Source File: FWParticle.java License: GNU Lesser General Public License v3.0 | 6 votes |
@Override public void renderParticle(VertexBuffer worldRendererIn, net.minecraft.entity.Entity p_180434_2_, float p_70539_2_, float x, float y, float z, float p_70539_6_, float p_70539_7_) { if (firstTick) { prevPosX = posX; prevPosY = posY; prevPosZ = posZ; setPosition(posX, posY, posZ); firstTick = false; } float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX); float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY); float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ); Tessellator.getInstance().draw(); FWEntityRenderer.render(this, wrapped, f11, f12, f13); Tessellator.getInstance().getBuffer().begin(GL_QUADS, DefaultVertexFormats.BLOCK); FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderUtility.particleResource); }
Example 4
Source Project: PneumaticCraft Source File: GuiCheckBox.java License: GNU General Public License v3.0 | 6 votes |
@Override public void render(int mouseX, int mouseY, float partialTick){ drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? -6250336 : 0xFF999999); drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? -16777216 : 0xFFAAAAAA); if(checked) { GL11.glDisable(GL11.GL_TEXTURE_2D); if(enabled) { GL11.glColor4d(1, 1, 1, 1); } else { GL11.glColor4d(0.8, 0.8, 0.8, 1); } Tessellator t = Tessellator.instance; t.startDrawing(GL11.GL_LINE_STRIP); t.addVertex(x + 2, y + 5, zLevel); t.addVertex(x + 5, y + 7, zLevel); t.addVertex(x + 8, y + 3, zLevel); t.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888); }
Example 5
Source Project: Signals Source File: GuiCheckBox.java License: GNU General Public License v3.0 | 6 votes |
@Override public void render(int mouseX, int mouseY, float partialTick){ drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? -6250336 : 0xFF999999); drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? -16777216 : 0xFFAAAAAA); if(checked) { GL11.glDisable(GL11.GL_TEXTURE_2D); if(enabled) { GL11.glColor4d(1, 1, 1, 1); } else { GL11.glColor4d(0.8, 0.8, 0.8, 1); } BufferBuilder wr = Tessellator.getInstance().getBuffer(); wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); wr.pos(x + 2, y + 5, zLevel).endVertex(); wr.pos(x + 5, y + 7, zLevel).endVertex(); wr.pos(x + 8, y + 3, zLevel).endVertex(); Tessellator.getInstance().draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888); }
Example 6
Source Project: seppuku Source File: RenderUtil.java License: GNU General Public License v3.0 | 6 votes |
public static void drawPlane(AxisAlignedBB boundingBox, int color) { float alpha = (color >> 24 & 0xFF) / 255.0F; float red = (color >> 16 & 0xFF) / 255.0F; float green = (color >> 8 & 0xFF) / 255.0F; float blue = (color & 0xFF) / 255.0F; double minX = boundingBox.minX; double minY = boundingBox.minY; double minZ = boundingBox.minZ; double maxX = boundingBox.maxX; double maxY = boundingBox.maxY; double maxZ = boundingBox.maxZ; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); bufferbuilder.pos(minX, minY, minZ).color(red, green, blue, alpha).endVertex(); bufferbuilder.pos(maxX, minY, maxZ).color(red, green, blue, alpha).endVertex(); bufferbuilder.pos(minX, minY, maxZ).color(red, green, blue, 0).endVertex(); bufferbuilder.pos(maxZ, minY, minZ).color(red, green, blue, alpha).endVertex(); tessellator.draw(); }
Example 7
Source Project: bleachhack-1.14 Source File: RenderUtils.java License: GNU General Public License v3.0 | 6 votes |
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) { gl11Setup(); GL11.glLineWidth(t); Vec3d ren = renderPos(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(3, DefaultVertexFormats.POSITION_COLOR); buffer.pos(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 0.0F).endVertex(); buffer.pos(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 1.0F).endVertex(); buffer.pos(x2 - ren.x, y2 - ren.y, z2 - ren.z).color(r, g, b, 1.0F).endVertex(); tessellator.draw(); gl11Cleanup(); }
Example 8
Source Project: Et-Futurum Source File: BlockChorusFlowerRender.java License: The Unlicense | 6 votes |
private void renderCube(RenderBlocks renderer, Block block, int meta) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); tessellator.draw(); }
Example 9
Source Project: Et-Futurum Source File: LingeringPotionRenderer.java License: The Unlicense | 6 votes |
private void renderIcon(IIcon icon) { Tessellator tessellator = Tessellator.instance; float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); OpenGLHelper.rotate(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F); OpenGLHelper.rotate(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV(-0.5F, -0.25F, 0.0D, minU, maxV); tessellator.addVertexWithUV(0.5F, -0.25F, 0.0D, maxU, maxV); tessellator.addVertexWithUV(0.5F, 0.75F, 0.0D, maxU, minV); tessellator.addVertexWithUV(-0.5F, 0.75F, 0.0D, minU, minV); tessellator.draw(); }
Example 10
Source Project: Chisel Source File: RenderBlocksCTM.java License: GNU General Public License v2.0 | 6 votes |
@Override public boolean renderStandardBlock(Block block, int x, int y, int z) { bx = x; by = y; bz = z; tessellator = Tessellator.instance; tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F); tessellator.addTranslation(x, y, z); boolean res = super.renderStandardBlock(block, x, y, z); tessellator.addTranslation(-x, -y, -z); return res; }
Example 11
Source Project: XRay-Mod Source File: GuiAddBlock.java License: GNU General Public License v3.0 | 6 votes |
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 12
Source Project: PneumaticCraft Source File: GuiRadioButton.java License: GNU General Public License v3.0 | 6 votes |
private void drawCircle(int x, int y, int radius, int color){ Tessellator t = Tessellator.instance; float f = (color >> 24 & 255) / 255.0F; float f1 = (color >> 16 & 255) / 255.0F; float f2 = (color >> 8 & 255) / 255.0F; float f3 = (color & 255) / 255.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(f1, f2, f3, f); t.startDrawing(GL11.GL_TRIANGLE_FAN); int points = 20; for(int i = 0; i < points; i++) { double sin = Math.sin((double)i / points * Math.PI * 2); double cos = Math.cos((double)i / points * Math.PI * 2); t.addVertex(x + sin * radius, y + cos * radius, zLevel); } t.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
Example 13
Source Project: BigReactors Source File: BeefGuiTextureProgressBar.java License: MIT License | 6 votes |
@Override protected void drawProgressBar(Tessellator tessellator, TextureManager renderEngine, int barMinX, int barMaxX, int barMinY, int barMaxY, int zLevel) { double barHeight = Math.round((getProgress() * (this.height-2))) + 2; if(getProgress() > 0.00001) { barHeight = Math.max(getBarMinHeight(), barHeight); } double barMaxV = 1; double barMinV = 1 - Math.min(1, Math.max(0, barHeight / this.height)); renderEngine.bindTexture(getBarTexture()); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height, zLevel, barLeftU, barMaxV); tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height, zLevel, barRightU, barMaxV); tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height - barHeight, zLevel, barRightU, barMinV); tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height - barHeight, zLevel, barLeftU, barMinV); tessellator.draw(); }
Example 14
Source Project: PneumaticCraft Source File: RenderBlockArrows.java License: GNU General Public License v3.0 | 6 votes |
private void drawArrow(float progress){ double arrowBaseWidth = 0.4D; double arrowBaseLength = 0.8D; double arrowLength = 1.5D; double arrowWidth = 0.7D; double scale = 0.1D; GL11.glPushMatrix(); GL11.glScaled(scale, scale, scale); GL11.glTranslatef(0, progress * 4, 0); Tessellator tess = Tessellator.instance; tess.startDrawing(GL11.GL_LINE_STRIP); tess.addVertex(-arrowBaseWidth, -arrowLength * 0.5D, 0); tess.addVertex(-arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0); tess.addVertex(-arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0); tess.addVertex(0, arrowLength * 0.5D, 0); tess.addVertex(arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0); tess.addVertex(arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0); tess.addVertex(arrowBaseWidth, -arrowLength * 0.5D, 0); tess.draw(); GL11.glPopMatrix(); }
Example 15
Source Project: MediaMod Source File: PlayerOverlay.java License: GNU General Public License v3.0 | 5 votes |
/** * Draws a rectangle with a vertical gradient between the specified colors (ARGB format). * Args: x1, y1, x2, y2, topColor, bottomColor * * @author ScottehBoeh */ private void drawGradientRect(double left, double top, double right, double bottom, int startColor, int endColor) { float f = (float) (startColor >> 24 & 255) / 255.0F; float f1 = (float) (startColor >> 16 & 255) / 255.0F; float f2 = (float) (startColor >> 8 & 255) / 255.0F; float f3 = (float) (startColor & 255) / 255.0F; float f4 = (float) (endColor >> 24 & 255) / 255.0F; float f5 = (float) (endColor >> 16 & 255) / 255.0F; float f6 = (float) (endColor >> 8 & 255) / 255.0F; float f7 = (float) (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.shadeModel(7425); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(right, top, 0).color(f1, f2, f3, f).endVertex(); worldrenderer.pos(left, top, 0).color(f1, f2, f3, f).endVertex(); worldrenderer.pos(left, bottom, 0).color(f5, f6, f7, f4).endVertex(); worldrenderer.pos(right, bottom, 0).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
Example 16
Source Project: PneumaticCraft Source File: ProgWidget.java License: GNU General Public License v3.0 | 5 votes |
@Override public void render(){ FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture()); int width = getWidth() + (getParameters() != null && getParameters().length > 0 ? 10 : 0); int height = getHeight() + (hasStepOutput() ? 10 : 0); Tessellator t = Tessellator.instance; t.startDrawingQuads(); t.addVertexWithUV(0, 0, 0, 0, 0); t.addVertexWithUV(0, height, 0, 0, 1); t.addVertexWithUV(width, height, 0, 1, 1); t.addVertexWithUV(width, 0, 0, 1, 0); t.draw(); }
Example 17
Source Project: Signals Source File: DirectionalityRenderer.java License: 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 18
Source Project: Gadomancy Source File: FXVortex.java License: GNU Lesser General Public License v3.0 | 5 votes |
public static void sheduleRender(List<FXVortex> vortexes, Tessellator tessellator, float partialTicks) { synchronized (EffectHandler.lockEffects) { for (FXVortex vortex : vortexes) { GL11.glPushMatrix(); vortex.render(tessellator, partialTicks); GL11.glPopMatrix(); } } }
Example 19
Source Project: TFC2 Source File: GuiInventoryButton.java License: GNU General Public License v3.0 | 5 votes |
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 20
Source Project: seppuku Source File: RenderUtil.java License: GNU General Public License v3.0 | 5 votes |
public static void drawGradientRect(float left, float top, float right, float bottom, int startColor, int endColor) { float f = (float) (startColor >> 24 & 255) / 255.0F; float f1 = (float) (startColor >> 16 & 255) / 255.0F; float f2 = (float) (startColor >> 8 & 255) / 255.0F; float f3 = (float) (startColor & 255) / 255.0F; float f4 = (float) (endColor >> 24 & 255) / 255.0F; float f5 = (float) (endColor >> 16 & 255) / 255.0F; float f6 = (float) (endColor >> 8 & 255) / 255.0F; float f7 = (float) (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(7425); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR); bufferbuilder.pos((double) right, (double) top, (double) 0).color(f1, f2, f3, f).endVertex(); bufferbuilder.pos((double) left, (double) top, (double) 0).color(f1, f2, f3, f).endVertex(); bufferbuilder.pos((double) left, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex(); bufferbuilder.pos((double) right, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
Example 21
Source Project: GardenCollection Source File: RenderHelper.java License: MIT License | 5 votes |
public void renderCrossedSquares (IBlockAccess blockAccess, Block block, int x, int y, int z, IIcon icon) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z)); calculateBaseColor(colorScratch, block.colorMultiplier(blockAccess, x, y, z)); setTessellatorColor(tessellator, colorScratch); drawCrossedSquares(icon, x, y, z, 1.0F); }
Example 22
Source Project: PneumaticCraft Source File: RenderProgressingLine.java License: GNU General Public License v3.0 | 5 votes |
@SideOnly(Side.CLIENT) public void render(){ Tessellator tess = Tessellator.instance; tess.startDrawing(GL11.GL_LINES); tess.addVertex(startX, startY, startZ); tess.addVertex(startX + (endX - startX) * progress, startY + (endY - startY) * progress, startZ + (endZ - startZ) * progress); tess.draw(); }
Example 23
Source Project: seppuku Source File: RenderUtil.java License: GNU General Public License v3.0 | 5 votes |
public static void drawTexture(float x, float y, float width, float height, float u, float v, float t, float s) { final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(x + width, y, 0F).tex(t, v).endVertex(); bufferbuilder.pos(x, y, 0F).tex(u, v).endVertex(); bufferbuilder.pos(x, y + height, 0F).tex(u, s).endVertex(); bufferbuilder.pos(x, y + height, 0F).tex(u, s).endVertex(); bufferbuilder.pos(x + width, y + height, 0F).tex(t, s).endVertex(); bufferbuilder.pos(x + width, y, 0F).tex(t, v).endVertex(); tessellator.draw(); }
Example 24
Source Project: Chisel-2 Source File: EntityHolystoneFX.java License: GNU General Public License v2.0 | 5 votes |
@Override public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { particleScale = 0.25f + initialScale * (float) Math.sin((particleAge + angleOffset) / 180.f); if (particleAge < fadetime) particleAlpha = particleAge / fadetime; else if (particleAge + fadetime >= particleMaxAge) particleAlpha = (particleMaxAge - particleAge) / fadetime; else particleAlpha = 1.0f; super.renderParticle(tessellator, partialTick, rotX, rotXZ, rotZ, rotYZ, rotXY); }
Example 25
Source Project: CommunityMod Source File: GuiAssembler.java License: GNU Lesser General Public License v2.1 | 5 votes |
public void drawGradientRect(GuiRoutiduct gui, int x, int y, int width, int height, int startColor, int endColor) { x = adjustX(gui, x); y = adjustY(gui, y); int left = x; int top = y; int right = x + width; int bottom = y + height; float f = (float) (startColor >> 24 & 255) / 255.0F; float f1 = (float) (startColor >> 16 & 255) / 255.0F; float f2 = (float) (startColor >> 8 & 255) / 255.0F; float f3 = (float) (startColor & 255) / 255.0F; float f4 = (float) (endColor >> 24 & 255) / 255.0F; float f5 = (float) (endColor >> 16 & 255) / 255.0F; float f6 = (float) (endColor >> 8 & 255) / 255.0F; float f7 = (float) (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(7425); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); vertexbuffer.pos((double) right, (double) top, (double) 0).color(f1, f2, f3, f).endVertex(); vertexbuffer.pos((double) left, (double) top, (double) 0).color(f1, f2, f3, f).endVertex(); vertexbuffer.pos((double) left, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex(); vertexbuffer.pos((double) right, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
Example 26
Source Project: BigReactors Source File: BeefGuiControlBase.java License: MIT License | 5 votes |
protected static void drawTexturedModelRectFromIcon(int x, int y, IIcon icon, int width, int height) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)(x + 0), (double)(y + height), 0.0D, (double)icon.getMinU(), (double)icon.getMaxV()); tessellator.addVertexWithUV((double)(x + width), (double)(y + height), 0.0D, (double)icon.getMaxU(), (double)icon.getMaxV()); tessellator.addVertexWithUV((double)(x + width), (double)(y + 0), 0.0D, (double)icon.getMaxU(), (double)icon.getMinV()); tessellator.addVertexWithUV((double)(x + 0), (double)(y + 0), 0.0D, (double)icon.getMinU(), (double)icon.getMinV()); tessellator.draw(); }
Example 27
Source Project: AdvancedRocketry Source File: GroupObject.java License: MIT License | 5 votes |
@SideOnly(Side.CLIENT) public void render() { if (faces.size() > 0) { BufferBuilder buffer = Tessellator.getInstance().getBuffer(); buffer.begin(glDrawingMode, drawMode); render(buffer); Tessellator.getInstance().draw(); } }
Example 28
Source Project: ExNihiloAdscensio Source File: RenderProjectileStone.java License: MIT License | 5 votes |
@Override public void doRender(ProjectileStone entity, double x, double y, double z, float entityYaw, float partialTicks) { TextureAtlasSprite texture = getTexture(Blocks.STONE.getDefaultState()); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); double minU = (double) texture.getMinU(); double maxU = (double) texture.getMaxU(); double minV = (double) texture.getMinV(); double maxV = (double) texture.getMaxV(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); double size = 0.5; //bufferCuboid(buffer, 1, minU, minV, maxU, maxV, -8, -8, -8, 8, 8, 8); bufferCuboid(buffer, size, minU, minV, maxU, maxV, -4, -2, -2, -2, 2, 2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, 4, 2, 2, 2, -2, -2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, -2, -4, -2, 2, -2, 2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, 2, 4, 2, -2, 2, -2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, -2, -2, -4, 2, 2, -2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, 2, 2, 4, -2, -2, 2); tessellator.draw(); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
Example 29
Source Project: OpenModsLib Source File: BaseComponent.java License: MIT License | 5 votes |
protected void drawSprite(Icon icon, int x, int y, int width, int height) { parent.bindTexture(icon.texture); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder worldrenderer = tessellator.getBuffer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(x + 0, y + height, this.zLevel).tex(icon.minU, icon.maxV).endVertex(); worldrenderer.pos(x + width, y + height, this.zLevel).tex(icon.maxU, icon.maxV).endVertex(); worldrenderer.pos(x + width, y + 0, this.zLevel).tex(icon.maxU, icon.minV).endVertex(); worldrenderer.pos(x + 0, y + 0, this.zLevel).tex(icon.minU, icon.minV).endVertex(); tessellator.draw(); }
Example 30
Source Project: OpenModsLib Source File: CachedRendererFactory.java License: MIT License | 5 votes |
public DisplayListRenderer(Tessellator tes) { displayList = GL11.glGenLists(1); if (isDisplayListValid()) { GL11.glNewList(displayList, GL11.GL_COMPILE); tes.draw(); GL11.glEndList(); } }