Search in sources :

Example 1 with ShaderEffect

use of net.minecraft.client.gl.ShaderEffect in project BleachHack by BleachDrinker420.

the class ShaderRender method onWorldRender.

@BleachSubscribe
public void onWorldRender(EventRenderShader event) {
    if (lastShader == null || lastWidth != mc.getWindow().getFramebufferWidth() || lastHeight != mc.getWindow().getFramebufferHeight() || !shaders.get(getSetting(0).asMode().getMode()).equals(lastId)) {
        lastId = shaders.get(getSetting(0).asMode().getMode());
        lastWidth = mc.getWindow().getFramebufferWidth();
        lastHeight = mc.getWindow().getFramebufferHeight();
        try {
            if (lastShader != null) {
                lastShader.close();
            }
            lastShader = new ShaderEffect(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), lastId);
            lastShader.setupDimensions(mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
        } catch (JsonSyntaxException | IOException e) {
            e.printStackTrace();
        }
    }
    event.setEffect(lastShader);
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) IOException(java.io.IOException) ShaderEffect(net.minecraft.client.gl.ShaderEffect) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 2 with ShaderEffect

use of net.minecraft.client.gl.ShaderEffect in project BleachHack by BleachDrinker420.

the class ShaderLoader method loadEffect.

public static ShaderEffect loadEffect(Framebuffer framebuffer, Identifier id) throws JsonSyntaxException, IOException {
    ResourceManager resMang = MinecraftClient.getInstance().getResourceManager();
    TextureManager texMang = MinecraftClient.getInstance().getTextureManager();
    return new ShaderEffect(texMang, new OpenResourceManager(resMang), framebuffer, id);
}
Also used : TextureManager(net.minecraft.client.texture.TextureManager) ResourceManager(net.minecraft.resource.ResourceManager) ShaderEffect(net.minecraft.client.gl.ShaderEffect)

Example 3 with ShaderEffect

use of net.minecraft.client.gl.ShaderEffect in project BleachHack by BleachDrinker420.

the class BlockHighlight method onEnable.

@Override
public void onEnable(boolean inWorld) {
    super.onEnable(inWorld);
    try {
        shader = new ShaderEffectWrapper(new ShaderEffect(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), new Identifier("bleachhack", "shaders/post/entity_outline.json")));
        colorVertexer = new ColorVertexConsumerProvider(shader.getFramebuffer("main"), BleachCoreShaders::getColorOverlayShader);
    } catch (JsonSyntaxException | IOException e) {
        e.printStackTrace();
        setEnabled(false);
    }
}
Also used : Identifier(net.minecraft.util.Identifier) JsonSyntaxException(com.google.gson.JsonSyntaxException) ColorVertexConsumerProvider(org.bleachhack.util.shader.ColorVertexConsumerProvider) IOException(java.io.IOException) ShaderEffectWrapper(org.bleachhack.util.shader.ShaderEffectWrapper) ShaderEffect(net.minecraft.client.gl.ShaderEffect)

Example 4 with ShaderEffect

use of net.minecraft.client.gl.ShaderEffect in project KiwiClient by TangyKiwi.

the class ESP method onEnable.

@Override
public void onEnable() {
    super.onEnable();
    try {
        shader = new ShaderEffectWrapper(new ShaderEffect(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), new Identifier("kiwiclient", "shaders/post/entity_outline.json")));
        colorVertexer = new ColorVertexConsumerProvider(shader.getFramebuffer("main"), ShaderCore::getColorOverlayShader);
    } catch (JsonSyntaxException | IOException e) {
        e.printStackTrace();
        super.onDisable();
    }
}
Also used : Identifier(net.minecraft.util.Identifier) JsonSyntaxException(com.google.gson.JsonSyntaxException) ColorVertexConsumerProvider(com.tangykiwi.kiwiclient.util.shader.ColorVertexConsumerProvider) IOException(java.io.IOException) ShaderEffectWrapper(com.tangykiwi.kiwiclient.util.shader.ShaderEffectWrapper) ShaderEffect(net.minecraft.client.gl.ShaderEffect)

Example 5 with ShaderEffect

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

the class GameRendererMixin method renderShader.

@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawEntityOutlinesFramebuffer()V", ordinal = 0))
private void renderShader(float tickDelta, long startTime, boolean tick, CallbackInfo ci) {
    ShaderEffect shader = Modules.get().get(Rendering.class).getShaderEffect();
    if (shader != null) {
        shader.setupDimensions(client.getWindow().getFramebufferWidth(), client.getWindow().getFramebufferHeight());
        shader.render(tickDelta);
    }
}
Also used : ShaderEffect(net.minecraft.client.gl.ShaderEffect)

Aggregations

ShaderEffect (net.minecraft.client.gl.ShaderEffect)10 IOException (java.io.IOException)7 JsonSyntaxException (com.google.gson.JsonSyntaxException)5 Identifier (net.minecraft.util.Identifier)4 EventTarget (dev.hypnotic.event.EventTarget)2 Rendering (anticope.rejects.modules.Rendering)1 ColorVertexConsumerProvider (com.tangykiwi.kiwiclient.util.shader.ColorVertexConsumerProvider)1 ShaderEffectWrapper (com.tangykiwi.kiwiclient.util.shader.ShaderEffectWrapper)1 TextureManager (net.minecraft.client.texture.TextureManager)1 Entity (net.minecraft.entity.Entity)1 ItemEntity (net.minecraft.entity.ItemEntity)1 LivingEntity (net.minecraft.entity.LivingEntity)1 EndCrystalEntity (net.minecraft.entity.decoration.EndCrystalEntity)1 AnimalEntity (net.minecraft.entity.passive.AnimalEntity)1 PassiveEntity (net.minecraft.entity.passive.PassiveEntity)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ChestMinecartEntity (net.minecraft.entity.vehicle.ChestMinecartEntity)1 ResourceManager (net.minecraft.resource.ResourceManager)1 Box (net.minecraft.util.math.Box)1 Vec3d (net.minecraft.util.math.Vec3d)1