Search in sources :

Example 16 with ShaderGroup

use of net.minecraft.client.shader.ShaderGroup in project sol-client-glassmc by danterusdev.

the class MixinEntityRenderer method addShaders.

@Inject(method = "updateCameraAndRender(FJ)V", at = @At(value = "INVOKE", target = "Lv1_8_9/net/minecraft/client/shader" + "/Framebuffer;bindFramebuffer(Z)V", shift = At.Shift.BEFORE))
public void addShaders(float partialTicks, long nanoTime, CallbackInfo callback) {
    for (ShaderGroup group : Client.INSTANCE.bus.post(new PostProcessingEvent(PostProcessingEvent.Type.RENDER)).groups) {
        GlStateManager.matrixMode(5890);
        GlStateManager.pushMatrix();
        GlStateManager.loadIdentity();
        group.loadShaderGroup(((AccessMinecraft) Minecraft.getMinecraft()).getTimerSC().renderPartialTicks);
        GlStateManager.popMatrix();
    }
}
Also used : ShaderGroup(v1_8_9.net.minecraft.client.shader.ShaderGroup) PostProcessingEvent(me.mcblueparrot.client.event.impl.PostProcessingEvent) AccessMinecraft(me.mcblueparrot.client.mixin.client.access.AccessMinecraft) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 17 with ShaderGroup

use of net.minecraft.client.shader.ShaderGroup in project sol-client-glassmc by danterusdev.

the class MotionBlurMod method update.

public void update() {
    if (group == null) {
        groupBlur = blur;
        try {
            group = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), RESOURCE_LOCATION);
            group.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
        } catch (JsonSyntaxException | IOException error) {
            logger.error("Could not load motion blur", error);
        }
    }
    if (groupBlur != blur) {
        ((AccessShaderGroup) group).getListShaders().forEach((shader) -> {
            ShaderUniform blendFactor = shader.getShaderManager().getShaderUniform("BlendFactor");
            if (blendFactor != null) {
                blendFactor.set(blur);
            }
        });
        groupBlur = blur;
    }
}
Also used : AccessShaderGroup(me.mcblueparrot.client.mixin.client.access.AccessShaderGroup) ShaderGroup(v1_8_9.net.minecraft.client.shader.ShaderGroup) JsonSyntaxException(com.google.gson.JsonSyntaxException) IOException(java.io.IOException) ShaderUniform(v1_8_9.net.minecraft.client.shader.ShaderUniform)

Example 18 with ShaderGroup

use of net.minecraft.client.shader.ShaderGroup in project Vampirism by TeamLapen.

the class RenderHandler method reMakeBloodVisionShader.

private void reMakeBloodVisionShader() {
    if (this.blurShader != null) {
        this.blurShader.close();
    }
    ResourceLocation resourcelocationBlur = new ResourceLocation(REFERENCE.MODID, "shaders/blank.json");
    try {
        this.blurShader = new ShaderGroup(this.mc.getTextureManager(), this.mc.getResourceManager(), this.mc.getMainRenderTarget(), resourcelocationBlur);
        Framebuffer swap = this.blurShader.getTempTarget("swap");
        blit0 = blurShader.addPass("blit", swap, this.mc.getMainRenderTarget());
        blur1 = blurShader.addPass("blur", this.mc.getMainRenderTarget(), swap);
        blur1.getEffect().safeGetUniform("BlurDir").set(1F, 0F);
        blur2 = blurShader.addPass("blur", swap, this.mc.getMainRenderTarget());
        blur2.getEffect().safeGetUniform("BlurDir").set(0F, 1F);
        this.blurShader.resize(this.mc.getWindow().getWidth(), this.mc.getWindow().getHeight());
    } catch (Exception e) {
        LOGGER.warn("Failed to load blood vision blur shader", e);
        this.blurShader = null;
    }
}
Also used : ShaderGroup(net.minecraft.client.shader.ShaderGroup) Framebuffer(net.minecraft.client.shader.Framebuffer) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 19 with ShaderGroup

use of net.minecraft.client.shader.ShaderGroup in project Client by Sol-Client.

the class MotionBlurMod method update.

public void update() {
    if (group == null) {
        groupBlur = blur;
        try {
            group = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), RESOURCE_LOCATION);
            group.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
        } catch (JsonSyntaxException | IOException error) {
            logger.error("Could not load motion blur", error);
        }
    }
    if (groupBlur != blur) {
        ((AccessShaderGroup) group).getListShaders().forEach((shader) -> {
            ShaderUniform blendFactor = shader.getShaderManager().getShaderUniform("BlendFactor");
            if (blendFactor != null) {
                blendFactor.set(blur);
            }
        });
        groupBlur = blur;
    }
}
Also used : AccessShaderGroup(me.mcblueparrot.client.util.access.AccessShaderGroup) ShaderGroup(net.minecraft.client.shader.ShaderGroup) JsonSyntaxException(com.google.gson.JsonSyntaxException) IOException(java.io.IOException) ShaderUniform(net.minecraft.client.shader.ShaderUniform)

Example 20 with ShaderGroup

use of net.minecraft.client.shader.ShaderGroup in project Client by Sol-Client.

the class MixinEntityRenderer method addShaders.

@Inject(method = "updateCameraAndRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/shader" + "/Framebuffer;bindFramebuffer(Z)V", shift = At.Shift.BEFORE))
public void addShaders(float partialTicks, long nanoTime, CallbackInfo callback) {
    for (ShaderGroup group : Client.INSTANCE.bus.post(new PostProcessingEvent(PostProcessingEvent.Type.RENDER)).groups) {
        GlStateManager.matrixMode(5890);
        GlStateManager.pushMatrix();
        GlStateManager.loadIdentity();
        group.loadShaderGroup(AccessMinecraft.getInstance().getTimerSC().renderPartialTicks);
        GlStateManager.popMatrix();
    }
}
Also used : ShaderGroup(net.minecraft.client.shader.ShaderGroup) PostProcessingEvent(me.mcblueparrot.client.event.impl.PostProcessingEvent) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

ShaderGroup (net.minecraft.client.shader.ShaderGroup)18 JsonSyntaxException (com.google.gson.JsonSyntaxException)16 IOException (java.io.IOException)16 ResourceLocation (net.minecraft.util.ResourceLocation)6 ShaderUniform (net.minecraft.client.shader.ShaderUniform)4 ShaderGroup (v1_8_9.net.minecraft.client.shader.ShaderGroup)4 AccessShaderGroup (me.mcblueparrot.client.mixin.client.access.AccessShaderGroup)3 AccessShaderGroup (me.mcblueparrot.client.util.access.AccessShaderGroup)3 ShaderUniform (v1_8_9.net.minecraft.client.shader.ShaderUniform)3 PostProcessingEvent (me.mcblueparrot.client.event.impl.PostProcessingEvent)2 Framebuffer (net.minecraft.client.shader.Framebuffer)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2 AirshipWorld (com.eriksonn.createaeronautics.dimension.AirshipWorld)1 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 IRenderGlobal (cope.cosmos.asm.mixins.accessor.IRenderGlobal)1 IShaderGroup (cope.cosmos.asm.mixins.accessor.IShaderGroup)1 DotShader (cope.cosmos.client.shader.shaders.DotShader)1 OutlineShader (cope.cosmos.client.shader.shaders.OutlineShader)1 RainbowOutlineShader (cope.cosmos.client.shader.shaders.RainbowOutlineShader)1 ObjectArrayList (it.unimi.dsi.fastutil.objects.ObjectArrayList)1