Search in sources :

Example 1 with AccessShaderGroup

use of me.mcblueparrot.client.mixin.client.access.AccessShaderGroup in project sol-client-glassmc by danterusdev.

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.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 2 with AccessShaderGroup

use of me.mcblueparrot.client.mixin.client.access.AccessShaderGroup in project sol-client-glassmc by danterusdev.

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 : 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 3 with AccessShaderGroup

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

Aggregations

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