Skip to content

Commit

Permalink
Fix weather shader
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Dec 8, 2024
1 parent d38410e commit d12f159
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions common/src/main/java/net/irisshaders/iris/NeoLambdas.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ public class NeoLambdas {
public static final String NEO_RENDER_WEATHER = "lambda$addWeatherPass$5";
public static final String NEO_RENDER_CLOUDS = "lambda$addCloudsPass$4";
public static final String NEO_PARTICLE = "lambda$static$26";
public static final String NEO_WEATHER_TYPE = "lambda$createWeather$35";
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
public class MixinRenderType {
@Unique
private static final RenderStateShard.ShaderStateShard TRANSLUCENT_PARTICLE_SHADER = new RenderStateShard.ShaderStateShard(ShaderAccess.TRANSLUCENT_PARTICLE_SHADER);
private static final RenderStateShard.ShaderStateShard WEATHER_SHADER = new RenderStateShard.ShaderStateShard(ShaderAccess.WEATHER_SHADER);

@Redirect(method = {"method_65225", NeoLambdas.NEO_PARTICLE }, require = 1, at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/RenderType;PARTICLE_SHADER:Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;"))
private static RenderStateShard.ShaderStateShard getTranslucentParticleShader() {
return TRANSLUCENT_PARTICLE_SHADER;
}

@Redirect(method = {"method_65228", NeoLambdas.NEO_WEATHER_TYPE }, require = 1, at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/RenderType;PARTICLE_SHADER:Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard;"))
private static RenderStateShard.ShaderStateShard getWeatherShader() {
return WEATHER_SHADER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ public abstract class MixinShaderManager_Overrides {
coreShaderMap.put(CoreShaders.POSITION_TEX, p -> ShaderOverrides.getSkyTexShader((IrisRenderingPipeline) p));
coreShaderMap.put(CoreShaders.POSITION_TEX_COLOR, p -> ShaderOverrides.getSkyTexColorShader((IrisRenderingPipeline) p));
coreShaderMap.put(CoreShaders.POSITION_COLOR, p -> ShaderOverrides.getSkyColorShader((IrisRenderingPipeline) p));
coreShaderMap.put(CoreShaders.PARTICLE, p -> ShaderOverrides.isPhase((IrisRenderingPipeline) p, WorldRenderingPhase.RAIN_SNOW) ? ShaderKey.WEATHER : ShaderKey.PARTICLES);
coreShaderMap.put(ShaderAccess.TRANSLUCENT_PARTICLE_SHADER, p -> ShaderOverrides.isPhase((IrisRenderingPipeline) p, WorldRenderingPhase.RAIN_SNOW) ? ShaderKey.WEATHER : ShaderKey.PARTICLES_TRANS);
coreShaderMap.put(CoreShaders.PARTICLE, p -> ShaderKey.PARTICLES);
coreShaderMap.put(ShaderAccess.TRANSLUCENT_PARTICLE_SHADER, p -> ShaderKey.PARTICLES_TRANS);
coreShaderMap.put(ShaderAccess.WEATHER_SHADER, p -> ShaderKey.WEATHER);
coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_CUTOUT, p -> getCutout(p));
coreShaderMap.put(CoreShaders.RENDERTYPE_ENTITY_SOLID, p -> getSolid(p));
coreShaderMap.put(CoreShaders.RENDERTYPE_ARMOR_CUTOUT_NO_CULL, p -> getCutout(p));
Expand Down Expand Up @@ -102,6 +103,7 @@ public abstract class MixinShaderManager_Overrides {
coreShaderMapShadow.put(CoreShaders.POSITION_COLOR, p -> ShaderKey.SHADOW_BASIC_COLOR);
coreShaderMapShadow.put(CoreShaders.PARTICLE, p -> ShaderKey.SHADOW_PARTICLES);
coreShaderMapShadow.put(ShaderAccess.TRANSLUCENT_PARTICLE_SHADER, p -> ShaderKey.SHADOW_PARTICLES);
coreShaderMapShadow.put(ShaderAccess.WEATHER_SHADER, p -> ShaderKey.SHADOW_PARTICLES);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_CUTOUT, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ENTITY_SOLID, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
coreShaderMapShadow.put(CoreShaders.RENDERTYPE_ARMOR_CUTOUT_NO_CULL, p -> ShaderKey.SHADOW_ENTITIES_CUTOUT);
Expand Down Expand Up @@ -223,6 +225,8 @@ private void redirectIrisProgram(ShaderProgram shaderProgram, CallbackInfoReturn
// TODO when IE updates
} else if (shaderProgram == ShaderAccess.TRANSLUCENT_PARTICLE_SHADER) {
cir.setReturnValue(getProgram(CoreShaders.PARTICLE));
} else if (shaderProgram == ShaderAccess.WEATHER_SHADER) {
cir.setReturnValue(getProgram(CoreShaders.PARTICLE));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class ShaderAccess {
.padding(1)
.build();
public static final ShaderProgram TRANSLUCENT_PARTICLE_SHADER = new ShaderProgram(ResourceLocation.fromNamespaceAndPath("iris", "translucent_particle"), DefaultVertexFormat.PARTICLE, ShaderDefines.EMPTY);
public static final ShaderProgram WEATHER_SHADER = new ShaderProgram(ResourceLocation.fromNamespaceAndPath("iris", "weather"), DefaultVertexFormat.PARTICLE, ShaderDefines.EMPTY);

public static CompiledShaderProgram getParticleTranslucentShader() {
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
Expand Down
2 changes: 1 addition & 1 deletion fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies {
addRuntimeFabricModule("fabric-rendering-fluids-v1")
addRuntimeFabricModule("fabric-resource-loader-v0")

modImplementation("maven.modrinth", "sodium", "mc1.21.4-0.6.2-fabric")
modImplementation("maven.modrinth", "sodium", "mc1.21.4-0.6.3-fabric")
implementAndInclude("org.antlr:antlr4-runtime:4.13.1")
implementAndInclude("io.github.douira:glsl-transformer:2.0.1")
implementAndInclude("org.anarres:jcpp:1.4.14")
Expand Down

0 comments on commit d12f159

Please sign in to comment.