public static void addVerticesToTessellator(@Nullable List<Vertex> vertices, @Nonnull VertexFormat format, boolean doBegin) { addVerticesToTessellator(vertices, null, format, doBegin); }
protected void renderConduitDynamic(@Nonnull IConduitTexture tex, @Nonnull IClientConduit.WithDefaultRendering conduit, @Nonnull CollidableComponent component, float brightness) { GlStateManager.color(1, 1, 1); if (component.isDirectional() && component.data == null) { final EnumFacing componentDirection = component.getDirection(); float scaleFactor = 0.75f; float xLen = Math.abs(componentDirection.getFrontOffsetX()) == 1 ? 1 : scaleFactor; float yLen = Math.abs(componentDirection.getFrontOffsetY()) == 1 ? 1 : scaleFactor; float zLen = Math.abs(componentDirection.getFrontOffsetZ()) == 1 ? 1 : scaleFactor; BoundingBox cube = component.bound; BoundingBox bb = cube.scale(xLen, yLen, zLen); TextureAtlasSprite sprite = tex.getSprite(); drawDynamicSection(bb, sprite.getInterpolatedU(tex.getUv().x * 16), sprite.getInterpolatedU(tex.getUv().z * 16), sprite.getInterpolatedV(tex.getUv().y * 16), sprite.getInterpolatedV(tex.getUv().w * 16), componentDirection, false, conduit.shouldMirrorTexture()); if (conduit.getConnectionMode(componentDirection) == ConnectionMode.DISABLED) { TextureAtlasSprite tex2 = ConduitBundleRenderManager.instance.getConnectorIcon(component.data); List<Vertex> corners = component.bound.getCornersWithUvForFace(componentDirection, tex2.getMinU(), tex2.getMaxU(), tex2.getMinV(), tex2.getMaxV()); RenderUtil.addVerticesToTessellator(corners, DefaultVertexFormats.POSITION_TEX, false); } } else { // TODO: HL: I commented this out because component.getDirection() (the second to last parameter) is always null in // this else branch and drawDynamicSection() with isTransmission=true (last parameter) would NPE on it. (Not a // mistake in the component.dir encapsulation, this was that way before.) // drawDynamicSection(component.bound, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), dir, true); } }
RenderUtil.addVerticesToTessellator(vertices, DefaultVertexFormats.POSITION_TEX_NORMAL, true); Tessellator.getInstance().draw();
private void renderSelection() { if (selection == null) { return; } BoundingBox bb = new BoundingBox(selection.config.getLocation()); TextureAtlasSprite icon = selectedFaceIcon.get(TextureAtlasSprite.class); List<Vertex> corners = bb.getCornersWithUvForFace(selection.face, icon.getMinU(), icon.getMaxU(), icon.getMinV(), icon.getMaxV()); GlStateManager.disableDepth(); GlStateManager.disableLighting(); RenderUtil.bindBlockTexture(); BufferBuilder tes = Tessellator.getInstance().getBuffer(); GlStateManager.color(1, 1, 1); Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z); tes.setTranslation(trans.x, trans.y, trans.z); RenderUtil.addVerticesToTessellator(corners, DefaultVertexFormats.POSITION_TEX, true); Tessellator.getInstance().draw(); tes.setTranslation(0, 0, 0); }