-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (Nodes): more
tslFn
related typings (#744)
* feat (Nodes): update rest of `tslFn` functions * feat (Nodes): Support `tslFn` with array arguments If the argument is an array, the array will be destructed. See: https://github.com/mrdoob/three.js/blob/r160/examples/jsm/nodes/materialx/lib/mx_noise.js * feat (Nodes): Update MaterialX nodes - Fix type of mx_hsv, mx_noise, MaterialXNodes - Add missing methods of mx_noise - Add mx_transform_color - Update test cases - the directory name was `materials` instead of `materialx`, fixed this `mx_noise.js` exports requires all arguments to exist, while `MaterialXNodes.js` exports don't * feat (Nodes): `tslFn` parameters are proxied * refactor: pnpm format * test: Fix test case for ShaderNode.ts I forgot to put a thing in `assetSwizzable()` * refactor: `pnpm format` * fix: Fix import statements on materialx files * fix: Fix the ShaderNodeObject circular reference issue The error is since `ContextNode` already has a member `.context` and `ShaderNodeObject` also gives it a method `.context` See: #744 (comment) I believe the behavior that the node class properties takes precedance than NodeElements is same as the actual implementation See: https://github.com/mrdoob/three.js/blob/r163/examples/jsm/nodes/shadernode/ShaderNode.js
- Loading branch information
Showing
16 changed files
with
358 additions
and
70 deletions.
There are no files selected for viewing
9 changes: 7 additions & 2 deletions
9
types/three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import Node from "../../core/Node.js"; | ||
import { ShaderNode } from "../../shadernode/ShaderNode.js"; | ||
import OperatorNode from "../../math/OperatorNode.js"; | ||
import { ShaderNodeObject } from "../../shadernode/ShaderNode.js"; | ||
|
||
declare const V_GGX_SmithCorrelated: ShaderNode<{ alpha: Node; dotNL: Node; dotNV: Node }>; | ||
declare const V_GGX_SmithCorrelated: (args: { | ||
alpha: Node; | ||
dotNL: Node; | ||
dotNV: Node; | ||
}) => ShaderNodeObject<OperatorNode>; | ||
|
||
export default V_GGX_SmithCorrelated; |
5 changes: 3 additions & 2 deletions
5
types/three/examples/jsm/nodes/functions/material/getGeometryRoughness.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { ShaderNode } from "../../shadernode/ShaderNode.js"; | ||
import MathNode from "../../math/MathNode.js"; | ||
import { ShaderNodeObject } from "../../shadernode/ShaderNode.js"; | ||
|
||
declare const getGeometryRoughness: ShaderNode; | ||
declare const getGeometryRoughness: () => ShaderNodeObject<MathNode>; | ||
|
||
export default getGeometryRoughness; |
5 changes: 3 additions & 2 deletions
5
types/three/examples/jsm/nodes/functions/material/getRoughness.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import Node from "../../core/Node.js"; | ||
import { ShaderNode } from "../../shadernode/ShaderNode.js"; | ||
import MathNode from "../../math/MathNode.js"; | ||
import { ShaderNodeObject } from "../../shadernode/ShaderNode.js"; | ||
|
||
declare const getRoughness: ShaderNode<{ roughness: Node }>; | ||
declare const getRoughness: (args: { roughness: Node }) => ShaderNodeObject<MathNode>; | ||
|
||
export default getRoughness; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
import Node from "../core/Node.js"; | ||
import { ShaderNode } from "../shadernode/ShaderNode.js"; | ||
import CondNode from "../math/CondNode.js"; | ||
import { ShaderNodeObject } from "../shadernode/ShaderNode.js"; | ||
|
||
export const getDistanceAttenuation: ShaderNode<{ lightDistance: Node; cutoffDistance: Node; decayExponent: Node }>; | ||
export const getDistanceAttenuation: (args: { | ||
lightDistance: Node; | ||
cutoffDistance: Node; | ||
decayExponent: Node; | ||
}) => ShaderNodeObject<CondNode>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { Fn } from "../../code/FunctionNode.js"; | ||
import Node from "../../core/Node.js"; | ||
import { ShaderNodeObject } from "../../shadernode/ShaderNode.js"; | ||
import { NodeRepresentation, ShaderNodeObject } from "../../shadernode/ShaderNode.js"; | ||
|
||
export function mx_hsvtorgb(...params: Fn<[Node]>): ShaderNodeObject<Node>; | ||
export function mx_rgbtohsv(...params: Fn<[Node]>): ShaderNodeObject<Node>; | ||
export const mx_hsvtorgb: (hsv_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_rgbtohsv: (c_immutable: NodeRepresentation) => ShaderNodeObject<Node>; |
133 changes: 127 additions & 6 deletions
133
types/three/examples/jsm/nodes/materialx/lib/mx_noise.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,129 @@ | ||
import { Fn } from "../../code/FunctionNode.js"; | ||
import Node from "../../core/Node.js"; | ||
import { ShaderNodeObject } from "../../shadernode/ShaderNode.js"; | ||
import VarNode from "../../core/VarNode.js"; | ||
import { NodeRepresentation, ShaderNodeObject } from "../../shadernode/ShaderNode.js"; | ||
|
||
export function mx_perlin_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>; | ||
export function mx_cell_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>; | ||
export function mx_worley_noise_float(...params: Fn<[Node]>): ShaderNodeObject<Node>; | ||
export function mx_fractal_noise_float(...params: Fn<[Node, Node, Node, Node]>): ShaderNodeObject<Node>; | ||
export const mx_select: ( | ||
b_immutable: NodeRepresentation, | ||
t_immutable: NodeRepresentation, | ||
f_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_negate_if: ( | ||
val_immutable: NodeRepresentation, | ||
b_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_floor: (x_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_floorfrac: (x_immutable: NodeRepresentation, i: ShaderNodeObject<VarNode>) => ShaderNodeObject<Node>; | ||
export const mx_bilerp: ( | ||
v0_immutable: NodeRepresentation, | ||
v1_immutable: NodeRepresentation, | ||
v2_immutable: NodeRepresentation, | ||
v3_immutable: NodeRepresentation, | ||
s_immutable: NodeRepresentation, | ||
t_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_trilerp: ( | ||
v0_immutable: NodeRepresentation, | ||
v1_immutable: NodeRepresentation, | ||
v2_immutable: NodeRepresentation, | ||
v3_immutable: NodeRepresentation, | ||
v4_immutable: NodeRepresentation, | ||
v5_immutable: NodeRepresentation, | ||
v6_immutable: NodeRepresentation, | ||
v7_immutable: NodeRepresentation, | ||
s_immutable: NodeRepresentation, | ||
t_immutable: NodeRepresentation, | ||
r_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_gradient_float: ( | ||
hash_immutable: NodeRepresentation, | ||
x_immutable: NodeRepresentation, | ||
y_immutable: NodeRepresentation, | ||
z_immutable?: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_gradient_vec3: ( | ||
hash_immutable: NodeRepresentation, | ||
x_immutable: NodeRepresentation, | ||
y_immutable: NodeRepresentation, | ||
z_immutable?: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_gradient_scale2d: (v_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_gradient_scale3d: (v_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_rotl32: (x_immutable: NodeRepresentation, k_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_bjmix: ( | ||
a: ShaderNodeObject<VarNode>, | ||
b: ShaderNodeObject<VarNode>, | ||
c: ShaderNodeObject<VarNode>, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_bjfinal: ( | ||
a_immutable: NodeRepresentation, | ||
b_immutable: NodeRepresentation, | ||
c_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_bits_to_01: (bits_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_fade: (t_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_hash_int: ( | ||
x_immutable: NodeRepresentation, | ||
y_immutable?: NodeRepresentation, | ||
z_immutable?: NodeRepresentation, | ||
xx_immutable?: NodeRepresentation, | ||
yy_immutable?: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_hash_vec3: ( | ||
x_immutable: NodeRepresentation, | ||
y_immutable: NodeRepresentation, | ||
z_immutable?: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_perlin_noise_float: (p_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_perlin_noise_vec3: (p_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_cell_noise_float: (p_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_cell_noise_vec3: (p_immutable: NodeRepresentation) => ShaderNodeObject<Node>; | ||
export const mx_fractal_noise_float: ( | ||
p_immutable: NodeRepresentation, | ||
octaves_immutable: NodeRepresentation, | ||
lacunarity_immutable: NodeRepresentation, | ||
diminish_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_fractal_noise_vec3: ( | ||
p_immutable: NodeRepresentation, | ||
octaves_immutable: NodeRepresentation, | ||
lacunarity_immutable: NodeRepresentation, | ||
diminish_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_fractal_noise_vec2: ( | ||
p_immutable: NodeRepresentation, | ||
octaves_immutable: NodeRepresentation, | ||
lacunarity_immutable: NodeRepresentation, | ||
diminish_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_fractal_noise_vec4: ( | ||
p_immutable: NodeRepresentation, | ||
octaves_immutable: NodeRepresentation, | ||
lacunarity_immutable: NodeRepresentation, | ||
diminish_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_worley_distance: ( | ||
p_immutable: NodeRepresentation, | ||
x_immutable: NodeRepresentation, | ||
y_immutable: NodeRepresentation, | ||
z_immutable: NodeRepresentation, | ||
xoff_immutable: NodeRepresentation, | ||
yoff_immutable: NodeRepresentation, | ||
zoff_immutable: NodeRepresentation, | ||
jitter_immutable: NodeRepresentation, | ||
metric_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_worley_noise_float: ( | ||
p_immutable: NodeRepresentation, | ||
jitter_immutable: NodeRepresentation, | ||
metric_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_worley_noise_vec2: ( | ||
p_immutable: NodeRepresentation, | ||
jitter_immutable: NodeRepresentation, | ||
metric_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; | ||
export const mx_worley_noise_vec3: ( | ||
p_immutable: NodeRepresentation, | ||
jitter_immutable: NodeRepresentation, | ||
metric_immutable: NodeRepresentation, | ||
) => ShaderNodeObject<Node>; |
4 changes: 4 additions & 0 deletions
4
types/three/examples/jsm/nodes/materialx/lib/mx_transform_color.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Node from "../../core/Node.js"; | ||
import { NodeRepresentation, ShaderNodeObject } from "../../shadernode/ShaderNode.js"; | ||
|
||
export const mx_srgb_texture_to_lin_rec709: (color_immutable: NodeRepresentation) => ShaderNodeObject<Node>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
types/three/test/unit/examples/jsm/nodes/materials/lib/mx_noise.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.