Skip to content

Commit

Permalink
fix: correctly set back to state and buffer during VR if a second pas…
Browse files Browse the repository at this point in the history
…s or histogram is used
  • Loading branch information
seankmartin committed Jul 8, 2024
1 parent 9eb8ca2 commit 73573ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/perspective_view/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,7 @@ export class PerspectivePanel extends RenderedDataPanel {
);
};
bindVolumeRenderingBuffer();
renderContext.bindVolumeRenderingBuffer = bindVolumeRenderingBuffer;
gl.clearDepth(1.0);
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clear(
Expand Down
5 changes: 5 additions & 0 deletions src/perspective_view/render_layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ export interface PerspectiveViewRenderContext
*/
bindMaxProjectionBuffer?: () => void | undefined;

/**
* Specifies how to bind the volume rendering buffer
*/
bindVolumeRenderingBuffer?: () => void | undefined;

/**
* Specifies how to assign the max projection emitter
*/
Expand Down
10 changes: 6 additions & 4 deletions src/volume_rendering/volume_render_layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,18 +775,20 @@ outputValue = vec4(1.0, 1.0, 1.0, 1.0);
const performedSecondPassForPicking =
!isProjectionMode(this.mode.value) &&
!renderContext.isContinuousCameraMotionInProgress;
// In this case, we need the max projection buffer
// If the layer is in projection mode or the second pass for picking has been performed,
// the max projection state is needed
// the max projection buffer is not bound, because it is immediately read back
// in the perspective panel to update the max projection picking buffer
if (isProjectionMode(this.mode.value) || performedSecondPassForPicking) {
gl.depthMask(true);
gl.disable(WebGL2RenderingContext.BLEND);
gl.depthFunc(WebGL2RenderingContext.GREATER);
renderContext.bindMaxProjectionBuffer!();
} else {
// Otherwise, the regular OIT buffer is needed
// Otherwise, the regular OIT buffer is needed along with the state
gl.depthMask(false);
gl.enable(WebGL2RenderingContext.BLEND);
gl.depthFunc(WebGL2RenderingContext.LESS);
renderContext.bindFramebuffer();
renderContext.bindVolumeRenderingBuffer!();
}
gl.enable(WebGL2RenderingContext.DEPTH_TEST);
};
Expand Down

0 comments on commit 73573ca

Please sign in to comment.