Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/refractor' into refractor
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Apr 3, 2024
2 parents 2958ced + 4e47cb6 commit eb54b79
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public class MixinLevelRenderer {
this.cullingFrustum = new NonCullingFrustum();
}

Minecraft.getInstance().smartCull = !pipeline.shouldDisableOcclusionCulling();

if (Iris.shouldActivateWireframe() && this.minecraft.isLocalServer()) {
IrisRenderSystem.setPolygonMode(GL43C.GL_LINE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public class IrisRenderingPipeline implements WorldRenderingPipeline, ShaderRend
private final boolean oldLighting;
private final OptionalInt forcedShadowRenderDistanceChunks;
private final boolean frustumCulling;
private final boolean occlusionCulling;
private final CloudSetting cloudSetting;
private final boolean shouldRenderSun;
private final boolean shouldRenderMoon;
Expand Down Expand Up @@ -198,6 +199,7 @@ public IrisRenderingPipeline(ProgramSet programSet) {
this.shouldRenderMoon = programSet.getPackDirectives().shouldRenderMoon();
this.allowConcurrentCompute = programSet.getPackDirectives().getConcurrentCompute();
this.frustumCulling = programSet.getPackDirectives().shouldUseFrustumCulling();
this.occlusionCulling = programSet.getPackDirectives().shouldUseOcclusionCulling();
this.resolver = new ProgramFallbackResolver(programSet);
this.pack = programSet.getPack();

Expand Down Expand Up @@ -1134,6 +1136,11 @@ public boolean shouldDisableFrustumCulling() {
return !frustumCulling;
}

@Override
public boolean shouldDisableOcclusionCulling() {
return !occlusionCulling;
}

@Override
public CloudSetting getCloudSetting() {
return cloudSetting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public boolean shouldDisableFrustumCulling() {
return false;
}

@Override
public boolean shouldDisableOcclusionCulling() {
return false;
}

@Override
public CloudSetting getCloudSetting() {
return CloudSetting.DEFAULT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public interface WorldRenderingPipeline {
boolean shouldDisableDirectionalShading();

boolean shouldDisableFrustumCulling();
boolean shouldDisableOcclusionCulling();

CloudSetting getCloudSetting();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class PackDirectives {
private boolean voxelizeLightBlocks;
private boolean separateEntityDraws;
private boolean frustumCulling;
private boolean occlusionCulling;
private boolean oldLighting;
private boolean concurrentCompute;
private boolean oldHandLight;
Expand Down Expand Up @@ -75,6 +76,7 @@ public PackDirectives(Set<Integer> supportedRenderTargets, ShaderProperties prop
voxelizeLightBlocks = properties.getVoxelizeLightBlocks().orElse(false);
separateEntityDraws = properties.getSeparateEntityDraws().orElse(false);
frustumCulling = properties.getFrustumCulling().orElse(true);
occlusionCulling = properties.getOcclusionCulling().orElse(true);
oldLighting = properties.getOldLighting().orElse(false);
supportsColorCorrection = properties.supportsColorCorrection().orElse(false);
concurrentCompute = properties.getConcurrentCompute().orElse(false);
Expand Down Expand Up @@ -180,6 +182,10 @@ public boolean shouldUseFrustumCulling() {
return frustumCulling;
}

public boolean shouldUseOcclusionCulling() {
return occlusionCulling;
}

public boolean isOldLighting() {
return oldLighting;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public class ShaderProperties {
private OptionalBoolean voxelizeLightBlocks = OptionalBoolean.DEFAULT;
private OptionalBoolean separateEntityDraws = OptionalBoolean.DEFAULT;
private OptionalBoolean frustumCulling = OptionalBoolean.DEFAULT;
private OptionalBoolean occlusionCulling = OptionalBoolean.DEFAULT;
private ShadowCullState shadowCulling = ShadowCullState.DEFAULT;
private OptionalBoolean shadowEnabled = OptionalBoolean.DEFAULT;
private OptionalBoolean dhShadowEnabled = OptionalBoolean.DEFAULT;
Expand Down Expand Up @@ -196,6 +197,7 @@ public ShaderProperties(String contents, ShaderPackOptions shaderPackOptions, It
handleBooleanDirective(key, value, "voxelizeLightBlocks", bool -> voxelizeLightBlocks = bool);
handleBooleanDirective(key, value, "separateEntityDraws", bool -> separateEntityDraws = bool);
handleBooleanDirective(key, value, "frustum.culling", bool -> frustumCulling = bool);
handleBooleanDirective(key, value, "occlusion.culling", bool -> occlusionCulling = bool);
handleBooleanDirective(key, value, "shadow.enabled", bool -> shadowEnabled = bool);
handleBooleanDirective(key, value, "dhShadow.enabled", bool -> dhShadowEnabled = bool);
handleBooleanDirective(key, value, "particles.before.deferred", bool -> {
Expand Down Expand Up @@ -808,6 +810,10 @@ public OptionalBoolean getFrustumCulling() {
return frustumCulling;
}

public OptionalBoolean getOcclusionCulling() {
return occlusionCulling;
}

public ShadowCullState getShadowCulling() {
return shadowCulling;
}
Expand Down

0 comments on commit eb54b79

Please sign in to comment.