Search in sources :

Example 6 with Framebuffer

use of net.minecraft.client.gl.Framebuffer in project meteor-client by MeteorDevelopment.

the class WorldRendererMixin method renderEntity.

@Inject(method = "renderEntity", at = @At("HEAD"))
private void renderEntity(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo info) {
    if (EntityShaders.shouldDrawOverlay(entity) && vertexConsumers != EntityShaders.overlayVertexConsumerProvider && vertexConsumers != EntityShaders.outlinesVertexConsumerProvider) {
        Framebuffer prevBuffer = this.entityOutlinesFramebuffer;
        this.entityOutlinesFramebuffer = EntityShaders.overlayFramebuffer;
        EntityShaders.overlayVertexConsumerProvider.setColor(0, 0, 0, 100);
        GlStateManager._disableDepthTest();
        renderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, matrices, EntityShaders.overlayVertexConsumerProvider);
        GlStateManager._enableDepthTest();
        this.entityOutlinesFramebuffer = prevBuffer;
    }
    if (EntityShaders.shouldDrawOutline(entity) && vertexConsumers != EntityShaders.outlinesVertexConsumerProvider && vertexConsumers != EntityShaders.overlayVertexConsumerProvider) {
        Framebuffer prevBuffer = this.entityOutlinesFramebuffer;
        this.entityOutlinesFramebuffer = EntityShaders.outlinesFramebuffer;
        Utils.renderingEntityOutline = true;
        Color color = Modules.get().get(ESP.class).getOutlineColor(entity);
        EntityShaders.outlinesVertexConsumerProvider.setColor(color.r, color.g, color.b, color.a);
        GlStateManager._disableDepthTest();
        renderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, matrices, EntityShaders.outlinesVertexConsumerProvider);
        GlStateManager._enableDepthTest();
        Utils.renderingEntityOutline = false;
        this.entityOutlinesFramebuffer = prevBuffer;
    }
}
Also used : Framebuffer(net.minecraft.client.gl.Framebuffer) Color(meteordevelopment.meteorclient.utils.render.color.Color)

Example 7 with Framebuffer

use of net.minecraft.client.gl.Framebuffer in project meteor-client by MeteorDevelopment.

the class EntityShaders method renderOutlines.

public static void renderOutlines(Runnable draw, boolean entities, int width, float fillOpacity, ShapeMode shapeMode) {
    WorldRenderer worldRenderer = mc.worldRenderer;
    WorldRendererAccessor wra = (WorldRendererAccessor) worldRenderer;
    Framebuffer fbo = worldRenderer.getEntityOutlinesFramebuffer();
    if (entities)
        wra.setEntityOutlinesFramebuffer(outlinesFramebuffer);
    else {
        outlinesFramebuffer.clear(false);
        outlinesFramebuffer.beginWrite(false);
    }
    draw.run();
    if (entities)
        wra.setEntityOutlinesFramebuffer(fbo);
    mc.getFramebuffer().beginWrite(false);
    GL.bindTexture(outlinesFramebuffer.getColorAttachment());
    outlinesShader.bind();
    outlinesShader.set("u_Size", mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
    outlinesShader.set("u_Texture", 0);
    outlinesShader.set("u_Width", width);
    outlinesShader.set("u_FillOpacity", fillOpacity / 255.0);
    outlinesShader.set("u_ShapeMode", shapeMode.ordinal());
    PostProcessRenderer.render();
}
Also used : WorldRendererAccessor(meteordevelopment.meteorclient.mixin.WorldRendererAccessor) SimpleFramebuffer(net.minecraft.client.gl.SimpleFramebuffer) Framebuffer(net.minecraft.client.gl.Framebuffer) WorldRenderer(net.minecraft.client.render.WorldRenderer)

Example 8 with Framebuffer

use of net.minecraft.client.gl.Framebuffer in project meteor-client by MeteorDevelopment.

the class EntityShaders method endRender.

public static void endRender() {
    WorldRenderer worldRenderer = mc.worldRenderer;
    WorldRendererAccessor wra = (WorldRendererAccessor) worldRenderer;
    Framebuffer fbo = worldRenderer.getEntityOutlinesFramebuffer();
    // Overlay
    if (chams != null && chams.isShader()) {
        wra.setEntityOutlinesFramebuffer(overlayFramebuffer);
        overlayVertexConsumerProvider.draw();
        wra.setEntityOutlinesFramebuffer(fbo);
        mc.getFramebuffer().beginWrite(false);
        GL.bindTexture(overlayFramebuffer.getColorAttachment());
        overlayShader.bind();
        overlayShader.set("u_Size", mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
        overlayShader.set("u_Texture", 0);
        overlayShader.set("u_Time", timer++ / 20.0);
        PostProcessRenderer.render();
    }
    // Outline
    if (esp != null && esp.isShader())
        renderOutlines(outlinesVertexConsumerProvider::draw, true, esp.outlineWidth.get(), esp.fillOpacity.get().floatValue(), esp.shapeMode.get());
}
Also used : WorldRendererAccessor(meteordevelopment.meteorclient.mixin.WorldRendererAccessor) SimpleFramebuffer(net.minecraft.client.gl.SimpleFramebuffer) Framebuffer(net.minecraft.client.gl.Framebuffer) WorldRenderer(net.minecraft.client.render.WorldRenderer)

Example 9 with Framebuffer

use of net.minecraft.client.gl.Framebuffer in project Client by MatHax.

the class EntityShaders method endRender.

public static void endRender() {
    WorldRenderer worldRenderer = mc.worldRenderer;
    WorldRendererAccessor wra = (WorldRendererAccessor) worldRenderer;
    Framebuffer fbo = worldRenderer.getEntityOutlinesFramebuffer();
    // Overlay
    if (chams != null && chams.isShader()) {
        wra.setEntityOutlinesFramebuffer(overlayFramebuffer);
        overlayVertexConsumerProvider.draw();
        wra.setEntityOutlinesFramebuffer(fbo);
        mc.getFramebuffer().beginWrite(false);
        GL.bindTexture(overlayFramebuffer.getColorAttachment());
        overlayShader.bind();
        overlayShader.set("u_Size", mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
        overlayShader.set("u_Texture", 0);
        overlayShader.set("u_Time", timer++ / 20.0);
        PostProcessRenderer.render();
    }
    // Outline
    if (esp != null && esp.isShader())
        renderOutlines(outlinesVertexConsumerProvider::draw, true, esp.outlineWidth.get(), esp.fillOpacity.get().floatValue(), esp.shapeMode.get());
}
Also used : WorldRendererAccessor(mathax.client.mixin.WorldRendererAccessor) SimpleFramebuffer(net.minecraft.client.gl.SimpleFramebuffer) Framebuffer(net.minecraft.client.gl.Framebuffer) WorldRenderer(net.minecraft.client.render.WorldRenderer)

Aggregations

Framebuffer (net.minecraft.client.gl.Framebuffer)9 SimpleFramebuffer (net.minecraft.client.gl.SimpleFramebuffer)4 WorldRenderer (net.minecraft.client.render.WorldRenderer)4 WorldRendererAccessor (mathax.client.mixin.WorldRendererAccessor)2 WorldRendererAccessor (meteordevelopment.meteorclient.mixin.WorldRendererAccessor)2 BufferBuilder (net.minecraft.client.render.BufferBuilder)2 Shader (net.minecraft.client.render.Shader)2 Tessellator (net.minecraft.client.render.Tessellator)2 MinecraftClientAccessor (com.glisco.isometricrenders.mixin.MinecraftClientAccessor)1 Color (mathax.client.utils.render.color.Color)1 Color (meteordevelopment.meteorclient.utils.render.color.Color)1 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1