From df3c6a75118151ed2c6d027bbcdca647f2006235 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Tue, 30 Jan 2024 09:24:55 -0500 Subject: [PATCH] WebGPURenderer: OperatorNode Add unary operator support (#793) --- types/three/examples/jsm/nodes/Nodes.d.ts | 6 ++---- types/three/examples/jsm/nodes/math/MathNode.d.ts | 10 +++------- types/three/examples/jsm/nodes/math/OperatorNode.d.ts | 6 +++++- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/types/three/examples/jsm/nodes/Nodes.d.ts b/types/three/examples/jsm/nodes/Nodes.d.ts index 6801e4efd..c042aa72f 100644 --- a/types/three/examples/jsm/nodes/Nodes.d.ts +++ b/types/three/examples/jsm/nodes/Nodes.d.ts @@ -121,9 +121,6 @@ export { MathNodeMethod2, MathNodeMethod3, MathNodeMethod, - Unary, - Binary, - Ternary, } from './math/MathNode.js'; export { @@ -140,14 +137,15 @@ export { greaterThanEqual, and, or, + not, xor, bitAnd, + bitNot, bitOr, bitXor, shiftLeft, shiftRight, OperatorNodeOp, - Operator, } from './math/OperatorNode.js'; export { default as CondNode, cond } from './math/CondNode.js'; export { default as HashNode, hash } from './math/HashNode.js'; diff --git a/types/three/examples/jsm/nodes/math/MathNode.d.ts b/types/three/examples/jsm/nodes/math/MathNode.d.ts index f3cf7001e..79a2eb847 100644 --- a/types/three/examples/jsm/nodes/math/MathNode.d.ts +++ b/types/three/examples/jsm/nodes/math/MathNode.d.ts @@ -127,7 +127,7 @@ export const INFINITY: ShaderNodeObject; export const PI: ShaderNodeObject; export const PI2: ShaderNodeObject; -export type Unary = (a: NodeRepresentation) => ShaderNodeObject; +type Unary = (a: NodeRepresentation) => ShaderNodeObject; export const radians: Unary; export const degrees: Unary; @@ -160,7 +160,7 @@ export const trunc: Unary; export const fwidth: Unary; export const bitcast: Unary; -export type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject; +type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject; export const atan2: Binary; export const min: Binary; @@ -178,11 +178,7 @@ export const pow3: Binary; export const pow4: Binary; export const transformDirection: Binary; -export type Ternary = ( - a: NodeRepresentation, - b: NodeRepresentation, - c: NodeRepresentation, -) => ShaderNodeObject; +type Ternary = (a: NodeRepresentation, b: NodeRepresentation, c: NodeRepresentation) => ShaderNodeObject; export const cbrt: Unary; export const lengthSq: Unary; diff --git a/types/three/examples/jsm/nodes/math/OperatorNode.d.ts b/types/three/examples/jsm/nodes/math/OperatorNode.d.ts index 764d9ca8d..9f58d98fd 100644 --- a/types/three/examples/jsm/nodes/math/OperatorNode.d.ts +++ b/types/three/examples/jsm/nodes/math/OperatorNode.d.ts @@ -30,7 +30,7 @@ export default class OperatorNode extends TempNode { constructor(op: OperatorNodeOp, ...params: [Node, Node, ...Node[]]); } -export type Operator = ( +type Operator = ( a: NodeRepresentation, b: NodeRepresentation, ...others: NodeRepresentation[] @@ -48,8 +48,10 @@ export const lessThanEqual: Operator; export const greaterThanEqual: Operator; export const and: Operator; export const or: Operator; +export const not: (a: NodeRepresentation) => ShaderNodeObject; export const xor: Operator; export const bitAnd: Operator; +export const bitNot: (a: NodeRepresentation) => ShaderNodeObject; export const bitOr: Operator; export const bitXor: Operator; export const shiftLeft: Operator; @@ -69,8 +71,10 @@ declare module '../shadernode/ShaderNode.js' { greaterThanEqual: typeof greaterThanEqual; and: typeof and; or: typeof or; + not: typeof not; xor: typeof xor; bitAnd: typeof bitAnd; + bitNot: typeof bitNot; bitOr: typeof bitOr; bitXor: typeof bitXor; shiftLeft: typeof shiftLeft;