Ver código fonte

fix canvas not cleared

- #201
- happens e.g. with antialiasing disabled plus transparent background on
Alexander Rose 3 anos atrás
pai
commit
301940c8bd
1 arquivos alterados com 7 adições e 2 exclusões
  1. 7 2
      src/mol-canvas3d/passes/draw.ts

+ 7 - 2
src/mol-canvas3d/passes/draw.ts

@@ -290,13 +290,18 @@ export class DrawPass {
         renderer.setViewport(x, y, width, height);
         renderer.update(camera);
 
+        if (transparentBackground) {
+            this.drawTarget.bind();
+            renderer.clear(false);
+        }
+
         if (this.wboitEnabled) {
             this._renderWboit(renderer, camera, scene, transparentBackground, postprocessingProps);
         } else {
             this._renderBlended(renderer, camera, scene, !volumeRendering && !postprocessingEnabled && !antialiasingEnabled && toDrawingBuffer, transparentBackground, postprocessingProps);
         }
 
-        if (PostprocessingPass.isEnabled(postprocessingProps)) {
+        if (postprocessingEnabled) {
             this.postprocessing.target.bind();
         } else if (!toDrawingBuffer || volumeRendering || this.wboitEnabled) {
             this.colorTarget.bind();
@@ -323,7 +328,7 @@ export class DrawPass {
             this.drawTarget.bind();
 
             this.webgl.state.disable(this.webgl.gl.DEPTH_TEST);
-            if (PostprocessingPass.isEnabled(postprocessingProps)) {
+            if (postprocessingEnabled) {
                 this.copyFboPostprocessing.render();
             } else if (volumeRendering || this.wboitEnabled) {
                 this.copyFboTarget.render();