private void loadShader(ResourceLocation resourceLocationIn) { try { this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); this.useShader = true; } catch (IOException ioexception) { logger.warn((String)("Failed to load shader: " + resourceLocationIn), (Throwable)ioexception); this.shaderIndex = shaderCount; this.useShader = false; } catch (JsonSyntaxException jsonsyntaxexception) { logger.warn((String)("Failed to load shader: " + resourceLocationIn), (Throwable)jsonsyntaxexception); this.shaderIndex = shaderCount; this.useShader = false; } }
public void loadShader(ResourceLocation resourceLocationIn) { if (OpenGlHelper.isFramebufferEnabled()) { try { this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); this.useShader = true; } catch (IOException ioexception) { logger.warn((String)("Failed to load shader: " + resourceLocationIn), (Throwable)ioexception); this.shaderIndex = shaderCount; this.useShader = false; } catch (JsonSyntaxException jsonsyntaxexception) { logger.warn((String)("Failed to load shader: " + resourceLocationIn), (Throwable)jsonsyntaxexception); this.shaderIndex = shaderCount; this.useShader = false; } } }
private void loadShader(ResourceLocation resourceLocationIn) { try { this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); this.useShader = true; } catch (IOException ioexception) { logger.warn((String) ("Failed to load shader: " + resourceLocationIn), (Throwable) ioexception); this.shaderIndex = shaderCount; this.useShader = false; } catch (JsonSyntaxException jsonsyntaxexception) { logger.warn((String) ("Failed to load shader: " + resourceLocationIn), (Throwable) jsonsyntaxexception); this.shaderIndex = shaderCount; this.useShader = false; } }
public void loadShader(ResourceLocation resourceLocationIn) { if (OpenGlHelper.isFramebufferEnabled()) { try { this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); this.useShader = true; } catch (IOException ioexception) { LOGGER.warn("Failed to load shader: {}", new Object[] {resourceLocationIn, ioexception}); this.shaderIndex = SHADER_COUNT; this.useShader = false; } catch (JsonSyntaxException jsonsyntaxexception) { LOGGER.warn("Failed to load shader: {}", new Object[] {resourceLocationIn, jsonsyntaxexception}); this.shaderIndex = SHADER_COUNT; this.useShader = false; } } }
public void loadShader(ResourceLocation resourceLocationIn) { try { this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); this.useShader = true; } catch (IOException ioexception) { LOGGER.warn("Failed to load shader: {}", new Object[] {resourceLocationIn, ioexception}); this.shaderIndex = SHADER_COUNT; this.useShader = false; } catch (JsonSyntaxException jsonsyntaxexception) { LOGGER.warn("Failed to load shader: {}", new Object[] {resourceLocationIn, jsonsyntaxexception}); this.shaderIndex = SHADER_COUNT; this.useShader = false; } }
public void activateBatch() { if(batch != null) { if(OpenGlHelper.shadersSupported) { try { ShaderGroup theShaderGroup = batch.toShaderGroup(resManager); theShaderGroup.createBindFramebuffers(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, theShaderGroup, 51); ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, true, 55); } catch(JsonException e) { e.printStackTrace(); } } } }
public void onResourceManagerReload(IResourceManager par1ResourceManager) { if (this.theShaderGroup != null) { this.theShaderGroup.deleteShaderGroup(); } if (this.shaderIndex != shaderCount) { try { this.theShaderGroup = new ShaderGroup(par1ResourceManager, this.mc.getFramebuffer(), shaderResourceLocations[this.shaderIndex]); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); } catch (IOException var3) { logger.warn("Failed to load shader: " + shaderResourceLocations[this.shaderIndex], var3); this.shaderIndex = shaderCount; } } }
@Override public void enableGrayscaleShader() { if (OpenGlHelper.shadersSupported) { Minecraft mc = Minecraft.getMinecraft(); EntityRenderer entityRenderer = mc.entityRenderer; if (entityRenderer.theShaderGroup != null) { entityRenderer.theShaderGroup.deleteShaderGroup(); } try { entityRenderer.theShaderGroup = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), this.shader); entityRenderer.theShaderGroup.createBindFramebuffers(mc.displayWidth, mc.displayHeight); } catch (IOException ioexception) { Corruption.logger.warn("Failed to load shader: ", ioexception); } } }
public void onResourceManagerReload(IResourceManager p_110549_1_) { if (this.theShaderGroup != null) { this.theShaderGroup.deleteShaderGroup(); } if (this.shaderIndex != shaderCount) { try { this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), p_110549_1_, this.mc.getFramebuffer(), shaderResourceLocations[this.shaderIndex]); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); } catch (IOException ioexception) { logger.warn("Failed to load shader: " + shaderResourceLocations[this.shaderIndex], ioexception); this.shaderIndex = shaderCount; } } }
private static void activateKongaShader() { EntityRenderer renderer = Minecraft.getMinecraft().entityRenderer; if (OpenGlHelper.shadersSupported) { if (renderer.theShaderGroup != null) { renderer.theShaderGroup.deleteShaderGroup(); } try { LogHelper.info("Selecting effect " + shader); renderer.theShaderGroup = new ShaderGroup(Minecraft.getMinecraft().getTextureManager(), Minecraft.getMinecraft().getResourceManager(), Minecraft.getMinecraft().getFramebuffer(), shader); renderer.theShaderGroup.createBindFramebuffers(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); } catch (Exception e) { e.printStackTrace(); LogHelper.warning("Failed to load shader: " + shader); } } }
/** * Creates the entity outline shader to be stored in RenderGlobal.entityOutlineShader */ public void makeEntityOutlineShader() { if (OpenGlHelper.shadersSupported) { if (ShaderLinkHelper.getStaticShaderLinkHelper() == null) { ShaderLinkHelper.setNewStaticShaderLinkHelper(); } ResourceLocation resourcelocation = new ResourceLocation("shaders/post/entity_outline.json"); try { this.entityOutlineShader = new ShaderGroup(this.mc.getTextureManager(), this.mc.getResourceManager(), this.mc.getFramebuffer(), resourcelocation); this.entityOutlineShader.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); this.entityOutlineFramebuffer = this.entityOutlineShader.getFramebufferRaw("final"); } catch (IOException ioexception) { logger.warn((String)("Failed to load shader: " + resourcelocation), (Throwable)ioexception); this.entityOutlineShader = null; this.entityOutlineFramebuffer = null; } catch (JsonSyntaxException jsonsyntaxexception) { logger.warn((String)("Failed to load shader: " + resourcelocation), (Throwable)jsonsyntaxexception); this.entityOutlineShader = null; this.entityOutlineFramebuffer = null; } } else { this.entityOutlineShader = null; this.entityOutlineFramebuffer = null; } }
/** * Creates the entity outline shader to be stored in RenderGlobal.entityOutlineShader */ public void makeEntityOutlineShader() { if (OpenGlHelper.shadersSupported) { if (ShaderLinkHelper.getStaticShaderLinkHelper() == null) { ShaderLinkHelper.setNewStaticShaderLinkHelper(); } ResourceLocation resourcelocation = new ResourceLocation("shaders/post/entity_outline.json"); try { this.entityOutlineShader = new ShaderGroup(this.mc.getTextureManager(), this.mc.getResourceManager(), this.mc.getFramebuffer(), resourcelocation); this.entityOutlineShader.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); this.entityOutlineFramebuffer = this.entityOutlineShader.getFramebufferRaw("final"); } catch (IOException ioexception) { LOGGER.warn("Failed to load shader: {}", new Object[] {resourcelocation, ioexception}); this.entityOutlineShader = null; this.entityOutlineFramebuffer = null; } catch (JsonSyntaxException jsonsyntaxexception) { LOGGER.warn("Failed to load shader: {}", new Object[] {resourcelocation, jsonsyntaxexception}); this.entityOutlineShader = null; this.entityOutlineFramebuffer = null; } } else { this.entityOutlineShader = null; this.entityOutlineFramebuffer = null; } }
public void activateNextShader() throws IOException { if (OpenGlHelper.shadersSupported) { if (this.theShaderGroup != null) { this.theShaderGroup.deleteShaderGroup(); } this.shaderIndex = ((this.shaderIndex + 1) % (shaderResourceLocations.length + 1)); if (this.shaderIndex != shaderCount) { try { logger.info("Selecting effect " + shaderResourceLocations[this.shaderIndex]); this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), shaderResourceLocations[this.shaderIndex]); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); } catch (JsonSyntaxException jsonsyntaxexception) { logger.warn("Failed to load shader: " + shaderResourceLocations[this.shaderIndex], jsonsyntaxexception); this.shaderIndex = shaderCount; } } else { this.theShaderGroup = null; logger.info("No effect selected"); } } }
public void activateNextShader() { if (OpenGlHelper.shadersSupported) { if (this.theShaderGroup != null) { this.theShaderGroup.deleteShaderGroup(); } this.shaderIndex = (this.shaderIndex + 1) % (shaderResourceLocations.length + 1); if (this.shaderIndex != shaderCount) { try { logger.info("Selecting effect " + shaderResourceLocations[this.shaderIndex]); this.theShaderGroup = new ShaderGroup(this.resourceManager, this.mc.getFramebuffer(), shaderResourceLocations[this.shaderIndex]); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); } catch (IOException var2) { logger.warn("Failed to load shader: " + shaderResourceLocations[this.shaderIndex], var2); this.shaderIndex = shaderCount; } catch (JsonSyntaxException var3) { logger.warn("Failed to load shader: " + shaderResourceLocations[this.shaderIndex], var3); this.shaderIndex = shaderCount; } } else { this.theShaderGroup = null; logger.info("No effect selected"); } } }
public void activateNextShader() { if (OpenGlHelper.shadersSupported) { if (this.theShaderGroup != null) { this.theShaderGroup.deleteShaderGroup(); } this.shaderIndex = (this.shaderIndex + 1) % (shaderResourceLocations.length + 1); if (this.shaderIndex != shaderCount) { try { logger.info("Selecting effect " + shaderResourceLocations[this.shaderIndex]); this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), shaderResourceLocations[this.shaderIndex]); this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); } catch (IOException ioexception) { logger.warn("Failed to load shader: " + shaderResourceLocations[this.shaderIndex], ioexception); this.shaderIndex = shaderCount; } catch (JsonSyntaxException jsonsyntaxexception) { logger.warn("Failed to load shader: " + shaderResourceLocations[this.shaderIndex], jsonsyntaxexception); this.shaderIndex = shaderCount; } } else { this.theShaderGroup = null; logger.info("No effect selected"); } } }
@SideOnly(Side.CLIENT) public static void setShader(ResourceLocation sha){ Minecraft mc = Minecraft.getMinecraft(); try { mc.entityRenderer.theShaderGroup = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), sha); } catch (Exception e) { HackeryMod.logger.error("Something bad happened while swapping shaders"); e.printStackTrace(); } mc.entityRenderer.theShaderGroup.createBindFramebuffers(mc.displayWidth, mc.displayHeight); }
public ShaderGroup getShaderGroup() { return this.theShaderGroup; }
public ShaderGroup toShaderGroup(ShadyResManager resManager) throws JsonException { return new ShaderGroup(Minecraft.getMinecraft().renderEngine, resManager, Minecraft.getMinecraft().getFramebuffer(), getResourceLocation()); }