-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix sodium and iris integration for sky and emancipation
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/io/wispforest/affinity/mixin/client/iris/SodiumProgramsMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.wispforest.affinity.mixin.client.iris; | ||
|
||
import io.wispforest.affinity.client.render.SkyCaptureBuffer; | ||
import io.wispforest.affinity.misc.CompatMixin; | ||
import io.wispforest.affinity.mixin.client.sodium.TerrainRenderPassAccessor; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.DefaultTerrainRenderPasses; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.terrain.TerrainRenderPass; | ||
import net.irisshaders.iris.pipeline.programs.SodiumPrograms; | ||
import net.irisshaders.iris.shadows.ShadowRenderingState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.util.Arrays; | ||
|
||
@Pseudo | ||
@CompatMixin("iris") | ||
@Mixin(SodiumPrograms.class) | ||
public class SodiumProgramsMixin { | ||
|
||
@Unique | ||
private static final TerrainRenderPass SKY_PASS = Arrays.stream(DefaultTerrainRenderPasses.ALL).filter(pass -> ((TerrainRenderPassAccessor) pass).affinity$getLayer() == SkyCaptureBuffer.SKY_STENCIL_LAYER).findFirst().get(); | ||
|
||
@Inject(method = "mapTerrainRenderPass", at = @At("HEAD"), cancellable = true) | ||
private void fixSky(TerrainRenderPass pass, CallbackInfoReturnable<SodiumPrograms.Pass> cir) { | ||
if (pass != SKY_PASS) return; | ||
cir.setReturnValue(ShadowRenderingState.areShadowsCurrentlyBeingRendered() ? SodiumPrograms.Pass.SHADOW : SodiumPrograms.Pass.TERRAIN); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters