Search in sources :

Example 1 with AccessShaderGroup

use of me.mcblueparrot.client.util.access.AccessShaderGroup in project Client by Sol-Client.

the class ColourSaturationMod method update.

public void update() {
    if (group == null) {
        groupSaturation = saturation;
        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 saturation shader", error);
        }
    }
    if (groupSaturation != saturation) {
        ((AccessShaderGroup) group).getListShaders().forEach((shader) -> {
            ShaderUniform saturationUniform = shader.getShaderManager().getShaderUniform("Saturation");
            if (saturationUniform != null) {
                saturationUniform.set(saturation);
            }
        });
        groupSaturation = saturation;
    }
}
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 2 with AccessShaderGroup

use of me.mcblueparrot.client.util.access.AccessShaderGroup in project Client by Sol-Client.

the class MenuBlurMod method update.

public void update() {
    if (group == null) {
        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 menu blur", error);
        }
    }
    ((AccessShaderGroup) group).getListShaders().forEach((shader) -> {
        ShaderUniform radius = shader.getShaderManager().getShaderUniform("Radius");
        ShaderUniform progress = shader.getShaderManager().getShaderUniform("Progress");
        if (radius != null) {
            radius.set(blur);
        }
        if (progress != null) {
            if (fadeTime > 0) {
                progress.set(getProgress());
            } else {
                progress.set(1);
            }
        }
    });
}
Also used : ShaderGroup(net.minecraft.client.shader.ShaderGroup) AccessShaderGroup(me.mcblueparrot.client.util.access.AccessShaderGroup) JsonSyntaxException(com.google.gson.JsonSyntaxException) IOException(java.io.IOException) ShaderUniform(net.minecraft.client.shader.ShaderUniform)

Example 3 with AccessShaderGroup

use of me.mcblueparrot.client.util.access.AccessShaderGroup 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)

Aggregations

JsonSyntaxException (com.google.gson.JsonSyntaxException)3 IOException (java.io.IOException)3 AccessShaderGroup (me.mcblueparrot.client.util.access.AccessShaderGroup)3 ShaderGroup (net.minecraft.client.shader.ShaderGroup)3 ShaderUniform (net.minecraft.client.shader.ShaderUniform)3