-
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.
- Loading branch information
Showing
4 changed files
with
70 additions
and
121 deletions.
There are no files selected for viewing
54 changes: 0 additions & 54 deletions
54
...main/java/qouteall/imm_ptl/core/compat/mixin/iris/MixinIrisNewWorldRenderingPipeline.java
This file was deleted.
Oops, something went wrong.
135 changes: 68 additions & 67 deletions
135
...ain/java/qouteall/imm_ptl/core/compat/mixin/iris/MixinIrisSodiumChunkShaderInterface.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 |
---|---|---|
@@ -1,67 +1,68 @@ | ||
//package qouteall.imm_ptl.core.compat.mixin.iris; | ||
// | ||
//import net.caffeinemc.mods.sodium.client.render.chunk.shader.ChunkShaderOptions; | ||
//import net.irisshaders.iris.compat.sodium.impl.shader_overrides.IrisChunkShaderInterface; | ||
//import net.irisshaders.iris.compat.sodium.impl.shader_overrides.ShaderBindingContextExt; | ||
//import net.irisshaders.iris.gl.blending.BlendModeOverride; | ||
//import net.irisshaders.iris.pipeline.SodiumTerrainPipeline; | ||
//import net.irisshaders.iris.uniforms.custom.CustomUniforms; | ||
//import org.lwjgl.opengl.GL20C; | ||
//import org.lwjgl.opengl.GL21; | ||
//import org.spongepowered.asm.mixin.Mixin; | ||
//import org.spongepowered.asm.mixin.injection.At; | ||
//import org.spongepowered.asm.mixin.injection.Inject; | ||
//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
//import qouteall.imm_ptl.core.render.FrontClipping; | ||
//import qouteall.q_misc_util.Helper; | ||
// | ||
//import java.util.List; | ||
// | ||
//@Mixin(value = IrisChunkShaderInterface.class, remap = false) | ||
//public class MixinIrisSodiumChunkShaderInterface { | ||
// private int uIPClippingEquation; | ||
// | ||
// private void ip_init(int shaderId) { | ||
// uIPClippingEquation = GL20C.glGetUniformLocation(shaderId, "imm_ptl_ClippingEquation"); | ||
// if (uIPClippingEquation < 0) { | ||
// Helper.err("uniform imm_ptl_ClippingEquation not found in transformed iris shader"); | ||
// uIPClippingEquation = -1; | ||
// } | ||
// } | ||
// | ||
// @Inject( | ||
// method = "<init>", | ||
// at = @At("RETURN"), | ||
// require = 0 | ||
// ) | ||
// private void onInit( | ||
// int handle, ShaderBindingContextExt contextExt, SodiumTerrainPipeline pipeline, ChunkShaderOptions options, boolean isTess, boolean isShadowPass, BlendModeOverride blendModeOverride, List bufferOverrides, float alpha, CustomUniforms customUniforms, CallbackInfo ci | ||
// ) { | ||
// ip_init(handle); | ||
// } | ||
// | ||
// @Inject( | ||
// method = "setupState", | ||
// at = @At("RETURN") | ||
// ) | ||
// private void onSetup(CallbackInfo ci) { | ||
// if (uIPClippingEquation != -1) { | ||
// if (FrontClipping.isClippingEnabled) { | ||
// double[] equation = FrontClipping.getActiveClipPlaneEquationAfterModelView(); | ||
// GL21.glUniform4f( | ||
// uIPClippingEquation, | ||
// (float) equation[0], | ||
// (float) equation[1], | ||
// (float) equation[2], | ||
// (float) equation[3] | ||
// ); | ||
// } | ||
// else { | ||
// GL21.glUniform4f( | ||
// uIPClippingEquation, | ||
// 0, 0, 0, 1 | ||
// ); | ||
// } | ||
// } | ||
// } | ||
//} | ||
package qouteall.imm_ptl.core.compat.mixin.iris; | ||
|
||
import net.caffeinemc.mods.sodium.client.render.chunk.shader.ShaderBindingContext; | ||
import net.irisshaders.iris.gl.blending.BlendModeOverride; | ||
import net.irisshaders.iris.pipeline.IrisRenderingPipeline; | ||
import net.irisshaders.iris.pipeline.programs.SodiumPrograms; | ||
import net.irisshaders.iris.pipeline.programs.SodiumShader; | ||
import net.irisshaders.iris.uniforms.custom.CustomUniforms; | ||
import org.lwjgl.opengl.GL20C; | ||
import org.lwjgl.opengl.GL21; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import qouteall.imm_ptl.core.render.FrontClipping; | ||
import qouteall.q_misc_util.Helper; | ||
|
||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
@Mixin(value = SodiumShader.class, remap = false) | ||
public class MixinIrisSodiumChunkShaderInterface { | ||
private int uIPClippingEquation; | ||
|
||
private void ip_init(int shaderId) { | ||
uIPClippingEquation = GL20C.glGetUniformLocation(shaderId, "imm_ptl_ClippingEquation"); | ||
if (uIPClippingEquation < 0) { | ||
Helper.err("uniform imm_ptl_ClippingEquation not found in transformed iris shader"); | ||
uIPClippingEquation = -1; | ||
} | ||
} | ||
|
||
@Inject( | ||
method = "<init>", | ||
at = @At("RETURN"), | ||
require = 0 | ||
) | ||
private void onInit( | ||
IrisRenderingPipeline pipeline, SodiumPrograms.Pass pass, ShaderBindingContext context, int handle, BlendModeOverride blendModeOverride, List bufferBlendOverrides, CustomUniforms customUniforms, Supplier flipState, float alphaTest, boolean containsTessellation, CallbackInfo ci | ||
) { | ||
ip_init(handle); | ||
} | ||
|
||
@Inject( | ||
method = "setupState", | ||
at = @At("RETURN") | ||
) | ||
private void onSetup(CallbackInfo ci) { | ||
if (uIPClippingEquation != -1) { | ||
if (FrontClipping.isClippingEnabled) { | ||
double[] equation = FrontClipping.getActiveClipPlaneEquationAfterModelView(); | ||
GL21.glUniform4f( | ||
uIPClippingEquation, | ||
(float) equation[0], | ||
(float) equation[1], | ||
(float) equation[2], | ||
(float) equation[3] | ||
); | ||
} | ||
else { | ||
GL21.glUniform4f( | ||
uIPClippingEquation, | ||
0, 0, 0, 1 | ||
); | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...in/java/qouteall/imm_ptl/core/compat/mixin/iris/MixinIrisSodiumSodiumTerrainPipeline.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
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