Skip to content

Commit

Permalink
Nodes: Avoid vector reuse in luminance() input (#29540)
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy authored Oct 2, 2024
1 parent 48f5603 commit 612cca4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/nodes/display/ColorAdjustment.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ export const hue = /*@__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => {

} );

const _luminanceCoefficients = /*@__PURE__*/ new Vector3();
export const luminance = (
color,
luminanceCoefficients = vec3( ... ColorManagement.getLuminanceCoefficients( _luminanceCoefficients ) )
luminanceCoefficients = vec3( ColorManagement.getLuminanceCoefficients( new Vector3() ) )
) => dot( color, luminanceCoefficients );

export const threshold = ( color, threshold ) => mix( vec3( 0.0 ), color, luminance( color ).sub( threshold ).max( 0 ) );

0 comments on commit 612cca4

Please sign in to comment.