Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
RenaudRohlinger committed Jan 16, 2025
1 parent f7db671 commit 1e332df
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,9 @@ class Renderer {

}

// #30329
renderContext.clearColorValue = this._clearColor;

this.backend.clear( color, depth, stencil, renderContext );

if ( renderTarget !== null && this._renderTarget === null ) {
Expand Down
31 changes: 25 additions & 6 deletions src/renderers/webgl-fallback/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,17 @@ class WebGLBackend extends Backend {

if ( descriptor === null ) {

const clearColor = this.getClearColor();

// premultiply alpha

clearColor.r *= clearColor.a;
clearColor.g *= clearColor.a;
clearColor.b *= clearColor.a;

descriptor = {
textures: null
textures: null,
clearColorValue: clearColor
};

}
Expand All @@ -714,13 +723,23 @@ class WebGLBackend extends Backend {

if ( clear !== 0 ) {

const clearColor = this.getClearColor();
let clearColor;

// premultiply alpha
if ( descriptor.clearColorValue ) {

clearColor.r *= clearColor.a;
clearColor.g *= clearColor.a;
clearColor.b *= clearColor.a;
clearColor = descriptor.clearColorValue;

} else {

clearColor = this.getClearColor();

// premultiply alpha

clearColor.r *= clearColor.a;
clearColor.g *= clearColor.a;
clearColor.b *= clearColor.a;

}

if ( depth ) this.state.setDepthMask( true );

Expand Down

0 comments on commit 1e332df

Please sign in to comment.