Search in sources :

Example 1 with ShaderUniform

use of v1_8_9.net.minecraft.client.shader.ShaderUniform 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 ShaderUniform

use of v1_8_9.net.minecraft.client.shader.ShaderUniform 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 ShaderUniform

use of v1_8_9.net.minecraft.client.shader.ShaderUniform 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 4 with ShaderUniform

use of v1_8_9.net.minecraft.client.shader.ShaderUniform 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 5 with ShaderUniform

use of v1_8_9.net.minecraft.client.shader.ShaderUniform in project cosmos by momentumdevelopment.

the class ESPModule method onUpdate.

@Override
public void onUpdate() {
    if (mode.getValue().equals(Mode.GLOW)) {
        // set all entities in the world glowing
        mc.world.loadedEntityList.forEach(entity -> {
            if (entity != null && !entity.equals(mc.player) && hasHighlight(entity)) {
                entity.setGlowing(true);
            }
        });
        // get the shaders
        ShaderGroup outlineShaderGroup = ((IRenderGlobal) mc.renderGlobal).getEntityOutlineShader();
        List<Shader> shaders = ((IShaderGroup) outlineShaderGroup).getListShaders();
        // update the shader radius
        shaders.forEach(shader -> {
            ShaderUniform outlineRadius = shader.getShaderManager().getShaderUniform("Radius");
            if (outlineRadius != null) {
                outlineRadius.set(width.getValue().floatValue());
            }
        });
    }
}
Also used : IShaderGroup(cope.cosmos.asm.mixins.accessor.IShaderGroup) ShaderGroup(net.minecraft.client.shader.ShaderGroup) IRenderGlobal(cope.cosmos.asm.mixins.accessor.IRenderGlobal) IShaderGroup(cope.cosmos.asm.mixins.accessor.IShaderGroup) Shader(net.minecraft.client.shader.Shader) DotShader(cope.cosmos.client.shader.shaders.DotShader) OutlineShader(cope.cosmos.client.shader.shaders.OutlineShader) RainbowOutlineShader(cope.cosmos.client.shader.shaders.RainbowOutlineShader) ShaderUniform(net.minecraft.client.shader.ShaderUniform)

Aggregations

JsonSyntaxException (com.google.gson.JsonSyntaxException)6 IOException (java.io.IOException)6 ShaderGroup (net.minecraft.client.shader.ShaderGroup)4 ShaderUniform (net.minecraft.client.shader.ShaderUniform)4 AccessShaderGroup (me.mcblueparrot.client.mixin.client.access.AccessShaderGroup)3 AccessShaderGroup (me.mcblueparrot.client.util.access.AccessShaderGroup)3 ShaderGroup (v1_8_9.net.minecraft.client.shader.ShaderGroup)3 ShaderUniform (v1_8_9.net.minecraft.client.shader.ShaderUniform)3 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 Shader (net.minecraft.client.shader.Shader)1