Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More nodes updates #731

Merged
merged 1 commit into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions types/three/examples/jsm/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,23 @@ export { default as NodeVarying } from './core/NodeVarying.js';
export {
default as PropertyNode,
property,
varyingProperty,
output,
diffuseColor,
roughness,
metalness,
clearcoat,
clearcoatRoughness,
sheen,
sheenRoughness,
iridescence,
iridescenceIOR,
iridescenceThickness,
specularColor,
shininess,
dashSize,
gapSize,
pointWidth,
} from './core/PropertyNode.js';
export { default as StackNode } from './core/StackNode.js';
export { default as TempNode } from './core/TempNode.js';
Expand Down Expand Up @@ -195,13 +207,16 @@ export {
MaterialNodeScope,
} from './accessors/MaterialNode.js';
export { default as MaterialReferenceNode, materialReference } from './accessors/MaterialReferenceNode.js';
export { default as TextureBicubicNode, textureBicubic } from './accessors/TextureBicubicNode.js';
export {
default as ModelNode,
modelDirection,
modelViewMatrix,
modelNormalMatrix,
modelWorldMatrix,
modelPosition,
modelViewPosition,
modelScale,
} from './accessors/ModelNode.js';
export { default as ModelViewProjectionNode, modelViewProjection } from './accessors/ModelViewProjectionNode.js';
export {
Expand Down Expand Up @@ -268,6 +283,19 @@ export {
viewportTopRight,
viewportBottomRight,
} from './display/ViewportNode.js';
export { default as ViewportTextureNode, viewportTexture, viewportMipTexture } from './display/ViewportTextureNode.js';
export { default as ViewportSharedTextureNode, viewportSharedTexture } from './display/ViewportSharedTextureNode.js';
export {
default as ViewportDepthNode,
viewZToOrthographicDepth,
orthographicDepthToViewZ,
viewZToPerspectiveDepth,
perspectiveDepthToViewZ,
depth,
depthTexture,
depthPixel,
ViewportDepthNodeScope,
} from './display/ViewportDepthNode.js';

// code
export { default as ExpressionNode, expression } from './code/ExpressionNode.js';
Expand Down
2 changes: 2 additions & 0 deletions types/three/examples/jsm/nodes/accessors/ModelNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ export default class ModelNode extends Object3DNode {
constructor(scope?: Object3DNodeScope);
}

export const modelDirection: ShaderNodeObject<ModelNode>;
export const modelViewMatrix: ShaderNodeObject<ModelNode>;
export const modelNormalMatrix: ShaderNodeObject<ModelNode>;
export const modelWorldMatrix: ShaderNodeObject<ModelNode>;
export const modelPosition: ShaderNodeObject<ModelNode>;
export const modelScale: ShaderNodeObject<ModelNode>;
export const modelViewPosition: ShaderNodeObject<ModelNode>;
18 changes: 18 additions & 0 deletions types/three/examples/jsm/nodes/accessors/TextureBicubicNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Node from '../core/Node.js';
import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';
import TempNode from '../core/TempNode.js';

export default class TextureBicubicNode extends TempNode {
textureNode: Node;
blurNode: Node;

constructor(textureNode: Node, blurNode?: Node);
}

export const textureBicubic: (textureNode: Node, blurNode?: NodeRepresentation) => ShaderNodeObject<TextureBicubicNode>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
bicubic: typeof textureBicubic;
}
}
2 changes: 2 additions & 0 deletions types/three/examples/jsm/nodes/accessors/TextureNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default class TextureNode extends UniformNode<Texture> {
constructor(value: Texture, uvNode?: Node, levelNode?: Node | null);

getDefaultUV(): Node;

clone(): this;
}

export const texture: (
Expand Down
21 changes: 19 additions & 2 deletions types/three/examples/jsm/nodes/core/PropertyNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,30 @@ import Node from './Node.js';
import { ShaderNodeObject } from '../shadernode/ShaderNode.js';

export default class PropertyNode extends Node {
constructor(name?: string, nodeType?: NodeTypeOption);
name: string | null;
varying: boolean;

readonly isPropertyNode: true;

constructor(nodeType?: NodeTypeOption | null, name?: string | null, varying?: boolean);
}

export const property: (name: string, nodeOrType: Node | NodeTypeOption) => ShaderNodeObject<Node>;
export const property: (type?: NodeTypeOption | null, name?: string | null) => ShaderNodeObject<PropertyNode>;
export const varyingProperty: (type?: NodeTypeOption | null, name?: string | null) => ShaderNodeObject<PropertyNode>;

export const diffuseColor: ShaderNodeObject<PropertyNode>;
export const roughness: ShaderNodeObject<PropertyNode>;
export const metalness: ShaderNodeObject<PropertyNode>;
export const clearcoat: ShaderNodeObject<PropertyNode>;
export const clearcoatRoughness: ShaderNodeObject<PropertyNode>;
export const sheen: ShaderNodeObject<PropertyNode>;
export const sheenRoughness: ShaderNodeObject<PropertyNode>;
export const iridescence: ShaderNodeObject<PropertyNode>;
export const iridescenceIOR: ShaderNodeObject<PropertyNode>;
export const iridescenceThickness: ShaderNodeObject<PropertyNode>;
export const specularColor: ShaderNodeObject<PropertyNode>;
export const shininess: ShaderNodeObject<PropertyNode>;
export const output: ShaderNodeObject<PropertyNode>;
export const dashSize: ShaderNodeObject<PropertyNode>;
export const gapSize: ShaderNodeObject<PropertyNode>;
export const pointWidth: ShaderNodeObject<PropertyNode>;
11 changes: 9 additions & 2 deletions types/three/examples/jsm/nodes/core/VarNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,12 @@ export default class VarNode extends Node {
div(...params: Node[]): this;
}

export const label: (node: NodeRepresentation, name?: string) => ShaderNodeObject<VarNode>;
export const temp: (node: NodeRepresentation, name?: string) => ShaderNodeObject<VarNode>;
export const label: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
export const temp: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
temp: typeof temp;
toVar: typeof temp;
}
}
9 changes: 9 additions & 0 deletions types/three/examples/jsm/nodes/display/BlendModeNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ export const burn: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation
export const dodge: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => ShaderNodeObject<BlendModeNode>;
export const overlay: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => ShaderNodeObject<BlendModeNode>;
export const screen: (baseNode: NodeRepresentation, blendNode?: NodeRepresentation) => ShaderNodeObject<BlendModeNode>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
burn: typeof burn;
dodge: typeof dodge;
overlay: typeof overlay;
screen: typeof screen;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ export const hue: (

export const lumaCoeffs: ShaderNodeObject<MathNode>;
export const luminance: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
saturation: typeof saturation;
vibrance: typeof vibrance;
hue: typeof hue;
}
}
6 changes: 6 additions & 0 deletions types/three/examples/jsm/nodes/display/PosterizeNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ export const posterize: (
sourceNode: NodeRepresentation,
stepsNode: NodeRepresentation,
) => ShaderNodeObject<PosterizeNode>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
posterize: typeof posterize;
}
}
32 changes: 32 additions & 0 deletions types/three/examples/jsm/nodes/display/ViewportDepthNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Node from '../core/Node.js';
import { ShaderNodeObject } from '../shadernode/ShaderNode.js';

export default class ViewportDepthNode extends Node {
scope: ViewportDepthNodeScope;
valueNode: Node;

readonly isViewportDepthNode: true;

constructor(scope: ViewportDepthNodeScope, valueNode?: Node | null);

static DEPTH: 'depth';
static DEPTH_TEXTURE: 'depthTexture';
static DEPTH_PIXEL: 'depthPixel';
}

export type ViewportDepthNodeScope =
| typeof ViewportDepthNode.DEPTH
| typeof ViewportDepthNode.DEPTH_TEXTURE
| typeof ViewportDepthNode.DEPTH_PIXEL;

export const viewZToOrthographicDepth: (viewZ: Node, near: Node, far: Node) => Node;

export const orthographicDepthToViewZ: (depth: Node, near: Node, far: Node) => Node;

export const viewZToPerspectiveDepth: (viewZ: Node, near: Node, far: Node) => Node;

export const perspectiveDepthToViewZ: (depth: Node, near: Node, far: Node) => Node;

export const depth: ShaderNodeObject<ViewportDepthNode>;
export const depthTexture: (valueNode?: Node | null) => ShaderNodeObject<ViewportDepthNode>;
export const depthPixel: ShaderNodeObject<ViewportDepthNode>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Node from '../core/Node.js';
import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
import ViewportTextureNode from './ViewportTextureNode.js';

export default class ViewportSharedTextureNode extends ViewportTextureNode {
constructor(uvNode?: Node, levelNode?: Node | null);
}

export const viewportSharedTexture: (
uvNode?: Node,
levelNode?: Node | null,
) => ShaderNodeObject<ViewportSharedTextureNode>;
26 changes: 26 additions & 0 deletions types/three/examples/jsm/nodes/display/ViewportTextureNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { FramebufferTexture } from '../../../../src/Three.js';
import TextureNode from '../accessors/TextureNode.js';
import Node from '../core/Node.js';
import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
import { NodeUpdateType } from '../core/constants.js';

export default class ViewportTextureNode extends TextureNode {
generateMipmaps: boolean;

readonly isOutputTextureNode: true;

updateBeforeType: NodeUpdateType;

constructor(uvNode?: Node, levelNode?: Node | null, framebufferTexture?: FramebufferTexture | null);
}

export const viewportTexture: (
uvNode?: Node,
levelNode?: Node | null,
framebufferTexture?: FramebufferTexture | null,
) => ShaderNodeObject<ViewportTextureNode>;
export const viewportMipTexture: (
uvNode?: Node,
levelNode?: Node | null,
framebufferTexture?: FramebufferTexture | null,
) => ShaderNodeObject<Node>;
6 changes: 6 additions & 0 deletions types/three/examples/jsm/nodes/math/CondNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ export function cond(
ifNode: NodeRepresentation,
elseNode: NodeRepresentation,
): ShaderNodeObject<Node>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
cond: typeof cond;
}
}
6 changes: 3 additions & 3 deletions types/three/examples/jsm/nodes/math/MathNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const trunc: Unary;
export const fwidth: Unary;
export const bitcast: Unary;

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

export const atan2: Binary;
export const min: Binary;
Expand All @@ -178,8 +178,8 @@ export const transformDirection: Binary;

export type Ternary = (
a: NodeRepresentation,
b: NodeRepresentation,
c: NodeRepresentation,
b?: NodeRepresentation | null,
c?: NodeRepresentation | null,
) => ShaderNodeObject<MathNode>;

export const mix: Ternary;
Expand Down
6 changes: 5 additions & 1 deletion types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import ConstNode from '../core/ConstNode.js';
import NodeBuilder from '../core/NodeBuilder.js';
import SplitNode from '../utils/SplitNode.js';

export interface NodeElements {}
export interface NodeElements {
append: typeof append;
}

export function addNodeElement(name: string, nodeElement: unknown): void;

Expand Down Expand Up @@ -162,6 +164,8 @@ export function nodeImmutable<T>(
...params: ProxiedTuple<GetConstructors<T>>
): ShaderNodeObject<ConstructedNode<T>>;

export function append(node: Node): Node;

export const color: ConvertType;

export const float: ConvertType;
Expand Down
27 changes: 23 additions & 4 deletions types/three/examples/jsm/nodes/utils/RemapNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Node from '../core/Node.js';
import { ShaderNodeObject } from '../shadernode/ShaderNode.js';
import { NodeRepresentation, ShaderNodeObject } from '../shadernode/ShaderNode.js';

export default class RemapNode extends Node {
node: Node;
Expand All @@ -10,8 +10,27 @@ export default class RemapNode extends Node {

doClamp: boolean;

constructor(node: Node, inLowNode: Node, inHighNode: Node, outLowNode: Node, outHighNode: Node);
constructor(node: Node, inLowNode: Node, inHighNode: Node, outLowNode?: Node, outHighNode?: Node);
}

export const remap: (node: Node, inLowNode: Node) => ShaderNodeObject<RemapNode>;
export const remapClamp: (node: Node, inLowNode: Node) => ShaderNodeObject<RemapNode>;
export const remap: (
node: Node,
inLowNode: NodeRepresentation,
inHighNode: NodeRepresentation,
outLowNode?: NodeRepresentation,
outHighNode?: NodeRepresentation,
) => ShaderNodeObject<RemapNode>;
export const remapClamp: (
node: Node,
inLowNode: NodeRepresentation,
inHighNode: NodeRepresentation,
outLowNode?: NodeRepresentation,
outHighNode?: NodeRepresentation,
) => ShaderNodeObject<RemapNode>;

declare module '../shadernode/ShaderNode.js' {
interface NodeElements {
remap: typeof remap;
remapClamp: typeof remapClamp;
}
}