Search in sources :

Example 6 with ShaderEffect

use of net.minecraft.client.gl.ShaderEffect in project meteor-rejects by AntiCope.

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 : Rendering(anticope.rejects.modules.Rendering) ShaderEffect(net.minecraft.client.gl.ShaderEffect)

Example 7 with ShaderEffect

use of net.minecraft.client.gl.ShaderEffect in project meteor-rejects by AntiCope.

the class Rendering method onChanged.

public void onChanged(Shader s) {
    String name;
    if (s == Shader.Vibrant)
        name = "color_convolve";
    else if (s == Shader.Scanline)
        name = "scan_pincushion";
    else
        name = s.toString().toLowerCase();
    Identifier shaderID = new Identifier(String.format("shaders/post/%s.json", name));
    try {
        ShaderEffect shader = new ShaderEffect(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), shaderID);
        this.shader = shader;
    } catch (IOException e) {
        this.shader = null;
    }
}
Also used : Identifier(net.minecraft.util.Identifier) IOException(java.io.IOException) ShaderEffect(net.minecraft.client.gl.ShaderEffect)

Example 8 with ShaderEffect

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

the class Rendering method onChanged.

public void onChanged(Shader s) {
    String name;
    if (s == Shader.Vibrant)
        name = "color_convolve";
    else if (s == Shader.Scanline)
        name = "scan_pincushion";
    else
        name = s.toString().toLowerCase();
    Identifier shaderID = new Identifier(String.format("shaders/post/%s.json", name));
    try {
        ShaderEffect shader = new ShaderEffect(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), shaderID);
        this.shader = shader;
    } catch (IOException e) {
        this.shader = null;
    }
}
Also used : Identifier(net.minecraft.util.Identifier) IOException(java.io.IOException) ShaderEffect(net.minecraft.client.gl.ShaderEffect)

Example 9 with ShaderEffect

use of net.minecraft.client.gl.ShaderEffect in project Hypnotic-Client by Hypnotic-Development.

the class StorageESP method onBlockEntityRenderPre.

@EventTarget
public void onBlockEntityRenderPre(EventBlockEntityRender.PreAll event) throws JsonSyntaxException, IOException {
    if (mode.is("Shader")) {
        if (mc.getWindow().getFramebufferWidth() != lastWidth || mc.getWindow().getFramebufferHeight() != lastHeight || lastShaderWidth != shaderWidth.getValue() || shaderUnloaded) {
            try {
                ShaderEffect shader = ShaderEffectLoader.load(mc.getFramebuffer(), "storageesp-shader", String.format(Locale.ENGLISH, IOUtils.toString(getClass().getResource("/assets/hypnotic/shaders/mc_outline.ujson"), StandardCharsets.UTF_8), shaderWidth.getValue() / 2, shaderWidth.getValue() / 4));
                shader.setupDimensions(mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
                lastWidth = mc.getWindow().getFramebufferWidth();
                lastHeight = mc.getWindow().getFramebufferHeight();
                lastShaderWidth = shaderWidth.getValue();
                shaderUnloaded = false;
                OutlineShaderManager.loadShader(shader);
            } catch (JsonSyntaxException | IOException e) {
                e.printStackTrace();
            }
        }
    } else if (!shaderUnloaded) {
        OutlineShaderManager.loadDefaultShader();
        shaderUnloaded = true;
    }
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) IOException(java.io.IOException) ShaderEffect(net.minecraft.client.gl.ShaderEffect) EventTarget(dev.hypnotic.event.EventTarget)

Example 10 with ShaderEffect

use of net.minecraft.client.gl.ShaderEffect in project Hypnotic-Client by Hypnotic-Development.

the class ESP method eventRender3D.

@EventTarget
public void eventRender3D(EventRender3D event) {
    for (Entity entity : mc.world.getEntities()) {
        if (shouldRenderEntity(entity) && entity != mc.player) {
            Vec3d renderPos = RenderUtils.getEntityRenderPosition(entity, event.getTickDelta());
            Box bb = new Box(renderPos.x - entity.getWidth() + 0.25, renderPos.y, renderPos.z - entity.getWidth() + 0.25, renderPos.x + entity.getWidth() - 0.25, renderPos.y + entity.getHeight() + 0.1, renderPos.z + entity.getWidth() - 0.25);
            if (mode.is("Box-Fill"))
                RenderUtils.drawEntityBox(event.getMatrices(), entity, renderPos.x, renderPos.y, renderPos.z, getEntityColor(entity, 80));
            if (mode.is("Box"))
                RenderUtils.drawOutlineBox(event.getMatrices(), bb, getEntityColor(entity, 80), true);
        }
    }
    if (mc.getWindow().getFramebufferWidth() != lastWidth || mc.getWindow().getFramebufferHeight() != lastHeight || lastShaderWidth != shaderWidth.getValue() || shaderUnloaded) {
        try {
            ShaderEffect shader = ShaderEffectLoader.load(mc.getFramebuffer(), "esp-shader", String.format(Locale.ENGLISH, IOUtils.toString(getClass().getResource("/assets/hypnotic/shaders/mc_outline.ujson"), StandardCharsets.UTF_8), shaderWidth.getValue() / 2, shaderWidth.getValue() / 4));
            shader.setupDimensions(mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
            lastWidth = mc.getWindow().getFramebufferWidth();
            lastHeight = mc.getWindow().getFramebufferHeight();
            lastShaderWidth = shaderWidth.getValue();
            shaderUnloaded = false;
            OutlineShaderManager.loadShader(shader);
        } catch (JsonSyntaxException | IOException e) {
            e.printStackTrace();
        }
    }
}
Also used : ItemEntity(net.minecraft.entity.ItemEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ChestMinecartEntity(net.minecraft.entity.vehicle.ChestMinecartEntity) JsonSyntaxException(com.google.gson.JsonSyntaxException) Box(net.minecraft.util.math.Box) IOException(java.io.IOException) Vec3d(net.minecraft.util.math.Vec3d) ShaderEffect(net.minecraft.client.gl.ShaderEffect) EventTarget(dev.hypnotic.event.EventTarget)

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