* clears color and depth buffers * with r,g,b,a * @private * @param {Number} r normalized red val. * @param {Number} g normalized green val. * @param {Number} b normalized blue val. * @param {Number} a normalized alpha val.
(...args)
| 624 | * @param {Number} a normalized alpha val. |
| 625 | */ |
| 626 | clear(...args) { |
| 627 | const _r = args[0] || 0; |
| 628 | const _g = args[1] || 0; |
| 629 | const _b = args[2] || 0; |
| 630 | let _a = args[3] || 0; |
| 631 | |
| 632 | const activeFramebuffer = this.activeFramebuffer(); |
| 633 | if ( |
| 634 | activeFramebuffer && |
| 635 | activeFramebuffer.format === constants.UNSIGNED_BYTE && |
| 636 | !activeFramebuffer.antialias && |
| 637 | _a === 0 |
| 638 | ) { |
| 639 | // Drivers on Intel Macs check for 0,0,0,0 exactly when drawing to a |
| 640 | // framebuffer and ignore the command if it's the only drawing command to |
| 641 | // the framebuffer. To work around it, we can set the alpha to a value so |
| 642 | // low that it still rounds down to 0, but that circumvents the buggy |
| 643 | // check in the driver. |
| 644 | _a = 1e-10; |
| 645 | } |
| 646 | |
| 647 | this.GL.clearColor(_r * _a, _g * _a, _b * _a, _a); |
| 648 | this.GL.clearDepth(1); |
| 649 | this.GL.clear(this.GL.COLOR_BUFFER_BIT | this.GL.DEPTH_BUFFER_BIT); |
| 650 | } |
| 651 | |
| 652 | /** |
| 653 | * Resets all depth information so that nothing previously drawn will |
no test coverage detected