Search in sources :

Example 1 with TextureStage

use of net.coderbot.iris.shaderpack.texture.TextureStage in project Iris by IrisShaders.

the class DeferredWorldRenderingPipeline method createPassInner.

private Pass createPassInner(ProgramBuilder builder, IdMap map, ProgramDirectives programDirectives, PackDirectives packDirectives) {
    CommonUniforms.addCommonUniforms(builder, map, packDirectives, updateNotifier);
    Supplier<ImmutableSet<Integer>> flipped = () -> isBeforeTranslucent ? flippedAfterPrepare : flippedAfterTranslucent;
    TextureStage textureStage = TextureStage.GBUFFERS_AND_SHADOW;
    ProgramSamplers.CustomTextureSamplerInterceptor customTextureSamplerInterceptor = ProgramSamplers.customTextureSamplerInterceptor(builder, customTextureManager.getCustomTextureIdMap().getOrDefault(textureStage, Object2ObjectMaps.emptyMap()));
    IrisSamplers.addRenderTargetSamplers(customTextureSamplerInterceptor, flipped, renderTargets, false);
    IrisImages.addRenderTargetImages(builder, flipped, renderTargets);
    IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, customTextureManager.getNormals(), customTextureManager.getSpecular());
    IrisSamplers.addWorldDepthSamplers(customTextureSamplerInterceptor, renderTargets);
    IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
    if (IrisSamplers.hasShadowSamplers(customTextureSamplerInterceptor)) {
        createShadowMapRenderer.run();
        IrisSamplers.addShadowSamplers(customTextureSamplerInterceptor, shadowMapRenderer);
        IrisImages.addShadowColorImages(builder, shadowMapRenderer);
    }
    GlFramebuffer framebufferBeforeTranslucents = renderTargets.createGbufferFramebuffer(flippedAfterPrepare, programDirectives.getDrawBuffers());
    GlFramebuffer framebufferAfterTranslucents = renderTargets.createGbufferFramebuffer(flippedAfterTranslucent, programDirectives.getDrawBuffers());
    builder.bindAttributeLocation(11, "mc_Entity");
    builder.bindAttributeLocation(12, "mc_midTexCoord");
    builder.bindAttributeLocation(13, "at_tangent");
    AlphaTestOverride alphaTestOverride = programDirectives.getAlphaTestOverride().orElse(null);
    Pass pass = new Pass(builder.build(), framebufferBeforeTranslucents, framebufferAfterTranslucents, alphaTestOverride, programDirectives.getBlendModeOverride());
    allPasses.add(pass);
    return pass;
}
Also used : AlphaTestOverride(net.coderbot.iris.gl.blending.AlphaTestOverride) ImmutableSet(com.google.common.collect.ImmutableSet) TextureStage(net.coderbot.iris.shaderpack.texture.TextureStage) ProgramSamplers(net.coderbot.iris.gl.program.ProgramSamplers) GlFramebuffer(net.coderbot.iris.gl.framebuffer.GlFramebuffer)

Aggregations

ImmutableSet (com.google.common.collect.ImmutableSet)1 AlphaTestOverride (net.coderbot.iris.gl.blending.AlphaTestOverride)1 GlFramebuffer (net.coderbot.iris.gl.framebuffer.GlFramebuffer)1 ProgramSamplers (net.coderbot.iris.gl.program.ProgramSamplers)1 TextureStage (net.coderbot.iris.shaderpack.texture.TextureStage)1