com.mojang.blaze3d.vertex.IVertexBuilder Java Examples

The following examples show how to use com.mojang.blaze3d.vertex.IVertexBuilder. 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: RenderBlockTER.java    From MiningGadgets with MIT License 6 votes vote down vote up
private void renderModelBrightnessColorQuads(MatrixStack.Entry matrixEntry, IVertexBuilder builder, float red, float green, float blue, float alpha, List<BakedQuad> listQuads, int combinedLightsIn, int combinedOverlayIn) {
    for(BakedQuad bakedquad : listQuads) {
        float f;
        float f1;
        float f2;

        if (bakedquad.hasTintIndex()) {
            f = red * 1f;
            f1 = green * 1f;
            f2 = blue * 1f;
        } else {
            f = 1f;
            f1 = 1f;
            f2 = 1f;
        }

        builder.addVertexData(matrixEntry, bakedquad, f, f1, f2, alpha, combinedLightsIn, combinedOverlayIn);
    }
}
 
Example #2
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 6 votes vote down vote up
public void render(Matrix4 mat, IRenderTypeBuffer getter, double yToCamera) {
    Vec3d projectedView = TileEntityRendererDispatcher.instance.renderInfo.getProjectedView();
    mat = mat.copy();//Defensive copy, prevent external modifications.
    randy.setSeed(31100L);
    for (int i = 0; i < 16; i++) {
        RenderType.State state = RENDER_STATES.get(i);
        EndPortalRenderType renderType = new EndPortalRenderType(i, yToCamera, projectedView, mat, state);
        IVertexBuilder builder = getter.getBuffer(renderType);
        float r = (randy.nextFloat() * 0.5F + 0.1F) * renderType.f7;
        float g = (randy.nextFloat() * 0.5F + 0.4F) * renderType.f7;
        float b = (randy.nextFloat() * 0.5F + 0.5F) * renderType.f7;
        if (i == 0) {
            r = g = b = 1.0F * renderType.f7;
        }
        builder.pos(surfaceX1, surfaceY, surfaceZ1).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX1, surfaceY, surfaceZ2).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX2, surfaceY, surfaceZ2).color(r, g, b, 1.0F).endVertex();
        builder.pos(surfaceX2, surfaceY, surfaceZ1).color(r, g, b, 1.0F).endVertex();
    }
}
 
Example #3
Source File: RenderUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static void bufferCuboidOutline(IVertexBuilder builder, Cuboid6 c, float r, float g, float b, float a) {
    builder.pos(c.min.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
}
 
Example #4
Source File: BlockOverlayRender.java    From MiningGadgets with MIT License 5 votes vote down vote up
public static void render(RenderWorldLastEvent event, ItemStack item) {
    final Minecraft mc = Minecraft.getInstance();

    IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();

    int range = MiningProperties.getBeamRange(item);
    BlockRayTraceResult lookingAt = VectorHelper.getLookingAt(mc.player, RayTraceContext.FluidMode.NONE, range);
    if (mc.world.getBlockState(VectorHelper.getLookingAt(mc.player, item, range).getPos()) == Blocks.AIR.getDefaultState()) {
        return;
    }

    List<BlockPos> coords = MiningCollect.collect(mc.player, lookingAt, mc.world, MiningProperties.getRange(item));
    Vec3d view = mc.gameRenderer.getActiveRenderInfo().getProjectedView();

    MatrixStack matrix = event.getMatrixStack();
    matrix.push();
    matrix.translate(-view.getX(), -view.getY(), -view.getZ());

    IVertexBuilder builder;
    builder = buffer.getBuffer(MyRenderType.BlockOverlay);
    coords.forEach(e -> {
        if (mc.world.getBlockState(e).getBlock() != ModBlocks.RENDER_BLOCK.get()) {

            matrix.push();
            matrix.translate(e.getX(), e.getY(), e.getZ());
            matrix.translate(-0.005f, -0.005f, -0.005f);
            matrix.scale(1.01f, 1.01f, 1.01f);
            matrix.rotate(Vector3f.YP.rotationDegrees(-90.0F));

            Matrix4f positionMatrix = matrix.getLast().getMatrix();
            BlockOverlayRender.render(positionMatrix, builder, e, Color.GREEN);
            matrix.pop();
        }
    });
    matrix.pop();
    RenderSystem.disableDepthTest();
    buffer.finish(MyRenderType.BlockOverlay);
}
 
Example #5
Source File: WrappedItemModel.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void renderWrapped(ItemStack stack, TransformType transformType, MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, int packedOverlay) {
    IBakedModel model = wrapped.getOverrides().getModelWithOverrides(wrapped, stack, world, entity);

    ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
    RenderType rType = RenderTypeLookup.getRenderType(stack);
    if (transformType == TransformType.GUI && Objects.equals(rType, Atlases.getTranslucentBlockType())) {
        rType = Atlases.getTranslucentCullBlockType();
    }

    IVertexBuilder builder = ItemRenderer.getBuffer(getter, rType, true, stack.hasEffect());
    itemRenderer.renderModel(model, stack, packedLight, packedOverlay, mStack, builder);
}
 
Example #6
Source File: BakedQuadVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public IVertexBuilder normal(float x, float y, float z) {
    checkNewQuad();
    current.vertices[vertex].normal[0] = x;
    current.vertices[vertex].normal[1] = y;
    current.vertices[vertex].normal[2] = z;
    return this;
}
 
Example #7
Source File: BakedQuadVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public IVertexBuilder lightmap(int u, int v) {
    checkNewQuad();
    current.vertices[vertex].lightmap[0] = u / (float) 0xF0;
    current.vertices[vertex].lightmap[1] = v / (float) 0xF0;
    return this;
}
 
Example #8
Source File: BakedQuadVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public IVertexBuilder overlay(int u, int v) {
    checkNewQuad();
    current.vertices[vertex].overlay[0] = u / (float) 0xF0;
    current.vertices[vertex].overlay[1] = v / (float) 0xF0;
    return this;
}
 
Example #9
Source File: BakedQuadVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public IVertexBuilder tex(float u, float v) {
    checkNewQuad();
    current.vertices[vertex].uv[0] = u;
    current.vertices[vertex].uv[1] = v;
    return this;
}
 
Example #10
Source File: BakedQuadVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public IVertexBuilder color(int red, int green, int blue, int alpha) {
    checkNewQuad();
    current.vertices[vertex].color[0] = red / 255F;
    current.vertices[vertex].color[1] = green / 255F;
    current.vertices[vertex].color[2] = blue / 255F;
    current.vertices[vertex].color[3] = alpha / 255F;
    return this;
}
 
Example #11
Source File: BakedQuadVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public IVertexBuilder pos(double x, double y, double z) {
    checkNewQuad();
    current.vertices[vertex].vec[0] = (float) x;
    current.vertices[vertex].vec[1] = (float) y;
    current.vertices[vertex].vec[2] = (float) z;
    return this;
}
 
Example #12
Source File: TransformingVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public IVertexBuilder normal(float x, float y, float z) {
    storage.set(x, y, z);
    transform.applyN(storage);
    delegate.normal((float) storage.x, (float) storage.y, (float) storage.z);
    return this;
}
 
Example #13
Source File: TransformingVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public IVertexBuilder pos(double x, double y, double z) {
    storage.set(x, y, z);
    transform.apply(storage);
    delegate.pos(storage.x, storage.y, storage.z);
    return this;
}
 
Example #14
Source File: CCBlockRendererDispatcher.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public boolean renderFluid(BlockPos pos, ILightReader world, IVertexBuilder builder, IFluidState state) {
    Optional<ICCBlockRenderer> renderOpt = BlockRenderingRegistry.getBlockRenderers().stream().filter(e -> e.canHandleFluid(world, pos, state)).findFirst();
    //noinspection OptionalIsPresent
    if (renderOpt.isPresent()) {
        return renderOpt.get().renderFluid(pos, world, builder, state);
    } else {
        return super.renderFluid(pos, world, builder, state);
    }
}
 
Example #15
Source File: CCBlockRendererDispatcher.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void renderModel(BlockState state, BlockPos pos, ILightReader world, MatrixStack matrixStackIn, IVertexBuilder vertexBuilderIn, IModelData data) {
    Optional<ICCBlockRenderer> renderOpt = BlockRenderingRegistry.getBlockRenderers().stream().filter(e -> e.canHandleBlock(world, pos, state)).findFirst();
    if (renderOpt.isPresent()) {
        renderOpt.get().renderBreaking(state, pos, world, matrixStackIn, vertexBuilderIn, data);
    } else {
        parentDispatcher.renderModel(state, pos, world, matrixStackIn, vertexBuilderIn, data);
    }
}
 
Example #16
Source File: ModelEnderChest.java    From EnderStorage with MIT License 5 votes vote down vote up
public void render(MatrixStack stack, IVertexBuilder builder, int packedLight, int packedOverlay, boolean personal) {
    chestKnob.rotateAngleX = chestLid.rotateAngleX;
    diamondKnob.rotateAngleX = chestLid.rotateAngleX;
    chestLid.render(stack, builder, packedLight, packedOverlay);
    chestBelow.render(stack, builder, packedLight, packedOverlay);
    if (personal) {
        diamondKnob.render(stack, builder, packedLight, packedOverlay);
    } else {
        chestKnob.render(stack, builder, packedLight, packedOverlay);
    }
}
 
Example #17
Source File: RenderUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Builds a solid cuboid.
 * Expects VertexFormat of POSITION_COLOR.
 * If you need anything more specialized, Use a {@link CCModel}.
 *
 * @param builder The {@link IVertexBuilder}
 * @param c       The {@link Cuboid6}
 * @param r       Red color.
 * @param g       Green color.
 * @param b       Blue Color.
 * @param a       Alpha channel.
 */
public static void bufferCuboidSolid(IVertexBuilder builder, Cuboid6 c, float r, float g, float b, float a) {
    builder.pos(c.min.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();

    builder.pos(c.min.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();

    builder.pos(c.min.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();

    builder.pos(c.min.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();

    builder.pos(c.min.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.min.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();

    builder.pos(c.max.x, c.min.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.min.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.max.y, c.max.z).color(r, g, b, a).endVertex();
    builder.pos(c.max.x, c.min.y, c.max.z).color(r, g, b, a).endVertex();
}
 
Example #18
Source File: TransformingVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IVertexBuilder overlay(int u, int v) {
    delegate.overlay(u, v);
    return this;
}
 
Example #19
Source File: BlockOverlayRender.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static void render(Matrix4f  matrix, IVertexBuilder builder, BlockPos pos, Color color) {
    float red = color.getRed() / 255f, green = color.getGreen() / 255f, blue = color.getBlue() / 255f, alpha = .125f;

    float startX = 0, startY = 0, startZ = -1, endX = 1, endY = 1, endZ = 0;

    //down
    builder.pos(matrix, startX, startY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, startY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, startY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, startX, startY, endZ).color(red, green, blue, alpha).endVertex();

    //up
    builder.pos(matrix, startX, endY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, startX, endY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, endY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, endY, startZ).color(red, green, blue, alpha).endVertex();

    //east
    builder.pos(matrix, startX, startY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, startX, endY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, endY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, startY, startZ).color(red, green, blue, alpha).endVertex();

    //west
    builder.pos(matrix, startX, startY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, startY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, endY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, startX, endY, endZ).color(red, green, blue, alpha).endVertex();

    //south
    builder.pos(matrix, endX, startY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, endY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, endY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, endX, startY, endZ).color(red, green, blue, alpha).endVertex();

    //north
    builder.pos(matrix, startX, startY, startZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, startX, startY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, startX, endY, endZ).color(red, green, blue, alpha).endVertex();
    builder.pos(matrix, startX, endY, startZ).color(red, green, blue, alpha).endVertex();
}
 
Example #20
Source File: RenderMiningLaser2.java    From MiningGadgets with MIT License 4 votes vote down vote up
private static void drawLasers(RenderWorldLastEvent event, Vec3d from, RayTraceResult trace, double xOffset, double yOffset, double zOffset, float r, float g, float b, float thickness, PlayerEntity player, float ticks, float speedModifier) {
    Hand activeHand;
    if (player.getHeldItemMainhand().getItem() instanceof MiningGadget) {
        activeHand = Hand.MAIN_HAND;
    } else if (player.getHeldItemOffhand().getItem() instanceof MiningGadget) {
        activeHand = Hand.OFF_HAND;
    } else {
        return;
    }

    IVertexBuilder builder;
    ItemStack stack = player.getHeldItem(activeHand);
    double distance = from.subtract(trace.getHitVec()).length();
    long gameTime = player.world.getGameTime();
    double v = gameTime * speedModifier;
    float additiveThickness = (thickness * 3.5f) * calculateLaserFlickerModifier(gameTime);

    float beam2r = MiningProperties.getColor(stack, MiningProperties.COLOR_RED_INNER) / 255f;
    float beam2g = MiningProperties.getColor(stack, MiningProperties.COLOR_GREEN_INNER) / 255f;
    float beam2b =MiningProperties.getColor(stack, MiningProperties.COLOR_BLUE_INNER) / 255f;

    Vec3d view = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
    IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();

    MatrixStack matrix = event.getMatrixStack();

    matrix.push();

    matrix.translate(-view.getX(), -view.getY(), -view.getZ());
    matrix.translate(from.x, from.y, from.z);
    matrix.rotate(Vector3f.YP.rotationDegrees(MathHelper.lerp(ticks, -player.rotationYaw, -player.prevRotationYaw)));
    matrix.rotate(Vector3f.XP.rotationDegrees(MathHelper.lerp(ticks, player.rotationPitch, player.prevRotationPitch)));

    MatrixStack.Entry matrixstack$entry = matrix.getLast();
    Matrix3f matrixNormal = matrixstack$entry.getNormal();
    Matrix4f positionMatrix = matrixstack$entry.getMatrix();

    //additive laser beam
    builder = buffer.getBuffer(MyRenderType.LASER_MAIN_ADDITIVE);
    drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, additiveThickness, activeHand, distance, 0.5, 1, ticks, r,g,b,0.7f);

    //main laser, colored part
    builder = buffer.getBuffer(MyRenderType.LASER_MAIN_BEAM);
    drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, thickness, activeHand, distance, v, v + distance * 1.5, ticks, r,g,b,1f);

    //core
    builder = buffer.getBuffer(MyRenderType.LASER_MAIN_CORE);
    drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, thickness/2, activeHand, distance, v, v + distance * 1.5, ticks, beam2r,beam2g,beam2b,1f);
    matrix.pop();
    RenderSystem.disableDepthTest();
    buffer.finish();
}
 
Example #21
Source File: RenderMiningLaser2.java    From MiningGadgets with MIT License 4 votes vote down vote up
private static void drawBeam(double xOffset, double yOffset, double zOffset, IVertexBuilder builder, Matrix4f positionMatrix, Matrix3f matrixNormalIn, float thickness, Hand hand, double distance, double v1, double v2, float ticks, float r, float g, float b, float alpha) {
    Vector3f vector3f = new Vector3f(0.0f, 1.0f, 0.0f);
    vector3f.transform(matrixNormalIn);
    ClientPlayerEntity player = Minecraft.getInstance().player;
    // Support for hand sides remembering to take into account of Skin options
    if( Minecraft.getInstance().gameSettings.mainHand != HandSide.RIGHT )
        hand = hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND;
    float startXOffset = -0.25f;
    float startYOffset = -.115f;
    float startZOffset = 0.65f + (1 - player.getFovModifier());
    if (hand == Hand.OFF_HAND) {
        startYOffset = -.120f;
        startXOffset = 0.25f;
    }
    float f = (MathHelper.lerp(ticks, player.prevRotationPitch, player.rotationPitch) - MathHelper.lerp(ticks, player.prevRenderArmPitch, player.renderArmPitch));
    float f1 = (MathHelper.lerp(ticks, player.prevRotationYaw, player.rotationYaw) - MathHelper.lerp(ticks, player.prevRenderArmYaw, player.renderArmYaw));
    startXOffset = startXOffset + (f1 / 100000000);
    startYOffset = startYOffset + (f / 100000000);

    Vector4f vec1 = new Vector4f(startXOffset, -thickness + startYOffset, startZOffset, 1.0F);
    vec1.transform(positionMatrix);
    Vector4f vec2 = new Vector4f((float) xOffset, -thickness + (float) yOffset, (float) distance + (float) zOffset, 1.0F);
    vec2.transform(positionMatrix);
    Vector4f vec3 = new Vector4f((float) xOffset, thickness + (float) yOffset, (float) distance + (float) zOffset, 1.0F);
    vec3.transform(positionMatrix);
    Vector4f vec4 = new Vector4f(startXOffset, thickness + startYOffset, startZOffset, 1.0F);
    vec4.transform(positionMatrix);

    if (hand == Hand.MAIN_HAND) {
        builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        //Rendering a 2nd time to allow you to see both sides in multiplayer, shouldn't be necessary with culling disabled but here we are....
        builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
    } else {
        builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        //Rendering a 2nd time to allow you to see both sides in multiplayer, shouldn't be necessary with culling disabled but here we are....
        builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
        builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ());
    }
}
 
Example #22
Source File: LaserParticle.java    From MiningGadgets with MIT License 4 votes vote down vote up
@Override
public void renderParticle(IVertexBuilder builder, ActiveRenderInfo activeRenderInfo, float partialTicks) {
    super.renderParticle(builder, activeRenderInfo, partialTicks);
}
 
Example #23
Source File: PlayerParticle.java    From MiningGadgets with MIT License 4 votes vote down vote up
@Override
public void renderParticle(IVertexBuilder p_225606_1_, ActiveRenderInfo p_225606_2_, float p_225606_3_) {
    super.renderParticle(p_225606_1_, p_225606_2_, p_225606_3_);
}
 
Example #24
Source File: RenderUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void bufferHitBox(Matrix4 mat, IRenderTypeBuffer getter, Cuboid6 cuboid) {
    IVertexBuilder builder = new TransformingVertexBuilder(getter.getBuffer(RenderType.getLines()), mat);
    bufferCuboidOutline(builder, cuboid.copy().expand(0.0020000000949949026D), 0.0F, 0.0F, 0.0F, 0.4F);
}
 
Example #25
Source File: TransformingVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IVertexBuilder lightmap(int u, int v) {
    delegate.lightmap(u, v);
    return this;
}
 
Example #26
Source File: TransformingVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IVertexBuilder tex(float u, float v) {
    delegate.tex(u, v);
    return this;
}
 
Example #27
Source File: TransformingVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IVertexBuilder color(int red, int green, int blue, int alpha) {
    delegate.color(red, green, blue, alpha);
    return this;
}
 
Example #28
Source File: TransformingVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public TransformingVertexBuilder(IVertexBuilder delegate, Transformation transform) {
    this.delegate = delegate;
    this.transform = transform;
}
 
Example #29
Source File: TransformingVertexBuilder.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public TransformingVertexBuilder(IVertexBuilder delegate, MatrixStack stack) {
    this(delegate, new Matrix4(stack));
}
 
Example #30
Source File: CCRenderState.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public IVertexBuilder getConsumer() {
    return r;
}