From 9ee033cddf5556a6aab30dc2c8eaed44803c420a Mon Sep 17 00:00:00 2001 From: sunag Date: Fri, 15 Nov 2024 00:40:25 -0300 Subject: [PATCH] Added `blend` prefix --- src/nodes/display/BlendModes.js | 46 +++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/src/nodes/display/BlendModes.js b/src/nodes/display/BlendModes.js index 89140c4d13b8d5..85eafe91015a41 100644 --- a/src/nodes/display/BlendModes.js +++ b/src/nodes/display/BlendModes.js @@ -1,12 +1,12 @@ import { Fn, vec4 } from '../tsl/TSLBase.js'; import { mix, min, step } from '../math/MathNode.js'; -export const burn = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { +export const blendBurn = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { return min( 1.0, base.oneMinus().div( blend ) ).oneMinus(); } ).setLayout( { - name: 'burnBlend', + name: 'blendBurn', type: 'vec3', inputs: [ { name: 'base', type: 'vec3' }, @@ -14,12 +14,12 @@ export const burn = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { ] } ); -export const dodge = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { +export const blendDodge = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { return min( base.div( blend.oneMinus() ), 1.0 ); } ).setLayout( { - name: 'dodgeBlend', + name: 'blendDodge', type: 'vec3', inputs: [ { name: 'base', type: 'vec3' }, @@ -27,12 +27,12 @@ export const dodge = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { ] } ); -export const screen = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { +export const blendScreen = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { return base.oneMinus().mul( blend.oneMinus() ).oneMinus(); } ).setLayout( { - name: 'screenBlend', + name: 'blendScreen', type: 'vec3', inputs: [ { name: 'base', type: 'vec3' }, @@ -40,12 +40,12 @@ export const screen = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { ] } ); -export const overlay = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { +export const blendOverlay = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { return mix( base.mul( 2.0 ).mul( blend ), base.oneMinus().mul( 2.0 ).mul( blend.oneMinus() ).oneMinus(), step( 0.5, base ) ); } ).setLayout( { - name: 'overlayBlend', + name: 'blendOverlay', type: 'vec3', inputs: [ { name: 'base', type: 'vec3' }, @@ -65,3 +65,33 @@ export const blendNormal = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { { name: 'blend', type: 'vec4' } ] } ); + +// deprecated + +export const burn = ( ...params ) => { // @deprecated, r171 + + console.warn( 'THREE.TSL: "burn" has been deprecated. Use "blendBurn" instead.' ); + return blendBurn( params ); + +}; + +export const dodge = ( ...params ) => { // @deprecated, r171 + + console.warn( 'THREE.TSL: "dodge" has been deprecated. Use "blendDodge" instead.' ); + return blendDodge( params ); + +}; + +export const screen = ( ...params ) => { // @deprecated, r171 + + console.warn( 'THREE.TSL: "screen" has been deprecated. Use "blendScreen" instead.' ); + return blendScreen( params ); + +}; + +export const overlay = ( ...params ) => { // @deprecated, r171 + + console.warn( 'THREE.TSL: "overlay" has been deprecated. Use "blendOverlay" instead.' ); + return blendOverlay( params ); + +};