Skip to content

Commit

Permalink
WebGPURenderer: OperatorNode Add unary operator support (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 authored Jan 30, 2024
1 parent 2b7ab09 commit df3c6a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 2 additions & 4 deletions types/three/examples/jsm/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ export {
MathNodeMethod2,
MathNodeMethod3,
MathNodeMethod,
Unary,
Binary,
Ternary,
} from './math/MathNode.js';

export {
Expand All @@ -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';
Expand Down
10 changes: 3 additions & 7 deletions types/three/examples/jsm/nodes/math/MathNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const INFINITY: ShaderNodeObject<Node>;
export const PI: ShaderNodeObject<Node>;
export const PI2: ShaderNodeObject<Node>;

export type Unary = (a: NodeRepresentation) => ShaderNodeObject<MathNode>;
type Unary = (a: NodeRepresentation) => ShaderNodeObject<MathNode>;

export const radians: Unary;
export const degrees: Unary;
Expand Down Expand Up @@ -160,7 +160,7 @@ export const trunc: Unary;
export const fwidth: Unary;
export const bitcast: Unary;

export type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
type Binary = (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;

export const atan2: Binary;
export const min: Binary;
Expand All @@ -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<MathNode>;
type Ternary = (a: NodeRepresentation, b: NodeRepresentation, c: NodeRepresentation) => ShaderNodeObject<MathNode>;

export const cbrt: Unary;
export const lengthSq: Unary;
Expand Down
6 changes: 5 additions & 1 deletion types/three/examples/jsm/nodes/math/OperatorNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand All @@ -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<OperatorNode>;
export const xor: Operator;
export const bitAnd: Operator;
export const bitNot: (a: NodeRepresentation) => ShaderNodeObject<OperatorNode>;
export const bitOr: Operator;
export const bitXor: Operator;
export const shiftLeft: Operator;
Expand All @@ -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;
Expand Down

0 comments on commit df3c6a7

Please sign in to comment.