Java Code Examples for com.mojang.blaze3d.systems.RenderSystem#lineWidth()

The following examples show how to use com.mojang.blaze3d.systems.RenderSystem#lineWidth() . 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: ShapesRenderer.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public void renderLines(Tessellator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
{
    if (shape.a == 0.0) return;
    Vec3d v1 = shape.relativiseRender(client.world, shape.from, partialTick);
    Vec3d v2 = shape.relativiseRender(client.world, shape.to, partialTick);
    RenderSystem.lineWidth(shape.lineWidth);
    drawBoxWireGLLines(tessellator, bufferBuilder,
            (float)(v1.x-cx-renderEpsilon), (float)(v1.y-cy-renderEpsilon), (float)(v1.z-cz-renderEpsilon),
            (float)(v2.x-cx+renderEpsilon), (float)(v2.y-cy+renderEpsilon), (float)(v2.z-cz+renderEpsilon),
            v1.x!=v2.x, v1.y!=v2.y, v1.z!=v2.z,
            shape.r, shape.g, shape.b, shape.a, shape.r, shape.g, shape.b
    );
}
 
Example 2
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public void renderFaces(Tessellator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
{
    if (shape.fa == 0.0) return;
    Vec3d v1 = shape.relativiseRender(client.world, shape.from, partialTick);
    Vec3d v2 = shape.relativiseRender(client.world, shape.to, partialTick);
    RenderSystem.lineWidth(1.0F);
    drawBoxFaces(tessellator, bufferBuilder,
            (float)(v1.x-cx-renderEpsilon), (float)(v1.y-cy-renderEpsilon), (float)(v1.z-cz-renderEpsilon),
            (float)(v2.x-cx+renderEpsilon), (float)(v2.y-cy+renderEpsilon), (float)(v2.z-cz+renderEpsilon),
            v1.x!=v2.x, v1.y!=v2.y, v1.z!=v2.z,
            shape.fr, shape.fg, shape.fb, shape.fa
    );
}
 
Example 3
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public void renderLines(Tessellator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
{
    Vec3d v1 = shape.relativiseRender(client.world, shape.from, partialTick);
    Vec3d v2 = shape.relativiseRender(client.world, shape.to, partialTick);
    RenderSystem.lineWidth(shape.lineWidth);
    drawLine(tessellator, bufferBuilder,
            (float)(v1.x-cx-renderEpsilon), (float)(v1.y-cy-renderEpsilon), (float)(v1.z-cz-renderEpsilon),
            (float)(v2.x-cx+renderEpsilon), (float)(v2.y-cy+renderEpsilon), (float)(v2.z-cz+renderEpsilon),
            shape.r, shape.g, shape.b, shape.a
    );
}
 
Example 4
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public void renderLines(Tessellator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
{
    if (shape.a == 0.0) return;
    Vec3d vc = shape.relativiseRender(client.world, shape.center, partialTick);
    RenderSystem.lineWidth(shape.lineWidth);
    drawSphereWireframe(tessellator, bufferBuilder,
            (float)(vc.x-cx), (float)(vc.y-cy), (float)(vc.z-cz),
            (float)(shape.radius+renderEpsilon), shape.subdivisions,
            shape.r, shape.g, shape.b, shape.a);
}
 
Example 5
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public void renderFaces(Tessellator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
{
    if (shape.fa == 0.0) return;
    Vec3d vc = shape.relativiseRender(client.world, shape.center, partialTick);
    RenderSystem.lineWidth(1.0f);
    drawSphereFaces(tessellator, bufferBuilder,
            (float)(vc.x-cx), (float)(vc.y-cy), (float)(vc.z-cz),
            (float)(shape.radius+renderEpsilon), shape.subdivisions,
            shape.fr, shape.fg, shape.fb, shape.fa);
}
 
Example 6
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public void renderLines(Tessellator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
{
    if (shape.a == 0.0) return;
    Vec3d vc = shape.relativiseRender(client.world, shape.center, partialTick);
    RenderSystem.lineWidth(shape.lineWidth);
    double dir = MathHelper.sign(shape.height);
    drawCylinderWireframe(tessellator, bufferBuilder,
            (float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon),
            (float) (shape.radius + renderEpsilon), (float) (shape.height + 2*dir*renderEpsilon), shape.axis,
            shape.subdivisions, shape.radius == 0,
            shape.r, shape.g, shape.b, shape.a);

}
 
Example 7
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public void renderFaces(Tessellator tessellator, BufferBuilder bufferBuilder, double cx, double cy, double cz, float partialTick)
{
    if (shape.fa == 0.0) return;
    Vec3d vc = shape.relativiseRender(client.world, shape.center, partialTick);
    RenderSystem.lineWidth(1.0f);
    double dir = MathHelper.sign(shape.height);
    drawCylinderFaces(tessellator, bufferBuilder,
            (float) (vc.x - cx - dir * renderEpsilon), (float) (vc.y - cy - dir * renderEpsilon), (float) (vc.z - cz - dir * renderEpsilon),
            (float) (shape.radius + renderEpsilon), (float) (shape.height + 2*dir*renderEpsilon), shape.axis,
            shape.subdivisions, shape.radius == 0,
            shape.fr, shape.fg, shape.fb, shape.fa);
}
 
Example 8
Source File: Render.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void apply()
{
    RenderSystem.disableTexture();
    RenderSystem.disableDepthTest();
    RenderSystem.depthMask( false );
    RenderSystem.polygonMode( GL_FRONT_AND_BACK, GL_LINE );
    RenderSystem.blendFunc( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA );
    RenderSystem.enableBlend();
    RenderSystem.lineWidth( (float) Configuration.general.outlineThickness.get().doubleValue() );
}
 
Example 9
Source File: ShapesRenderer.java    From fabric-carpet with MIT License 4 votes vote down vote up
public void render(Camera camera, float partialTick)
{
    IWorld iWorld = this.client.world;
    DimensionType dimensionType = iWorld.getDimension().getType();
    if (shapes.get(dimensionType) == null || shapes.get(dimensionType).isEmpty()) return;
    long currentTime = client.world.getTime();
    RenderSystem.disableTexture();
    RenderSystem.enableDepthTest();
    RenderSystem.depthFunc(515);
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    //RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
    //RenderSystem.shadeModel(7425);
    RenderSystem.shadeModel(GL11.GL_FLAT);
    RenderSystem.enableAlphaTest();
    RenderSystem.alphaFunc(GL11.GL_GREATER, 0.003f);
    RenderSystem.disableCull();
    RenderSystem.disableLighting();
    RenderSystem.depthMask(false);
    //RenderSystem.polygonOffset(-3f, -3f);
    //RenderSystem.enablePolygonOffset();
    //Entity entity = this.client.gameRenderer.getCamera().getFocusedEntity();

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();

    // render
    double cameraX = camera.getPos().x;
    double cameraY = camera.getPos().y;
    double cameraZ = camera.getPos().z;

    synchronized (shapes)
    {
        shapes.get(dimensionType).long2ObjectEntrySet().removeIf(
                entry -> entry.getValue().isExpired(currentTime)
        );
        shapes.get(dimensionType).values().forEach(
                s ->
                {
                    if ( s.shouldRender(dimensionType))
                        s.renderFaces(tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick);
                }
        );
        //lines
        shapes.get(dimensionType).values().forEach(

                s -> {
                    if ( s.shouldRender(dimensionType))
                        s.renderLines(tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick);
                }
        );
    }
    RenderSystem.enableCull();
    RenderSystem.depthMask(true);
    RenderSystem.lineWidth(1.0F);
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    RenderSystem.enableTexture();
    RenderSystem.shadeModel(7424);
}