Skip to content

Commit

Permalink
Track framebuffer target in emissive capture
Browse files Browse the repository at this point in the history
Fixes corrupt bloom layer in mixed-target scene with translucency
  • Loading branch information
grondag committed Oct 31, 2020
1 parent 434f416 commit 956eb94
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/grondag/canvas/material/state/RenderState.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ public void enable() {
return;
}

target.enable();

if (active == null) {
// same for all, so only do 1X
RenderSystem.shadeModel(GL11.GL_SMOOTH);
target.enable();
// NB: must be after frame-buffer target switch
if (Configurator.enableBloom) CanvasFrameBufferHacks.startEmissiveCapture();
} else if (active.target != target) {
if (Configurator.enableBloom) CanvasFrameBufferHacks.endEmissiveCapture();
target.enable();
if (Configurator.enableBloom) CanvasFrameBufferHacks.startEmissiveCapture();
}

active = this;
Expand All @@ -76,9 +81,6 @@ public void enable() {
fog.enable();
decal.enable();

// NB: must be after frame-buffer target switch
if (Configurator.enableBloom) CanvasFrameBufferHacks.startEmissiveCapture();

CULL_STATE.setEnabled(cull);
LIGHTMAP_STATE.setEnabled(enableLightmap);
LINE_STATE.setEnabled(lines);
Expand Down

0 comments on commit 956eb94

Please sign in to comment.