diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 79cb7ea7023706..74dbedc0104ebf 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -125891,7 +125891,7 @@ declare namespace Word { after = "After", } /** - * Represents the location of a {@link https://learn.microsoft.com/javascript/api/word/word.border | border}. + * Represents the location of a {@link Word.Border | border}. * * @remarks * [Api set: WordApi 1.3] @@ -126059,7 +126059,7 @@ declare namespace Word { mixed = "Mixed", } /** - * The {@link https://learn.microsoft.com/javascript/api/word/word.border | border} types. + * The {@link Word.Border | border} types. * * @remarks * [Api set: WordApi 1.3] @@ -195874,7 +195874,7 @@ declare namespace PowerPoint { */ $top?: number; /** - * Specify the number of items in the collection that are to be skipped and not included in the result. If top is specified, the selection of result will start after skipping the specified number of items. + * Specify the number of items in the collection that are to be skipped and not included in the result. If `top` is specified, the selection of result will start after skipping the specified number of items. */ $skip?: number; } diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index a663211ebeac63..689b1e899c053c 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -118841,7 +118841,7 @@ declare namespace Word { after = "After", } /** - * Represents the location of a {@link https://learn.microsoft.com/javascript/api/word/word.border | border}. + * Represents the location of a {@link Word.Border | border}. * * @remarks * [Api set: WordApi 1.3] @@ -119009,7 +119009,7 @@ declare namespace Word { mixed = "Mixed", } /** - * The {@link https://learn.microsoft.com/javascript/api/word/word.border | border} types. + * The {@link Word.Border | border} types. * * @remarks * [Api set: WordApi 1.3] @@ -184874,7 +184874,7 @@ declare namespace PowerPoint { */ $top?: number; /** - * Specify the number of items in the collection that are to be skipped and not included in the result. If top is specified, the selection of result will start after skipping the specified number of items. + * Specify the number of items in the collection that are to be skipped and not included in the result. If `top` is specified, the selection of result will start after skipping the specified number of items. */ $skip?: number; } diff --git a/types/three/examples/jsm/geometries/TextGeometry.d.ts b/types/three/examples/jsm/geometries/TextGeometry.d.ts index 2b39ff50d40881..bb8dca78de3e65 100644 --- a/types/three/examples/jsm/geometries/TextGeometry.d.ts +++ b/types/three/examples/jsm/geometries/TextGeometry.d.ts @@ -59,6 +59,8 @@ export interface TextGeometryParameters extends ExtrudeGeometryOptions { * @defaultValue `3` */ bevelSegments?: number | undefined; + + direction?: "ltr" | "rtl" | "tb" | undefined; } /** diff --git a/types/three/examples/jsm/gpgpu/BitonicSort.d.ts b/types/three/examples/jsm/gpgpu/BitonicSort.d.ts new file mode 100644 index 00000000000000..d6a04a21c2886b --- /dev/null +++ b/types/three/examples/jsm/gpgpu/BitonicSort.d.ts @@ -0,0 +1,21 @@ +import { Node, Renderer, StorageBufferNode } from "three/webgpu"; + +export const getBitonicFlipIndices: (index: Node, blockHeight: Node) => Node; + +export const getBitonicDisperseIndices: (index: Node, swapSpan: Node) => Node; + +export interface BitonicSortOptions { + workgroupSize?: number | undefined; +} + +export class BitonicSort { + infoStorage: StorageBufferNode; + + swapOpCount: number; + stepCount: number; + + constructor(renderer: Renderer, dataBuffer: StorageBufferNode, options?: BitonicSortOptions); + + computeStep(renderer: Renderer): Promise; + compute(renderer: Renderer): Promise; +} diff --git a/types/three/examples/jsm/inspector/Inspector.d.ts b/types/three/examples/jsm/inspector/Inspector.d.ts new file mode 100644 index 00000000000000..12eac3e13dd742 --- /dev/null +++ b/types/three/examples/jsm/inspector/Inspector.d.ts @@ -0,0 +1,10 @@ +import { RendererInspector } from "./RendererInspector.js"; +import { ParametersGroup } from "./tabs/Parameters.js"; + +declare class Inspector extends RendererInspector { + createParameters(name: string): ParametersGroup; + + get domElement(): HTMLDivElement; +} + +export { Inspector }; diff --git a/types/three/examples/jsm/inspector/RendererInspector.d.ts b/types/three/examples/jsm/inspector/RendererInspector.d.ts new file mode 100644 index 00000000000000..a69a469d2c7f2f --- /dev/null +++ b/types/three/examples/jsm/inspector/RendererInspector.d.ts @@ -0,0 +1,4 @@ +import { InspectorBase } from "three/webgpu"; + +export class RendererInspector extends InspectorBase { +} diff --git a/types/three/examples/jsm/inspector/tabs/Parameters.d.ts b/types/three/examples/jsm/inspector/tabs/Parameters.d.ts new file mode 100644 index 00000000000000..c1a9d2e5227d32 --- /dev/null +++ b/types/three/examples/jsm/inspector/tabs/Parameters.d.ts @@ -0,0 +1,95 @@ +import { Tab } from "../ui/Tab.js"; +import { ValueButton, ValueCheckbox, ValueColor, ValueNumber, ValueSelect, ValueSlider } from "../ui/Values.js"; + +type KeyToValueOfType = { [K in keyof T]: T[K] extends V ? K : never }[keyof T]; + +interface ValueSelectWithParameters, K extends keyof T = keyof T> + extends ValueSelect +{ + name: (name: string) => this; + listen: () => this; +} + +interface ValueNumberWithParameters< + T = Record, + K extends KeyToValueOfType = KeyToValueOfType, +> extends ValueNumber { + name: (name: string) => this; + listen: () => this; +} + +interface ValueSliderWithParameters< + T = Record, + K extends KeyToValueOfType = KeyToValueOfType, +> extends ValueSlider { + name: (name: string) => this; + listen: () => this; +} + +interface ValueCheckboxWithParameters< + T = Record, + K extends KeyToValueOfType = KeyToValueOfType, +> extends ValueCheckbox { + name: (name: string) => this; + listen: () => this; +} + +interface ValueButtonWithParameters< + T = Record, + K extends KeyToValueOfType void> = KeyToValueOfType void>, +> extends ValueButton { + name: (name: string) => this; +} + +interface ValueColorWithParameters< + T = Record, + K extends keyof T = keyof T, +> extends ValueColor { + name: (name: string) => this; + listen: () => this; +} + +declare class ParametersGroup { + name: string; + + constructor(parameters: never, name: string); + + add( + object: T, + property: K, + options: ReadonlyArray | Record, + ): ValueSelectWithParameters; + add>( + object: T, + property: K, + min: number, + max: number, + step?: number, + ): ValueSliderWithParameters; + add>( + object: T, + property: K, + min?: number, + ): ValueNumberWithParameters; + add>( + object: T, + property: K, + options?: never, + ): ValueCheckboxWithParameters; + add void>>( + object: T, + property: K, + options?: never, + ): ValueButtonWithParameters; + + addFolder(name: string): ParametersGroup; + + addColor(object: T, property: K, rgbScale?: number): ValueColorWithParameters; +} + +declare class Parameters extends Tab { + createGroup(name: string): ParametersGroup; +} + +export { Parameters }; +export type { ParametersGroup }; diff --git a/types/three/examples/jsm/inspector/ui/Tab.d.ts b/types/three/examples/jsm/inspector/ui/Tab.d.ts new file mode 100644 index 00000000000000..cb47d31f5fe668 --- /dev/null +++ b/types/three/examples/jsm/inspector/ui/Tab.d.ts @@ -0,0 +1,3 @@ +export class Tab { + constructor(title: string); +} diff --git a/types/three/examples/jsm/inspector/ui/Values.d.ts b/types/three/examples/jsm/inspector/ui/Values.d.ts new file mode 100644 index 00000000000000..a0bfcb24bbedf1 --- /dev/null +++ b/types/three/examples/jsm/inspector/ui/Values.d.ts @@ -0,0 +1,80 @@ +import { ColorRepresentation, EventDispatcher } from "three"; + +type KeyToValueOfType = { [K in keyof T]: T[K] extends V ? K : never }[keyof T]; + +declare class Value, K extends keyof T = keyof T> extends EventDispatcher { + onChange(callback: (value: T[K]) => void): this; +} + +export interface ValueNumberParams { + value?: number; + step?: number; + min?: number; + max?: number; +} + +declare class ValueNumber< + T = Record, + K extends KeyToValueOfType = KeyToValueOfType, +> extends Value { + constructor(params: ValueNumberParams); +} + +export interface ValueCheckboxParams { + value?: boolean; +} + +declare class ValueCheckbox< + T = Record, + K extends KeyToValueOfType = KeyToValueOfType, +> extends Value { + constructor(params: ValueCheckboxParams); +} + +export interface ValueSliderParams { + value?: number; + min?: number; + max?: number; + step?: number; +} + +declare class ValueSlider< + T = Record, + K extends KeyToValueOfType = KeyToValueOfType, +> extends Value { + constructor(params: ValueSliderParams); + + setValue(val: number): this; + step(value: number): this; +} + +export interface ValueSelectParams { + options?: ReadonlyArray | Record; + value?: number; +} + +declare class ValueSelect, K extends keyof T = keyof T> extends Value { + constructor(params: ValueSelectParams); +} + +export interface ValueColorParams { + value?: ColorRepresentation; +} + +declare class ValueColor, K extends keyof T = keyof T> extends Value { + constructor(params: ValueColorParams); +} + +export interface ValueButtonParams { + text?: string; + value?: () => void; +} + +declare class ValueButton< + T = Record, + K extends KeyToValueOfType void> = KeyToValueOfType void>, +> extends Value { + constructor(params: ValueColorParams); +} + +export { Value, ValueButton, ValueCheckbox, ValueColor, ValueNumber, ValueSelect, ValueSlider }; diff --git a/types/three/examples/jsm/interactive/SelectionBox.d.ts b/types/three/examples/jsm/interactive/SelectionBox.d.ts index 4c211911b5a794..0dbb1259775c9c 100644 --- a/types/three/examples/jsm/interactive/SelectionBox.d.ts +++ b/types/three/examples/jsm/interactive/SelectionBox.d.ts @@ -1,16 +1,16 @@ -import { Camera, Frustum, Mesh, Object3D, Scene, Vector3 } from "three"; +import { Camera, Object3D, Scene, Vector3 } from "three"; -export class SelectionBox { - constructor(camera: Camera, scene: Scene, deep?: number); +declare class SelectionBox { camera: Camera; - collection: Mesh[]; - deep: number; - endPoint: Vector3; scene: Scene; startPoint: Vector3; + endPoint: Vector3; + collection: Object3D[]; instances: Record; + batches: Record; + deep: number; + + constructor(camera: Camera, scene: Scene, deep?: number); - select(startPoint?: Vector3, endPoint?: Vector3): Mesh[]; - updateFrustum(startPoint: Vector3, endPoint: Vector3): void; - searchChildInFrustum(frustum: Frustum, object: Object3D): void; + select(startPoint?: Vector3, endPoint?: Vector3): Object3D[]; } diff --git a/types/three/examples/jsm/lighting/TiledLighting.d.ts b/types/three/examples/jsm/lighting/TiledLighting.d.ts index 5eaab9b09c2a37..3764cbd741579a 100644 --- a/types/three/examples/jsm/lighting/TiledLighting.d.ts +++ b/types/three/examples/jsm/lighting/TiledLighting.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Lighting } from "three/webgpu"; import { Light } from "../../../src/lights/Light.js"; import TiledLightsNode from "../tsl/lighting/TiledLightsNode.js"; @@ -6,5 +5,5 @@ import TiledLightsNode from "../tsl/lighting/TiledLightsNode.js"; export class TiledLighting extends Lighting { constructor(); - createNode(lights?: Light[]): ShaderNodeObject; + createNode(lights?: Light[]): TiledLightsNode; } diff --git a/types/three/examples/jsm/loaders/FontLoader.d.ts b/types/three/examples/jsm/loaders/FontLoader.d.ts index e79c4600052714..d7deea85fa8ce7 100644 --- a/types/three/examples/jsm/loaders/FontLoader.d.ts +++ b/types/three/examples/jsm/loaders/FontLoader.d.ts @@ -37,5 +37,5 @@ export class Font { constructor(data: FontData); - generateShapes(text: string, size?: number): Shape[]; + generateShapes(text: string, size?: number, direction?: "ltr" | "rtl" | "tb"): Shape[]; } diff --git a/types/three/examples/jsm/loaders/KTX2Loader.d.ts b/types/three/examples/jsm/loaders/KTX2Loader.d.ts index 954300a08dae89..f8cdfb635951c1 100644 --- a/types/three/examples/jsm/loaders/KTX2Loader.d.ts +++ b/types/three/examples/jsm/loaders/KTX2Loader.d.ts @@ -35,6 +35,9 @@ export class KTX2Loader extends Loader { */ setWorkerLimit(limit: number): this; + /** + * "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer. + */ detectSupportAsync(renderer: Renderer): Promise; /** diff --git a/types/three/examples/jsm/objects/SkyMesh.d.ts b/types/three/examples/jsm/objects/SkyMesh.d.ts index 1fb14111694d7c..a092ff0da496e1 100644 --- a/types/three/examples/jsm/objects/SkyMesh.d.ts +++ b/types/three/examples/jsm/objects/SkyMesh.d.ts @@ -1,13 +1,12 @@ -import { ShaderNodeObject } from "three/tsl"; import { BoxGeometry, Mesh, NodeMaterial, UniformNode, Vector3 } from "three/webgpu"; declare class SkyMesh extends Mesh { - turbidity: ShaderNodeObject>; - rayleigh: ShaderNodeObject>; - mieCoefficient: ShaderNodeObject>; - mieDirectionalG: ShaderNodeObject>; - sunPosition: ShaderNodeObject>; - upUniform: ShaderNodeObject>; + turbidity: UniformNode; + rayleigh: UniformNode; + mieCoefficient: UniformNode; + mieDirectionalG: UniformNode; + sunPosition: UniformNode; + upUniform: UniformNode; readonly isSky: true; diff --git a/types/three/examples/jsm/objects/WaterMesh.d.ts b/types/three/examples/jsm/objects/WaterMesh.d.ts index db0c76d62d2041..fe90d37007e1b4 100644 --- a/types/three/examples/jsm/objects/WaterMesh.d.ts +++ b/types/three/examples/jsm/objects/WaterMesh.d.ts @@ -11,7 +11,7 @@ import { } from "three/webgpu"; export interface WaterMeshOptions { - resolution?: number | undefined; + resolutionScale?: number | undefined; waterNormals: Texture; alpha?: number | undefined; size?: number | undefined; @@ -24,7 +24,7 @@ export interface WaterMeshOptions { declare class WaterMesh extends Mesh { readonly isWater: true; - resolution: number; + resolutionScale: number; waterNormals: TextureNode; alpha: UniformNode; diff --git a/types/three/examples/jsm/renderers/CSS2DRenderer.d.ts b/types/three/examples/jsm/renderers/CSS2DRenderer.d.ts index d0ef6e89137a5a..5b1d19db249fa0 100644 --- a/types/three/examples/jsm/renderers/CSS2DRenderer.d.ts +++ b/types/three/examples/jsm/renderers/CSS2DRenderer.d.ts @@ -1,23 +1,28 @@ import { Camera, Object3D, Scene, Vector2 } from "three"; -export class CSS2DObject extends Object3D { - constructor(element: HTMLElement); +declare class CSS2DObject extends Object3D { element: HTMLElement; center: Vector2; + constructor(element: HTMLElement); + onBeforeRender: (renderer: unknown, scene: Scene, camera: Camera) => void; onAfterRender: (renderer: unknown, scene: Scene, camera: Camera) => void; } -export type CSS2DParameters = { - element?: HTMLElement; -}; +export interface CSS2DParameters { + element?: HTMLElement | undefined; +} + +declare class CSS2DRenderer { + domElement: HTMLElement; + sortObjects: boolean; -export class CSS2DRenderer { constructor(parameters?: CSS2DParameters); - domElement: HTMLElement; - getSize(): { width: number; height: number }; - setSize(width: number, height: number): void; - render(scene: Scene, camera: Camera): void; + getSize: () => { width: number; height: number }; + render: (scene: Scene, camera: Camera) => void; + setSize: (width: number, height: number) => void; } + +export { CSS2DObject, CSS2DRenderer }; diff --git a/types/three/examples/jsm/tsl/display/AfterImageNode.d.ts b/types/three/examples/jsm/tsl/display/AfterImageNode.d.ts index 2a0939abd851a3..7fdf4eb48e4226 100644 --- a/types/three/examples/jsm/tsl/display/AfterImageNode.d.ts +++ b/types/three/examples/jsm/tsl/display/AfterImageNode.d.ts @@ -1,16 +1,15 @@ -import { ShaderNodeObject } from "three/tsl"; -import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu"; +import { Node, TempNode, TextureNode } from "three/webgpu"; export default class AfterImageNode extends TempNode { textureNode: TextureNode; textureNodeOld: Node; - damp: UniformNode; + damp: Node; - constructor(textureNode: Node, damp?: number); + constructor(textureNode: Node, damp?: Node); getTextureNode(): TextureNode; setSize(width: number, height: number): void; } -export const afterImage: (node: Node, damp?: number) => ShaderNodeObject; +export const afterImage: (node: Node, damp?: Node | number) => AfterImageNode; diff --git a/types/three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts b/types/three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts index 9c457e93fa1c88..72cb8c7e3a4672 100644 --- a/types/three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +++ b/types/three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, Scene } from "three/webgpu"; import StereoCompositePassNode from "./StereoCompositePassNode.js"; @@ -10,4 +9,4 @@ declare class AnaglyphPassNode extends StereoCompositePassNode { export default AnaglyphPassNode; -export const anaglyphPass: (scene: Scene, camera: Camera) => ShaderNodeObject; +export const anaglyphPass: (scene: Scene, camera: Camera) => AnaglyphPassNode; diff --git a/types/three/examples/jsm/tsl/display/AnamorphicNode.d.ts b/types/three/examples/jsm/tsl/display/AnamorphicNode.d.ts index 26c8fc804883ef..6f45988983b7de 100644 --- a/types/three/examples/jsm/tsl/display/AnamorphicNode.d.ts +++ b/types/three/examples/jsm/tsl/display/AnamorphicNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, Vector2 } from "three/webgpu"; export default class AnamorphicNode extends TempNode { @@ -29,4 +28,4 @@ export const anamorphic: ( threshold?: Node, scale?: Node, samples?: Node | number, -) => ShaderNodeObject; +) => AnamorphicNode; diff --git a/types/three/examples/jsm/tsl/display/BleachBypass.d.ts b/types/three/examples/jsm/tsl/display/BleachBypass.d.ts index 588a529f2ac906..1ba09d99cba898 100644 --- a/types/three/examples/jsm/tsl/display/BleachBypass.d.ts +++ b/types/three/examples/jsm/tsl/display/BleachBypass.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node } from "three/webgpu"; -export const bleach: (color: Node, opacity?: number) => ShaderNodeObject; +export const bleach: (color: Node, opacity?: number) => Node; diff --git a/types/three/examples/jsm/tsl/display/BloomNode.d.ts b/types/three/examples/jsm/tsl/display/BloomNode.d.ts index 18fd8e53f9a8fc..b2bd8135d7fb96 100644 --- a/types/three/examples/jsm/tsl/display/BloomNode.d.ts +++ b/types/three/examples/jsm/tsl/display/BloomNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu"; declare class BloomNode extends TempNode { @@ -11,7 +10,7 @@ declare class BloomNode extends TempNode { constructor(inputNode: Node, strength?: number, radius?: number, threshold?: number); - getTexture(): ShaderNodeObject; + getTexture(): TextureNode; setSize(width: number, height: number): void; } @@ -21,6 +20,6 @@ export const bloom: ( strength?: number, radius?: number, threshold?: number, -) => ShaderNodeObject; +) => BloomNode; export default BloomNode; diff --git a/types/three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts b/types/three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts index d55a7c263092e6..133767bf53982a 100644 --- a/types/three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +++ b/types/three/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, Vector2 } from "three/webgpu"; declare class ChromaticAberrationNode extends TempNode { @@ -17,4 +16,4 @@ export const chromaticAberration: ( strength?: Node, center?: Node | Vector2 | null, scale?: Node, -) => ShaderNodeObject; +) => ChromaticAberrationNode; diff --git a/types/three/examples/jsm/tsl/display/DenoiseNode.d.ts b/types/three/examples/jsm/tsl/display/DenoiseNode.d.ts index e8018c8f73943b..b2689fad2554cd 100644 --- a/types/three/examples/jsm/tsl/display/DenoiseNode.d.ts +++ b/types/three/examples/jsm/tsl/display/DenoiseNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, Node, TempNode, UniformNode } from "three/webgpu"; declare class DenoiseNode extends TempNode { @@ -24,4 +23,4 @@ export const denoise: ( depthNode: Node, normalNode: Node, camera: Camera, -) => ShaderNodeObject; +) => DenoiseNode; diff --git a/types/three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts b/types/three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts index 80f9a065e4bea0..9e104e6150c43e 100644 --- a/types/three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +++ b/types/three/examples/jsm/tsl/display/DepthOfFieldNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode } from "three/webgpu"; declare class DepthOfFieldNode extends TempNode { @@ -26,4 +25,4 @@ export const dof: ( focusDistance?: Node | number, focalLength?: Node | number, bokehScale?: Node | number, -) => ShaderNodeObject; +) => DepthOfFieldNode; diff --git a/types/three/examples/jsm/tsl/display/DotScreenNode.d.ts b/types/three/examples/jsm/tsl/display/DotScreenNode.d.ts index 2a502d510671ae..26f43564e8fced 100644 --- a/types/three/examples/jsm/tsl/display/DotScreenNode.d.ts +++ b/types/three/examples/jsm/tsl/display/DotScreenNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, UniformNode, Vector2 } from "three/webgpu"; declare class DotScreenNode extends TempNode { @@ -17,4 +16,4 @@ export const dotScreen: ( center?: Vector2, angle?: number, scale?: number, -) => ShaderNodeObject; +) => DotScreenNode; diff --git a/types/three/examples/jsm/tsl/display/FXAANode.d.ts b/types/three/examples/jsm/tsl/display/FXAANode.d.ts index cc522e34dba1be..cb34101cac7730 100644 --- a/types/three/examples/jsm/tsl/display/FXAANode.d.ts +++ b/types/three/examples/jsm/tsl/display/FXAANode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode } from "three/webgpu"; declare class FXAANode extends TempNode { @@ -9,4 +8,4 @@ declare class FXAANode extends TempNode { export default FXAANode; -export const fxaa: (node: Node) => ShaderNodeObject; +export const fxaa: (node: Node) => FXAANode; diff --git a/types/three/examples/jsm/tsl/display/FilmNode.d.ts b/types/three/examples/jsm/tsl/display/FilmNode.d.ts index 5a1a59dfa9294a..beacaa2bf52c3c 100644 --- a/types/three/examples/jsm/tsl/display/FilmNode.d.ts +++ b/types/three/examples/jsm/tsl/display/FilmNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode } from "three/webgpu"; declare class FilmNode extends TempNode { @@ -15,4 +14,4 @@ export const film: ( inputNode: Node, intensityNode?: Node | null, uvNode?: Node | null, -) => ShaderNodeObject; +) => FilmNode; diff --git a/types/three/examples/jsm/tsl/display/GTAONode.d.ts b/types/three/examples/jsm/tsl/display/GTAONode.d.ts index 6bb28dcd63f941..8fd6fad03d48e4 100644 --- a/types/three/examples/jsm/tsl/display/GTAONode.d.ts +++ b/types/three/examples/jsm/tsl/display/GTAONode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, Node, TempNode, TextureNode, UniformNode, Vector2 } from "three/webgpu"; declare class GTAONode extends TempNode { @@ -7,17 +6,19 @@ declare class GTAONode extends TempNode { resolutionScale: number; - radius: ShaderNodeObject>; - resolution: ShaderNodeObject>; - thickness: ShaderNodeObject>; - distanceExponent: ShaderNodeObject>; - distanceFallOff: ShaderNodeObject>; - scale: ShaderNodeObject>; - samples: ShaderNodeObject>; + radius: UniformNode; + resolution: UniformNode; + thickness: UniformNode; + distanceExponent: UniformNode; + distanceFallOff: UniformNode; + scale: UniformNode; + samples: UniformNode; + + useTemporalFiltering: boolean; constructor(depthNode: Node, normalNode: Node, camera: Camera); - getTextureNode(): ShaderNodeObject; + getTextureNode(): TextureNode; setSize(width: number, height: number): void; } @@ -28,4 +29,4 @@ export const ao: ( depthNode: Node, normalNode: Node, camera: Camera, -) => ShaderNodeObject; +) => GTAONode; diff --git a/types/three/examples/jsm/tsl/display/GaussianBlurNode.d.ts b/types/three/examples/jsm/tsl/display/GaussianBlurNode.d.ts index 39842fe2386cef..88493f2c50ddb3 100644 --- a/types/three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +++ b/types/three/examples/jsm/tsl/display/GaussianBlurNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode, Vector2 } from "three/webgpu"; export interface GaussianBlurNodeOptions { @@ -43,7 +42,7 @@ export const gaussianBlur: ( directionNode?: Node | number | null, sigma?: number, options?: GaussianBlurNodeOptions, -) => ShaderNodeObject; +) => GaussianBlurNode; /** * @deprecated "premultipliedGaussianBlur()" is deprecated. Use "gaussianBlur()" with "premultipliedAlpha: true" option instead. @@ -52,4 +51,4 @@ export const premultipliedGaussianBlur: ( node: Node, directionNode?: Node | number | null, sigma?: number, -) => ShaderNodeObject; +) => GaussianBlurNode; diff --git a/types/three/examples/jsm/tsl/display/LensflareNode.d.ts b/types/three/examples/jsm/tsl/display/LensflareNode.d.ts index e298b2719adc11..b2bd8018cca384 100644 --- a/types/three/examples/jsm/tsl/display/LensflareNode.d.ts +++ b/types/three/examples/jsm/tsl/display/LensflareNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode, UniformNode, Vector3 } from "three/webgpu"; interface LensflareNodeParams { @@ -13,11 +12,11 @@ interface LensflareNodeParams { declare class LensflareNode extends TempNode { textureNode: TextureNode; - ghostTintNode: ShaderNodeObject>; - thresholdNode: ShaderNodeObject>; - ghostSamplesNode: ShaderNodeObject>; - ghostSpacingNode: ShaderNodeObject>; - ghostAttenuationFactorNode: ShaderNodeObject>; + ghostTintNode: UniformNode; + thresholdNode: UniformNode; + ghostSamplesNode: UniformNode; + ghostSpacingNode: UniformNode; + ghostAttenuationFactorNode: UniformNode; downSampleRatio: number; constructor(textureNode: TextureNode, params?: LensflareNodeParams); @@ -32,4 +31,4 @@ export default LensflareNode; export const lensflare: ( inputNode: Node, params?: LensflareNodeParams, -) => ShaderNodeObject; +) => LensflareNode; diff --git a/types/three/examples/jsm/tsl/display/Lut3DNode.d.ts b/types/three/examples/jsm/tsl/display/Lut3DNode.d.ts index 8e1d0342e6731e..3b292e76446a36 100644 --- a/types/three/examples/jsm/tsl/display/Lut3DNode.d.ts +++ b/types/three/examples/jsm/tsl/display/Lut3DNode.d.ts @@ -1,10 +1,9 @@ -import { ShaderNodeObject } from "three/tsl"; import { Data3DTexture, Node, TempNode, Texture3DNode, UniformNode } from "three/webgpu"; declare class Lut3DNode extends TempNode { inputNode: Node; lutNode: Texture3DNode; - size: ShaderNodeObject>; + size: UniformNode; intensityNode: UniformNode; constructor(inputNode: Node, lutNode: UniformNode, size: number, intensityNode: UniformNode); @@ -17,4 +16,4 @@ export const lut3D: ( lut: Node, size: number, intensity: Node, -) => ShaderNodeObject; +) => Lut3DNode; diff --git a/types/three/examples/jsm/tsl/display/MotionBlur.d.ts b/types/three/examples/jsm/tsl/display/MotionBlur.d.ts index bf04eb51fcb877..e2c720ad83df71 100644 --- a/types/three/examples/jsm/tsl/display/MotionBlur.d.ts +++ b/types/three/examples/jsm/tsl/display/MotionBlur.d.ts @@ -1,8 +1,7 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node } from "three/webgpu"; export const motionBlur: ( inputNode: Node, velocity: Node, numSamples?: Node, -) => ShaderNodeObject; +) => Node; diff --git a/types/three/examples/jsm/tsl/display/OutlineNode.d.ts b/types/three/examples/jsm/tsl/display/OutlineNode.d.ts index 2860824e2b4525..479bc345e9f795 100644 --- a/types/three/examples/jsm/tsl/display/OutlineNode.d.ts +++ b/types/three/examples/jsm/tsl/display/OutlineNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, Node, Object3D, Scene, TempNode, TextureNode, UniformNode } from "three/webgpu"; export interface OutlineNodeParams { @@ -12,21 +11,21 @@ declare class OutlineNode extends TempNode { scene: Scene; camera: Camera; selectedObjects: Object3D[]; - edgeThicknessNode: ShaderNodeObject>; - edgeGlowNode: ShaderNodeObject>; + edgeThicknessNode: UniformNode; + edgeGlowNode: UniformNode; downSampleRatio: number; constructor(scene: Scene, camera: Camera, params?: OutlineNodeParams); - get visibleEdge(): ShaderNodeObject; + get visibleEdge(): Node; - get hiddenEdge(): ShaderNodeObject; + get hiddenEdge(): Node; - getTextureNode(): ShaderNodeObject; + getTextureNode(): TextureNode; setSize(width: number, height: number): void; } export default OutlineNode; -export const outline: (scene: Scene, camera: Camera, params?: OutlineNodeParams) => ShaderNodeObject; +export const outline: (scene: Scene, camera: Camera, params?: OutlineNodeParams) => OutlineNode; diff --git a/types/three/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts b/types/three/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts index 92517d6866f4d6..fe2601549791a9 100644 --- a/types/three/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts +++ b/types/three/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, Scene } from "three/webgpu"; import StereoCompositePassNode from "./StereoCompositePassNode.js"; @@ -10,4 +9,4 @@ declare class ParallaxBarrierPassNode extends StereoCompositePassNode { export default ParallaxBarrierPassNode; -export const parallaxBarrierPass: (scene: Scene, camera: Camera) => ShaderNodeObject; +export const parallaxBarrierPass: (scene: Scene, camera: Camera) => ParallaxBarrierPassNode; diff --git a/types/three/examples/jsm/tsl/display/PixelationPassNode.d.ts b/types/three/examples/jsm/tsl/display/PixelationPassNode.d.ts index 225675c4efbff3..6c4223e479fd01 100644 --- a/types/three/examples/jsm/tsl/display/PixelationPassNode.d.ts +++ b/types/three/examples/jsm/tsl/display/PixelationPassNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, PassNode, Scene, UniformNode } from "three/webgpu"; declare class PixelationPassNode extends PassNode { @@ -23,6 +22,6 @@ export const pixelationPass: ( pixelSize: UniformNode, normalEdgeStrength: UniformNode, depthEdgeStrength: UniformNode, -) => ShaderNodeObject; +) => PixelationPassNode; export default PixelationPassNode; diff --git a/types/three/examples/jsm/tsl/display/RGBShiftNode.d.ts b/types/three/examples/jsm/tsl/display/RGBShiftNode.d.ts index 5570ed3a834d9f..e368898288ef90 100644 --- a/types/three/examples/jsm/tsl/display/RGBShiftNode.d.ts +++ b/types/three/examples/jsm/tsl/display/RGBShiftNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu"; export default class RGBShiftNode extends TempNode { @@ -13,4 +12,4 @@ export default class RGBShiftNode extends TempNode { setSize(width: number, height: number): void; } -export const rgbShift: (node: Node, amount?: number, angle?: number) => ShaderNodeObject; +export const rgbShift: (node: Node, amount?: number, angle?: number) => RGBShiftNode; diff --git a/types/three/examples/jsm/tsl/display/SMAANode.d.ts b/types/three/examples/jsm/tsl/display/SMAANode.d.ts index d17edca57271d5..e6a5b71abf6f14 100644 --- a/types/three/examples/jsm/tsl/display/SMAANode.d.ts +++ b/types/three/examples/jsm/tsl/display/SMAANode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode } from "three/webgpu"; declare class SMAANode extends TempNode { @@ -15,4 +14,4 @@ declare class SMAANode extends TempNode { getSearchTexture(): string; } -export const smaa: (node: Node) => ShaderNodeObject; +export const smaa: (node: Node) => SMAANode; diff --git a/types/three/examples/jsm/tsl/display/SSAAPassNode.d.ts b/types/three/examples/jsm/tsl/display/SSAAPassNode.d.ts index 80dfebbf7922c7..3a0760f17a705b 100644 --- a/types/three/examples/jsm/tsl/display/SSAAPassNode.d.ts +++ b/types/three/examples/jsm/tsl/display/SSAAPassNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, Color, PassNode, RenderTarget, Scene, UniformNode } from "three/webgpu"; declare class SSAAPassNode extends PassNode { @@ -18,4 +17,4 @@ declare class SSAAPassNode extends PassNode { export default SSAAPassNode; -export const ssaaPass: (scene: Scene, camera: Camera) => ShaderNodeObject; +export const ssaaPass: (scene: Scene, camera: Camera) => SSAAPassNode; diff --git a/types/three/examples/jsm/tsl/display/SSGINode.d.ts b/types/three/examples/jsm/tsl/display/SSGINode.d.ts new file mode 100644 index 00000000000000..f2479fa8d1ef42 --- /dev/null +++ b/types/three/examples/jsm/tsl/display/SSGINode.d.ts @@ -0,0 +1,30 @@ +import { Node, PerspectiveCamera, TempNode, UniformNode } from "three/webgpu"; + +declare class SSGINode extends TempNode { + beautyNode: Node; + depthNode: Node; + normalNode: Node; + + sliceCount: UniformNode; + stepCount: UniformNode; + aoIntensity: UniformNode; + giIntensity: UniformNode; + radius: UniformNode; + useScreenSpaceSampling: UniformNode; + expFactor: UniformNode; + thickness: UniformNode; + useLinearThickness: UniformNode; + backfaceLighting: UniformNode; + useTemporalFiltering: boolean; + + constructor(beautyNode: Node, depthNode: Node, normalNode: Node, camera: PerspectiveCamera); +} + +export default SSGINode; + +export const ssgi: ( + beautyNode: Node, + depthNode: Node, + normalNode: Node, + camera: PerspectiveCamera, +) => SSGINode; diff --git a/types/three/examples/jsm/tsl/display/SSRNode.d.ts b/types/three/examples/jsm/tsl/display/SSRNode.d.ts index dc10791d7332f0..4cad8929a7a338 100644 --- a/types/three/examples/jsm/tsl/display/SSRNode.d.ts +++ b/types/three/examples/jsm/tsl/display/SSRNode.d.ts @@ -1,12 +1,11 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, Node, TempNode, TextureNode, UniformNode } from "three/webgpu"; declare class SSRNode extends TempNode { - colorNode: ShaderNodeObject; - depthNode: ShaderNodeObject; - normalNode: ShaderNodeObject; - metalnessNode: ShaderNodeObject; - roughnessNode: ShaderNodeObject | null; + colorNode: Node; + depthNode: Node; + normalNode: Node; + metalnessNode: Node; + roughnessNode: Node | null; camera: Camera | null; resolutionScale: number; @@ -18,15 +17,15 @@ declare class SSRNode extends TempNode { blurQuality: UniformNode; constructor( - colorNode: ShaderNodeObject, - depthNode: ShaderNodeObject, - normalNode: ShaderNodeObject, - metalnessNode: ShaderNodeObject, - roughnessNode?: ShaderNodeObject | null, + colorNode: Node, + depthNode: Node, + normalNode: Node, + metalnessNode: Node, + roughnessNode?: Node | null, camera?: Camera | null, ); - getTextureNode(): ShaderNodeObject; + getTextureNode(): TextureNode; setSize(width: number, height: number): void; } @@ -40,4 +39,4 @@ export const ssr: ( metalnessNode: Node, roughnessNode?: Node | null, camera?: Camera | null, -) => ShaderNodeObject; +) => SSRNode; diff --git a/types/three/examples/jsm/tsl/display/SSSNode.d.ts b/types/three/examples/jsm/tsl/display/SSSNode.d.ts new file mode 100644 index 00000000000000..557111f753fb51 --- /dev/null +++ b/types/three/examples/jsm/tsl/display/SSSNode.d.ts @@ -0,0 +1,18 @@ +import { Camera, DirectionalLight, TempNode, TextureNode, UniformNode } from "three/webgpu"; + +declare class SSSNode extends TempNode { + depthNode: TextureNode; + + maxDistance: UniformNode; + thickness: UniformNode; + shadowIntensity: UniformNode; + quality: UniformNode; + resolutionScale: number; + useTemporalFiltering: boolean; + + constructor(depthNode: TextureNode, camera: Camera, mainLight: DirectionalLight); +} + +export default SSSNode; + +export const sss: (depthNode: TextureNode, camera: Camera, mainLight: DirectionalLight) => SSSNode; diff --git a/types/three/examples/jsm/tsl/display/Sepia.d.ts b/types/three/examples/jsm/tsl/display/Sepia.d.ts index d0e940ad78cf69..b66eebe5ca5050 100644 --- a/types/three/examples/jsm/tsl/display/Sepia.d.ts +++ b/types/three/examples/jsm/tsl/display/Sepia.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node } from "three/webgpu"; -export const sepia: (color: Node) => ShaderNodeObject; +export const sepia: (color: Node) => Node; diff --git a/types/three/examples/jsm/tsl/display/SobelOperatorNode.d.ts b/types/three/examples/jsm/tsl/display/SobelOperatorNode.d.ts index c8aef432b86065..0467ca32190d94 100644 --- a/types/three/examples/jsm/tsl/display/SobelOperatorNode.d.ts +++ b/types/three/examples/jsm/tsl/display/SobelOperatorNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode } from "three/webgpu"; declare class SobelOperatorNode extends TempNode { @@ -9,4 +8,4 @@ declare class SobelOperatorNode extends TempNode { export default SobelOperatorNode; -export const sobel: (node: Node) => ShaderNodeObject; +export const sobel: (node: Node) => SobelOperatorNode; diff --git a/types/three/examples/jsm/tsl/display/StereoPassNode.d.ts b/types/three/examples/jsm/tsl/display/StereoPassNode.d.ts index b29f90f467181d..6db6bd78cf03d9 100644 --- a/types/three/examples/jsm/tsl/display/StereoPassNode.d.ts +++ b/types/three/examples/jsm/tsl/display/StereoPassNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, PassNode, Scene, StereoCamera } from "three/webgpu"; declare class StereoPassNode extends PassNode { @@ -11,4 +10,4 @@ declare class StereoPassNode extends PassNode { export default StereoPassNode; -export const stereoPass: (scene: Scene, camera: Camera) => ShaderNodeObject; +export const stereoPass: (scene: Scene, camera: Camera) => StereoPassNode; diff --git a/types/three/examples/jsm/tsl/display/TRAANode.d.ts b/types/three/examples/jsm/tsl/display/TRAANode.d.ts index 97b18635631e39..3757903956edb6 100644 --- a/types/three/examples/jsm/tsl/display/TRAANode.d.ts +++ b/types/three/examples/jsm/tsl/display/TRAANode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Camera, Node, TempNode, TextureNode } from "three/webgpu"; declare class TRAANode extends TempNode { @@ -19,4 +18,4 @@ export const traa: ( depthNode: TextureNode, velocityNode: TextureNode, camera: Camera, -) => ShaderNodeObject; +) => TRAANode; diff --git a/types/three/examples/jsm/tsl/display/TransitionNode.d.ts b/types/three/examples/jsm/tsl/display/TransitionNode.d.ts index 48ad52270029f1..2a0b55e2d15a76 100644 --- a/types/three/examples/jsm/tsl/display/TransitionNode.d.ts +++ b/types/three/examples/jsm/tsl/display/TransitionNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu"; declare class TransitionNode extends TempNode { @@ -29,4 +28,4 @@ export const transition: ( mixRatio: UniformNode, threshold: UniformNode, useTexture: UniformNode, -) => ShaderNodeObject; +) => TransitionNode; diff --git a/types/three/examples/jsm/tsl/display/boxBlur.d.ts b/types/three/examples/jsm/tsl/display/boxBlur.d.ts index aa57bc8e39bfff..a42f9720c62900 100644 --- a/types/three/examples/jsm/tsl/display/boxBlur.d.ts +++ b/types/three/examples/jsm/tsl/display/boxBlur.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node } from "three/webgpu"; export interface BoxBlurOptions { @@ -8,4 +7,4 @@ export interface BoxBlurOptions { premultipliedAlpha?: boolean | undefined; } -export const boxBlur: (textureNode: Node, options?: BoxBlurOptions) => ShaderNodeObject; +export const boxBlur: (textureNode: Node, options?: BoxBlurOptions) => Node; diff --git a/types/three/examples/jsm/tsl/display/hashBlur.d.ts b/types/three/examples/jsm/tsl/display/hashBlur.d.ts index 461f0455f5a0c2..e591cbcd104c9b 100644 --- a/types/three/examples/jsm/tsl/display/hashBlur.d.ts +++ b/types/three/examples/jsm/tsl/display/hashBlur.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node } from "three/webgpu"; interface HashBlurOptions { @@ -11,4 +10,4 @@ export const hashBlur: ( textureNode: Node, bluramount?: Node | number, options?: HashBlurOptions, -) => ShaderNodeObject; +) => Node; diff --git a/types/three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts b/types/three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts index 118f1d0bbe9016..0a6f19bb6686d6 100644 --- a/types/three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +++ b/types/three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { LightsNode, Node } from "three/webgpu"; export const circleIntersectsAABB: ( @@ -6,18 +5,18 @@ export const circleIntersectsAABB: ( radius: Node, minBounds: Node, maxBounds: Node, -) => ShaderNodeObject; +) => Node; declare class TiledLightsNode extends LightsNode { constructor(maxLights?: number, tileSize?: number); updateLightsTexture(): void; - getBlock(block?: number): ShaderNodeObject; + getBlock(block?: number): Node; setSize(width: number, height: number): this; } export default TiledLightsNode; -export const tiledLights: (maxLights?: number, tileSize?: number) => ShaderNodeObject; +export const tiledLights: (maxLights?: number, tileSize?: number) => TiledLightsNode; diff --git a/types/three/examples/jsm/tsl/math/Bayer.d.ts b/types/three/examples/jsm/tsl/math/Bayer.d.ts index dc4eda25406cb0..f261abbe006fd0 100644 --- a/types/three/examples/jsm/tsl/math/Bayer.d.ts +++ b/types/three/examples/jsm/tsl/math/Bayer.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "three/tsl"; import { Node } from "three/webgpu"; -export const bayer16: (uv: Node) => ShaderNodeObject; +export const bayer16: (uv: Node) => Node; diff --git a/types/three/examples/jsm/tsl/utils/Raymarching.d.ts b/types/three/examples/jsm/tsl/utils/Raymarching.d.ts index 64927abde27433..f42fdc16469723 100644 --- a/types/three/examples/jsm/tsl/utils/Raymarching.d.ts +++ b/types/three/examples/jsm/tsl/utils/Raymarching.d.ts @@ -1,9 +1,8 @@ -import { ShaderNodeObject } from "three/tsl"; import { FunctionNode, Node } from "three/webgpu"; export const RaymarchingBox: ( steps: number | Node, callback: - | ((params: { positionRay: ShaderNodeObject }) => void) - | FunctionNode<{ positionRay: ShaderNodeObject }>, + | ((params: { positionRay: Node }) => void) + | FunctionNode<{ positionRay: Node }>, ) => void; diff --git a/types/three/package.json b/types/three/package.json index 13e8f4f95978bc..bf6043e795939f 100644 --- a/types/three/package.json +++ b/types/three/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/three", - "version": "0.180.9999", + "version": "0.181.9999", "projects": [ "https://threejs.org/" ], diff --git a/types/three/src/Three.Core.d.ts b/types/three/src/Three.Core.d.ts index 54fe3a4b99bce4..07a66c051b5504 100644 --- a/types/three/src/Three.Core.d.ts +++ b/types/three/src/Three.Core.d.ts @@ -160,4 +160,4 @@ export * from "./textures/Source.js"; export * from "./textures/Texture.js"; export * from "./textures/VideoFrameTexture.js"; export * from "./textures/VideoTexture.js"; -export { createCanvasElement } from "./utils.js"; +export { createCanvasElement, error, getConsoleFunction, log, setConsoleFunction, warn, warnOnce } from "./utils.js"; diff --git a/types/three/src/Three.TSL.d.ts b/types/three/src/Three.TSL.d.ts index becbe83a141128..d6d271e77a7180 100644 --- a/types/three/src/Three.TSL.d.ts +++ b/types/three/src/Three.TSL.d.ts @@ -24,6 +24,8 @@ export const PCFShadowFilter: typeof TSL.PCFShadowFilter; export const PCFSoftShadowFilter: typeof TSL.PCFSoftShadowFilter; export const PI: typeof TSL.PI; export const PI2: typeof TSL.PI2; +export const TWO_PI: typeof TSL.TWO_PI; +export const HALF_PI: typeof TSL.HALF_PI; export const PointShadowFilter: typeof TSL.PointShadowFilter; export const Return: typeof TSL.Return; export const Schlick_to_F0: typeof TSL.Schlick_to_F0; @@ -196,6 +198,7 @@ export const getDirection: typeof TSL.getDirection; export const getDistanceAttenuation: typeof TSL.getDistanceAttenuation; export const getGeometryRoughness: typeof TSL.getGeometryRoughness; export const getNormalFromDepth: typeof TSL.getNormalFromDepth; +export const interleavedGradientNoise: typeof TSL.interleavedGradientNoise; export const getParallaxCorrectNormal: typeof TSL.getParallaxCorrectNormal; export const getRoughness: typeof TSL.getRoughness; export const getScreenPosition: typeof TSL.getScreenPosition; @@ -396,6 +399,8 @@ export const objectRadius: typeof TSL.objectRadius; export const objectScale: typeof TSL.objectScale; export const objectViewPosition: typeof TSL.objectViewPosition; export const objectWorldMatrix: typeof TSL.objectWorldMatrix; +export const OnBeforeObjectUpdate: typeof TSL.OnBeforeObjectUpdate; +export const OnBeforeMaterialUpdate: typeof TSL.OnBeforeMaterialUpdate; export const OnObjectUpdate: typeof TSL.OnObjectUpdate; export const OnMaterialUpdate: typeof TSL.OnMaterialUpdate; export const oneMinus: typeof TSL.oneMinus; @@ -547,6 +552,7 @@ export const textureBicubicLevel: typeof TSL.textureBicubicLevel; export const textureCubeUV: typeof TSL.textureCubeUV; export const textureLoad: typeof TSL.textureLoad; export const textureSize: typeof TSL.textureSize; +export const textureLevel: typeof TSL.textureLevel; export const textureStore: typeof TSL.textureStore; export const thickness: typeof TSL.thickness; export const time: typeof TSL.time; @@ -612,4 +618,4 @@ export const workgroupId: typeof TSL.workgroupId; export const workingToColorSpace: typeof TSL.workingToColorSpace; export const xor: typeof TSL.xor; -export type { ProxiedObject, ShaderNodeObject, Swizzable } from "./nodes/TSL.js"; +export type { ProxiedObject, Swizzable } from "./nodes/TSL.js"; diff --git a/types/three/src/Three.WebGPU.Nodes.d.ts b/types/three/src/Three.WebGPU.Nodes.d.ts index 4f558cf93f7a91..d7c18ce9bb20f8 100644 --- a/types/three/src/Three.WebGPU.Nodes.d.ts +++ b/types/three/src/Three.WebGPU.Nodes.d.ts @@ -16,6 +16,8 @@ export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js"; export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js"; export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js"; export * from "./nodes/Nodes.js"; +export { default as CanvasTarget } from "./renderers/common/CanvasTarget.js"; +export { default as InspectorBase } from "./renderers/common/InspectorBase.js"; import * as TSL from "./nodes/TSL.js"; export { TSL }; export { ClippingGroup } from "./objects/ClippingGroup.js"; diff --git a/types/three/src/Three.WebGPU.d.ts b/types/three/src/Three.WebGPU.d.ts index d7a2fc76f2d112..24ec94d4c5994c 100644 --- a/types/three/src/Three.WebGPU.d.ts +++ b/types/three/src/Three.WebGPU.d.ts @@ -16,6 +16,8 @@ export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js"; export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js"; export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js"; export * from "./nodes/Nodes.js"; +export { default as CanvasTarget } from "./renderers/common/CanvasTarget.js"; +export { default as InspectorBase } from "./renderers/common/InspectorBase.js"; import * as TSL from "./nodes/TSL.js"; export { TSL }; export { ClippingGroup } from "./objects/ClippingGroup.js"; diff --git a/types/three/src/animation/AnimationMixer.d.ts b/types/three/src/animation/AnimationMixer.d.ts index 4f2b5e97fa8531..f2a673510476a3 100644 --- a/types/three/src/animation/AnimationMixer.d.ts +++ b/types/three/src/animation/AnimationMixer.d.ts @@ -74,7 +74,7 @@ export class AnimationMixer extends EventDispatcher { /** * Deactivates all previously scheduled actions on this mixer. * - * @return {AnimationMixer} A reference to thi animation mixer. + * @return {AnimationMixer} A reference to this animation mixer. */ stopAllAction(): AnimationMixer; /** @@ -84,7 +84,7 @@ export class AnimationMixer extends EventDispatcher { * time from {@link Clock} or {@link Timer}. * * @param {number} deltaTime - The delta time in seconds. - * @return {AnimationMixer} A reference to thi animation mixer. + * @return {AnimationMixer} A reference to this animation mixer. */ update(deltaTime: number): AnimationMixer; /** @@ -94,7 +94,7 @@ export class AnimationMixer extends EventDispatcher { * input parameter will be scaled by {@link AnimationMixer#timeScale} * * @param {number} time - The time to set in seconds. - * @return {AnimationMixer} A reference to thi animation mixer. + * @return {AnimationMixer} A reference to this animation mixer. */ setTime(time: number): AnimationMixer; /** diff --git a/types/three/src/lights/DirectionalLight.d.ts b/types/three/src/lights/DirectionalLight.d.ts index 3d43b7d89165d6..18bdcb970320f8 100644 --- a/types/three/src/lights/DirectionalLight.d.ts +++ b/types/three/src/lights/DirectionalLight.d.ts @@ -10,7 +10,6 @@ import { Light } from "./Light.js"; * This light will behave as though it is infinitely far away and the rays produced from it are all parallel * The common use case for this is to simulate daylight; the sun is far enough away that its position can be considered to be infinite, and all light rays coming from it are parallel. * A common point of confusion for directional lights is that setting the rotation has no effect - * @remarks * This is because three.js's {@link DirectionalLight} is the equivalent to what is often called a 'Target Direct Light' in other applications. * This means that its direction is calculated as pointing from the light's {@link THREE.Object3D.position | position} to the {@link THREE.DirectionalLight.target | target}'s * position (as opposed to a 'Free Direct Light' that just has a rotation component). diff --git a/types/three/src/loaders/ObjectLoader.d.ts b/types/three/src/loaders/ObjectLoader.d.ts index 306c757008a4f7..9cc81c481f4b6b 100644 --- a/types/three/src/loaders/ObjectLoader.d.ts +++ b/types/three/src/loaders/ObjectLoader.d.ts @@ -23,9 +23,9 @@ export class ObjectLoader extends Loader { parseGeometries(json: unknown): { [key: string]: InstancedBufferGeometry | BufferGeometry }; parseMaterials(json: unknown, textures: { [key: string]: Texture }): { [key: string]: Material }; parseAnimations(json: unknown): { [key: string]: AnimationClip }; - parseImages(json: unknown, onLoad?: () => void): { [key: string]: Source }; - parseImagesAsync(json: unknown): Promise<{ [key: string]: Source }>; - parseTextures(json: unknown, images: { [key: string]: Source }): { [key: string]: Texture }; + parseImages(json: unknown, onLoad?: () => void): { [key: string]: Source }; + parseImagesAsync(json: unknown): Promise<{ [key: string]: Source }>; + parseTextures(json: unknown, images: { [key: string]: Source }): { [key: string]: Texture }; parseObject( data: unknown, geometries: { [key: string]: InstancedBufferGeometry | BufferGeometry }, diff --git a/types/three/src/loaders/TextureLoader.d.ts b/types/three/src/loaders/TextureLoader.d.ts index 3cc07f5c329358..c41af0498320fd 100644 --- a/types/three/src/loaders/TextureLoader.d.ts +++ b/types/three/src/loaders/TextureLoader.d.ts @@ -6,13 +6,13 @@ import { LoadingManager } from "./LoadingManager.js"; * Class for loading a texture. * Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object. */ -export class TextureLoader extends Loader { +export class TextureLoader extends Loader> { constructor(manager?: LoadingManager); load( url: string, - onLoad?: (data: Texture) => void, + onLoad?: (data: Texture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void, - ): Texture; + ): Texture; } diff --git a/types/three/src/materials/Material.d.ts b/types/three/src/materials/Material.d.ts index 50aebf436364cd..a2b14ae67f4dff 100644 --- a/types/three/src/materials/Material.d.ts +++ b/types/three/src/materials/Material.d.ts @@ -541,7 +541,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> { * The type property is used for detecting the object type * in context of serialization/deserialization. */ - readonly type: string; + type: string; /** * This starts at `0` and counts how many times {@link Material#needsUpdate} is set to `true`. * @@ -575,7 +575,7 @@ export class Material extends EventDispatcher<{ dispose: {} }> { * * This method can only be used when rendering with {@link WebGLRenderer}. The * recommended approach when customizing materials is to use `WebGPURenderer` with the new - * Node Material system and [TSL]{@link https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language}. + * Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language). * * @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source. * @param {WebGLRenderer} renderer - A reference to the renderer. diff --git a/types/three/src/materials/MeshLambertMaterial.d.ts b/types/three/src/materials/MeshLambertMaterial.d.ts index 97e9115e989587..cf42f76bea8a91 100644 --- a/types/three/src/materials/MeshLambertMaterial.d.ts +++ b/types/three/src/materials/MeshLambertMaterial.d.ts @@ -241,7 +241,7 @@ export interface MeshLambertMaterialParameters /** * A material for non-shiny surfaces, without specular highlights. * - * The material uses a non-physically based [Lambertian]{@link https://en.wikipedia.org/wiki/Lambertian_reflectance} + * The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance) * model for calculating reflectance. This can simulate some surfaces (such * as untreated wood or stone) well, but cannot simulate shiny surfaces with * specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment diff --git a/types/three/src/materials/MeshMatcapMaterial.d.ts b/types/three/src/materials/MeshMatcapMaterial.d.ts index 463cec31ad3539..313abd6eed0888 100644 --- a/types/three/src/materials/MeshMatcapMaterial.d.ts +++ b/types/three/src/materials/MeshMatcapMaterial.d.ts @@ -103,6 +103,20 @@ export interface MeshMatcapMaterialProperties extends MaterialProperties { * @default null */ alphaMap: Texture | null; + /** + * Renders the geometry as a wireframe. + * + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * Can only be used with {@link SVGRenderer}. + * + * @default 1 + */ + wireframeLinewidth: number; /** * Whether the material is rendered with flat shading or not. * diff --git a/types/three/src/materials/MeshPhongMaterial.d.ts b/types/three/src/materials/MeshPhongMaterial.d.ts index 2a1add23bcf94b..c1cc686c20a339 100644 --- a/types/three/src/materials/MeshPhongMaterial.d.ts +++ b/types/three/src/materials/MeshPhongMaterial.d.ts @@ -255,7 +255,7 @@ export interface MeshPhongMaterialParameters /** * A material for shiny surfaces with specular highlights. * - * The material uses a non-physically based [Blinn-Phong]{@link https://en.wikipedia.org/wiki/Blinn-Phong_shading_model} + * The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model) * model for calculating reflectance. Unlike the Lambertian model used in the * {@link MeshLambertMaterial} this can simulate shiny surfaces with specular * highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading. diff --git a/types/three/src/materials/MeshPhysicalMaterial.d.ts b/types/three/src/materials/MeshPhysicalMaterial.d.ts index 0838f4bd9ceaa8..5dc1ad6e43dd7a 100644 --- a/types/three/src/materials/MeshPhysicalMaterial.d.ts +++ b/types/three/src/materials/MeshPhysicalMaterial.d.ts @@ -195,7 +195,7 @@ export interface MeshPhysicalMaterialProperties extends MeshStandardMaterialProp specularColorMap: Texture | null; set anisotropy(value: number); /** - * The anisotropy strength. + * The anisotropy strength, from `0.0` to `1.0`. * * @default 0 */ diff --git a/types/three/src/materials/MeshStandardMaterial.d.ts b/types/three/src/materials/MeshStandardMaterial.d.ts index 56ba5fe3fdcd4c..839ae2c3481455 100644 --- a/types/three/src/materials/MeshStandardMaterial.d.ts +++ b/types/three/src/materials/MeshStandardMaterial.d.ts @@ -249,9 +249,9 @@ export interface MeshStandardMaterialParameters * A standard physically based material, using Metallic-Roughness workflow. * * Physically based rendering (PBR) has recently become the standard in many - * 3D applications, such as [Unity]{@link https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/}, - * [Unreal]{@link https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/} and - * [3D Studio Max]{@link http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017}. + * 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/), + * [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and + * [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017). * * This approach differs from older approaches in that instead of using * approximations for the way in which light interacts with a surface, a @@ -267,13 +267,13 @@ export interface MeshStandardMaterialParameters * Note that for best results you should always specify an environment map when using this material. * * For a non-technical introduction to the concept of PBR and how to set up a - * PBR material, check out these articles by the people at [marmoset]{@link https://www.marmoset.co}: + * PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co): * - * - [Basic Theory of Physically Based Rendering]{@link https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/} - * - [Physically Based Rendering and You Can Too]{@link https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/} + * - [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/) + * - [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/) * * Technical details of the approach used in three.js (and most other PBR systems) can be found is this - * [paper from Disney]{@link https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf} + * [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf) * (pdf), by Brent Burley. */ export class MeshStandardMaterial extends Material { diff --git a/types/three/src/materials/PointsMaterial.d.ts b/types/three/src/materials/PointsMaterial.d.ts index fe69504f3a0bc7..3cdc56177b09a4 100644 --- a/types/three/src/materials/PointsMaterial.d.ts +++ b/types/three/src/materials/PointsMaterial.d.ts @@ -33,7 +33,7 @@ export interface PointsMaterialProperties extends MaterialProperties { /** * Defines the size of the points in pixels. * - * Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE]{@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete}. + * Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete). * * @default 1 */ diff --git a/types/three/src/materials/ShaderMaterial.d.ts b/types/three/src/materials/ShaderMaterial.d.ts index ca4adb7ac1c1dc..b481765e2b5e80 100644 --- a/types/three/src/materials/ShaderMaterial.d.ts +++ b/types/three/src/materials/ShaderMaterial.d.ts @@ -130,7 +130,7 @@ export interface ShaderMaterialProperties extends MaterialProperties { uv1: [number, number]; }; /** - * If set, this calls [gl.bindAttribLocation]{@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation} + * If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation) * to bind a generic vertex index to an attribute variable. * * @default undefined @@ -209,7 +209,7 @@ export interface ShaderMaterialJSON extends MaterialJSON { * - You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end` * in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has * to be placed right above the loop. The loop formatting has to correspond to a defined standard. - * - The loop has to be [normalized]{@link https://en.wikipedia.org/wiki/Normalized_loop}. + * - The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop). * - The loop variable has to be *i*. * - The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly * value of *i* for the given iteration and can be used in preprocessor @@ -217,12 +217,12 @@ export interface ShaderMaterialJSON extends MaterialJSON { * * ```js * const material = new THREE.ShaderMaterial( { - * uniforms: { - * time: { value: 1.0 }, - * resolution: { value: new THREE.Vector2() } - * }, - * vertexShader: document.getElementById( 'vertexShader' ).textContent, - * fragmentShader: document.getElementById( 'fragmentShader' ).textContent + * uniforms: { + * time: { value: 1.0 }, + * resolution: { value: new THREE.Vector2() } + * }, + * vertexShader: document.getElementById( 'vertexShader' ).textContent, + * fragmentShader: document.getElementById( 'fragmentShader' ).textContent * } ); * ``` */ diff --git a/types/three/src/materials/nodes/MeshSSSNodeMaterial.d.ts b/types/three/src/materials/nodes/MeshSSSNodeMaterial.d.ts index 45b86f3d985242..0fd2fe66b1ce62 100644 --- a/types/three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +++ b/types/three/src/materials/nodes/MeshSSSNodeMaterial.d.ts @@ -40,7 +40,7 @@ declare class SSSLightingModel extends PhysicalLightingModel { /** * Extends the default implementation with a SSS term. * - * Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look]{@link https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/} + * Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) * * @param {Object} input - The input data. * @param {NodeBuilder} builder - The current node builder. diff --git a/types/three/src/materials/nodes/NodeMaterial.d.ts b/types/three/src/materials/nodes/NodeMaterial.d.ts index 04e828d9da639e..8bad115e454834 100644 --- a/types/three/src/materials/nodes/NodeMaterial.d.ts +++ b/types/three/src/materials/nodes/NodeMaterial.d.ts @@ -4,7 +4,6 @@ import MRTNode from "../../nodes/core/MRTNode.js"; import Node from "../../nodes/core/Node.js"; import NodeBuilder from "../../nodes/core/NodeBuilder.js"; import LightsNode from "../../nodes/lighting/LightsNode.js"; -import { ShaderNodeObject } from "../../nodes/tsl/TSLCore.js"; import { MapColorPropertiesToColorRepresentations, Material, MaterialParameters } from "../Material.js"; import NodeMaterialObserver from "./manager/NodeMaterialObserver.js"; @@ -105,7 +104,7 @@ export interface NodeMaterialNodeProperties { * and `alphaMap` properties. This node property allows to overwrite the default * and define the opacity with a node instead. * - * If you don't want to overwrite the normals but modify the existing + * If you don't want to overwrite the opacity but modify the existing * value instead, use {@link materialOpacity}. * * @default null @@ -385,7 +384,7 @@ declare class NodeMaterial extends Material { * * @return {Node} The normal node. */ - setupNormal(): ShaderNodeObject; + setupNormal(): Node; /** * Setups the environment node from the material. * diff --git a/types/three/src/materials/nodes/VolumeNodeMaterial.d.ts b/types/three/src/materials/nodes/VolumeNodeMaterial.d.ts index b988fe8b72e714..cafd4db985d649 100644 --- a/types/three/src/materials/nodes/VolumeNodeMaterial.d.ts +++ b/types/three/src/materials/nodes/VolumeNodeMaterial.d.ts @@ -1,6 +1,5 @@ import Node from "../../nodes/core/Node.js"; import VolumetricLightingModel from "../../nodes/functions/VolumetricLightingModel.js"; -import { ShaderNodeObject } from "../../nodes/tsl/TSLCore.js"; import { MapColorPropertiesToColorRepresentations, MaterialParameters, MaterialProperties } from "../Material.js"; import NodeMaterial, { NodeMaterialNodeProperties } from "./NodeMaterial.js"; @@ -23,7 +22,7 @@ export interface VolumeNodeMaterialNodeProperties extends NodeMaterialNodeProper * * @default null */ - scatteringNode: (params: { positionRay: ShaderNodeObject }) => Node | null; + scatteringNode: (params: { positionRay: Node }) => Node | null; } // eslint-disable-next-line @typescript-eslint/no-empty-interface diff --git a/types/three/src/math/Vector3.d.ts b/types/three/src/math/Vector3.d.ts index 56e907ceb99075..4f14967d1865be 100644 --- a/types/three/src/math/Vector3.d.ts +++ b/types/three/src/math/Vector3.d.ts @@ -103,7 +103,7 @@ export class Vector3 { /** * Subtracts v from this vector. */ - sub(a: Vector3Like): this; + sub(v: Vector3Like): this; subScalar(s: number): this; @@ -208,7 +208,7 @@ export class Vector3 { /** * Sets this vector to cross product of itself and v. */ - cross(a: Vector3Like): this; + cross(v: Vector3Like): this; /** * Sets this vector to cross product of a and b. diff --git a/types/three/src/nodes/Nodes.d.ts b/types/three/src/nodes/Nodes.d.ts index 406cbdcb739334..9fc53df5fb9631 100644 --- a/types/three/src/nodes/Nodes.d.ts +++ b/types/three/src/nodes/Nodes.d.ts @@ -6,10 +6,10 @@ export { default as ArrayNode } from "./core/ArrayNode.js"; export { default as AssignNode } from "./core/AssignNode.js"; export { default as AttributeNode } from "./core/AttributeNode.js"; export { default as BypassNode } from "./core/BypassNode.js"; -export { default as CacheNode } from "./core/CacheNode.js"; export { default as ConstNode } from "./core/ConstNode.js"; export { default as ContextNode } from "./core/ContextNode.js"; export { default as IndexNode, IndexNodeScope } from "./core/IndexNode.js"; +export { default as IsolateNode } from "./core/IsolateNode.js"; export { default as LightingModel, LightingModelDirectInput, diff --git a/types/three/src/nodes/TSL.d.ts b/types/three/src/nodes/TSL.d.ts index a5b55bc2e9bb82..cac7f3910ffa0d 100644 --- a/types/three/src/nodes/TSL.d.ts +++ b/types/three/src/nodes/TSL.d.ts @@ -5,9 +5,9 @@ export * from "./core/constants.js"; export * from "./core/AssignNode.js"; export * from "./core/AttributeNode.js"; export * from "./core/BypassNode.js"; -export * from "./core/CacheNode.js"; export * from "./core/ContextNode.js"; export * from "./core/IndexNode.js"; +export * from "./core/IsolateNode.js"; export * from "./core/MRTNode.js"; export * from "./core/OutputStructNode.js"; export * from "./core/ParameterNode.js"; diff --git a/types/three/src/nodes/accessors/AccessorsUtils.d.ts b/types/three/src/nodes/accessors/AccessorsUtils.d.ts index 908e50b6280c5c..d41210d319cf0d 100644 --- a/types/three/src/nodes/accessors/AccessorsUtils.d.ts +++ b/types/three/src/nodes/accessors/AccessorsUtils.d.ts @@ -1,9 +1,8 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const TBNViewMatrix: ShaderNodeObject; +export const TBNViewMatrix: Node; -export const parallaxDirection: ShaderNodeObject; -export const parallaxUV: (uv: ShaderNodeObject, scale: Node) => ShaderNodeObject; +export const parallaxDirection: Node; +export const parallaxUV: (uv: Node, scale: Node) => Node; -export const bentNormalView: ShaderNodeObject; +export const bentNormalView: Node; diff --git a/types/three/src/nodes/accessors/Arrays.d.ts b/types/three/src/nodes/accessors/Arrays.d.ts index 53948fb3958886..df0a81a7b2f458 100644 --- a/types/three/src/nodes/accessors/Arrays.d.ts +++ b/types/three/src/nodes/accessors/Arrays.d.ts @@ -1,14 +1,13 @@ import { TypedArray } from "../../core/BufferAttribute.js"; import { Struct } from "../core/StructNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import StorageBufferNode from "./StorageBufferNode.js"; export const attributeArray: ( count: TypedArray | number, type?: string | Struct, -) => ShaderNodeObject; +) => StorageBufferNode; export const instancedArray: ( count: TypedArray | number, type?: string | Struct, -) => ShaderNodeObject; +) => StorageBufferNode; diff --git a/types/three/src/nodes/accessors/BatchNode.d.ts b/types/three/src/nodes/accessors/BatchNode.d.ts index 51db8b6bbd37ed..ef0812031fa5aa 100644 --- a/types/three/src/nodes/accessors/BatchNode.d.ts +++ b/types/three/src/nodes/accessors/BatchNode.d.ts @@ -1,6 +1,5 @@ import { BatchedMesh } from "../../objects/BatchedMesh.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class BatchNode extends Node { batchMesh: BatchedMesh; @@ -10,4 +9,4 @@ export default class BatchNode extends Node { constructor(batchMesh: BatchedMesh); } -export const batch: (batchMesh: BatchedMesh) => ShaderNodeObject; +export const batch: (batchMesh: BatchedMesh) => BatchNode; diff --git a/types/three/src/nodes/accessors/Bitangent.d.ts b/types/three/src/nodes/accessors/Bitangent.d.ts index dacf98c2eeceab..312036144b29d3 100644 --- a/types/three/src/nodes/accessors/Bitangent.d.ts +++ b/types/three/src/nodes/accessors/Bitangent.d.ts @@ -1,7 +1,6 @@ import MathNode from "../math/MathNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const bitangentGeometry: ShaderNodeObject; -export const bitangentLocal: ShaderNodeObject; -export const bitangentView: ShaderNodeObject; -export const bitangentWorld: ShaderNodeObject; +export const bitangentGeometry: MathNode; +export const bitangentLocal: MathNode; +export const bitangentView: MathNode; +export const bitangentWorld: MathNode; diff --git a/types/three/src/nodes/accessors/BufferAttributeNode.d.ts b/types/three/src/nodes/accessors/BufferAttributeNode.d.ts index 70aaaa277414d3..43f0b3600c3821 100644 --- a/types/three/src/nodes/accessors/BufferAttributeNode.d.ts +++ b/types/three/src/nodes/accessors/BufferAttributeNode.d.ts @@ -4,8 +4,6 @@ import { InterleavedBuffer } from "../../core/InterleavedBuffer.js"; import { InterleavedBufferAttribute } from "../../core/InterleavedBufferAttribute.js"; import InputNode from "../core/InputNode.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -import BufferNode from "./BufferNode.js"; /** * In earlier `three.js` versions it was only possible to define attribute data * on geometry level. With `BufferAttributeNode`, it is also possible to do this @@ -121,7 +119,7 @@ export declare const bufferAttribute: ( type?: string | null, stride?: number, offset?: number, -) => ShaderNodeObject; +) => BufferAttributeNode; /** * TSL function for creating a buffer attribute node but with dynamic draw usage. * Use this function if attribute data are updated per frame. @@ -139,7 +137,7 @@ export declare const dynamicBufferAttribute: ( type?: string | null, stride?: number, offset?: number, -) => ShaderNodeObject; +) => BufferAttributeNode; /** * TSL function for creating a buffer attribute node but with enabled instancing * @@ -156,7 +154,7 @@ export declare const instancedBufferAttribute: ( type?: string | null, stride?: number, offset?: number, -) => ShaderNodeObject; +) => BufferAttributeNode; /** * TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing * @@ -173,9 +171,10 @@ export declare const instancedDynamicBufferAttribute: ( type?: string | null, stride?: number, offset?: number, -) => ShaderNodeObject; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - toAttribute: (bufferNode: BufferNode) => ShaderNodeObject; +) => BufferAttributeNode; +declare module "../Nodes.js" { + interface BufferNode { + toAttribute: () => BufferAttributeNode; + toAttributeAssign: () => this; } } diff --git a/types/three/src/nodes/accessors/BufferNode.d.ts b/types/three/src/nodes/accessors/BufferNode.d.ts index c475362c1a4213..586468951fa6e8 100644 --- a/types/three/src/nodes/accessors/BufferNode.d.ts +++ b/types/three/src/nodes/accessors/BufferNode.d.ts @@ -1,5 +1,5 @@ import UniformNode from "../core/UniformNode.js"; -import { NodeOrType, ShaderNodeObject } from "../tsl/TSLCore.js"; +import { NodeOrType } from "../tsl/TSLCore.js"; export default class BufferNode extends UniformNode { isBufferNode: true; @@ -14,4 +14,4 @@ export const buffer: ( value: unknown, nodeOrType: NodeOrType, count: number, -) => ShaderNodeObject>; +) => BufferNode; diff --git a/types/three/src/nodes/accessors/BuiltinNode.d.ts b/types/three/src/nodes/accessors/BuiltinNode.d.ts index 5a9b9194c733ac..e24d57d7b3e5dc 100644 --- a/types/three/src/nodes/accessors/BuiltinNode.d.ts +++ b/types/three/src/nodes/accessors/BuiltinNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class BuiltinNode extends Node { name: string; @@ -11,4 +10,4 @@ declare class BuiltinNode extends Node { export default BuiltinNode; -export const builtin: (name: string) => ShaderNodeObject; +export const builtin: (name: string) => BuiltinNode; diff --git a/types/three/src/nodes/accessors/Camera.d.ts b/types/three/src/nodes/accessors/Camera.d.ts index f354479725603d..a37ce5a113b289 100644 --- a/types/three/src/nodes/accessors/Camera.d.ts +++ b/types/three/src/nodes/accessors/Camera.d.ts @@ -3,15 +3,14 @@ import { Matrix4 } from "../../math/Matrix4.js"; import { Vector3 } from "../../math/Vector3.js"; import { Vector4 } from "../../math/Vector4.js"; import UniformNode from "../core/UniformNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const cameraIndex: ShaderNodeObject>; -export const cameraNear: ShaderNodeObject>; -export const cameraFar: ShaderNodeObject>; -export const cameraProjectionMatrix: ShaderNodeObject>; -export const cameraProjectionMatrixInverse: ShaderNodeObject>; -export const cameraViewMatrix: ShaderNodeObject>; -export const cameraWorldMatrix: ShaderNodeObject>; -export const cameraNormalMatrix: ShaderNodeObject>; -export const cameraPosition: ShaderNodeObject>; -export const cameraViewport: ShaderNodeObject>; +export const cameraIndex: UniformNode; +export const cameraNear: UniformNode; +export const cameraFar: UniformNode; +export const cameraProjectionMatrix: UniformNode; +export const cameraProjectionMatrixInverse: UniformNode; +export const cameraViewMatrix: UniformNode; +export const cameraWorldMatrix: UniformNode; +export const cameraNormalMatrix: UniformNode; +export const cameraPosition: UniformNode; +export const cameraViewport: UniformNode; diff --git a/types/three/src/nodes/accessors/ClippingNode.d.ts b/types/three/src/nodes/accessors/ClippingNode.d.ts index 38baf32ee4b371..2704c3876fe5c6 100644 --- a/types/three/src/nodes/accessors/ClippingNode.d.ts +++ b/types/three/src/nodes/accessors/ClippingNode.d.ts @@ -1,7 +1,4 @@ -import { Plane } from "../../math/Plane.js"; import Node from "../core/Node.js"; -import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type ClippingNodeScope = typeof ClippingNode.ALPHA_TO_COVERAGE | typeof ClippingNode.DEFAULT; @@ -17,6 +14,6 @@ export default class ClippingNode extends Node { static HARDWARE: "hardware"; } -export const clipping: () => ShaderNodeObject; -export const clippingAlpha: () => ShaderNodeObject; -export const hardwareClipping: () => ShaderNodeObject; +export const clipping: () => ClippingNode; +export const clippingAlpha: () => ClippingNode; +export const hardwareClipping: () => ClippingNode; diff --git a/types/three/src/nodes/accessors/CubeTextureNode.d.ts b/types/three/src/nodes/accessors/CubeTextureNode.d.ts index 3684cdc60ecf17..4f40b452d1b830 100644 --- a/types/three/src/nodes/accessors/CubeTextureNode.d.ts +++ b/types/three/src/nodes/accessors/CubeTextureNode.d.ts @@ -1,18 +1,17 @@ import { CubeTexture } from "../../textures/CubeTexture.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import TextureNode from "./TextureNode.js"; declare class CubeTextureNode extends TextureNode { isCubeTextureNode: boolean; - uvNode: ShaderNodeObject | null; - levelNode: ShaderNodeObject | null; + uvNode: Node | null; + levelNode: Node | null; constructor( value: CubeTexture, - uvNode?: ShaderNodeObject | null, - levelNode?: ShaderNodeObject | null, - biasNode?: ShaderNodeObject | null, + uvNode?: Node | null, + levelNode?: Node | null, + biasNode?: Node | null, ); getDefaultUV(): Node; @@ -25,15 +24,15 @@ export const cubeTextureBase: ( uvNode?: Node, levelNode?: Node, biasNode?: Node, -) => ShaderNodeObject; +) => CubeTextureNode; export const cubeTexture: ( value?: CubeTexture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null, -) => ShaderNodeObject; +) => CubeTextureNode; export const uniformCubeTexture: ( value?: CubeTexture, -) => ShaderNodeObject; +) => CubeTextureNode; diff --git a/types/three/src/nodes/accessors/InstanceNode.d.ts b/types/three/src/nodes/accessors/InstanceNode.d.ts index a1a5890a282c49..2972093cf23ab4 100644 --- a/types/three/src/nodes/accessors/InstanceNode.d.ts +++ b/types/three/src/nodes/accessors/InstanceNode.d.ts @@ -1,6 +1,5 @@ import { InstancedBufferAttribute } from "../../core/InstancedBufferAttribute.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class InstanceNode extends Node { count: number; @@ -21,4 +20,4 @@ export const instance: ( count: number, instanceMatrix: InstancedBufferAttribute, instanceColor?: InstancedBufferAttribute | null, -) => ShaderNodeObject; +) => InstanceNode; diff --git a/types/three/src/nodes/accessors/InstancedMeshNode.d.ts b/types/three/src/nodes/accessors/InstancedMeshNode.d.ts index 91a10d2a5d255a..b6ce8ffcc346b4 100644 --- a/types/three/src/nodes/accessors/InstancedMeshNode.d.ts +++ b/types/three/src/nodes/accessors/InstancedMeshNode.d.ts @@ -1,5 +1,4 @@ import { InstancedMesh } from "../../objects/InstancedMesh.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import InstanceNode from "./InstanceNode.js"; declare class InstancedMeshNode extends InstanceNode { @@ -8,4 +7,4 @@ declare class InstancedMeshNode extends InstanceNode { export default InstancedMeshNode; -export const instancedMesh: (instancedMesh: InstancedMesh) => ShaderNodeObject; +export const instancedMesh: (instancedMesh: InstancedMesh) => InstancedMeshNode; diff --git a/types/three/src/nodes/accessors/Lights.d.ts b/types/three/src/nodes/accessors/Lights.d.ts index f0389d440d1764..862422913d0b52 100644 --- a/types/three/src/nodes/accessors/Lights.d.ts +++ b/types/three/src/nodes/accessors/Lights.d.ts @@ -1,15 +1,14 @@ import { Light } from "../../lights/Light.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export function lightShadowMatrix(light: Light): ShaderNodeObject; +export function lightShadowMatrix(light: Light): Node; -export function lightProjectionUV(light: Light, position?: Node): ShaderNodeObject; +export function lightProjectionUV(light: Light, position?: Node): Node; -export function lightPosition(light: Light): ShaderNodeObject; +export function lightPosition(light: Light): Node; -export function lightTargetPosition(light: Light): ShaderNodeObject; +export function lightTargetPosition(light: Light): Node; -export function lightViewPosition(light: Light): ShaderNodeObject; +export function lightViewPosition(light: Light): Node; -export const lightTargetDirection: (light: Light) => ShaderNodeObject; +export const lightTargetDirection: (light: Light) => Node; diff --git a/types/three/src/nodes/accessors/MaterialNode.d.ts b/types/three/src/nodes/accessors/MaterialNode.d.ts index 0452994fda73ba..2a2aa75ce43b53 100644 --- a/types/three/src/nodes/accessors/MaterialNode.d.ts +++ b/types/three/src/nodes/accessors/MaterialNode.d.ts @@ -1,7 +1,6 @@ import { Vector2 } from "../../math/Vector2.js"; import Node from "../core/Node.js"; import UniformNode from "../core/UniformNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type MaterialNodeScope = | typeof MaterialNode.ALPHA_TEST @@ -87,43 +86,43 @@ export default class MaterialNode extends Node { constructor(scope?: MaterialNodeScope); } -export const materialAlphaTest: ShaderNodeObject; -export const materialColor: ShaderNodeObject; -export const materialShininess: ShaderNodeObject; -export const materialEmissive: ShaderNodeObject; -export const materialOpacity: ShaderNodeObject; -export const materialSpecular: ShaderNodeObject; +export const materialAlphaTest: MaterialNode; +export const materialColor: MaterialNode; +export const materialShininess: MaterialNode; +export const materialEmissive: MaterialNode; +export const materialOpacity: MaterialNode; +export const materialSpecular: MaterialNode; -export const materialSpecularIntensity: ShaderNodeObject; -export const materialSpecularColor: ShaderNodeObject; +export const materialSpecularIntensity: MaterialNode; +export const materialSpecularColor: MaterialNode; -export const materialSpecularStrength: ShaderNodeObject; -export const materialReflectivity: ShaderNodeObject; -export const materialRoughness: ShaderNodeObject; -export const materialMetalness: ShaderNodeObject; -export const materialNormal: ShaderNodeObject; -export const materialClearcoat: ShaderNodeObject; -export const materialClearcoatRoughness: ShaderNodeObject; -export const materialClearcoatNormal: ShaderNodeObject; -export const materialRotation: ShaderNodeObject; -export const materialSheen: ShaderNodeObject; -export const materialSheenRoughness: ShaderNodeObject; -export const materialAnisotropy: ShaderNodeObject; -export const materialIridescence: ShaderNodeObject; -export const materialIridescenceIOR: ShaderNodeObject; -export const materialIridescenceThickness: ShaderNodeObject; -export const materialTransmission: ShaderNodeObject; -export const materialThickness: ShaderNodeObject; -export const materialIOR: ShaderNodeObject; -export const materialAttenuationDistance: ShaderNodeObject; -export const materialAttenuationColor: ShaderNodeObject; -export const materialLineScale: ShaderNodeObject; -export const materialLineDashSize: ShaderNodeObject; -export const materialLineGapSize: ShaderNodeObject; -export const materialLineWidth: ShaderNodeObject; -export const materialLineDashOffset: ShaderNodeObject; -export const materialPointSize: ShaderNodeObject; -export const materialDispersion: ShaderNodeObject; -export const materialLightMap: ShaderNodeObject; -export const materialAO: ShaderNodeObject; -export const materialAnisotropyVector: ShaderNodeObject>; +export const materialSpecularStrength: MaterialNode; +export const materialReflectivity: MaterialNode; +export const materialRoughness: MaterialNode; +export const materialMetalness: MaterialNode; +export const materialNormal: Node; +export const materialClearcoat: MaterialNode; +export const materialClearcoatRoughness: MaterialNode; +export const materialClearcoatNormal: Node; +export const materialRotation: MaterialNode; +export const materialSheen: MaterialNode; +export const materialSheenRoughness: MaterialNode; +export const materialAnisotropy: MaterialNode; +export const materialIridescence: MaterialNode; +export const materialIridescenceIOR: MaterialNode; +export const materialIridescenceThickness: MaterialNode; +export const materialTransmission: MaterialNode; +export const materialThickness: MaterialNode; +export const materialIOR: MaterialNode; +export const materialAttenuationDistance: MaterialNode; +export const materialAttenuationColor: MaterialNode; +export const materialLineScale: MaterialNode; +export const materialLineDashSize: MaterialNode; +export const materialLineGapSize: MaterialNode; +export const materialLineWidth: MaterialNode; +export const materialLineDashOffset: MaterialNode; +export const materialPointSize: MaterialNode; +export const materialDispersion: MaterialNode; +export const materialLightMap: MaterialNode; +export const materialAO: MaterialNode; +export const materialAnisotropyVector: UniformNode; diff --git a/types/three/src/nodes/accessors/MaterialProperties.d.ts b/types/three/src/nodes/accessors/MaterialProperties.d.ts index 544fc944716f56..b97bf137a60770 100644 --- a/types/three/src/nodes/accessors/MaterialProperties.d.ts +++ b/types/three/src/nodes/accessors/MaterialProperties.d.ts @@ -1,9 +1,8 @@ import { Matrix4 } from "../../math/Matrix4.js"; import UniformNode from "../core/UniformNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const materialRefractionRatio: ShaderNodeObject>; +export const materialRefractionRatio: UniformNode; -export const materialEnvIntensity: ShaderNodeObject>; +export const materialEnvIntensity: UniformNode; -export const materialEnvRotation: ShaderNodeObject>; +export const materialEnvRotation: UniformNode; diff --git a/types/three/src/nodes/accessors/MaterialReferenceNode.d.ts b/types/three/src/nodes/accessors/MaterialReferenceNode.d.ts index 7b0cdf4acac26f..34fd8550dd21af 100644 --- a/types/three/src/nodes/accessors/MaterialReferenceNode.d.ts +++ b/types/three/src/nodes/accessors/MaterialReferenceNode.d.ts @@ -1,5 +1,5 @@ import { Material } from "../../materials/Material.js"; -import { NodeOrType, ShaderNodeObject } from "../tsl/TSLCore.js"; +import { NodeOrType } from "../tsl/TSLCore.js"; import ReferenceNode from "./ReferenceNode.js"; export default class MaterialReferenceNode extends ReferenceNode { @@ -12,4 +12,4 @@ export const materialReference: ( name: string, nodeOrType: NodeOrType, material?: Material | null, -) => ShaderNodeObject; +) => MaterialReferenceNode; diff --git a/types/three/src/nodes/accessors/ModelNode.d.ts b/types/three/src/nodes/accessors/ModelNode.d.ts index bfcb534dd3d233..3545af20c403fd 100644 --- a/types/three/src/nodes/accessors/ModelNode.d.ts +++ b/types/three/src/nodes/accessors/ModelNode.d.ts @@ -1,7 +1,6 @@ import { Matrix4 } from "../../math/Matrix4.js"; import Node from "../core/Node.js"; import { UniformNode } from "../Nodes.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Object3DNode from "./Object3DNode.js"; /** @@ -11,23 +10,23 @@ export default class ModelNode extends Object3DNode { constructor(scope: string); } -export const modelDirection: ShaderNodeObject; -export const modelWorldMatrix: ShaderNodeObject; -export const modelPosition: ShaderNodeObject; -export const modelScale: ShaderNodeObject; -export const modelViewPosition: ShaderNodeObject; -export const modelRadius: ShaderNodeObject; -export const modelNormalMatrix: ShaderNodeObject; -export const modelWorldMatrixInverse: ShaderNodeObject>; +export const modelDirection: ModelNode; +export const modelWorldMatrix: ModelNode; +export const modelPosition: ModelNode; +export const modelScale: ModelNode; +export const modelViewPosition: ModelNode; +export const modelRadius: ModelNode; +export const modelNormalMatrix: Node; +export const modelWorldMatrixInverse: UniformNode; -export const modelViewMatrix: ShaderNodeObject; +export const modelViewMatrix: ModelNode; // GPU Precision -export const mediumpModelViewMatrix: ShaderNodeObject; +export const mediumpModelViewMatrix: Node; // CPU Precision -export const highpModelViewMatrix: ShaderNodeObject; +export const highpModelViewMatrix: Node; -export const highpModelNormalViewMatrix: ShaderNodeObject; +export const highpModelNormalViewMatrix: Node; diff --git a/types/three/src/nodes/accessors/ModelViewProjectionNode.d.ts b/types/three/src/nodes/accessors/ModelViewProjectionNode.d.ts index a9f1d182364602..965f0144e02af1 100644 --- a/types/three/src/nodes/accessors/ModelViewProjectionNode.d.ts +++ b/types/three/src/nodes/accessors/ModelViewProjectionNode.d.ts @@ -1,4 +1,3 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const modelViewProjection: ShaderNodeObject; +export const modelViewProjection: Node; diff --git a/types/three/src/nodes/accessors/MorphNode.d.ts b/types/three/src/nodes/accessors/MorphNode.d.ts index 8987acf6e80bef..32f8f53b27505f 100644 --- a/types/three/src/nodes/accessors/MorphNode.d.ts +++ b/types/three/src/nodes/accessors/MorphNode.d.ts @@ -1,7 +1,6 @@ import { Mesh } from "../../objects/Mesh.js"; import Node from "../core/Node.js"; import UniformNode from "../core/UniformNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class MorphNode extends Node { mesh: Mesh; @@ -12,4 +11,4 @@ declare class MorphNode extends Node { export default MorphNode; -export const morphReference: (mesh: Mesh) => ShaderNodeObject; +export const morphReference: (mesh: Mesh) => MorphNode; diff --git a/types/three/src/nodes/accessors/Normal.d.ts b/types/three/src/nodes/accessors/Normal.d.ts index 1e4acb385852c6..bdc76a815e4747 100644 --- a/types/three/src/nodes/accessors/Normal.d.ts +++ b/types/three/src/nodes/accessors/Normal.d.ts @@ -1,39 +1,38 @@ import AttributeNode from "../core/AttributeNode.js"; import Node from "../core/Node.js"; import VarNode from "../core/VarNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const normalGeometry: ShaderNodeObject; +export const normalGeometry: AttributeNode; -export const normalLocal: ShaderNodeObject; +export const normalLocal: VarNode; -export const normalFlat: ShaderNodeObject; +export const normalFlat: VarNode; -export const normalViewGeometry: ShaderNodeObject; +export const normalViewGeometry: VarNode; -export const normalWorldGeometry: ShaderNodeObject; +export const normalWorldGeometry: VarNode; -export const normalView: ShaderNodeObject; +export const normalView: VarNode; -export const normalWorld: ShaderNodeObject; +export const normalWorld: VarNode; -export const clearcoatNormalView: ShaderNodeObject; +export const clearcoatNormalView: VarNode; -export const transformNormal: (normal: Node, matrix?: Node) => ShaderNodeObject; +export const transformNormal: (normal: Node, matrix?: Node) => Node; -export const transformNormalToView: (normal: Node) => ShaderNodeObject; +export const transformNormalToView: (normal: Node) => Node; /** * @deprecated since r178. Use `normalView` instead. */ -export const transformedNormalView: ShaderNodeObject; +export const transformedNormalView: VarNode; /** * @deprecated since r178. Use `normalWorld` instead. */ -export const transformedNormalWorld: ShaderNodeObject; +export const transformedNormalWorld: VarNode; /** * @deprecated since r178. Use `clearcoatNormalView` instead. */ -export const transformedClearcoatNormalView: ShaderNodeObject; +export const transformedClearcoatNormalView: VarNode; diff --git a/types/three/src/nodes/accessors/Object3DNode.d.ts b/types/three/src/nodes/accessors/Object3DNode.d.ts index 739477c5d32a87..568869585e656b 100644 --- a/types/three/src/nodes/accessors/Object3DNode.d.ts +++ b/types/three/src/nodes/accessors/Object3DNode.d.ts @@ -1,6 +1,5 @@ import { Object3D } from "../../core/Object3D.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class Object3DNode extends Node { scope: string; @@ -16,9 +15,9 @@ export default class Object3DNode extends Node { static RADIUS: "radius"; } -export const objectDirection: (object3d: Object3D | null) => ShaderNodeObject; -export const objectWorldMatrix: (object3d: Object3D | null) => ShaderNodeObject; -export const objectPosition: (object3d: Object3D | null) => ShaderNodeObject; -export const objectScale: (object3d: Object3D | null) => ShaderNodeObject; -export const objectViewPosition: (object3d: Object3D | null) => ShaderNodeObject; -export const objectRadius: (object3d: Object3D | null) => ShaderNodeObject; +export const objectDirection: (object3d: Object3D | null) => Object3DNode; +export const objectWorldMatrix: (object3d: Object3D | null) => Object3DNode; +export const objectPosition: (object3d: Object3D | null) => Object3DNode; +export const objectScale: (object3d: Object3D | null) => Object3DNode; +export const objectViewPosition: (object3d: Object3D | null) => Object3DNode; +export const objectRadius: (object3d: Object3D | null) => Object3DNode; diff --git a/types/three/src/nodes/accessors/PointUVNode.d.ts b/types/three/src/nodes/accessors/PointUVNode.d.ts index 2220e556321b34..c2bbd02818ef5d 100644 --- a/types/three/src/nodes/accessors/PointUVNode.d.ts +++ b/types/three/src/nodes/accessors/PointUVNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class PointUVNode extends Node { isPointUVNode: true; @@ -7,4 +6,4 @@ export default class PointUVNode extends Node { constructor(); } -export const pointUV: ShaderNodeObject; +export const pointUV: PointUVNode; diff --git a/types/three/src/nodes/accessors/Position.d.ts b/types/three/src/nodes/accessors/Position.d.ts index a9f6fc811f131f..cbe99d876bf558 100644 --- a/types/three/src/nodes/accessors/Position.d.ts +++ b/types/three/src/nodes/accessors/Position.d.ts @@ -1,10 +1,9 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const positionGeometry: ShaderNodeObject; -export const positionLocal: ShaderNodeObject; -export const positionPrevious: ShaderNodeObject; -export const positionWorld: ShaderNodeObject; -export const positionWorldDirection: ShaderNodeObject; -export const positionView: ShaderNodeObject; -export const positionViewDirection: ShaderNodeObject; +export const positionGeometry: Node; +export const positionLocal: Node; +export const positionPrevious: Node; +export const positionWorld: Node; +export const positionWorldDirection: Node; +export const positionView: Node; +export const positionViewDirection: Node; diff --git a/types/three/src/nodes/accessors/ReferenceBaseNode.d.ts b/types/three/src/nodes/accessors/ReferenceBaseNode.d.ts index 00c4496549823d..308a7cb1fc2567 100644 --- a/types/three/src/nodes/accessors/ReferenceBaseNode.d.ts +++ b/types/three/src/nodes/accessors/ReferenceBaseNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ReferenceBaseNode extends Node { property: string; @@ -18,10 +17,10 @@ declare class ReferenceBaseNode extends Node { export default ReferenceBaseNode; -export const reference: (name: string, type: string, object: T) => ShaderNodeObject>; +export const reference: (name: string, type: string, object: T) => ReferenceBaseNode; export const referenceBuffer: ( name: string, type: string, count: number, object: T, -) => ShaderNodeObject>; +) => ReferenceBaseNode; diff --git a/types/three/src/nodes/accessors/ReferenceNode.d.ts b/types/three/src/nodes/accessors/ReferenceNode.d.ts index 1dea4d31ff573f..f5e72dbc2b3123 100644 --- a/types/three/src/nodes/accessors/ReferenceNode.d.ts +++ b/types/three/src/nodes/accessors/ReferenceNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ReferenceNode extends Node { property: string; @@ -20,10 +19,10 @@ declare class ReferenceNode extends Node { export default ReferenceNode; -export const reference: (name: string, type: string, object: T) => ShaderNodeObject>; +export const reference: (name: string, type: string, object: T) => ReferenceNode; export const referenceBuffer: ( name: string, type: string, count: number, object: T, -) => ShaderNodeObject>; +) => ReferenceNode; diff --git a/types/three/src/nodes/accessors/ReflectVector.d.ts b/types/three/src/nodes/accessors/ReflectVector.d.ts index 4978b4975a215f..32f149bf3394ab 100644 --- a/types/three/src/nodes/accessors/ReflectVector.d.ts +++ b/types/three/src/nodes/accessors/ReflectVector.d.ts @@ -1,9 +1,8 @@ import Node from "../core/Node.js"; import VarNode from "../core/VarNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const reflectView: ShaderNodeObject; -export const refractView: ShaderNodeObject; +export const reflectView: Node; +export const refractView: Node; -export const reflectVector: ShaderNodeObject; -export const refractVector: ShaderNodeObject; +export const reflectVector: VarNode; +export const refractVector: VarNode; diff --git a/types/three/src/nodes/accessors/RendererReferenceNode.d.ts b/types/three/src/nodes/accessors/RendererReferenceNode.d.ts index 0e100b0498a8e6..7bf48604c67257 100644 --- a/types/three/src/nodes/accessors/RendererReferenceNode.d.ts +++ b/types/three/src/nodes/accessors/RendererReferenceNode.d.ts @@ -1,5 +1,4 @@ import Renderer from "../../renderers/common/Renderer.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import ReferenceNode from "./ReferenceNode.js"; export default class RendererReferenceNode extends ReferenceNode { @@ -12,4 +11,4 @@ export const rendererReference: ( name: string, type: string, renderer?: Renderer | null, -) => ShaderNodeObject; +) => RendererReferenceNode; diff --git a/types/three/src/nodes/accessors/SceneNode.d.ts b/types/three/src/nodes/accessors/SceneNode.d.ts index 14ba16b6f1febd..3eac5bb4ba47eb 100644 --- a/types/three/src/nodes/accessors/SceneNode.d.ts +++ b/types/three/src/nodes/accessors/SceneNode.d.ts @@ -1,6 +1,5 @@ import { Scene } from "../../scenes/Scene.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type SceneNodeScope = typeof SceneNode.BACKGROUND_BLURRINESS | typeof SceneNode.BACKGROUND_INTENSITY; @@ -17,6 +16,6 @@ declare class SceneNode extends Node { export default SceneNode; -export const backgroundBlurriness: ShaderNodeObject; -export const backgroundIntensity: ShaderNodeObject; -export const backgroundRotation: ShaderNodeObject; +export const backgroundBlurriness: SceneNode; +export const backgroundIntensity: SceneNode; +export const backgroundRotation: SceneNode; diff --git a/types/three/src/nodes/accessors/SkinningNode.d.ts b/types/three/src/nodes/accessors/SkinningNode.d.ts index 2c01094cea525a..61c05f52dd5c67 100644 --- a/types/three/src/nodes/accessors/SkinningNode.d.ts +++ b/types/three/src/nodes/accessors/SkinningNode.d.ts @@ -1,7 +1,6 @@ import { SkinnedMesh } from "../../objects/SkinnedMesh.js"; import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class SkinningNode extends Node { skinnedMesh: SkinnedMesh; @@ -18,14 +17,14 @@ export default class SkinningNode extends Node { constructor(skinnedMesh: SkinnedMesh); - getSkinnedPosition(boneMatrices?: Node, position?: Node): ShaderNodeObject; + getSkinnedPosition(boneMatrices?: Node, position?: Node): Node; - getSkinnedNormal(boneMatrices?: Node, normal?: Node): ShaderNodeObject; + getSkinnedNormal(boneMatrices?: Node, normal?: Node): Node; - getPreviousSkinnedPosition(builder: NodeBuilder): ShaderNodeObject; + getPreviousSkinnedPosition(builder: NodeBuilder): Node; needsPreviousBoneMatrices(builder: NodeBuilder): boolean; } -export const skinning: (skinnedMesh: SkinnedMesh) => ShaderNodeObject; -export const computeSkinning: (skinnedMesh: SkinnedMesh, toPosition?: Node | null) => ShaderNodeObject; +export const skinning: (skinnedMesh: SkinnedMesh) => SkinningNode; +export const computeSkinning: (skinnedMesh: SkinnedMesh, toPosition?: Node | null) => SkinningNode; diff --git a/types/three/src/nodes/accessors/StorageBufferNode.d.ts b/types/three/src/nodes/accessors/StorageBufferNode.d.ts index 3d199513729296..7045ca722b716a 100644 --- a/types/three/src/nodes/accessors/StorageBufferNode.d.ts +++ b/types/three/src/nodes/accessors/StorageBufferNode.d.ts @@ -1,10 +1,10 @@ +import { BufferAttribute } from "../../core/BufferAttribute.js"; import StorageBufferAttribute from "../../renderers/common/StorageBufferAttribute.js"; import StorageInstancedBufferAttribute from "../../renderers/common/StorageInstancedBufferAttribute.js"; import { NodeAccess } from "../core/constants.js"; import Node from "../core/Node.js"; import { Struct } from "../core/StructNode.js"; import StructTypeNode from "../core/StructTypeNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import StorageArrayElementNode from "../utils/StorageArrayElementNode.js"; import BufferNode from "./BufferNode.js"; @@ -25,7 +25,7 @@ export default class StorageBufferNode extends BufferNode; + element: (indexNode: Node | number) => StorageArrayElementNode; setPBO(value: boolean): this; @@ -41,10 +41,10 @@ export default class StorageBufferNode extends BufferNode ShaderNodeObject; +) => StorageBufferNode; /** * @deprecated @@ -53,4 +53,4 @@ export const storageObject: ( value: StorageBufferAttribute | StorageInstancedBufferAttribute, type?: string | Struct | null, count?: number, -) => ShaderNodeObject; +) => StorageBufferNode; diff --git a/types/three/src/nodes/accessors/StorageTextureNode.d.ts b/types/three/src/nodes/accessors/StorageTextureNode.d.ts index 7af708641081c9..9eef343b990e97 100644 --- a/types/three/src/nodes/accessors/StorageTextureNode.d.ts +++ b/types/three/src/nodes/accessors/StorageTextureNode.d.ts @@ -2,24 +2,27 @@ import { Texture } from "../../textures/Texture.js"; import { NodeAccess } from "../core/constants.js"; import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import TextureNode from "./TextureNode.js"; export default class StorageTextureNode extends TextureNode { storeNode: Node | null; + mipLevel: number; + readonly isStorageTextureNode: true; access: NodeAccess; constructor( value: Texture, - uvNode?: ShaderNodeObject | null, + uvNode?: Node | null, storeNode?: Node | null, ); setAccess(value: NodeAccess): this; + setMipLevel(level: number): this; + toReadWrite(): this; toReadOnly(): this; @@ -33,10 +36,10 @@ export const storageTexture: ( value: Texture, uvNode?: Node | null, storeNode?: Node, -) => ShaderNodeObject; +) => StorageTextureNode; export const textureStore: ( value: Texture, uvNode?: Node | null, storeNode?: Node, -) => ShaderNodeObject; +) => StorageTextureNode; diff --git a/types/three/src/nodes/accessors/Tangent.d.ts b/types/three/src/nodes/accessors/Tangent.d.ts index 63454c41a6382c..bad61533a90677 100644 --- a/types/three/src/nodes/accessors/Tangent.d.ts +++ b/types/three/src/nodes/accessors/Tangent.d.ts @@ -1,10 +1,8 @@ import AttributeNode from "../core/AttributeNode.js"; -import VarNode from "../core/VarNode.js"; import VaryingNode from "../core/VaryingNode.js"; import MathNode from "../math/MathNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const tangentGeometry: ShaderNodeObject; -export const tangentLocal: ShaderNodeObject; -export const tangentView: ShaderNodeObject; -export const tangentWorld: ShaderNodeObject; +export const tangentGeometry: AttributeNode; +export const tangentLocal: VaryingNode; +export const tangentView: MathNode; +export const tangentWorld: MathNode; diff --git a/types/three/src/nodes/accessors/TangentUtils.d.ts b/types/three/src/nodes/accessors/TangentUtils.d.ts index f1dc35a5044582..065984f66acf60 100644 --- a/types/three/src/nodes/accessors/TangentUtils.d.ts +++ b/types/three/src/nodes/accessors/TangentUtils.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; /** * Tangent vector in view space, computed dynamically from geometry and UV derivatives. @@ -9,7 +8,7 @@ import { ShaderNodeObject } from "../tsl/TSLCore.js"; * * @tsl */ -export const tangentViewFrame: ShaderNodeObject; +export const tangentViewFrame: Node; /** * Bitangent vector in view space, computed dynamically from geometry and UV derivatives. @@ -19,4 +18,4 @@ export const tangentViewFrame: ShaderNodeObject; * * @tsl */ -export const bitangentViewFrame: ShaderNodeObject; +export const bitangentViewFrame: Node; diff --git a/types/three/src/nodes/accessors/Texture3DNode.d.ts b/types/three/src/nodes/accessors/Texture3DNode.d.ts index 4dddac2eb20d08..db0d842f36c43b 100644 --- a/types/three/src/nodes/accessors/Texture3DNode.d.ts +++ b/types/three/src/nodes/accessors/Texture3DNode.d.ts @@ -1,18 +1,17 @@ import { Texture } from "../../textures/Texture.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import TextureNode from "./TextureNode.js"; export default class Texture3DNode extends TextureNode { readonly isTexture3DNode: true; - constructor(value: Texture, uvNode?: ShaderNodeObject | null, levelNode?: ShaderNodeObject | null); + constructor(value: Texture, uvNode?: Node | null, levelNode?: Node | null); - normal(uvNode: Node): ShaderNodeObject; + normal(uvNode: Node): Node; } export const texture3D: ( value: Texture, uvNode?: Node | null, levelNode?: Node | number | null, -) => ShaderNodeObject; +) => Texture3DNode; diff --git a/types/three/src/nodes/accessors/TextureBicubic.d.ts b/types/three/src/nodes/accessors/TextureBicubic.d.ts index 51845bcde14145..4d0740e5e3a6ce 100644 --- a/types/three/src/nodes/accessors/TextureBicubic.d.ts +++ b/types/three/src/nodes/accessors/TextureBicubic.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const textureBicubicLevel: (textureNode: Node, lodNode: Node) => ShaderNodeObject; +export const textureBicubicLevel: (textureNode: Node, lodNode: Node) => Node; -export const textureBicubic: (textureNode: Node, strength: Node) => ShaderNodeObject; +export const textureBicubic: (textureNode: Node, strength: Node) => Node; diff --git a/types/three/src/nodes/accessors/TextureNode.d.ts b/types/three/src/nodes/accessors/TextureNode.d.ts index b6cd68c1c3b983..e619bf69968ba3 100644 --- a/types/three/src/nodes/accessors/TextureNode.d.ts +++ b/types/three/src/nodes/accessors/TextureNode.d.ts @@ -1,14 +1,13 @@ import { Texture } from "../../textures/Texture.js"; import Node from "../core/Node.js"; import UniformNode from "../core/UniformNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class TextureNode extends UniformNode { readonly isTextureNode: true; - uvNode: ShaderNodeObject | null; - levelNode: ShaderNodeObject | null; - biasNode: ShaderNodeObject | null; + uvNode: Node | null; + levelNode: Node | null; + biasNode: Node | null; compareNode: Node | null; depthNode: Node | null; gradNode: Node | null; @@ -20,9 +19,9 @@ export default class TextureNode extends UniformNode { constructor( value?: Texture, - uvNode?: ShaderNodeObject | null, - levelNode?: ShaderNodeObject | null, - biasNode?: ShaderNodeObject | null, + uvNode?: Node | null, + levelNode?: Node | null, + biasNode?: Node | null, ); getDefaultUV(): Node; @@ -34,49 +33,55 @@ export default class TextureNode extends UniformNode { /** * @deprecated */ - uv(uvNode: Node): ShaderNodeObject; + uv(uvNode: Node): Node; - sample(uvNode: Node): ShaderNodeObject; + sample(uvNode: Node): Node; - load(uvNode: Node): ShaderNodeObject; + load(uvNode: Node): Node; - blur(amountNode: Node): ShaderNodeObject; + blur(amountNode: Node): Node; - level(levelNode: Node): ShaderNodeObject; + level(levelNode: Node): Node; - size(levelNode: Node): ShaderNodeObject; + size(levelNode: Node): Node; - bias(biasNode: Node): ShaderNodeObject; + bias(biasNode: Node): Node; getBase(): TextureNode; - compare(compareNode: Node): ShaderNodeObject; + compare(compareNode: Node): Node; - grad(gradeNodeX: Node, gradeNodeY: Node): ShaderNodeObject; + grad(gradeNodeX: Node, gradeNodeY: Node): Node; - depth(depthNode: Node): ShaderNodeObject; + depth(depthNode: Node): Node; clone(): this; } export const texture: ( - value?: Texture, + value?: Texture | TextureNode, uvNode?: Node | null, levelNode?: Node | number | null, biasNode?: Node | null, -) => ShaderNodeObject; +) => TextureNode; export const uniformTexture: ( value?: Texture, -) => ShaderNodeObject; +) => TextureNode; export const textureLoad: ( - value?: Texture, + value?: Texture | TextureNode, uvNode?: Node, levelNode?: Node | number, biasNode?: Node, -) => ShaderNodeObject; +) => TextureNode; + +export const textureLevel: ( + value: Texture | TextureNode, + uv: Node, + level: Node, +) => TextureNode; -export const sampler: (value: Texture | TextureNode) => ShaderNodeObject; +export const sampler: (value: Texture | TextureNode) => Node; -export const samplerComparison: (value: Texture | TextureNode) => ShaderNodeObject; +export const samplerComparison: (value: Texture | TextureNode) => Node; diff --git a/types/three/src/nodes/accessors/TextureSizeNode.d.ts b/types/three/src/nodes/accessors/TextureSizeNode.d.ts index f6c644a47ed600..62d8a820228e2f 100644 --- a/types/three/src/nodes/accessors/TextureSizeNode.d.ts +++ b/types/three/src/nodes/accessors/TextureSizeNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class TextureSizeNode extends Node { readonly isTextureSizeNode: true; @@ -15,4 +14,4 @@ export default TextureSizeNode; export const textureSize: ( textureNode: Node, levelNode?: Node | null, -) => ShaderNodeObject; +) => TextureSizeNode; diff --git a/types/three/src/nodes/accessors/UV.d.ts b/types/three/src/nodes/accessors/UV.d.ts index aedabbd02dbfd1..e5e8f0a991351e 100644 --- a/types/three/src/nodes/accessors/UV.d.ts +++ b/types/three/src/nodes/accessors/UV.d.ts @@ -1,4 +1,3 @@ import AttributeNode from "../core/AttributeNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const uv: (index?: number) => ShaderNodeObject; +export const uv: (index?: number) => AttributeNode; diff --git a/types/three/src/nodes/accessors/UniformArrayNode.d.ts b/types/three/src/nodes/accessors/UniformArrayNode.d.ts index 2cd7dec9666253..1f3e6dd926af5b 100644 --- a/types/three/src/nodes/accessors/UniformArrayNode.d.ts +++ b/types/three/src/nodes/accessors/UniformArrayNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import ArrayElementNode from "../utils/ArrayElementNode.js"; import BufferNode from "./BufferNode.js"; @@ -18,9 +17,9 @@ declare class UniformArrayNode extends BufferNode { getPaddedType(): string; - element(indexNode: Node): ShaderNodeObject; + element: (indexNode: Node) => UniformArrayElementNode; } export default UniformArrayNode; -export const uniformArray: (values: unknown[], nodeType?: string | null) => ShaderNodeObject; +export const uniformArray: (values: unknown[], nodeType?: string | null) => UniformArrayNode; diff --git a/types/three/src/nodes/accessors/UserDataNode.d.ts b/types/three/src/nodes/accessors/UserDataNode.d.ts index 647c1841240632..0daa1d74821668 100644 --- a/types/three/src/nodes/accessors/UserDataNode.d.ts +++ b/types/three/src/nodes/accessors/UserDataNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import ReferenceNode from "./ReferenceNode.js"; export type NodeUserData = Record; @@ -12,4 +11,4 @@ export const userData: ( name: string, inputType: string, userData?: NodeUserData, -) => ShaderNodeObject; +) => UserDataNode; diff --git a/types/three/src/nodes/accessors/VelocityNode.d.ts b/types/three/src/nodes/accessors/VelocityNode.d.ts index 32c040c16aca47..4719cc7bf7c55c 100644 --- a/types/three/src/nodes/accessors/VelocityNode.d.ts +++ b/types/three/src/nodes/accessors/VelocityNode.d.ts @@ -1,7 +1,6 @@ import { Matrix4 } from "../../math/Matrix4.js"; import TempNode from "../core/TempNode.js"; import UniformNode from "../core/UniformNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class VelocityNode extends TempNode { projectionMatrix: Matrix4 | null; @@ -17,4 +16,4 @@ declare class VelocityNode extends TempNode { export default VelocityNode; -export const velocity: ShaderNodeObject; +export const velocity: VelocityNode; diff --git a/types/three/src/nodes/accessors/VertexColorNode.d.ts b/types/three/src/nodes/accessors/VertexColorNode.d.ts index 5973a243b85932..e880b7b6d60e4d 100644 --- a/types/three/src/nodes/accessors/VertexColorNode.d.ts +++ b/types/three/src/nodes/accessors/VertexColorNode.d.ts @@ -1,5 +1,4 @@ import AttributeNode from "../core/AttributeNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class VertexColorNode extends AttributeNode { readonly isVertexColorNode: true; @@ -9,4 +8,4 @@ export default class VertexColorNode extends AttributeNode { constructor(index: number); } -export const vertexColor: (index?: number) => ShaderNodeObject; +export const vertexColor: (index?: number) => VertexColorNode; diff --git a/types/three/src/nodes/code/CodeNode.d.ts b/types/three/src/nodes/code/CodeNode.d.ts index 7cc59e74e54573..ad5384238df412 100644 --- a/types/three/src/nodes/code/CodeNode.d.ts +++ b/types/three/src/nodes/code/CodeNode.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export interface CodeNodeInclude { build(builder: NodeBuilder): void; @@ -17,7 +16,7 @@ export default class CodeNode extends Node { getIncludes(builder: NodeBuilder): CodeNodeInclude[]; } -export const code: (code: string, includes?: CodeNodeInclude[], language?: string) => ShaderNodeObject; -export const js: (src: string, includes?: CodeNodeInclude[]) => ShaderNodeObject; -export const wgsl: (src: string, includes?: CodeNodeInclude[]) => ShaderNodeObject; -export const glsl: (src: string, includes?: CodeNodeInclude[]) => ShaderNodeObject; +export const code: (code: string, includes?: CodeNodeInclude[], language?: string) => CodeNode; +export const js: (src: string, includes?: CodeNodeInclude[]) => CodeNode; +export const wgsl: (src: string, includes?: CodeNodeInclude[]) => CodeNode; +export const glsl: (src: string, includes?: CodeNodeInclude[]) => CodeNode; diff --git a/types/three/src/nodes/code/ExpressionNode.d.ts b/types/three/src/nodes/code/ExpressionNode.d.ts index c9c6eb1617976e..bad5c0dc92a3dd 100644 --- a/types/three/src/nodes/code/ExpressionNode.d.ts +++ b/types/three/src/nodes/code/ExpressionNode.d.ts @@ -1,5 +1,4 @@ import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class ExpressionNode extends TempNode { snipped: string; @@ -7,4 +6,4 @@ export default class ExpressionNode extends TempNode { constructor(snipped?: string, nodeType?: string); } -export const expression: (snipped: string, nodeType?: string) => ShaderNodeObject; +export const expression: (snipped: string, nodeType?: string) => ExpressionNode; diff --git a/types/three/src/nodes/code/FunctionCallNode.d.ts b/types/three/src/nodes/code/FunctionCallNode.d.ts index da77f480b392fd..d746ead23296bd 100644 --- a/types/three/src/nodes/code/FunctionCallNode.d.ts +++ b/types/three/src/nodes/code/FunctionCallNode.d.ts @@ -1,6 +1,6 @@ import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ProxiedObject, ShaderNodeObject } from "../tsl/TSLCore.js"; +import { ProxiedObject } from "../tsl/TSLCore.js"; import FunctionNode, { FunctionNodeArguments } from "./FunctionNode.js"; export default class FunctionCallNode

| { [name: string]: Node | number }> @@ -18,10 +18,11 @@ export default class FunctionCallNode

| { [name: export const call:

( functionNode?: FunctionNode

, parameters?: ProxiedObject

, -) => ShaderNodeObject>; +) => FunctionCallNode

; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - call: typeof call; +declare module "../Nodes.js" { + interface FunctionNode

{ + call: (parameters?: ProxiedObject

) => FunctionCallNode

; + callAssign: (parameters?: ProxiedObject

) => this; } } diff --git a/types/three/src/nodes/code/FunctionNode.d.ts b/types/three/src/nodes/code/FunctionNode.d.ts index 605a99697731c8..b4cecf51cd87e1 100644 --- a/types/three/src/nodes/code/FunctionNode.d.ts +++ b/types/three/src/nodes/code/FunctionNode.d.ts @@ -2,9 +2,8 @@ import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; import NodeFunction from "../core/NodeFunction.js"; import NodeFunctionInput from "../core/NodeFunctionInput.js"; -import { ProxiedObject, ProxiedTuple, ShaderNodeObject } from "../tsl/TSLCore.js"; +import { ProxiedObject, ProxiedTuple } from "../tsl/TSLCore.js"; import CodeNode, { CodeNodeInclude } from "./CodeNode.js"; -import FunctionCallNode from "./FunctionCallNode.js"; export type FunctionNodeArguments = Array | { [name: string]: Node | number }; @@ -13,7 +12,6 @@ export default class FunctionNode

| { [name: stri getInputs(builder: NodeBuilder): NodeFunctionInput[]; getNodeFunction(builder: NodeBuilder): NodeFunction; - call(parameters: P): FunctionCallNode

; } type FnParameters

= P extends readonly [...unknown[]] ? ProxiedTuple

@@ -24,15 +22,15 @@ export const nativeFn:

( includes?: CodeNodeInclude[], language?: string, // eslint-disable-next-line @definitelytyped/no-unnecessary-generics -) => (...params: FnParameters

) => ShaderNodeObject; +) => (...params: FnParameters

) => Node; export const glslFn:

( code: string, includes?: CodeNodeInclude[], // eslint-disable-next-line @definitelytyped/no-unnecessary-generics -) => (...params: FnParameters

) => ShaderNodeObject; +) => (...params: FnParameters

) => Node; export const wgslFn:

( code: string, includes?: CodeNodeInclude[], // eslint-disable-next-line @definitelytyped/no-unnecessary-generics -) => (...params: FnParameters

) => ShaderNodeObject; +) => (...params: FnParameters

) => Node; diff --git a/types/three/src/nodes/code/ScriptableNode.d.ts b/types/three/src/nodes/code/ScriptableNode.d.ts index 3389d25cde9bcd..1849bb228fec9a 100644 --- a/types/three/src/nodes/code/ScriptableNode.d.ts +++ b/types/three/src/nodes/code/ScriptableNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class Resources extends Map { get(key: string, callback?: ((...args: TArgs) => void) | null, ...params: TArgs): unknown; @@ -19,4 +18,4 @@ export default ScriptableNode; export const scriptable: ( codeNode: Node, parameters?: Record, -) => ShaderNodeObject; +) => ScriptableNode; diff --git a/types/three/src/nodes/code/ScriptableValueNode.d.ts b/types/three/src/nodes/code/ScriptableValueNode.d.ts index 601f66a584fe49..066b3203b338a6 100644 --- a/types/three/src/nodes/code/ScriptableValueNode.d.ts +++ b/types/three/src/nodes/code/ScriptableValueNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ScriptableValueNode extends Node { constructor(value: unknown); @@ -7,4 +6,4 @@ declare class ScriptableValueNode extends Node { export default ScriptableValueNode; -export const scriptableValue: (value: unknown) => ShaderNodeObject; +export const scriptableValue: (value: unknown) => ScriptableValueNode; diff --git a/types/three/src/nodes/core/ArrayNode.d.ts b/types/three/src/nodes/core/ArrayNode.d.ts index b33068b9214aaf..327ac90cd30a90 100644 --- a/types/three/src/nodes/core/ArrayNode.d.ts +++ b/types/three/src/nodes/core/ArrayNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; import TempNode from "./TempNode.js"; @@ -13,14 +12,15 @@ declare class ArrayNode extends TempNode { export default ArrayNode; interface ArrayFunction { - (values: Node[]): ShaderNodeObject; - (nodeType: string, count: number): ShaderNodeObject; + (values: Node[]): ArrayNode; + (nodeType: string, count: number): ArrayNode; } export const array: ArrayFunction; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - toArray: typeof array; +declare module "../Nodes.js" { + interface Node { + toArray: (count: number) => ArrayNode; + toArrayAssign: (count: number) => this; } } diff --git a/types/three/src/nodes/core/AssignNode.d.ts b/types/three/src/nodes/core/AssignNode.d.ts index 020672effcc0b3..85ee70b3c77c85 100644 --- a/types/three/src/nodes/core/AssignNode.d.ts +++ b/types/three/src/nodes/core/AssignNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; import NodeBuilder from "./NodeBuilder.js"; import TempNode from "./TempNode.js"; @@ -13,10 +12,4 @@ declare class AssignNode extends TempNode { export default AssignNode; -export const assign: (targetNode: Node, sourceNode: Node | number) => ShaderNodeObject; - -declare module "../tsl/TSLCore.js" { - interface NodeElements { - assign: typeof assign; - } -} +export const assign: (targetNode: Node, sourceNode: Node | number) => AssignNode; diff --git a/types/three/src/nodes/core/AttributeNode.d.ts b/types/three/src/nodes/core/AttributeNode.d.ts index 7a18229848d908..c9e762a3f66fdf 100644 --- a/types/three/src/nodes/core/AttributeNode.d.ts +++ b/types/three/src/nodes/core/AttributeNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; import NodeBuilder from "./NodeBuilder.js"; @@ -13,4 +12,4 @@ export default class AttributeNode extends Node { export const attribute: ( name: string, nodeType?: string | null, -) => ShaderNodeObject; +) => AttributeNode; diff --git a/types/three/src/nodes/core/BypassNode.d.ts b/types/three/src/nodes/core/BypassNode.d.ts index f2e13ecacb1420..f39e08c2d05ba5 100644 --- a/types/three/src/nodes/core/BypassNode.d.ts +++ b/types/three/src/nodes/core/BypassNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; export default class BypassNode extends Node { @@ -9,10 +8,11 @@ export default class BypassNode extends Node { constructor(returnNode: Node, callNode: Node); } -export const bypass: (returnNode: Node, callNode: Node) => ShaderNodeObject; +export const bypass: (returnNode: Node, callNode: Node) => BypassNode; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - bypass: typeof bypass; +declare module "../Nodes.js" { + interface Node { + bypass: (callNode: Node) => BypassNode; + bypassAssign: (callNode: Node) => this; } } diff --git a/types/three/src/nodes/core/CacheNode.d.ts b/types/three/src/nodes/core/CacheNode.d.ts deleted file mode 100644 index da5b8836b3f28a..00000000000000 --- a/types/three/src/nodes/core/CacheNode.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -import ContextNode from "./ContextNode.js"; -import Node from "./Node.js"; -import NodeCache from "./NodeCache.js"; - -export default class CacheNode extends Node { - node: Node; - parent: boolean; - - readonly isCacheNode: true; - - constructor(node: Node, parent?: boolean); -} - -export const cache: (node: Node, cache?: NodeCache) => ShaderNodeObject; - -declare module "../tsl/TSLCore.js" { - interface NodeElements { - cache: typeof cache; - } -} diff --git a/types/three/src/nodes/core/ContextNode.d.ts b/types/three/src/nodes/core/ContextNode.d.ts index 7321e3018522aa..a73a11bbf541fb 100644 --- a/types/three/src/nodes/core/ContextNode.d.ts +++ b/types/three/src/nodes/core/ContextNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; import { NodeBuilderContext } from "./NodeBuilder.js"; @@ -13,22 +12,35 @@ declare class ContextNode extends Node { export default ContextNode; -export const context: (node: Node, context?: NodeBuilderContext) => ShaderNodeObject; +export const context: (node: Node, context?: NodeBuilderContext) => ContextNode; -export const uniformFlow: (node: Node) => ShaderNodeObject; +export const uniformFlow: (node: Node) => ContextNode; -export const setName: (node: Node, label: string) => ShaderNodeObject; +export const setName: (node: Node, label: string) => Node; /** * @deprecated "label()" has been deprecated. Use "setName()" instead. */ -export function label(node: Node, label: string): ShaderNodeObject; - -declare module "../tsl/TSLCore.js" { - interface NodeElements { - context: typeof context; - label: typeof label; - uniformFlow: typeof uniformFlow; - setName: typeof setName; +export function label(node: Node, label: string): Node; + +declare module "../Nodes.js" { + interface Node { + context: (context?: NodeBuilderContext) => ContextNode; + contextAssign: (context?: NodeBuilderContext) => this; + + /** + * @deprecated "label()" has been deprecated. Use "setName()" instead. + */ + label: (label: string) => Node; + /** + * @deprecated "label()" has been deprecated. Use "setName()" instead. + */ + labelAssign: (label: string) => this; + + uniformFlow: () => ContextNode; + uniformFlowAssign: () => this; + + setName: (label: string) => Node; + setNameAssign: (label: string) => this; } } diff --git a/types/three/src/nodes/core/IndexNode.d.ts b/types/three/src/nodes/core/IndexNode.d.ts index 081250058602c3..c60fd7bbcdae4c 100644 --- a/types/three/src/nodes/core/IndexNode.d.ts +++ b/types/three/src/nodes/core/IndexNode.d.ts @@ -1,10 +1,11 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; export type IndexNodeScope = | typeof IndexNode.VERTEX | typeof IndexNode.INSTANCE + | typeof IndexNode.SUBGROUP | typeof IndexNode.INVOCATION_LOCAL + | typeof IndexNode.INVOCATION_SUBGROUP | typeof IndexNode.DRAW; declare class IndexNode extends Node { @@ -16,15 +17,17 @@ declare class IndexNode extends Node { static VERTEX: "vertex"; static INSTANCE: "instance"; + static SUBGROUP: "subgroup"; static INVOCATION_LOCAL: "invocationLocal"; + static INVOCATION_SUBGROUP: "invocationSubgroup"; static DRAW: "draw"; } export default IndexNode; -export const vertexIndex: ShaderNodeObject; -export const instanceIndex: ShaderNodeObject; -export const subgroupIndex: ShaderNodeObject; -export const invocationSubgroupIndex: ShaderNodeObject; -export const invocationLocalIndex: ShaderNodeObject; -export const drawIndex: ShaderNodeObject; +export const vertexIndex: IndexNode; +export const instanceIndex: IndexNode; +export const subgroupIndex: IndexNode; +export const invocationSubgroupIndex: IndexNode; +export const invocationLocalIndex: IndexNode; +export const drawIndex: IndexNode; diff --git a/types/three/src/nodes/core/InspectorNode.d.ts b/types/three/src/nodes/core/InspectorNode.d.ts new file mode 100644 index 00000000000000..93ec3d69f0a8c4 --- /dev/null +++ b/types/three/src/nodes/core/InspectorNode.d.ts @@ -0,0 +1,16 @@ +import Node from "./Node.js"; + +declare class InspectorNode extends Node { + constructor(node: Node, name?: string, callback?: (node: Node) => Node); +} + +export default InspectorNode; + +export function inspector(node: T, name?: string, callback?: (node: T) => Node): T; + +declare module "../Nodes.js" { + interface Node { + toInspector: (name?: string, callback?: (node: this) => Node) => this; + toInspectorAssign: (name?: string, callback?: (node: this) => Node) => this; + } +} diff --git a/types/three/src/nodes/core/IsolateNode.d.ts b/types/three/src/nodes/core/IsolateNode.d.ts new file mode 100644 index 00000000000000..d466d2a8bcc560 --- /dev/null +++ b/types/three/src/nodes/core/IsolateNode.d.ts @@ -0,0 +1,36 @@ +import Node from "./Node.js"; +import NodeCache from "./NodeCache.js"; + +declare class IsolateNode extends Node { + node: Node; + parent: boolean; + + readonly isIsolateNode: true; + + constructor(node: Node, parent?: boolean); +} + +export default IsolateNode; + +export const isolate: (node: Node) => IsolateNode; + +/** + * @deprecated "cache()" has been deprecated. Use "isolate()" instead. + */ +export const cache: (node: Node, cache?: NodeCache) => IsolateNode; + +declare module "../Nodes.js" { + interface Node { + /** + * @deprecated "cache()" has been deprecated. Use "isolate()" instead. + */ + cache: (cache?: NodeCache) => IsolateNode; + /** + * @deprecated "cache()" has been deprecated. Use "isolate()" instead. + */ + cacheAssign: (cache?: NodeCache) => this; + + isolate: () => IsolateNode; + isolateAssign: () => this; + } +} diff --git a/types/three/src/nodes/core/MRTNode.d.ts b/types/three/src/nodes/core/MRTNode.d.ts index ef223da73bee83..76bd089f76b089 100644 --- a/types/three/src/nodes/core/MRTNode.d.ts +++ b/types/three/src/nodes/core/MRTNode.d.ts @@ -1,6 +1,5 @@ import { Texture } from "../../textures/Texture.js"; import { Node } from "../Nodes.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import OutputStructNode from "./OutputStructNode.js"; export function getTextureIndex(textures: ReadonlyArray, name: string): number; @@ -14,11 +13,11 @@ declare class MRTNode extends OutputStructNode { has(name: string): boolean; - get(name: string): Node; + get: (name: string) => Node; - merge(mrtNode: MRTNode): ShaderNodeObject; + merge(mrtNode: MRTNode): MRTNode; } export default MRTNode; -export const mrt: (outputNodes: { [name: string]: Node }) => ShaderNodeObject; +export const mrt: (outputNodes: { [name: string]: Node }) => MRTNode; diff --git a/types/three/src/nodes/core/Node.d.ts b/types/three/src/nodes/core/Node.d.ts index 948bace5648a76..ab64d6332de653 100644 --- a/types/three/src/nodes/core/Node.d.ts +++ b/types/three/src/nodes/core/Node.d.ts @@ -57,6 +57,11 @@ interface NodeJSONOutputData { images?: unknown[]; nodes?: NodeJSONOutputData[]; } +export interface NodeChild { + property: string; + index?: number | string; + childNode: Node; +} /** * Base class for all nodes. * @@ -72,6 +77,7 @@ declare class Node extends EventDispatcher<{ updateAfterType: NodeUpdateType; uuid: string; version: number; + name: string | null; _cacheKey: number | null; _cacheKeyVersion: number; global: boolean; @@ -180,13 +186,22 @@ declare class Node extends EventDispatcher<{ * @param {traverseCallback} callback - A callback that is executed per node. */ traverse(callback: (node: Node) => void): void; + /** + * Returns the child nodes of this node. + * + * @private + * @param {Set} [ignores=new Set()] - A set of nodes to ignore during the search to avoid circular references. + * @returns {Array} An array of objects describing the child nodes. + */ + _getChildren(ignores?: Set): NodeChild[]; /** * Returns the cache key for this node. * * @param {boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced. + * @param {Set} [ignores=null] - A set of nodes to ignore during the computation of the cache key. * @return {number} The cache key of the node. */ - getCacheKey(force?: boolean): number; + getCacheKey(force?: boolean, ignores?: Set | null): number; /** * Generate a custom cache key for this node. * @@ -320,6 +335,7 @@ declare class Node extends EventDispatcher<{ * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). */ update(frame: NodeFrame): void; + before(node: Node): this; /** * This method performs the build of a node. The behavior and return value depend on the current build stage: * - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant. @@ -336,7 +352,7 @@ declare class Node extends EventDispatcher<{ * * @return {Generator} An iterable list of serialized child objects as JSON. */ - getSerializeChildren(): Generator; + getSerializeChildren(): NodeChild[]; /** * Serializes the node to JSON. * diff --git a/types/three/src/nodes/core/NodeUtils.d.ts b/types/three/src/nodes/core/NodeUtils.d.ts index bdaa4b2f6675d6..e359fe59d3c604 100644 --- a/types/three/src/nodes/core/NodeUtils.d.ts +++ b/types/three/src/nodes/core/NodeUtils.d.ts @@ -6,20 +6,10 @@ import { Vector3 } from "../../math/Vector3.js"; import { Vector4 } from "../../math/Vector4.js"; import Node from "./Node.js"; -export interface NodeChild { - property: string; - index?: number | string; - childNode: Node; -} - export const hashString: (str: string) => number; export const hashArray: (array: number[]) => number; export const hash: (...params: number[]) => number; -export function getCacheKey(object: Node, force?: boolean): number; - -export function getNodeChildren(object: Node): Generator; - export function getTypeFromLength(length: number): string | undefined; export function getLengthFromType(type: string): number | undefined; diff --git a/types/three/src/nodes/core/OutputStructNode.d.ts b/types/three/src/nodes/core/OutputStructNode.d.ts index 5a7fc6e7bffb3c..ea461a87b4728c 100644 --- a/types/three/src/nodes/core/OutputStructNode.d.ts +++ b/types/three/src/nodes/core/OutputStructNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; export default class OutputStructNode extends Node { @@ -9,4 +8,4 @@ export default class OutputStructNode extends Node { constructor(...members: Node[]); } -export const outputStruct: (...members: Node[]) => ShaderNodeObject; +export const outputStruct: (...members: Node[]) => OutputStructNode; diff --git a/types/three/src/nodes/core/ParameterNode.d.ts b/types/three/src/nodes/core/ParameterNode.d.ts index 02629dbf5dca06..d00ab02af0753a 100644 --- a/types/three/src/nodes/core/ParameterNode.d.ts +++ b/types/three/src/nodes/core/ParameterNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import PropertyNode from "./PropertyNode.js"; declare class ParameterNode extends PropertyNode { @@ -9,4 +8,4 @@ declare class ParameterNode extends PropertyNode { export default ParameterNode; -export const parameter: (type: string, name?: string | null) => ShaderNodeObject; +export const parameter: (type: string, name?: string | null) => ParameterNode; diff --git a/types/three/src/nodes/core/PropertyNode.d.ts b/types/three/src/nodes/core/PropertyNode.d.ts index b365d107bfdff9..1f9ad51150d1fc 100644 --- a/types/three/src/nodes/core/PropertyNode.d.ts +++ b/types/three/src/nodes/core/PropertyNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; export default class PropertyNode extends Node { @@ -10,34 +9,34 @@ export default class PropertyNode extends Node { constructor(nodeType?: string | null, name?: string | null, varying?: boolean); } -export const property: (type?: string | null, name?: string | null) => ShaderNodeObject; -export const varyingProperty: (type?: string | null, name?: string | null) => ShaderNodeObject; +export const property: (type?: string | null, name?: string | null) => PropertyNode; +export const varyingProperty: (type?: string | null, name?: string | null) => PropertyNode; -export const diffuseColor: ShaderNodeObject; -export const emissive: ShaderNodeObject; -export const roughness: ShaderNodeObject; -export const metalness: ShaderNodeObject; -export const clearcoat: ShaderNodeObject; -export const clearcoatRoughness: ShaderNodeObject; -export const sheen: ShaderNodeObject; -export const sheenRoughness: ShaderNodeObject; -export const iridescence: ShaderNodeObject; -export const iridescenceIOR: ShaderNodeObject; -export const iridescenceThickness: ShaderNodeObject; -export const alphaT: ShaderNodeObject; -export const anisotropy: ShaderNodeObject; -export const anisotropyT: ShaderNodeObject; -export const anisotropyB: ShaderNodeObject; -export const specularColor: ShaderNodeObject; -export const specularF90: ShaderNodeObject; -export const shininess: ShaderNodeObject; -export const output: ShaderNodeObject; -export const dashSize: ShaderNodeObject; -export const gapSize: ShaderNodeObject; -export const pointWidth: ShaderNodeObject; -export const ior: ShaderNodeObject; -export const transmission: ShaderNodeObject; -export const thickness: ShaderNodeObject; -export const attenuationDistance: ShaderNodeObject; -export const attenuationColor: ShaderNodeObject; -export const dispersion: ShaderNodeObject; +export const diffuseColor: PropertyNode; +export const emissive: PropertyNode; +export const roughness: PropertyNode; +export const metalness: PropertyNode; +export const clearcoat: PropertyNode; +export const clearcoatRoughness: PropertyNode; +export const sheen: PropertyNode; +export const sheenRoughness: PropertyNode; +export const iridescence: PropertyNode; +export const iridescenceIOR: PropertyNode; +export const iridescenceThickness: PropertyNode; +export const alphaT: PropertyNode; +export const anisotropy: PropertyNode; +export const anisotropyT: PropertyNode; +export const anisotropyB: PropertyNode; +export const specularColor: PropertyNode; +export const specularF90: PropertyNode; +export const shininess: PropertyNode; +export const output: PropertyNode; +export const dashSize: PropertyNode; +export const gapSize: PropertyNode; +export const pointWidth: PropertyNode; +export const ior: PropertyNode; +export const transmission: PropertyNode; +export const thickness: PropertyNode; +export const attenuationDistance: PropertyNode; +export const attenuationColor: PropertyNode; +export const dispersion: PropertyNode; diff --git a/types/three/src/nodes/core/StackNode.d.ts b/types/three/src/nodes/core/StackNode.d.ts index ff75333eba706f..52f31da83735ce 100644 --- a/types/three/src/nodes/core/StackNode.d.ts +++ b/types/three/src/nodes/core/StackNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; declare class StackNode extends Node { @@ -8,8 +7,6 @@ declare class StackNode extends Node { constructor(); - add(node: Node): this; - If(boolNode: Node, method: () => void): this; ElseIf(boolNode: Node, method: () => void): this; @@ -25,4 +22,4 @@ declare class StackNode extends Node { export default StackNode; -export const stack: () => ShaderNodeObject; +export const stack: () => StackNode; diff --git a/types/three/src/nodes/core/StructNode.d.ts b/types/three/src/nodes/core/StructNode.d.ts index f677ceffe48586..83ff8f95cac80f 100644 --- a/types/three/src/nodes/core/StructNode.d.ts +++ b/types/three/src/nodes/core/StructNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; import StructTypeNode, { MembersLayout } from "./StructTypeNode.js"; @@ -11,9 +10,9 @@ declare class StructNode extends Node { export default StructNode; export interface Struct { - (): ShaderNodeObject; - (values: Node[]): ShaderNodeObject; - (...values: Node[]): ShaderNodeObject; + (): StructNode; + (values: Node[]): StructNode; + (...values: Node[]): StructNode; layout: StructTypeNode; isStruct: true; } diff --git a/types/three/src/nodes/core/SubBuildNode.d.ts b/types/three/src/nodes/core/SubBuildNode.d.ts index 66fff27e463ba2..c4707c2b8c0ded 100644 --- a/types/three/src/nodes/core/SubBuildNode.d.ts +++ b/types/three/src/nodes/core/SubBuildNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; declare class SubBuildNode extends Node { @@ -12,4 +11,4 @@ declare class SubBuildNode extends Node { export default SubBuildNode; -export const subBuild: (node: Node, name: string, type?: string | null) => ShaderNodeObject; +export const subBuild: (node: Node, name: string, type?: string | null) => SubBuildNode; diff --git a/types/three/src/nodes/core/UniformNode.d.ts b/types/three/src/nodes/core/UniformNode.d.ts index 53f2f181c30390..4d6a41738def7a 100644 --- a/types/three/src/nodes/core/UniformNode.d.ts +++ b/types/three/src/nodes/core/UniformNode.d.ts @@ -27,7 +27,7 @@ declare class UniformNode extends InputNode { * @param {string} name - The name of the uniform. * @return {UniformNode} A reference to this node. */ - setName(name: string): this; + setName: (name: string) => this; /** * Sets the {@link UniformNode#name} property. * @@ -35,7 +35,7 @@ declare class UniformNode extends InputNode { * @param {string} name - The name of the uniform. * @return {UniformNode} A reference to this node. */ - label(name: string): this; + label: (name: string) => this; /** * Sets the {@link UniformNode#groupNode} property. * @@ -71,7 +71,4 @@ export default UniformNode; * @param {string} [type] - The node type. If no explicit type is defined, the node tries to derive the type from its value. * @returns {UniformNode} */ -export declare const uniform: ( - value: InputNode | TValue, - type?: Node | string, -) => import("../tsl/TSLCore.js").ShaderNodeObject>; +export declare const uniform: (value: InputNode | TValue, type?: Node | string) => UniformNode; diff --git a/types/three/src/nodes/core/VarNode.d.ts b/types/three/src/nodes/core/VarNode.d.ts index 58dd5f401f5dbb..55fe3c46bcc694 100644 --- a/types/three/src/nodes/core/VarNode.d.ts +++ b/types/three/src/nodes/core/VarNode.d.ts @@ -1,4 +1,3 @@ -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; declare class VarNode extends Node { @@ -19,16 +18,21 @@ declare class VarNode extends Node { export default VarNode; -export const Var: (node: Node, name?: string | null) => ShaderNodeObject; +export const Var: (node: Node, name?: string | null) => VarNode; -export const Const: (node: Node, name?: string | null) => ShaderNodeObject; +export const Const: (node: Node, name?: string | null) => VarNode; export const VarIntent: (node: Node) => Node; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - toVar: (node: Node, name?: string | null) => ShaderNodeObject; - toConst: (node: Node, name?: string | null) => ShaderNodeObject; - toVarIntent: (node: Node) => Node; +declare module "../Nodes.js" { + interface Node { + toVar: (name?: string | null) => VarNode; + toVarAssign: (name?: string | null) => this; + + toConst: (name?: string | null) => VarNode; + toConstAssign: (name?: string | null) => this; + + toVarIntent: () => Node; + toVarIntentAssign: () => this; } } diff --git a/types/three/src/nodes/core/VaryingNode.d.ts b/types/three/src/nodes/core/VaryingNode.d.ts index 966c0f6397dfba..218cfcedddebeb 100644 --- a/types/three/src/nodes/core/VaryingNode.d.ts +++ b/types/three/src/nodes/core/VaryingNode.d.ts @@ -1,5 +1,4 @@ import { InterpolationSamplingMode, InterpolationSamplingType } from "../../constants.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import Node from "./Node.js"; import NodeBuilder from "./NodeBuilder.js"; import NodeVarying from "./NodeVarying.js"; @@ -18,22 +17,25 @@ export default class VaryingNode extends Node { setupVarying(builder: NodeBuilder): NodeVarying; } -export const varying: (node: Node, name?: string) => ShaderNodeObject; +export const varying: (node: Node, name?: string) => VaryingNode; -export const vertexStage: (node: Node) => ShaderNodeObject; +export const vertexStage: (node: Node) => VaryingNode; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - toVarying: typeof varying; - toVertexStage: typeof vertexStage; +declare module "../Nodes.js" { + interface Node { + toVarying: (name?: string) => VaryingNode; + toVaryingAssign: (name?: string) => this; + + toVertexStage: () => VaryingNode; + toVertexStageAssign: () => this; /** - * @deprecated .varying() has been renamed to .toVarying(). + * @deprecated .vertexStage() has been renamed to .toVertexStage(). */ - varying: typeof varying; + vertexStage: () => VaryingNode; /** * @deprecated .vertexStage() has been renamed to .toVertexStage(). */ - vertexStage: typeof vertexStage; + vertexStageAssign: () => this; } } diff --git a/types/three/src/nodes/display/BlendModes.d.ts b/types/three/src/nodes/display/BlendModes.d.ts index b2f60dda31896f..e0a56b78a937ef 100644 --- a/types/three/src/nodes/display/BlendModes.d.ts +++ b/types/three/src/nodes/display/BlendModes.d.ts @@ -1,36 +1,35 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const blendBurn: (base: Node, blend: Node) => ShaderNodeObject; +export const blendBurn: (base: Node, blend: Node) => Node; -export const blendDodge: (base: Node, blend: Node) => ShaderNodeObject; +export const blendDodge: (base: Node, blend: Node) => Node; -export const blendScreen: (base: Node, blend: Node) => ShaderNodeObject; +export const blendScreen: (base: Node, blend: Node) => Node; -export const blendOverlay: (base: Node, blend: Node) => ShaderNodeObject; +export const blendOverlay: (base: Node, blend: Node) => Node; -export const blendColor: (base: Node, blend: Node) => ShaderNodeObject; +export const blendColor: (base: Node, blend: Node) => Node; -export const premultiplyAlpha: (color: Node) => ShaderNodeObject; +export const premultiplyAlpha: (color: Node) => Node; -export const unpremultiplyAlpha: (color: Node) => ShaderNodeObject; +export const unpremultiplyAlpha: (color: Node) => Node; /** * @deprecated */ -export const burn: (base: Node, blend: Node) => ShaderNodeObject; +export const burn: (base: Node, blend: Node) => Node; /** * @deprecated */ -export const dodge: (base: Node, blend: Node) => ShaderNodeObject; +export const dodge: (base: Node, blend: Node) => Node; /** * @deprecated */ -export const screen: (base: Node, blend: Node) => ShaderNodeObject; +export const screen: (base: Node, blend: Node) => Node; /** * @deprecated */ -export const overlay: (base: Node, blend: Node) => ShaderNodeObject; +export const overlay: (base: Node, blend: Node) => Node; diff --git a/types/three/src/nodes/display/BumpMapNode.d.ts b/types/three/src/nodes/display/BumpMapNode.d.ts index 338e6c20f39643..376d541c6b25db 100644 --- a/types/three/src/nodes/display/BumpMapNode.d.ts +++ b/types/three/src/nodes/display/BumpMapNode.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class BumpMapNode extends TempNode { textureNode: Node; @@ -14,4 +13,4 @@ export default BumpMapNode; export const bumpMap: ( textureNode: Node, scaleNode?: Node | null, -) => ShaderNodeObject; +) => BumpMapNode; diff --git a/types/three/src/nodes/display/ColorAdjustment.d.ts b/types/three/src/nodes/display/ColorAdjustment.d.ts index d1c04ef2bf205d..612ffb0c22b899 100644 --- a/types/three/src/nodes/display/ColorAdjustment.d.ts +++ b/types/three/src/nodes/display/ColorAdjustment.d.ts @@ -1,30 +1,29 @@ import Node from "../core/Node.js"; import MathNode from "../math/MathNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const grayscale: (color: Node) => ShaderNodeObject; +export const grayscale: (color: Node) => Node; export const saturation: ( color: Node, adjustment?: Node | number, -) => ShaderNodeObject; +) => Node; export const vibrance: ( color: Node, adjustment?: Node | number, -) => ShaderNodeObject; +) => Node; export const hue: ( color: Node, adjustment?: Node | number, -) => ShaderNodeObject; +) => Node; export const luminance: ( color: Node, luminanceCoefficients?: Node, -) => ShaderNodeObject; +) => MathNode; -export const threshold: (color: Node, thershold: Node) => ShaderNodeObject; +export const threshold: (color: Node, thershold: Node) => MathNode; /** * Color Decision List (CDL) v1.2 @@ -53,4 +52,4 @@ export const cdl: ( power?: Node, saturation?: Node, luminanceCoefficients?: Node, -) => ShaderNodeObject; +) => Node; diff --git a/types/three/src/nodes/display/ColorSpaceFunctions.d.ts b/types/three/src/nodes/display/ColorSpaceFunctions.d.ts index 636f00100a3f1b..830397f73c3e73 100644 --- a/types/three/src/nodes/display/ColorSpaceFunctions.d.ts +++ b/types/three/src/nodes/display/ColorSpaceFunctions.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const sRGBTransferEOTF: (color: Node) => ShaderNodeObject; +export const sRGBTransferEOTF: (color: Node) => Node; -export const sRGBTransferOETF: (color: Node) => ShaderNodeObject; +export const sRGBTransferOETF: (color: Node) => Node; diff --git a/types/three/src/nodes/display/ColorSpaceNode.d.ts b/types/three/src/nodes/display/ColorSpaceNode.d.ts index 982056d021d671..b193155616d5c6 100644 --- a/types/three/src/nodes/display/ColorSpaceNode.d.ts +++ b/types/three/src/nodes/display/ColorSpaceNode.d.ts @@ -2,7 +2,6 @@ import { LinearSRGBColorSpace, SRGBColorSpace } from "../../constants.js"; import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type WorkingOrOutputColorSpace = "WorkingColorSpace" | "OutputColorSpace"; @@ -30,21 +29,32 @@ export default class ColorSpaceNode extends TempNode { export const workingToColorSpace: ( node: Node, targetColorSpace: string, -) => ShaderNodeObject; +) => ColorSpaceNode; export const colorSpaceToWorking: ( node: Node, sourceColorSpace: string, -) => ShaderNodeObject; +) => ColorSpaceNode; export const convertColorSpace: ( node: Node, sourceColorSpace: string, targetColorSpace: string, -) => ShaderNodeObject; - -declare module "../tsl/TSLCore.js" { - interface NodeElements { - workingToColorSpace: typeof workingToColorSpace; - colorSpaceToWorking: typeof colorSpaceToWorking; +) => ColorSpaceNode; + +declare module "../Nodes.js" { + interface Node { + workingToColorSpace: ( + targetColorSpace: string, + ) => ColorSpaceNode; + workingToColorSpaceAssign: ( + targetColorSpace: string, + ) => this; + + colorSpaceToWorking: ( + sourceColorSpace: string, + ) => ColorSpaceNode; + colorSpaceToWorkingAssign: ( + sourceColorSpace: string, + ) => this; } } diff --git a/types/three/src/nodes/display/FrontFacingNode.d.ts b/types/three/src/nodes/display/FrontFacingNode.d.ts index 6f2c2e34f5725d..b4398515e4b97a 100644 --- a/types/three/src/nodes/display/FrontFacingNode.d.ts +++ b/types/three/src/nodes/display/FrontFacingNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class FrontFacingNode extends Node { isFrontFacingNode: true; @@ -8,6 +7,6 @@ declare class FrontFacingNode extends Node { export default FrontFacingNode; -export const frontFacing: ShaderNodeObject; -export const faceDirection: ShaderNodeObject; -export const directionToFaceDirection: (direction: Node) => ShaderNodeObject; +export const frontFacing: FrontFacingNode; +export const faceDirection: Node; +export const directionToFaceDirection: (direction: Node) => Node; diff --git a/types/three/src/nodes/display/NormalMapNode.d.ts b/types/three/src/nodes/display/NormalMapNode.d.ts index d06459502994db..bcade5b8a2f1ae 100644 --- a/types/three/src/nodes/display/NormalMapNode.d.ts +++ b/types/three/src/nodes/display/NormalMapNode.d.ts @@ -1,7 +1,6 @@ import { NormalMapTypes } from "../../constants.js"; import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class NormalMapNode extends TempNode { node: Node; @@ -14,4 +13,4 @@ declare class NormalMapNode extends TempNode { export default NormalMapNode; -export const normalMap: (node: Node, scaleNode?: Node) => ShaderNodeObject; +export const normalMap: (node: Node, scaleNode?: Node) => NormalMapNode; diff --git a/types/three/src/nodes/display/PassNode.d.ts b/types/three/src/nodes/display/PassNode.d.ts index c8c15d8cfd4940..a00eb337fb8e80 100644 --- a/types/three/src/nodes/display/PassNode.d.ts +++ b/types/three/src/nodes/display/PassNode.d.ts @@ -1,15 +1,14 @@ import { Camera } from "../../cameras/Camera.js"; import { Layers } from "../../core/Layers.js"; +import { Object3D } from "../../core/Object3D.js"; import { RenderTarget, RenderTargetOptions } from "../../core/RenderTarget.js"; import { Vector4 } from "../../math/Vector4.js"; import Renderer from "../../renderers/common/Renderer.js"; -import { Scene } from "../../scenes/Scene.js"; import { Texture } from "../../textures/Texture.js"; import TextureNode from "../accessors/TextureNode.js"; import MRTNode from "../core/MRTNode.js"; import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class PassTextureNode extends TextureNode { passNode: PassNode; @@ -28,17 +27,27 @@ declare class PassMultipleTextureNode extends PassTextureNode { declare class PassNode extends TempNode { scope: PassNodeScope; - scene: Scene; + scene: Object3D; camera: Camera; renderTarget: RenderTarget; readonly isPassNode: true; - constructor(scope: PassNodeScope, scene: Scene, camera: Camera, options?: RenderTargetOptions); + constructor(scope: PassNodeScope, scene: Object3D, camera: Camera, options?: RenderTargetOptions); + setResolutionScale(resolution: number): this; + + getResolutionScale(): number; + + /** + * @deprecated Use {@link PassNode#setResolutionScale `setResolutionScale()`} instead. + */ setResolution(resolution: number): this; + /** + * @deprecated Use {@link PassNode#getResolutionScale `getResolutionScale()`} instead. + */ getResolution(): number; setLayers(layers: Layers): this; @@ -55,13 +64,13 @@ declare class PassNode extends TempNode { toggleTexture(name: string): void; - getTextureNode(name?: string): ShaderNodeObject; + getTextureNode(name?: string): TextureNode; - getPreviousTextureNode(name?: string): ShaderNodeObject; + getPreviousTextureNode(name?: string): Node; - getViewZNode(name?: string): ShaderNodeObject; + getViewZNode(name?: string): Node; - getLinearDepthNode(name?: string): ShaderNodeObject; + getLinearDepthNode(name?: string): Node; compileAsync(renderer: Renderer): Promise; @@ -85,6 +94,6 @@ export type PassNodeScope = typeof PassNode.COLOR | typeof PassNode.DEPTH; export default PassNode; -export const pass: (scene: Scene, camera: Camera, options?: RenderTargetOptions) => ShaderNodeObject; -export const passTexture: (pass: PassNode, texture: Texture) => ShaderNodeObject; -export const depthPass: (scene: Scene, camera: Camera, options?: RenderTargetOptions) => ShaderNodeObject; +export const pass: (scene: Object3D, camera: Camera, options?: RenderTargetOptions) => PassNode; +export const passTexture: (pass: PassNode, texture: Texture) => PassTextureNode; +export const depthPass: (scene: Object3D, camera: Camera, options?: RenderTargetOptions) => PassNode; diff --git a/types/three/src/nodes/display/PosterizeNode.d.ts b/types/three/src/nodes/display/PosterizeNode.d.ts index ee310e13fb7ad0..9c3dd1bce4676f 100644 --- a/types/three/src/nodes/display/PosterizeNode.d.ts +++ b/types/three/src/nodes/display/PosterizeNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class PosterizeNode extends Node { sourceNode: Node; @@ -11,4 +10,4 @@ export default class PosterizeNode extends Node { export const posterize: ( sourceNode: Node, stepsNode: Node | number, -) => ShaderNodeObject; +) => PosterizeNode; diff --git a/types/three/src/nodes/display/RenderOutputNode.d.ts b/types/three/src/nodes/display/RenderOutputNode.d.ts index 1a8e5f83aefc20..5762c657d103c4 100644 --- a/types/three/src/nodes/display/RenderOutputNode.d.ts +++ b/types/three/src/nodes/display/RenderOutputNode.d.ts @@ -1,11 +1,9 @@ import { ToneMapping } from "../../constants.js"; import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class RenderOutputNode extends TempNode { colorNode: Node; - toneMapping: ToneMapping | null; outputColorSpace: string | null; readonly isRenderOutput: true; @@ -19,10 +17,17 @@ export const renderOutput: ( color: Node, toneMapping?: ToneMapping | null, outputColorSpace?: string | null, -) => ShaderNodeObject; +) => RenderOutputNode; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - renderOutput: typeof renderOutput; +declare module "../Nodes.js" { + interface Node { + renderOutput: ( + toneMapping?: ToneMapping | null, + outputColorSpace?: string | null, + ) => RenderOutputNode; + renderOutputAssign: ( + toneMapping?: ToneMapping | null, + outputColorSpace?: string | null, + ) => this; } } diff --git a/types/three/src/nodes/display/ScreenNode.d.ts b/types/three/src/nodes/display/ScreenNode.d.ts index 64ddc23a0c3e1a..4bd121ea22f019 100644 --- a/types/three/src/nodes/display/ScreenNode.d.ts +++ b/types/three/src/nodes/display/ScreenNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type ScreenNodeScope = | typeof ScreenNode.COORDINATE @@ -26,21 +25,21 @@ export default ScreenNode; // Screen -export const screenDPR: ShaderNodeObject; -export const screenUV: ShaderNodeObject; -export const screenSize: ShaderNodeObject; -export const screenCoordinate: ShaderNodeObject; +export const screenDPR: ScreenNode; +export const screenUV: ScreenNode; +export const screenSize: ScreenNode; +export const screenCoordinate: ScreenNode; // Viewport -export const viewport: ShaderNodeObject; -export const viewportSize: ShaderNodeObject; -export const viewportCoordinate: ShaderNodeObject; -export const viewportUV: ShaderNodeObject; +export const viewport: ScreenNode; +export const viewportSize: Node; +export const viewportCoordinate: Node; +export const viewportUV: Node; // Deprecated /** * @deprecated "viewportResolution" is deprecated. Use "screenSize" instead. */ -export const viewportResolution: ShaderNodeObject; +export const viewportResolution: ScreenNode; diff --git a/types/three/src/nodes/display/ToneMappingFunctions.d.ts b/types/three/src/nodes/display/ToneMappingFunctions.d.ts index 9c99cb008b8af7..c73d55cbc48277 100644 --- a/types/three/src/nodes/display/ToneMappingFunctions.d.ts +++ b/types/three/src/nodes/display/ToneMappingFunctions.d.ts @@ -1,14 +1,13 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const linearToneMapping: (color: Node, exposure: Node) => ShaderNodeObject; +export const linearToneMapping: (color: Node, exposure: Node) => Node; -export const reinhardToneMapping: (color: Node, exposure: Node) => ShaderNodeObject; +export const reinhardToneMapping: (color: Node, exposure: Node) => Node; -export const cineonToneMapping: (color: Node, exposure: Node) => ShaderNodeObject; +export const cineonToneMapping: (color: Node, exposure: Node) => Node; -export const acesFilmicToneMapping: (color: Node, exposure: Node) => ShaderNodeObject; +export const acesFilmicToneMapping: (color: Node, exposure: Node) => Node; -export const agxToneMapping: (color: Node, exposure: Node) => ShaderNodeObject; +export const agxToneMapping: (color: Node, exposure: Node) => Node; -export const neutralToneMapping: (color: Node, exposure: Node) => ShaderNodeObject; +export const neutralToneMapping: (color: Node, exposure: Node) => Node; diff --git a/types/three/src/nodes/display/ToneMappingNode.d.ts b/types/three/src/nodes/display/ToneMappingNode.d.ts index 090b481f05995c..d8ae7fda350d7e 100644 --- a/types/three/src/nodes/display/ToneMappingNode.d.ts +++ b/types/three/src/nodes/display/ToneMappingNode.d.ts @@ -2,10 +2,8 @@ import { ToneMapping } from "../../constants.js"; import RendererReferenceNode from "../accessors/RendererReferenceNode.js"; import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ToneMappingNode extends TempNode { - toneMapping: ToneMapping; exposureNode: Node; colorNode: Node | null; @@ -18,15 +16,18 @@ export const toneMapping: ( mapping: ToneMapping, exposure: Node | number, color?: Node, -) => ShaderNodeObject; -export const toneMappingExposure: ShaderNodeObject; +) => ToneMappingNode; +export const toneMappingExposure: RendererReferenceNode; -declare module "../tsl/TSLCore.js" { - interface NodeElements { +declare module "../Nodes.js" { + interface Node { toneMapping: ( - color: Node, mapping?: ToneMapping, exposure?: Node | number, - ) => ShaderNodeObject; + ) => ToneMappingNode; + toneMappingAssign: ( + mapping?: ToneMapping, + exposure?: Node | number, + ) => this; } } diff --git a/types/three/src/nodes/display/ToonOutlinePassNode.d.ts b/types/three/src/nodes/display/ToonOutlinePassNode.d.ts index fe556b50561782..284b98815f7b5d 100644 --- a/types/three/src/nodes/display/ToonOutlinePassNode.d.ts +++ b/types/three/src/nodes/display/ToonOutlinePassNode.d.ts @@ -2,7 +2,6 @@ import { Camera } from "../../cameras/Camera.js"; import { Color } from "../../math/Color.js"; import { Scene } from "../../scenes/Scene.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import PassNode from "./PassNode.js"; declare class ToonOutlinePassNode extends PassNode { @@ -21,4 +20,4 @@ export const toonOutlinePass: ( color?: Color, thickness?: number, alpha?: number, -) => ShaderNodeObject; +) => ToonOutlinePassNode; diff --git a/types/three/src/nodes/display/ViewportDepthNode.d.ts b/types/three/src/nodes/display/ViewportDepthNode.d.ts index 1a3043d4b4e8e8..fe601cd5aafcf5 100644 --- a/types/three/src/nodes/display/ViewportDepthNode.d.ts +++ b/types/three/src/nodes/display/ViewportDepthNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ViewportDepthNode extends Node { scope: ViewportDepthNodeScope; @@ -33,6 +32,6 @@ export const viewZToLogarithmicDepth: (viewZ: Node, near: Node, far: Node) => No export const logarithmicDepthToViewZ: (depth: Node, near: Node, far: Node) => Node; -export const depth: ShaderNodeObject; -export const linearDepth: (valueNode?: Node | null) => ShaderNodeObject; -export const viewportLinearDepth: ShaderNodeObject; +export const depth: ViewportDepthNode; +export const linearDepth: (valueNode?: Node | null) => ViewportDepthNode; +export const viewportLinearDepth: ViewportDepthNode; diff --git a/types/three/src/nodes/display/ViewportDepthTextureNode.d.ts b/types/three/src/nodes/display/ViewportDepthTextureNode.d.ts index 77b6920de2cfa0..87d2b7eaaf69c1 100644 --- a/types/three/src/nodes/display/ViewportDepthTextureNode.d.ts +++ b/types/three/src/nodes/display/ViewportDepthTextureNode.d.ts @@ -1,6 +1,5 @@ import { DepthTexture } from "../../textures/DepthTexture.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import ViewportTextureNode from "./ViewportTextureNode.js"; declare class ViewportDepthTextureNode extends ViewportTextureNode { @@ -14,4 +13,4 @@ export default ViewportDepthTextureNode; export const viewportDepthTexture: ( uvNode?: Node, levelNode?: Node, -) => ShaderNodeObject; +) => ViewportDepthTextureNode; diff --git a/types/three/src/nodes/display/ViewportSharedTextureNode.d.ts b/types/three/src/nodes/display/ViewportSharedTextureNode.d.ts index 8be4d9b6cc4682..fe461792b8c905 100644 --- a/types/three/src/nodes/display/ViewportSharedTextureNode.d.ts +++ b/types/three/src/nodes/display/ViewportSharedTextureNode.d.ts @@ -1,6 +1,5 @@ import { FramebufferTexture } from "../../textures/FramebufferTexture.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import ViewportTextureNode from "./ViewportTextureNode.js"; declare class ViewportSharedTextureNode extends ViewportTextureNode { @@ -14,4 +13,4 @@ export default ViewportSharedTextureNode; export const viewportSharedTexture: ( uvNode?: Node, levelNode?: Node | null, -) => ShaderNodeObject; +) => ViewportSharedTextureNode; diff --git a/types/three/src/nodes/display/ViewportTextureNode.d.ts b/types/three/src/nodes/display/ViewportTextureNode.d.ts index 1e6f67e5c5c8e4..02625fc0f3c3e3 100644 --- a/types/three/src/nodes/display/ViewportTextureNode.d.ts +++ b/types/three/src/nodes/display/ViewportTextureNode.d.ts @@ -4,7 +4,6 @@ import { Texture } from "../../textures/Texture.js"; import TextureNode from "../accessors/TextureNode.js"; import { NodeUpdateType } from "../core/constants.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ViewportTextureNode extends TextureNode { generateMipmaps: boolean; @@ -24,9 +23,9 @@ 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; diff --git a/types/three/src/nodes/fog/Fog.d.ts b/types/three/src/nodes/fog/Fog.d.ts index 159ed17008c7f9..4424e72b4abb9d 100644 --- a/types/three/src/nodes/fog/Fog.d.ts +++ b/types/three/src/nodes/fog/Fog.d.ts @@ -1,11 +1,10 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const rangeFogFactor: (near: Node | number, far: Node | number) => ShaderNodeObject; +export const rangeFogFactor: (near: Node | number, far: Node | number) => Node; -export const densityFogFactor: (density: Node) => ShaderNodeObject; +export const densityFogFactor: (density: Node) => Node; -export const fog: (color: Node, factor: Node) => ShaderNodeObject; +export const fog: (color: Node, factor: Node) => Node; /** * @deprecated @@ -14,7 +13,7 @@ export function rangeFog( color: Node, near: Node, far: Node, -): ShaderNodeObject; +): Node; /** * @deprecated @@ -23,4 +22,4 @@ export function densityFog( color: Node, near: Node, far: Node, -): ShaderNodeObject; +): Node; diff --git a/types/three/src/nodes/functions/BSDF/BRDF_GGX.d.ts b/types/three/src/nodes/functions/BSDF/BRDF_GGX.d.ts index a22bb480a17cb9..1bcb4d1c37117b 100644 --- a/types/three/src/nodes/functions/BSDF/BRDF_GGX.d.ts +++ b/types/three/src/nodes/functions/BSDF/BRDF_GGX.d.ts @@ -1,15 +1,14 @@ import Node from "../../core/Node.js"; import OperatorNode from "../../math/OperatorNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; declare const BRDF_GGX: (args: { lightDirection: Node; f0: Node; f90: Node; roughness: Node; - f?: Node; - USE_IRIDESCENCE?: Node; - USE_ANISOTROPY?: Node; -}) => ShaderNodeObject; + f?: Node | undefined; + USE_IRIDESCENCE?: Node | undefined; + USE_ANISOTROPY?: Node | undefined; +}) => OperatorNode; export default BRDF_GGX; diff --git a/types/three/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.d.ts b/types/three/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.d.ts new file mode 100644 index 00000000000000..76955c74cd9ecc --- /dev/null +++ b/types/three/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.d.ts @@ -0,0 +1,14 @@ +import Node from "../../core/Node.js"; +import OperatorNode from "../../math/OperatorNode.js"; + +declare const BRDF_GGX_Multiscatter: (args: { + lightDirection: Node; + f0: Node; + f90: Node; + roughness: Node; + f?: Node | undefined; + USE_IRIDESCENCE?: Node | undefined; + USE_ANISOTROPY?: Node | undefined; +}) => OperatorNode; + +export default BRDF_GGX_Multiscatter; diff --git a/types/three/src/nodes/functions/BSDF/BRDF_Lambert.d.ts b/types/three/src/nodes/functions/BSDF/BRDF_Lambert.d.ts index 591fc262d0798c..031c02c1ac856f 100644 --- a/types/three/src/nodes/functions/BSDF/BRDF_Lambert.d.ts +++ b/types/three/src/nodes/functions/BSDF/BRDF_Lambert.d.ts @@ -1,7 +1,6 @@ import Node from "../../core/Node.js"; import OperatorNode from "../../math/OperatorNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -declare const BRDF_Lambert: (args: { diffuseColor: Node }) => ShaderNodeObject; +declare const BRDF_Lambert: (args: { diffuseColor: Node }) => OperatorNode; export default BRDF_Lambert; diff --git a/types/three/src/nodes/functions/BSDF/BRDF_Sheen.d.ts b/types/three/src/nodes/functions/BSDF/BRDF_Sheen.d.ts index 3e5b218e8dc9b8..4920222d314d3a 100644 --- a/types/three/src/nodes/functions/BSDF/BRDF_Sheen.d.ts +++ b/types/three/src/nodes/functions/BSDF/BRDF_Sheen.d.ts @@ -1,7 +1,6 @@ import Node from "../../core/Node.js"; import OperatorNode from "../../math/OperatorNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -declare const BRDF_Sheen: (args: { lightDirection: Node }) => ShaderNodeObject; +declare const BRDF_Sheen: (args: { lightDirection: Node }) => OperatorNode; export default BRDF_Sheen; diff --git a/types/three/src/nodes/functions/BSDF/DFGApprox.d.ts b/types/three/src/nodes/functions/BSDF/DFGApprox.d.ts index 010b70ccceb4bf..68c1c056b5a361 100644 --- a/types/three/src/nodes/functions/BSDF/DFGApprox.d.ts +++ b/types/three/src/nodes/functions/BSDF/DFGApprox.d.ts @@ -1,11 +1,10 @@ import Node from "../../core/Node.js"; import OperatorNode from "../../math/OperatorNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; // Analytical approximation of the DFG LUT, one half of the // split-sum approximation used in indirect specular lighting. // via 'environmentBRDF' from "Physically Based Shading on Mobile" // https://www.unrealengine.com/blog/physically-based-shading-on-mobile -declare const DFGApprox: (args: { roughness: Node; dotNV: Node }) => ShaderNodeObject; +declare const DFGApprox: (args: { roughness: Node; dotNV: Node }) => OperatorNode; export default DFGApprox; diff --git a/types/three/src/nodes/functions/BSDF/D_GGX.d.ts b/types/three/src/nodes/functions/BSDF/D_GGX.d.ts index 71b673c6c24cc3..363036549ee6e2 100644 --- a/types/three/src/nodes/functions/BSDF/D_GGX.d.ts +++ b/types/three/src/nodes/functions/BSDF/D_GGX.d.ts @@ -1,10 +1,9 @@ import Node from "../../core/Node.js"; import OperatorNode from "../../math/OperatorNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; // Microfacet Models for Refraction through Rough Surfaces - equation (33) // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html // alpha is "roughness squared" in Disney’s reparameterization -declare const D_GGX: (args: { alpha: Node; dotNH: Node }) => ShaderNodeObject; +declare const D_GGX: (args: { alpha: Node; dotNH: Node }) => OperatorNode; export default D_GGX; diff --git a/types/three/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts b/types/three/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts index e296ea11d54088..ce63f407b36a90 100644 --- a/types/three/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts +++ b/types/three/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts @@ -1,10 +1,9 @@ import Node from "../../core/Node.js"; import OperatorNode from "../../math/OperatorNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf declare const D_GGX_Anisotropic: ( args: { alphaT: Node; alphaB: Node; dotNH: Node; dotTH: Node; dotBH: Node }, -) => ShaderNodeObject; +) => OperatorNode; export default D_GGX_Anisotropic; diff --git a/types/three/src/nodes/functions/BSDF/F_Schlick.d.ts b/types/three/src/nodes/functions/BSDF/F_Schlick.d.ts index 46940e6a3498f5..b76474853645d8 100644 --- a/types/three/src/nodes/functions/BSDF/F_Schlick.d.ts +++ b/types/three/src/nodes/functions/BSDF/F_Schlick.d.ts @@ -1,7 +1,6 @@ import Node from "../../core/Node.js"; import OperatorNode from "../../math/OperatorNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -declare const F_Schlick: (args: { f0: Node; f90: Node; dotVH: Node }) => ShaderNodeObject; +declare const F_Schlick: (args: { f0: Node; f90: Node; dotVH: Node }) => OperatorNode; export default F_Schlick; diff --git a/types/three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts b/types/three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts index 8a7aa884d3f287..a107faa9a73225 100644 --- a/types/three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +++ b/types/three/src/nodes/functions/BSDF/Schlick_to_F0.d.ts @@ -1,10 +1,9 @@ import Node from "../../core/Node.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; declare const Schlick_to_F0: ( f: Node, f90: Node, dotVH: Node, -) => ShaderNodeObject; +) => Node; export default Schlick_to_F0; diff --git a/types/three/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts b/types/three/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts index b6c1ca80cfb1df..b663a1496780a7 100644 --- a/types/three/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +++ b/types/three/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts @@ -1,11 +1,10 @@ import Node from "../../core/Node.js"; import OperatorNode from "../../math/OperatorNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; declare const V_GGX_SmithCorrelated: (inputs: { alpha: Node; dotNL: Node; dotNV: Node; -}) => ShaderNodeObject; +}) => OperatorNode; export default V_GGX_SmithCorrelated; diff --git a/types/three/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts b/types/three/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts index 5150bf6b1db7d4..fca82ecb0ee413 100644 --- a/types/three/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts +++ b/types/three/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts @@ -1,6 +1,5 @@ import Node from "../../core/Node.js"; import MathNode from "../../math/MathNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; declare const V_GGX_SmithCorrelated: (inputs: { alphaT: Node; @@ -11,6 +10,6 @@ declare const V_GGX_SmithCorrelated: (inputs: { dotBL: Node; dotNV: Node; dotNL: Node; -}) => ShaderNodeObject; +}) => MathNode; export default V_GGX_SmithCorrelated; diff --git a/types/three/src/nodes/functions/ShadowMaskModel.d.ts b/types/three/src/nodes/functions/ShadowMaskModel.d.ts index bcdee8b5c2601e..80440ad8ae75f4 100644 --- a/types/three/src/nodes/functions/ShadowMaskModel.d.ts +++ b/types/three/src/nodes/functions/ShadowMaskModel.d.ts @@ -1,9 +1,8 @@ import LightingModel from "../core/LightingModel.js"; import VarNode from "../core/VarNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class ShadowMaskModel extends LightingModel { - shadowNode: ShaderNodeObject; + shadowNode: VarNode; constructor(); } diff --git a/types/three/src/nodes/functions/material/getAlphaHashThreshold.d.ts b/types/three/src/nodes/functions/material/getAlphaHashThreshold.d.ts index f29afd91d3377e..ecf608d48f900a 100644 --- a/types/three/src/nodes/functions/material/getAlphaHashThreshold.d.ts +++ b/types/three/src/nodes/functions/material/getAlphaHashThreshold.d.ts @@ -1,6 +1,5 @@ import Node from "../../core/Node.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -declare const getAlphaHashThreshold: (position: Node) => ShaderNodeObject; +declare const getAlphaHashThreshold: (position: Node) => Node; export default getAlphaHashThreshold; diff --git a/types/three/src/nodes/functions/material/getGeometryRoughness.d.ts b/types/three/src/nodes/functions/material/getGeometryRoughness.d.ts index dd629cee0fc77c..bbdca2d8fb6b8d 100644 --- a/types/three/src/nodes/functions/material/getGeometryRoughness.d.ts +++ b/types/three/src/nodes/functions/material/getGeometryRoughness.d.ts @@ -1,6 +1,5 @@ import MathNode from "../../math/MathNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -declare const getGeometryRoughness: () => ShaderNodeObject; +declare const getGeometryRoughness: () => MathNode; export default getGeometryRoughness; diff --git a/types/three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts b/types/three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts index edc2c6666b2d1b..3221174a4a7bf8 100644 --- a/types/three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +++ b/types/three/src/nodes/functions/material/getParallaxCorrectNormal.d.ts @@ -1,10 +1,9 @@ import Node from "../../core/Node.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; declare const getParallaxCorrectNormal: ( normal: Node, cubeSize: Node, cubePos: Node, -) => ShaderNodeObject; +) => Node; export default getParallaxCorrectNormal; diff --git a/types/three/src/nodes/functions/material/getRoughness.d.ts b/types/three/src/nodes/functions/material/getRoughness.d.ts index 7022672b02b5be..502790cc0033d1 100644 --- a/types/three/src/nodes/functions/material/getRoughness.d.ts +++ b/types/three/src/nodes/functions/material/getRoughness.d.ts @@ -1,7 +1,6 @@ import Node from "../../core/Node.js"; import MathNode from "../../math/MathNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -declare const getRoughness: (args: { roughness: Node }) => ShaderNodeObject; +declare const getRoughness: (args: { roughness: Node }) => MathNode; export default getRoughness; diff --git a/types/three/src/nodes/functions/material/getShIrradianceAt.d.ts b/types/three/src/nodes/functions/material/getShIrradianceAt.d.ts index 95c8d03c573f7a..9deec083e61c89 100644 --- a/types/three/src/nodes/functions/material/getShIrradianceAt.d.ts +++ b/types/three/src/nodes/functions/material/getShIrradianceAt.d.ts @@ -1,6 +1,5 @@ import Node from "../../core/Node.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -declare const getShIrradianceAt: (normal: Node, shCoefficients: Node) => ShaderNodeObject; +declare const getShIrradianceAt: (normal: Node, shCoefficients: Node) => Node; export default getShIrradianceAt; diff --git a/types/three/src/nodes/geometry/RangeNode.d.ts b/types/three/src/nodes/geometry/RangeNode.d.ts index 8093da6ba64d42..61a91b01424231 100644 --- a/types/three/src/nodes/geometry/RangeNode.d.ts +++ b/types/three/src/nodes/geometry/RangeNode.d.ts @@ -4,7 +4,6 @@ import { Vector3 } from "../../math/Vector3.js"; import { Vector4 } from "../../math/Vector4.js"; import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class RangeNode extends Node { minNode: Node; @@ -18,4 +17,4 @@ export default class RangeNode extends Node { export const range: ( minNode: Node | number | Color | Vector2 | Vector3 | Vector4, maxNode: Node | number | Color | Vector2 | Vector3 | Vector4, -) => ShaderNodeObject; +) => RangeNode; diff --git a/types/three/src/nodes/gpgpu/AtomicFunctionNode.d.ts b/types/three/src/nodes/gpgpu/AtomicFunctionNode.d.ts index 27f7f30fafc784..c31c5d4b0c9708 100644 --- a/types/three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +++ b/types/three/src/nodes/gpgpu/AtomicFunctionNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type AtomicMethod = | typeof AtomicFunctionNode.ATOMIC_LOAD @@ -35,48 +34,48 @@ export const atomicFunc: ( method: AtomicMethod, pointerNode: Node, valueNode: Node, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicLoad: ( pointerNode: Node, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicStore: ( pointerNode: Node, valueNode: Node | number, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicAdd: ( pointerNode: Node, valueNode: Node | number, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicSub: ( pointerNode: Node, valueNode: Node | number, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicMax: ( pointerNode: Node, valueNode: Node, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicMin: ( pointerNode: Node, valueNode: Node, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicAnd: ( pointerNode: Node, valueNode: Node, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicOr: ( pointerNode: Node, valueNode: Node, -) => ShaderNodeObject; +) => AtomicFunctionNode; export const atomicXor: ( pointerNode: Node, valueNode: Node, -) => ShaderNodeObject; +) => AtomicFunctionNode; diff --git a/types/three/src/nodes/gpgpu/BarrierNode.d.ts b/types/three/src/nodes/gpgpu/BarrierNode.d.ts index 5abf23f90a6ec7..65cb90b9e41bc5 100644 --- a/types/three/src/nodes/gpgpu/BarrierNode.d.ts +++ b/types/three/src/nodes/gpgpu/BarrierNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class BarrierNode extends Node { scope: string; @@ -7,6 +6,6 @@ declare class BarrierNode extends Node { constructor(scope: string); } -export const workgroupBarrier: () => ShaderNodeObject; -export const storageBarrier: () => ShaderNodeObject; -export const textureBarrier: () => ShaderNodeObject; +export const workgroupBarrier: () => Node; +export const storageBarrier: () => Node; +export const textureBarrier: () => Node; diff --git a/types/three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts b/types/three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts index 50884f665118c8..51b74015978035 100644 --- a/types/three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +++ b/types/three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ComputeBuiltinNode extends Node { constructor(builtinName: string, nodeType: string); @@ -7,8 +6,8 @@ declare class ComputeBuiltinNode extends Node { export default ComputeBuiltinNode; -export const numWorkgroups: ShaderNodeObject; -export const workgroupId: ShaderNodeObject; -export const globalId: ShaderNodeObject; -export const localId: ShaderNodeObject; -export const subgroupSize: ShaderNodeObject; +export const numWorkgroups: ComputeBuiltinNode; +export const workgroupId: ComputeBuiltinNode; +export const globalId: ComputeBuiltinNode; +export const localId: ComputeBuiltinNode; +export const subgroupSize: ComputeBuiltinNode; diff --git a/types/three/src/nodes/gpgpu/ComputeNode.d.ts b/types/three/src/nodes/gpgpu/ComputeNode.d.ts index 8b85d1f225ec8c..aa1f483e63c13c 100644 --- a/types/three/src/nodes/gpgpu/ComputeNode.d.ts +++ b/types/three/src/nodes/gpgpu/ComputeNode.d.ts @@ -1,43 +1,51 @@ import Renderer from "../../renderers/common/Renderer.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class ComputeNode extends Node { readonly isComputeNode: true; computeNode: Node; workgroupSize: number[]; - count: number | null; + count: number | number[] | null; name: string; onInitFunction: ((args: { renderer: Renderer }) => void) | null; constructor(computeNode: Node, workgroupSize: number[]); - setCount(count: number): this; - getCount(): number | null; + setCount(count: number | number[]): this; + getCount(): number | number[] | null; - setName(name: string): this; + setName: (name: string) => this; /** * @deprecated "label()" has been deprecated. Use "setName()" instead. */ - label(name: string): this; + label: (name: string) => this; onInit(callback: ((args: { renderer: Renderer }) => void) | null): void; } -export const computeKernel: (node: Node, workgroupSize?: number[]) => ShaderNodeObject; +export const computeKernel: (node: Node, workgroupSize?: number[]) => ComputeNode; export const compute: ( node: Node, count: number, workgroupSize?: number[], -) => ShaderNodeObject; - -declare module "../tsl/TSLCore.js" { - interface NodeElements { - compute: typeof compute; - computeKernel: typeof computeKernel; +) => ComputeNode; + +declare module "../Nodes.js" { + interface Node { + compute: ( + count: number, + workgroupSize?: number[], + ) => ComputeNode; + computeAssign: ( + count: number, + workgroupSize?: number[], + ) => this; + + computeKernel: (workgroupSize?: number[]) => ComputeNode; + computeKernelAssign: (workgroupSize?: number[]) => this; } } diff --git a/types/three/src/nodes/gpgpu/SubgroupFunctionNode.d.ts b/types/three/src/nodes/gpgpu/SubgroupFunctionNode.d.ts index e32de328ac40e8..f4eee26639bb2d 100644 --- a/types/three/src/nodes/gpgpu/SubgroupFunctionNode.d.ts +++ b/types/three/src/nodes/gpgpu/SubgroupFunctionNode.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type SubgroupFunctionNodeMethod0 = typeof SubgroupFunctionNode.SUBGROUP_ELECT; @@ -71,30 +70,30 @@ declare class SubgroupFunctionNode extends TempNode { export default SubgroupFunctionNode; -export const subgroupElect: () => ShaderNodeObject; +export const subgroupElect: () => Node; -export const subgroupBallot: (pred: Node) => ShaderNodeObject; -export const subgroupAdd: (e: Node) => ShaderNodeObject; -export const subgroupInclusiveAdd: (e: Node) => ShaderNodeObject; -export const subgroupExclusiveAdd: (e: Node) => ShaderNodeObject; -export const subgroupMul: (e: Node) => ShaderNodeObject; -export const subgroupInclusiveMul: (e: Node) => ShaderNodeObject; -export const subgroupExclusiveMul: (e: Node) => ShaderNodeObject; -export const subgroupAnd: (e: Node) => ShaderNodeObject; -export const subgroupOr: (e: Node) => ShaderNodeObject; -export const subgroupXor: (e: Node) => ShaderNodeObject; -export const subgroupMin: (e: Node) => ShaderNodeObject; -export const subgroupMax: (e: Node) => ShaderNodeObject; -export const subgroupAll: () => ShaderNodeObject; -export const subgroupAny: () => ShaderNodeObject; -export const subgroupBroadcastFirst: (e: Node, id: Node) => ShaderNodeObject; -export const quadSwapX: (e: Node) => ShaderNodeObject; -export const quadSwapY: (e: Node) => ShaderNodeObject; -export const quadSwapDiagonal: (e: Node) => ShaderNodeObject; +export const subgroupBallot: (pred: Node) => Node; +export const subgroupAdd: (e: Node) => Node; +export const subgroupInclusiveAdd: (e: Node) => Node; +export const subgroupExclusiveAdd: (e: Node) => Node; +export const subgroupMul: (e: Node) => Node; +export const subgroupInclusiveMul: (e: Node) => Node; +export const subgroupExclusiveMul: (e: Node) => Node; +export const subgroupAnd: (e: Node) => Node; +export const subgroupOr: (e: Node) => Node; +export const subgroupXor: (e: Node) => Node; +export const subgroupMin: (e: Node) => Node; +export const subgroupMax: (e: Node) => Node; +export const subgroupAll: () => Node; +export const subgroupAny: () => Node; +export const subgroupBroadcastFirst: (e: Node, id: Node) => Node; +export const quadSwapX: (e: Node) => Node; +export const quadSwapY: (e: Node) => Node; +export const quadSwapDiagonal: (e: Node) => Node; -export const subgroupBroadcast: (e: Node, id: Node) => ShaderNodeObject; -export const subgroupShuffle: (v: Node, id: Node) => ShaderNodeObject; -export const subgroupShuffleXor: (v: Node, mask: Node) => ShaderNodeObject; -export const subgroupShuffleUp: (v: Node, delta: Node) => ShaderNodeObject; -export const subgroupShuffleDown: (v: Node, delta: Node) => ShaderNodeObject; -export const quadBroadcast: (e: Node) => ShaderNodeObject; +export const subgroupBroadcast: (e: Node, id: Node) => Node; +export const subgroupShuffle: (v: Node, id: Node) => Node; +export const subgroupShuffleXor: (v: Node, mask: Node) => Node; +export const subgroupShuffleUp: (v: Node, delta: Node) => Node; +export const subgroupShuffleDown: (v: Node, delta: Node) => Node; +export const quadBroadcast: (e: Node) => Node; diff --git a/types/three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts b/types/three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts index d43135ae815a4e..ccd2de83e5371c 100644 --- a/types/three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +++ b/types/three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class WorkgroupInfoNode extends Node { bufferType: string; @@ -16,4 +15,4 @@ declare class WorkgroupInfoNode extends Node { export default WorkgroupInfoNode; -export const workgroupArray: (type: string, count?: number) => ShaderNodeObject; +export const workgroupArray: (type: string, count?: number) => WorkgroupInfoNode; diff --git a/types/three/src/nodes/lighting/AnalyticLightNode.d.ts b/types/three/src/nodes/lighting/AnalyticLightNode.d.ts index 9d5cfad3934660..1c1b11d67b5691 100644 --- a/types/three/src/nodes/lighting/AnalyticLightNode.d.ts +++ b/types/three/src/nodes/lighting/AnalyticLightNode.d.ts @@ -1,7 +1,6 @@ import { Light } from "../../lights/Light.js"; import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import LightingNode from "./LightingNode.js"; import { DirectLightData, DirectRectAreaLightData } from "./LightsNode.js"; import ShadowNode from "./ShadowNode.js"; @@ -23,7 +22,7 @@ declare class AnalyticLightNode extends LightingNode { setupDirectRectArea(builder: NodeBuilder): DirectRectAreaLightData | undefined; - setupShadowNode(): ShaderNodeObject; + setupShadowNode(): ShadowNode; setupShadow(builder: NodeBuilder): void; } diff --git a/types/three/src/nodes/lighting/LightUtils.d.ts b/types/three/src/nodes/lighting/LightUtils.d.ts index 4fd41ea55d1974..7f10cdf64ca9cd 100644 --- a/types/three/src/nodes/lighting/LightUtils.d.ts +++ b/types/three/src/nodes/lighting/LightUtils.d.ts @@ -1,9 +1,8 @@ import Node from "../core/Node.js"; import ConditionalNode from "../math/ConditionalNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export const getDistanceAttenuation: (args: { lightDistance: Node; cutoffDistance: Node; decayExponent: Node; -}) => ShaderNodeObject; +}) => ConditionalNode; diff --git a/types/three/src/nodes/lighting/LightingContextNode.d.ts b/types/three/src/nodes/lighting/LightingContextNode.d.ts index b73837618ed6fd..bb7079b6ceea22 100644 --- a/types/three/src/nodes/lighting/LightingContextNode.d.ts +++ b/types/three/src/nodes/lighting/LightingContextNode.d.ts @@ -1,7 +1,6 @@ import ContextNode from "../core/ContextNode.js"; import LightingModel, { LightingModelReflectedLight } from "../core/LightingModel.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import LightsNode from "./LightsNode.js"; export interface LightingContext { @@ -32,4 +31,4 @@ export default class LightingContextNode extends ContextNode { export const lightingContext: ( node: LightsNode, lightingModelNode?: LightingModel, -) => ShaderNodeObject; +) => LightingContextNode; diff --git a/types/three/src/nodes/lighting/LightsNode.d.ts b/types/three/src/nodes/lighting/LightsNode.d.ts index aaa400d7207992..b7387a2efe6469 100644 --- a/types/three/src/nodes/lighting/LightsNode.d.ts +++ b/types/three/src/nodes/lighting/LightsNode.d.ts @@ -1,7 +1,6 @@ import { Light } from "../../lights/Light.js"; import Node from "../core/Node.js"; import { NodeBuilder } from "../Nodes.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import LightingNode from "./LightingNode.js"; export interface DirectLightData { @@ -44,4 +43,4 @@ declare class LightsNode extends Node { export default LightsNode; -export const lights: (lights?: Light[]) => ShaderNodeObject; +export const lights: (lights?: Light[]) => LightsNode; diff --git a/types/three/src/nodes/lighting/PointLightNode.d.ts b/types/three/src/nodes/lighting/PointLightNode.d.ts index d7b9682d99e7e8..b982f0420aab08 100644 --- a/types/three/src/nodes/lighting/PointLightNode.d.ts +++ b/types/three/src/nodes/lighting/PointLightNode.d.ts @@ -1,15 +1,14 @@ import { PointLight } from "../../lights/PointLight.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import AnalyticLightNode from "./AnalyticLightNode.js"; import { DirectLightData } from "./LightsNode.js"; import PointShadowNode from "./PointShadowNode.js"; export const directPointLight: (params: { - color: ShaderNodeObject; - lightViewPosition: ShaderNodeObject; - cutoffDistance: ShaderNodeObject; - decayExponent: ShaderNodeObject; + color: Node; + lightViewPosition: Node; + cutoffDistance: Node; + decayExponent: Node; }) => DirectLightData; declare class PointLightNode extends AnalyticLightNode { @@ -18,7 +17,7 @@ declare class PointLightNode extends AnalyticLightNode { constructor(light?: PointLight | null); - setupShadowNode(): ShaderNodeObject; + setupShadowNode(): PointShadowNode; } export default PointLightNode; diff --git a/types/three/src/nodes/lighting/PointShadowNode.d.ts b/types/three/src/nodes/lighting/PointShadowNode.d.ts index f565e672cd7d3b..47597d446db139 100644 --- a/types/three/src/nodes/lighting/PointShadowNode.d.ts +++ b/types/three/src/nodes/lighting/PointShadowNode.d.ts @@ -1,17 +1,16 @@ import { Light } from "../../lights/Light.js"; import { LightShadow } from "../../lights/LightShadow.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import ShadowNode from "./ShadowNode.js"; -export const cubeToUV: (pos: Node, texelSizeY: Node) => ShaderNodeObject; +export const cubeToUV: (pos: Node, texelSizeY: Node) => Node; export const BasicPointShadowFilter: ( depthTexture: Node, bd3D: Node, dp: Node, texelSize: Node, -) => ShaderNodeObject; +) => Node; export const PointShadowFilter: ( depthTexture: Node, @@ -19,7 +18,7 @@ export const PointShadowFilter: ( dp: Node, texelSize: Node, shadow: Node, -) => ShaderNodeObject; +) => Node; declare class PointShadowNode extends ShadowNode { constructor(light: Light, shadow: LightShadow | null); @@ -27,4 +26,4 @@ declare class PointShadowNode extends ShadowNode { export default PointShadowNode; -export const pointShadow: (light: Light, shadow?: LightShadow | null) => ShaderNodeObject; +export const pointShadow: (light: Light, shadow?: LightShadow | null) => PointShadowNode; diff --git a/types/three/src/nodes/lighting/ShadowBaseNode.d.ts b/types/three/src/nodes/lighting/ShadowBaseNode.d.ts index 9e410d6075094f..bb2f2b1d66cd9c 100644 --- a/types/three/src/nodes/lighting/ShadowBaseNode.d.ts +++ b/types/three/src/nodes/lighting/ShadowBaseNode.d.ts @@ -1,7 +1,6 @@ import { Light } from "../../lights/Light.js"; import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ShadowBaseNode extends Node { light: Light; @@ -13,6 +12,6 @@ declare class ShadowBaseNode extends Node { setupShadowPosition(builder: NodeBuilder): void; } -export const shadowPositionWorld: ShaderNodeObject; +export const shadowPositionWorld: Node; export default ShadowBaseNode; diff --git a/types/three/src/nodes/lighting/ShadowFilterNode.d.ts b/types/three/src/nodes/lighting/ShadowFilterNode.d.ts index 467b8ed564ef51..66715ac5390cdd 100644 --- a/types/three/src/nodes/lighting/ShadowFilterNode.d.ts +++ b/types/three/src/nodes/lighting/ShadowFilterNode.d.ts @@ -1,28 +1,27 @@ import { Light } from "../../lights/Light.js"; import NodeMaterial from "../../materials/nodes/NodeMaterial.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export const BasicShadowFilter: ( depthTexture: Node, shadowCoord: Node, -) => ShaderNodeObject; +) => Node; export const PCFShadowFilter: ( depthTexture: Node, shadowCoord: Node, shadow: Node, -) => ShaderNodeObject; +) => Node; export const PCFSoftShadowFilter: ( depthTexture: Node, shadowCoord: Node, shadow: Node, -) => ShaderNodeObject; +) => Node; export const VSMShadowFilter: ( depthTexture: Node, shadowCoord: Node, -) => ShaderNodeObject; +) => Node; export const getShadowMaterial: (light: Light) => NodeMaterial; diff --git a/types/three/src/nodes/lighting/ShadowNode.d.ts b/types/three/src/nodes/lighting/ShadowNode.d.ts index 4edfda0d34f6d9..de744ea5e3a6e9 100644 --- a/types/three/src/nodes/lighting/ShadowNode.d.ts +++ b/types/three/src/nodes/lighting/ShadowNode.d.ts @@ -8,7 +8,6 @@ import { Group } from "../../objects/Group.js"; import ClippingContext from "../../renderers/common/ClippingContext.js"; import Renderer from "../../renderers/common/Renderer.js"; import { Scene } from "../../scenes/Scene.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import LightsNode from "./LightsNode.js"; import ShadowBaseNode from "./ShadowBaseNode.js"; @@ -35,4 +34,4 @@ declare class ShadowNode extends ShadowBaseNode { export default ShadowNode; -export const shadow: (light: Light, shadow?: LightShadow) => ShaderNodeObject; +export const shadow: (light: Light, shadow?: LightShadow) => ShadowNode; diff --git a/types/three/src/nodes/lighting/SpotLightNode.d.ts b/types/three/src/nodes/lighting/SpotLightNode.d.ts index 5eec9c31aef060..2929c1cc1f1471 100644 --- a/types/three/src/nodes/lighting/SpotLightNode.d.ts +++ b/types/three/src/nodes/lighting/SpotLightNode.d.ts @@ -1,7 +1,6 @@ import { SpotLight } from "../../lights/SpotLight.js"; import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import AnalyticLightNode from "./AnalyticLightNode.js"; declare class SpotLightNode extends AnalyticLightNode { @@ -17,7 +16,7 @@ declare class SpotLightNode extends AnalyticLightNode { constructor(light?: SpotLight | null); - getLightCoord(builder: NodeBuilder): ShaderNodeObject; + getLightCoord(builder: NodeBuilder): Node; } declare module "three" { diff --git a/types/three/src/nodes/materialx/MaterialXNodes.d.ts b/types/three/src/nodes/materialx/MaterialXNodes.d.ts index 9a30f1dea30915..9297660c2fba77 100644 --- a/types/three/src/nodes/materialx/MaterialXNodes.d.ts +++ b/types/three/src/nodes/materialx/MaterialXNodes.d.ts @@ -1,21 +1,20 @@ import Node from "../core/Node.js"; import MathNode from "../math/MathNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import { mx_hsvtorgb, mx_rgbtohsv } from "./lib/mx_hsv.js"; import { mx_srgb_texture_to_lin_rec709 } from "./lib/mx_transform_color.js"; -export const mx_aastep: (threshold: Node | number, value: Node | number) => ShaderNodeObject; +export const mx_aastep: (threshold: Node | number, value: Node | number) => MathNode; export const mx_ramplr: ( valuel: Node | number, valuer: Node | number, texcoord?: Node, -) => ShaderNodeObject; +) => MathNode; export const mx_ramptb: ( valuet: Node | number, valueb: Node | number, texcoord?: Node, -) => ShaderNodeObject; +) => MathNode; export const mx_ramp4: ( valuetl: Node | number, @@ -23,50 +22,50 @@ export const mx_ramp4: ( valuebl: Node | number, valuebr: Node | number, texcoord?: Node, -) => ShaderNodeObject; +) => MathNode; export const mx_splitlr: ( valuel: Node | number, valuer: Node | number, center: Node | number, texcoord?: Node, -) => ShaderNodeObject; +) => MathNode; export const mx_splittb: ( valuet: Node | number, valueb: Node | number, center: Node | number, texcoord?: Node, -) => ShaderNodeObject; +) => MathNode; export const mx_transform_uv: ( uv_scale?: Node | number, uv_offset?: Node | number, uv_geo?: Node, -) => ShaderNodeObject; +) => Node; -export const mx_safepower: (in1: Node | number, in2?: Node | number) => ShaderNodeObject; +export const mx_safepower: (in1: Node | number, in2?: Node | number) => Node; export const mx_contrast: ( input: Node | number, amount?: Node | number, pivot?: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_noise_float: ( texcoord?: Node, amplitude?: Node | number, pivot?: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_noise_vec3: ( texcoord?: Node, amplitude?: Node | number, pivot?: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_noise_vec4: ( texcoord?: Node, amplitude?: Node | number, pivot?: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_unifiednoise2d: ( noiseType: Node, @@ -80,7 +79,7 @@ export const mx_unifiednoise2d: ( octaves?: Node | number, lacunarity?: Node | number, diminish?: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_unifiednoise3d: ( noiseType: Node, texcoord?: Node, @@ -93,22 +92,22 @@ export const mx_unifiednoise3d: ( octaves?: Node | number, lacunarity?: Node | number, diminish?: Node | number, -) => ShaderNodeObject; +) => Node; export function mx_worley_noise_float( texcoord?: Node, jitter?: Node | number, -): ShaderNodeObject; +): Node; export function mx_worley_noise_vec2( texcoord?: Node, jitter?: Node | number, -): ShaderNodeObject; +): Node; export function mx_worley_noise_vec3( texcoord?: Node, jitter?: Node | number, -): ShaderNodeObject; +): Node; -export function mx_cell_noise_float(texcoord?: Node): ShaderNodeObject; +export function mx_cell_noise_float(texcoord?: Node): Node; export function mx_fractal_noise_float( position?: Node, @@ -116,46 +115,46 @@ export function mx_fractal_noise_float( lacunarity?: Node | number, diminish?: Node | number, amplitude?: Node | number, -): ShaderNodeObject; +): Node; export function mx_fractal_noise_vec2( position?: Node, octaves?: Node | number, lacunarity?: Node | number, diminish?: Node | number, amplitude?: Node | number, -): ShaderNodeObject; +): Node; export function mx_fractal_noise_vec3( position?: Node, octaves?: Node | number, lacunarity?: Node | number, diminish?: Node | number, amplitude?: Node | number, -): ShaderNodeObject; +): Node; export function mx_fractal_noise_vec4( position?: Node, octaves?: Node | number, lacunarity?: Node | number, diminish?: Node | number, amplitude?: Node | number, -): ShaderNodeObject; +): Node; export { mx_hsvtorgb, mx_rgbtohsv, mx_srgb_texture_to_lin_rec709 }; -export const mx_add: (in1: Node, in2?: Node) => ShaderNodeObject; -export const mx_subtract: (in1: Node, in2?: Node) => ShaderNodeObject; -export const mx_multiply: (in1: Node, in2?: Node) => ShaderNodeObject; -export const mx_divide: (in1: Node, in2?: Node) => ShaderNodeObject; -export const mx_modulo: (in1: Node, in2?: Node) => ShaderNodeObject; -export const mx_power: (in1: Node, in2?: Node) => ShaderNodeObject; -export const mx_atan2: (in1?: Node, in2?: Node) => ShaderNodeObject; -export const mx_timer: () => ShaderNodeObject; -export const mx_frame: () => ShaderNodeObject; -export const mx_invert: (in1: Node, amount?: Node) => ShaderNodeObject; -export const mx_ifgreater: (value1: Node, value2: Node, in1: Node, in2: Node) => ShaderNodeObject; -export const mx_ifgreatereq: (value1: Node, value2: Node, in1: Node, in2: Node) => ShaderNodeObject; -export const mx_ifequal: (value1: Node, value2: Node, in1: Node, in2: Node) => ShaderNodeObject; - -export const mx_separate: (in1: Node, channelOrOut?: string | number) => ShaderNodeObject; +export const mx_add: (in1: Node, in2?: Node) => Node; +export const mx_subtract: (in1: Node, in2?: Node) => Node; +export const mx_multiply: (in1: Node, in2?: Node) => Node; +export const mx_divide: (in1: Node, in2?: Node) => Node; +export const mx_modulo: (in1: Node, in2?: Node) => Node; +export const mx_power: (in1: Node, in2?: Node) => Node; +export const mx_atan2: (in1?: Node, in2?: Node) => Node; +export const mx_timer: () => Node; +export const mx_frame: () => Node; +export const mx_invert: (in1: Node, amount?: Node) => Node; +export const mx_ifgreater: (value1: Node, value2: Node, in1: Node, in2: Node) => Node; +export const mx_ifgreatereq: (value1: Node, value2: Node, in1: Node, in2: Node) => Node; +export const mx_ifequal: (value1: Node, value2: Node, in1: Node, in2: Node) => Node; + +export const mx_separate: (in1: Node, channelOrOut?: string | number) => Node; export const mx_place2d: ( texcoord: Node, @@ -163,10 +162,10 @@ export const mx_place2d: ( scale?: Node, rotate?: Node, offset?: Node, -) => ShaderNodeObject; +) => Node; -export const mx_rotate2d: (input: Node, amount: Node) => ShaderNodeObject; +export const mx_rotate2d: (input: Node, amount: Node) => Node; -export const mx_rotate3d: (input: Node, amount: Node, axis: Node) => ShaderNodeObject; +export const mx_rotate3d: (input: Node, amount: Node, axis: Node) => Node; -export const mx_heighttonormal: (input: Node, scale: Node) => ShaderNodeObject; +export const mx_heighttonormal: (input: Node, scale: Node) => Node; diff --git a/types/three/src/nodes/materialx/lib/mx_hsv.d.ts b/types/three/src/nodes/materialx/lib/mx_hsv.d.ts index 8f99986c30ba85..1be021162de7cf 100644 --- a/types/three/src/nodes/materialx/lib/mx_hsv.d.ts +++ b/types/three/src/nodes/materialx/lib/mx_hsv.d.ts @@ -1,6 +1,5 @@ import Node from "../../core/Node.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -export const mx_hsvtorgb: (hsv: Node) => ShaderNodeObject; +export const mx_hsvtorgb: (hsv: Node) => Node; -export const mx_rgbtohsv: (c_immutable: Node) => ShaderNodeObject; +export const mx_rgbtohsv: (c_immutable: Node) => Node; diff --git a/types/three/src/nodes/materialx/lib/mx_noise.d.ts b/types/three/src/nodes/materialx/lib/mx_noise.d.ts index fee4fce43afddb..735aec32f3faaf 100644 --- a/types/three/src/nodes/materialx/lib/mx_noise.d.ts +++ b/types/three/src/nodes/materialx/lib/mx_noise.d.ts @@ -1,21 +1,20 @@ import Node from "../../core/Node.js"; import VarNode from "../../core/VarNode.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; export const mx_select: ( b_immutable: Node | boolean, t_immutable: Node | number, f_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_negate_if: ( val_immutable: Node | boolean, b_immutable: Node | number, -) => ShaderNodeObject; +) => Node; -export const mx_floor: (x_immutable: Node | number) => ShaderNodeObject; +export const mx_floor: (x_immutable: Node | number) => Node; -export const mx_floorfrac: (x_immutable: Node | number, i: ShaderNodeObject) => ShaderNodeObject; +export const mx_floorfrac: (x_immutable: Node | number, i: VarNode) => Node; export const mx_bilerp_0: ( v0_immutable: Node | number, @@ -24,7 +23,7 @@ export const mx_bilerp_0: ( v3_immutable: Node | number, s_immutable: Node | number, t_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_bilerp_1: ( v0_immutable: Node | number, @@ -33,7 +32,7 @@ export const mx_bilerp_1: ( v3_immutable: Node | number, s_immutable: Node | number, t_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_bilerp: ( v0_immutable: Node | number, @@ -42,7 +41,7 @@ export const mx_bilerp: ( v3_immutable: Node | number, s_immutable: Node | number, t_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_trilerp_0: ( v0_immutable: Node | number, @@ -56,7 +55,7 @@ export const mx_trilerp_0: ( s_immutable: Node | number, t_immutable: Node | number, r_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_trilerp_1: ( v0_immutable: Node | number, @@ -70,7 +69,7 @@ export const mx_trilerp_1: ( s_immutable: Node | number, t_immutable: Node | number, r_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_trilerp: ( v0_immutable: Node | number, @@ -84,97 +83,97 @@ export const mx_trilerp: ( s_immutable: Node | number, t_immutable: Node | number, r_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_gradient_float_0: ( hash_immutable: Node | number, x_immutable: Node | number, y_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_gradient_float_1: ( hash_immutable: Node | number, x_immutable: Node | number, y_immutable: Node | number, z_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_gradient_float: ( hash_immutable: Node | number, x_immutable: Node | number, y_immutable: Node | number, z_immutable?: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_gradient_vec3_0: ( hash_immutable: Node | number, x_immutable: Node | number, y_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_gradient_vec3_1: ( hash_immutable: Node | number, x_immutable: Node | number, y_immutable: Node | number, z_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_gradient_vec3: ( hash_immutable: Node | number, x_immutable: Node | number, y_immutable: Node | number, z_immutable?: Node | number, -) => ShaderNodeObject; +) => Node; -export const mx_gradient_scale2d_0: (v_immutable: Node | number) => ShaderNodeObject; +export const mx_gradient_scale2d_0: (v_immutable: Node | number) => Node; -export const mx_gradient_scale3d_0: (v_immutable: Node | number) => ShaderNodeObject; +export const mx_gradient_scale3d_0: (v_immutable: Node | number) => Node; -export const mx_gradient_scale2d_1: (v_immutable: Node | number) => ShaderNodeObject; +export const mx_gradient_scale2d_1: (v_immutable: Node | number) => Node; -export const mx_gradient_scale2d: (v_immutable: Node | number) => ShaderNodeObject; +export const mx_gradient_scale2d: (v_immutable: Node | number) => Node; -export const mx_gradient_scale3d_1: (v_immutable: Node | number) => ShaderNodeObject; +export const mx_gradient_scale3d_1: (v_immutable: Node | number) => Node; -export const mx_gradient_scale3d: (v_immutable: Node | number) => ShaderNodeObject; +export const mx_gradient_scale3d: (v_immutable: Node | number) => Node; -export const mx_rotl32: (x_immutable: Node | number, k_immutable: Node | number) => ShaderNodeObject; +export const mx_rotl32: (x_immutable: Node | number, k_immutable: Node | number) => Node; export const mx_bjmix: ( - a: ShaderNodeObject, - b: ShaderNodeObject, - c: ShaderNodeObject, -) => ShaderNodeObject; + a: VarNode, + b: VarNode, + c: VarNode, +) => Node; export const mx_bjfinal: ( a_immutable: Node | number, b_immutable: Node | number, c_immutable: Node | number, -) => ShaderNodeObject; +) => Node; -export const mx_bits_to_01: (bits_immutable: Node | number) => ShaderNodeObject; +export const mx_bits_to_01: (bits_immutable: Node | number) => Node; -export const mx_fade: (t_immutable: Node | number) => ShaderNodeObject; +export const mx_fade: (t_immutable: Node | number) => Node; -export const mx_hash_int_0: (x_immutable: Node | number) => ShaderNodeObject; +export const mx_hash_int_0: (x_immutable: Node | number) => Node; export const mx_hash_int_1: ( x_immutable: Node | number, y_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_hash_int_2: ( x_immutable: Node | number, y_immutable: Node | number, z_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_hash_int_3: ( x_immutable: Node | number, y_immutable: Node | number, z_immutable: Node | number, xx_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_hash_int_4: ( x_immutable: Node | number, @@ -182,7 +181,7 @@ export const mx_hash_int_4: ( z_immutable: Node | number, xx_immutable: Node | number, yy_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_hash_int: ( x_immutable: Node | number, @@ -190,84 +189,84 @@ export const mx_hash_int: ( z_immutable?: Node | number, xx_immutable?: Node | number, yy_immutable?: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_hash_vec3_0: ( x_immutable: Node | number, y_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_hash_vec3_1: ( x_immutable: Node | number, y_immutable: Node | number, z_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_hash_vec3: ( x_immutable: Node | number, y_immutable: Node | number, z_immutable?: Node | number, -) => ShaderNodeObject; +) => Node; -export const mx_perlin_noise_float_0: (p_immutable: Node) => ShaderNodeObject; +export const mx_perlin_noise_float_0: (p_immutable: Node) => Node; -export const mx_perlin_noise_float_1: (p_immutable: Node) => ShaderNodeObject; +export const mx_perlin_noise_float_1: (p_immutable: Node) => Node; -export const mx_perlin_noise_float: (p_immutable: Node) => ShaderNodeObject; +export const mx_perlin_noise_float: (p_immutable: Node) => Node; -export const mx_perlin_noise_vec3_0: (p_immutable: Node) => ShaderNodeObject; +export const mx_perlin_noise_vec3_0: (p_immutable: Node) => Node; -export const mx_perlin_noise_vec3_1: (p_immutable: Node) => ShaderNodeObject; +export const mx_perlin_noise_vec3_1: (p_immutable: Node) => Node; -export const mx_perlin_noise_vec3: (p_immutable: Node) => ShaderNodeObject; +export const mx_perlin_noise_vec3: (p_immutable: Node) => Node; -export const mx_cell_noise_float_0: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_float_0: (p_immutable: Node) => Node; -export const mx_cell_noise_float_1: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_float_1: (p_immutable: Node) => Node; -export const mx_cell_noise_float_2: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_float_2: (p_immutable: Node) => Node; -export const mx_cell_noise_float_3: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_float_3: (p_immutable: Node) => Node; -export const mx_cell_noise_float: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_float: (p_immutable: Node) => Node; -export const mx_cell_noise_vec3_0: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_vec3_0: (p_immutable: Node) => Node; -export const mx_cell_noise_vec3_1: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_vec3_1: (p_immutable: Node) => Node; -export const mx_cell_noise_vec3_2: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_vec3_2: (p_immutable: Node) => Node; -export const mx_cell_noise_vec3_3: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_vec3_3: (p_immutable: Node) => Node; -export const mx_cell_noise_vec3: (p_immutable: Node) => ShaderNodeObject; +export const mx_cell_noise_vec3: (p_immutable: Node) => Node; export const mx_fractal_noise_float: ( p_immutable: Node, octaves_immutable: Node | number, lacunarity_immutable: Node | number, diminish_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_fractal_noise_vec3: ( p_immutable: Node, octaves_immutable: Node | number, lacunarity_immutable: Node | number, diminish_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_fractal_noise_vec2: ( p_immutable: Node, octaves_immutable: Node | number, lacunarity_immutable: Node | number, diminish_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_fractal_noise_vec4: ( p_immutable: Node, octaves_immutable: Node | number, lacunarity_immutable: Node | number, diminish_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_distance_0: ( p_immutable: Node, @@ -278,7 +277,7 @@ export const mx_worley_distance_0: ( yoff_immutable: Node | number, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_distance_1: ( p_immutable: Node, @@ -290,7 +289,7 @@ export const mx_worley_distance_1: ( zoff_immutable: Node | number, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_distance: ( p_immutable: Node, @@ -302,61 +301,61 @@ export const mx_worley_distance: ( zoff_immutable: Node | number, jitter_immutable: Node | number, metric_immutable?: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_float_0: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_vec2_0: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_vec3_0: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_float_1: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_float: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_vec2_1: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_vec2: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_vec3_1: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_worley_noise_vec3: ( p_immutable: Node, jitter_immutable: Node | number, metric_immutable: Node | number, -) => ShaderNodeObject; +) => Node; export const mx_unifiednoise2d: ( noiseType_immutable: Node, @@ -370,7 +369,7 @@ export const mx_unifiednoise2d: ( octaves_immutable: Node, lacunarity_immutable: Node, diminish_immutable: Node, -) => ShaderNodeObject; +) => Node; export const mx_unifiednoise3d: ( noiseType_immutable: Node, @@ -384,4 +383,4 @@ export const mx_unifiednoise3d: ( octaves_immutable: Node, lacunarity_immutable: Node, diminish_immutable: Node, -) => ShaderNodeObject; +) => Node; diff --git a/types/three/src/nodes/materialx/lib/mx_transform_color.d.ts b/types/three/src/nodes/materialx/lib/mx_transform_color.d.ts index ae1bd79997452e..1ae9a26e334817 100644 --- a/types/three/src/nodes/materialx/lib/mx_transform_color.d.ts +++ b/types/three/src/nodes/materialx/lib/mx_transform_color.d.ts @@ -1,4 +1,3 @@ import Node from "../../core/Node.js"; -import { ShaderNodeObject } from "../../tsl/TSLCore.js"; -export const mx_srgb_texture_to_lin_rec709: (color_immutable: Node) => ShaderNodeObject; +export const mx_srgb_texture_to_lin_rec709: (color_immutable: Node) => Node; diff --git a/types/three/src/nodes/math/BitcastNode.d.ts b/types/three/src/nodes/math/BitcastNode.d.ts index 6f39871a545340..253b200553fd89 100644 --- a/types/three/src/nodes/math/BitcastNode.d.ts +++ b/types/three/src/nodes/math/BitcastNode.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class BitcastNode extends TempNode { valueNode: Node; @@ -14,12 +13,12 @@ declare class BitcastNode extends TempNode { export default BitcastNode; -export const bitcast: (x: Node | number, y: string) => ShaderNodeObject; +export const bitcast: (x: Node | number, y: string) => BitcastNode; -export const floatBitsToInt: (value: Node) => ShaderNodeObject; +export const floatBitsToInt: (value: Node) => BitcastNode; -export const floatBitsToUint: (value: Node) => ShaderNodeObject; +export const floatBitsToUint: (value: Node) => BitcastNode; -export const intBitsToFloat: (value: Node) => ShaderNodeObject; +export const intBitsToFloat: (value: Node) => BitcastNode; -export const uintBitsToFloat: (value: Node) => ShaderNodeObject; +export const uintBitsToFloat: (value: Node) => BitcastNode; diff --git a/types/three/src/nodes/math/ConditionalNode.d.ts b/types/three/src/nodes/math/ConditionalNode.d.ts index bcb6123386f4f5..77e83a04640e73 100644 --- a/types/three/src/nodes/math/ConditionalNode.d.ts +++ b/types/three/src/nodes/math/ConditionalNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class ConditionalNode extends Node { condNode: Node; @@ -15,10 +14,17 @@ export const select: ( condNode: Node, ifNode: Node | number, elseNode?: Node | number | null, -) => ShaderNodeObject; +) => Node; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - select: typeof select; +declare module "../Nodes.js" { + interface Node { + select: ( + ifNode: Node | number, + elseNode?: Node | number | null, + ) => Node; + selectAssign: ( + ifNode: Node | number, + elseNode?: Node | number | null, + ) => this; } } diff --git a/types/three/src/nodes/math/Hash.d.ts b/types/three/src/nodes/math/Hash.d.ts index b02f2fbddebfeb..57620ad34f89a8 100644 --- a/types/three/src/nodes/math/Hash.d.ts +++ b/types/three/src/nodes/math/Hash.d.ts @@ -1,4 +1,3 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const hash: (seed: Node) => ShaderNodeObject; +export const hash: (seed: Node) => Node; diff --git a/types/three/src/nodes/math/MathNode.d.ts b/types/three/src/nodes/math/MathNode.d.ts index 7fe2a6c847fede..2d718b4a894b10 100644 --- a/types/three/src/nodes/math/MathNode.d.ts +++ b/types/three/src/nodes/math/MathNode.d.ts @@ -1,7 +1,6 @@ import { Vector3 } from "../../math/Vector3.js"; import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import OperatorNode from "./OperatorNode.js"; export type MathNodeMethod1 = @@ -130,14 +129,22 @@ export default class MathNode extends TempNode { constructor(method: MathNodeMethod3, aNode: Node, bNode: Node, cNode: Node); } -export const EPSILON: ShaderNodeObject; -export const INFINITY: ShaderNodeObject; -export const PI: ShaderNodeObject; -export const PI2: ShaderNodeObject; +export const EPSILON: Node; +export const INFINITY: Node; +export const PI: Node; + +/** + * @deprecated Please use the non-deprecated version `TWO_PI`. + */ +export const PI2: Node; + +export const TWO_PI: Node; + +export const HALF_PI: Node; type MathNodeParameter = Node | number; -type Unary = (a: MathNodeParameter) => ShaderNodeObject; +type Unary = (a: MathNodeParameter) => MathNode; export const all: Unary; export const any: Unary; @@ -157,14 +164,14 @@ export const sqrt: Unary; export const inverseSqrt: Unary; export const floor: Unary; export const ceil: Unary; -export const normalize: (a: Node | Vector3) => ShaderNodeObject; +export const normalize: (a: Node | Vector3) => MathNode; export const fract: Unary; export const sin: Unary; export const cos: Unary; export const tan: Unary; export const asin: Unary; export const acos: Unary; -export const atan: (a: MathNodeParameter, b?: MathNodeParameter) => ShaderNodeObject; +export const atan: (a: MathNodeParameter, b?: MathNodeParameter) => MathNode; export const abs: Unary; export const sign: Unary; export const length: Unary; @@ -177,27 +184,27 @@ export const reciprocal: Unary; export const trunc: Unary; export const fwidth: Unary; export const transpose: Unary; -export const determinant: (x: Node) => ShaderNodeObject; -export const inverse: (x: Node) => ShaderNodeObject; +export const determinant: (x: Node) => MathNode; +export const inverse: (x: Node) => MathNode; -type Binary = (a: MathNodeParameter, b: MathNodeParameter) => ShaderNodeObject; +type Binary = (a: MathNodeParameter, b: MathNodeParameter) => MathNode; export const min: ( x: MathNodeParameter, y: MathNodeParameter, ...values: MathNodeParameter[] -) => ShaderNodeObject; +) => MathNode; export const max: ( x: MathNodeParameter, y: MathNodeParameter, ...values: MathNodeParameter[] -) => ShaderNodeObject; +) => MathNode; export const step: Binary; export const reflect: Binary; export const distance: Binary; export const difference: Binary; export const dot: Binary; -export const cross: (x: Node, y: Node) => ShaderNodeObject; +export const cross: (x: Node, y: Node) => MathNode; export const pow: Binary; export const pow2: Unary; export const pow3: Unary; @@ -206,20 +213,20 @@ export const transformDirection: Binary; export const cbrt: Unary; export const lengthSq: Unary; -type Ternary = (a: MathNodeParameter, b: MathNodeParameter, c: MathNodeParameter) => ShaderNodeObject; +type Ternary = (a: MathNodeParameter, b: MathNodeParameter, c: MathNodeParameter) => MathNode; export const mix: Ternary; export const clamp: ( a: MathNodeParameter, b?: MathNodeParameter, c?: MathNodeParameter, -) => ShaderNodeObject; +) => MathNode; export const saturate: Unary; export const refract: Ternary; export const smoothstep: Ternary; export const faceForward: Ternary; -export const rand: (uv: MathNodeParameter) => ShaderNodeObject; +export const rand: (uv: MathNodeParameter) => OperatorNode; export const mixElement: Ternary; export const smoothstepElement: Ternary; @@ -237,65 +244,204 @@ export const inversesqrt: typeof inverseSqrt; // Method chaining -declare module "../tsl/TSLCore.js" { - interface NodeElements { - all: typeof all; - any: typeof any; - equals: typeof equals; - radians: typeof radians; - degrees: typeof degrees; - exp: typeof exp; - exp2: typeof exp2; - log: typeof log; - log2: typeof log2; - sqrt: typeof sqrt; - inverseSqrt: typeof inverseSqrt; - floor: typeof floor; - ceil: typeof ceil; - normalize: typeof normalize; - fract: typeof fract; - sin: typeof sin; - cos: typeof cos; - tan: typeof tan; - asin: typeof asin; - acos: typeof acos; - atan: typeof atan; - abs: typeof abs; - sign: typeof sign; - length: typeof length; - lengthSq: typeof lengthSq; - negate: typeof negate; - oneMinus: typeof oneMinus; - dFdx: typeof dFdx; - dFdy: typeof dFdy; - round: typeof round; - reciprocal: typeof reciprocal; - trunc: typeof trunc; - fwidth: typeof fwidth; - atan2: typeof atan2; - min: typeof min; - max: typeof max; - step: typeof stepElement; - reflect: typeof reflect; - distance: typeof distance; - dot: typeof dot; - cross: typeof cross; - pow: typeof pow; - pow2: typeof pow2; - pow3: typeof pow3; - pow4: typeof pow4; - transformDirection: typeof transformDirection; - mix: typeof mixElement; - clamp: typeof clamp; - refract: typeof refract; - smoothstep: typeof smoothstepElement; - faceForward: typeof faceForward; - difference: typeof difference; - saturate: typeof saturate; - cbrt: typeof cbrt; - transpose: typeof transpose; - determinant: typeof determinant; - inverse: typeof inverse; - rand: typeof rand; +declare module "../Nodes.js" { + interface Node { + all: () => MathNode; + allAssign: () => this; + + any: () => MathNode; + anyAssign: () => this; + + /** + * @deprecated "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )" + */ + equals: () => MathNode; + /** + * @deprecated "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )" + */ + equalsAssign: () => this; + + radians: () => MathNode; + radiansAssign: () => this; + + degrees: () => MathNode; + degreesAssign: () => this; + + exp: () => MathNode; + expAssign: () => this; + + exp2: () => MathNode; + exp2Assign: () => this; + + log: () => MathNode; + logAssign: () => this; + + log2: () => MathNode; + log2Assign: () => this; + + sqrt: () => MathNode; + sqrtAssign: () => this; + + inverseSqrt: () => MathNode; + inverseSqrtAssign: () => this; + + floor: () => MathNode; + floorAssign: () => this; + + ceil: () => MathNode; + ceilAssign: () => this; + + normalize: () => MathNode; + normalizeAssign: () => this; + + fract: () => MathNode; + fractAssign: () => this; + + sin: () => MathNode; + sinAssign: () => this; + + cos: () => MathNode; + cosAssign: () => this; + + tan: () => MathNode; + tanAssign: () => this; + + asin: () => MathNode; + asinAssign: () => this; + + acos: () => MathNode; + acosAssign: () => this; + + atan: (b?: MathNodeParameter) => MathNode; + atanAssign: (b?: MathNodeParameter) => this; + + abs: () => MathNode; + absAssign: () => this; + + sign: () => MathNode; + signAssign: () => this; + + length: () => MathNode; + lengthAssign: () => this; + + lengthSq: () => MathNode; + lengthSqAssign: () => this; + + negate: () => MathNode; + negateAssign: () => this; + + oneMinus: () => MathNode; + oneMinusAssign: () => this; + + dFdx: () => MathNode; + dFdxAssign: () => this; + + dFdy: () => MathNode; + dFdyAssign: () => this; + + round: () => MathNode; + roundAssign: () => this; + + reciprocal: () => MathNode; + reciprocalAssign: () => this; + + trunc: () => MathNode; + truncAssign: () => this; + + fwidth: () => MathNode; + fwidthAssign: () => this; + + /** + * @deprecated + */ + atan2: (b: MathNodeParameter) => MathNode; + /** + * @deprecated + */ + atan2Assign: (b: MathNodeParameter) => this; + + min: ( + y: MathNodeParameter, + ...values: MathNodeParameter[] + ) => MathNode; + minAssign: ( + y: MathNodeParameter, + ...values: MathNodeParameter[] + ) => this; + + max: ( + y: MathNodeParameter, + ...values: MathNodeParameter[] + ) => MathNode; + maxAssign: ( + y: MathNodeParameter, + ...values: MathNodeParameter[] + ) => this; + + step: (b: MathNodeParameter) => MathNode; + stepAssign: (b: MathNodeParameter) => this; + + reflect: (b: MathNodeParameter) => MathNode; + reflectAssign: (b: MathNodeParameter) => this; + + distance: (b: MathNodeParameter) => MathNode; + distanceAssign: (b: MathNodeParameter) => this; + + dot: (b: MathNodeParameter) => MathNode; + dotAssign: (b: MathNodeParameter) => this; + + cross: (y: Node) => MathNode; + crossAssign: (y: Node) => this; + + pow: (b: MathNodeParameter) => MathNode; + powAssign: (b: MathNodeParameter) => this; + + pow2: () => MathNode; + pow2Assign: () => this; + + pow3: () => MathNode; + pow3Assign: () => this; + + pow4: () => MathNode; + pow4Assign: () => this; + + transformDirection: (b: MathNodeParameter) => MathNode; + transformDirectionAssign: (b: MathNodeParameter) => this; + + mix: (b: MathNodeParameter, c: MathNodeParameter) => MathNode; + mixAssign: (b: MathNodeParameter, c: MathNodeParameter) => this; + + clamp: (b?: MathNodeParameter, c?: MathNodeParameter) => MathNode; + clampAssign: (b?: MathNodeParameter, c?: MathNodeParameter) => this; + + refract: (b: MathNodeParameter, c: MathNodeParameter) => MathNode; + refractAssign: (b: MathNodeParameter, c: MathNodeParameter) => this; + + smoothstep: (b: MathNodeParameter, c: MathNodeParameter) => MathNode; + smoothstepAssign: (b: MathNodeParameter, c: MathNodeParameter) => this; + + faceForward: (b: MathNodeParameter, c: MathNodeParameter) => MathNode; + faceForwardAssign: (b: MathNodeParameter, c: MathNodeParameter) => this; + + difference: (b: MathNodeParameter) => MathNode; + differenceAssign: (b: MathNodeParameter) => this; + + saturate: () => MathNode; + saturateAssign: () => this; + + cbrt: () => MathNode; + cbrtAssign: () => this; + + transpose: () => MathNode; + transposeAssign: () => this; + + determinant: () => MathNode; + determinantAssign: () => this; + + inverse: () => MathNode; + inverseAssign: () => this; + + rand: () => OperatorNode; + randAssign: () => this; } } diff --git a/types/three/src/nodes/math/OperatorNode.d.ts b/types/three/src/nodes/math/OperatorNode.d.ts index d6580a3160932e..fc9fdde0d2d7a3 100644 --- a/types/three/src/nodes/math/OperatorNode.d.ts +++ b/types/three/src/nodes/math/OperatorNode.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type OperatorNodeOp = | "%" @@ -39,93 +38,238 @@ export const add: ( a: OperatorNodeParameter, b: OperatorNodeParameter, ...params: OperatorNodeParameter[] -) => ShaderNodeObject; +) => OperatorNode; export const sub: ( a: OperatorNodeParameter, b: OperatorNodeParameter, ...params: OperatorNodeParameter[] -) => ShaderNodeObject; +) => OperatorNode; export const mul: ( a: OperatorNodeParameter, b: OperatorNodeParameter, ...params: OperatorNodeParameter[] -) => ShaderNodeObject; +) => OperatorNode; export const div: ( a: OperatorNodeParameter, b: OperatorNodeParameter, ...params: OperatorNodeParameter[] -) => ShaderNodeObject; -export const mod: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const equal: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const notEqual: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const lessThan: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const greaterThan: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const lessThanEqual: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const greaterThanEqual: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; +) => OperatorNode; +export const mod: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const equal: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const notEqual: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const lessThan: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const greaterThan: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const lessThanEqual: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const greaterThanEqual: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; export const and: ( a: OperatorNodeParameter, b: OperatorNodeParameter, ...params: OperatorNodeParameter[] -) => ShaderNodeObject; +) => OperatorNode; export const or: ( a: OperatorNodeParameter, b: OperatorNodeParameter, ...params: OperatorNodeParameter[] -) => ShaderNodeObject; -export const not: (value: OperatorNodeParameter) => ShaderNodeObject; -export const xor: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const bitAnd: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const bitNot: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const bitOr: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const bitXor: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const shiftLeft: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; -export const shiftRight: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; - -export const incrementBefore: (a: OperatorNodeParameter) => ShaderNodeObject; -export const decrementBefore: (a: OperatorNodeParameter) => ShaderNodeObject; -export const increment: (a: OperatorNodeParameter) => ShaderNodeObject; -export const decrement: (a: OperatorNodeParameter) => ShaderNodeObject; - -declare module "../tsl/TSLCore.js" { - interface NodeElements { - add: typeof add; - sub: typeof sub; - mul: typeof mul; - div: typeof div; - mod: typeof mod; - equal: typeof equal; - notEqual: typeof notEqual; - lessThan: typeof lessThan; - greaterThan: typeof greaterThan; - lessThanEqual: typeof lessThanEqual; - 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; - shiftRight: typeof shiftRight; - incrementBefore: typeof incrementBefore; - decrementBefore: typeof decrement; - increment: typeof increment; - decrement: typeof decrement; +) => OperatorNode; +export const not: (value: OperatorNodeParameter) => OperatorNode; +export const xor: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const bitAnd: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const bitNot: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const bitOr: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const bitXor: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const shiftLeft: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; +export const shiftRight: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; + +export const incrementBefore: (a: OperatorNodeParameter) => Node; +export const decrementBefore: (a: OperatorNodeParameter) => Node; +export const increment: (a: OperatorNodeParameter) => Node; +export const decrement: (a: OperatorNodeParameter) => Node; + +declare module "../Nodes.js" { + interface Node { + add: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => OperatorNode; + addAssign: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => this; + + sub: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => OperatorNode; + subAssign: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => this; + + mul: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => OperatorNode; + mulAssign: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => this; + + div: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => OperatorNode; + divAssign: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => this; + + mod: ( + b: OperatorNodeParameter, + ) => OperatorNode; + modAssign: ( + b: OperatorNodeParameter, + ) => this; + + equal: ( + b: OperatorNodeParameter, + ) => OperatorNode; + equalAssign: ( + b: OperatorNodeParameter, + ) => this; + + notEqual: ( + b: OperatorNodeParameter, + ) => OperatorNode; + notEqualAssign: ( + b: OperatorNodeParameter, + ) => this; + + lessThan: ( + b: OperatorNodeParameter, + ) => OperatorNode; + lessThanAssign: ( + b: OperatorNodeParameter, + ) => this; + + greaterThan: ( + b: OperatorNodeParameter, + ) => OperatorNode; + greaterThanAssign: ( + b: OperatorNodeParameter, + ) => this; + + lessThanEqual: ( + b: OperatorNodeParameter, + ) => OperatorNode; + lessThanEqualAssign: ( + b: OperatorNodeParameter, + ) => this; + + greaterThanEqual: ( + b: OperatorNodeParameter, + ) => OperatorNode; + greaterThanEqualAssign: ( + b: OperatorNodeParameter, + ) => this; + + and: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => OperatorNode; + andAssign: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => this; + + or: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => OperatorNode; + orAssign: ( + b: OperatorNodeParameter, + ...params: OperatorNodeParameter[] + ) => this; + + not: () => OperatorNode; + notAssign: () => this; + + xor: ( + b: OperatorNodeParameter, + ) => OperatorNode; + xorAssign: ( + b: OperatorNodeParameter, + ) => this; + + bitAnd: ( + b: OperatorNodeParameter, + ) => OperatorNode; + bitAndAssign: ( + b: OperatorNodeParameter, + ) => this; + + bitNot: ( + b: OperatorNodeParameter, + ) => OperatorNode; + bitNotAssign: ( + b: OperatorNodeParameter, + ) => this; + + bitOr: ( + b: OperatorNodeParameter, + ) => OperatorNode; + bitOrAssign: ( + b: OperatorNodeParameter, + ) => this; + + bitXor: ( + b: OperatorNodeParameter, + ) => OperatorNode; + bitXorAssign: ( + b: OperatorNodeParameter, + ) => this; + + shiftLeft: ( + b: OperatorNodeParameter, + ) => OperatorNode; + shiftLeftAssign: ( + b: OperatorNodeParameter, + ) => this; + + shiftRight: ( + b: OperatorNodeParameter, + ) => OperatorNode; + shiftRightAssign: ( + b: OperatorNodeParameter, + ) => this; + + incrementBefore: () => OperatorNode; + incrementBeforeAssign: () => this; + + decrementBefore: () => OperatorNode; + decrementBeforeAssign: () => this; + + increment: () => OperatorNode; + incrementAssign: () => this; + + decrement: () => OperatorNode; + decrementAssign: () => this; } } /** * @deprecated "modInt()" is deprecated. Use "mod( int( ... ) )" instead. */ -export const modInt: (a: OperatorNodeParameter, b: OperatorNodeParameter) => ShaderNodeObject; +export const modInt: (a: OperatorNodeParameter, b: OperatorNodeParameter) => OperatorNode; -declare module "../tsl/TSLCore.js" { - interface NodeElements { +declare module "../Nodes.js" { + interface Nodes { + /** + * @deprecated "modInt()" is deprecated. Use "mod( int( ... ) )" instead. + */ + modInt: (b: OperatorNodeParameter) => OperatorNode; /** * @deprecated "modInt()" is deprecated. Use "mod( int( ... ) )" instead. */ - modInt: typeof modInt; + modIntAssign: (b: OperatorNodeParameter) => this; } } diff --git a/types/three/src/nodes/math/TriNoise3D.d.ts b/types/three/src/nodes/math/TriNoise3D.d.ts index 9c1689d6b01395..c1ca74b9454235 100644 --- a/types/three/src/nodes/math/TriNoise3D.d.ts +++ b/types/three/src/nodes/math/TriNoise3D.d.ts @@ -1,12 +1,11 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const tri: (x: Node) => ShaderNodeObject; +export const tri: (x: Node) => Node; -export const tri3: (p: Node) => ShaderNodeObject; +export const tri3: (p: Node) => Node; export const triNoise3D: ( position: Node, speed: Node | number, time: Node | number, -) => ShaderNodeObject; +) => Node; diff --git a/types/three/src/nodes/pmrem/PMREMNode.d.ts b/types/three/src/nodes/pmrem/PMREMNode.d.ts index ab9178127c4598..6e52fb81cbdc94 100644 --- a/types/three/src/nodes/pmrem/PMREMNode.d.ts +++ b/types/three/src/nodes/pmrem/PMREMNode.d.ts @@ -1,7 +1,6 @@ import { Texture } from "../../textures/Texture.js"; import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class PMREMNode extends TempNode { uvNode: Node | null; @@ -19,4 +18,4 @@ export const pmremTexture: ( value: Texture, uvNode?: Node, levelNode?: Node, -) => ShaderNodeObject; +) => PMREMNode; diff --git a/types/three/src/nodes/pmrem/PMREMUtils.d.ts b/types/three/src/nodes/pmrem/PMREMUtils.d.ts index 27227d8ca3d3e2..3dc918bbf8e7e8 100644 --- a/types/three/src/nodes/pmrem/PMREMUtils.d.ts +++ b/types/three/src/nodes/pmrem/PMREMUtils.d.ts @@ -1,7 +1,6 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const getDirection: (uv_immutable: Node, face: Node) => ShaderNodeObject; +export const getDirection: (uv_immutable: Node, face: Node) => Node; export const textureCubeUV: ( envMap: Node, @@ -10,7 +9,7 @@ export const textureCubeUV: ( CUBEUV_TEXEL_WIDTH: Node, CUBEUV_TEXEL_HEIGHT: Node, CUBEUV_MAX_MIP: Node, -) => ShaderNodeObject; +) => Node; export const blur: ( n: Node, @@ -25,4 +24,4 @@ export const blur: ( CUBEUV_TEXEL_WIDTH: Node, CUBEUV_TEXEL_HEIGHT: Node, CUBEUV_MAX_MIP: Node, -) => ShaderNodeObject; +) => Node; diff --git a/types/three/src/nodes/procedural/Checker.d.ts b/types/three/src/nodes/procedural/Checker.d.ts index 55e2cd5474eeae..bcde98423daa9a 100644 --- a/types/three/src/nodes/procedural/Checker.d.ts +++ b/types/three/src/nodes/procedural/Checker.d.ts @@ -1,4 +1,3 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const checker: (coord?: Node) => ShaderNodeObject; +export const checker: (coord?: Node) => Node; diff --git a/types/three/src/nodes/shapes/Shapes.d.ts b/types/three/src/nodes/shapes/Shapes.d.ts index 1dca1482a530ff..2e87ea04bca5a3 100644 --- a/types/three/src/nodes/shapes/Shapes.d.ts +++ b/types/three/src/nodes/shapes/Shapes.d.ts @@ -1,4 +1,3 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const shapeCircle: (coord?: Node) => ShaderNodeObject; +export const shapeCircle: (coord?: Node) => Node; diff --git a/types/three/src/nodes/tsl/TSLBase.d.ts b/types/three/src/nodes/tsl/TSLBase.d.ts index d31b583979578f..b899d353a62adf 100644 --- a/types/three/src/nodes/tsl/TSLBase.d.ts +++ b/types/three/src/nodes/tsl/TSLBase.d.ts @@ -4,8 +4,9 @@ export * from "../code/FunctionCallNode.js"; export * from "../core/ArrayNode.js"; export * from "../core/AssignNode.js"; export * from "../core/BypassNode.js"; -export * from "../core/CacheNode.js"; export * from "../core/ContextNode.js"; +export * from "../core/InspectorNode.js"; +export * from "../core/IsolateNode.js"; export * from "../core/PropertyNode.js"; export * from "../core/SubBuildNode.js"; export * from "../core/UniformNode.js"; diff --git a/types/three/src/nodes/tsl/TSLCore.d.ts b/types/three/src/nodes/tsl/TSLCore.d.ts index 0e3c220817408f..d6a49ae0383d8b 100644 --- a/types/three/src/nodes/tsl/TSLCore.d.ts +++ b/types/three/src/nodes/tsl/TSLCore.d.ts @@ -11,38 +11,15 @@ import NodeBuilder from "../core/NodeBuilder.js"; import StackNode from "../core/StackNode.js"; import JoinNode from "../utils/JoinNode.js"; -export interface NodeElements { - toStack: typeof Stack; - - toColor: (node: Node) => ShaderNodeObject; - toFloat: (node: Node) => ShaderNodeObject; - toInt: (node: Node) => ShaderNodeObject; - toUint: (node: Node) => ShaderNodeObject; - toBool: (node: Node) => ShaderNodeObject; - toVec2: (node: Node) => ShaderNodeObject; - toIvec2: (node: Node) => ShaderNodeObject; - toUvec2: (node: Node) => ShaderNodeObject; - toBvec2: (node: Node) => ShaderNodeObject; - toVec3: (node: Node) => ShaderNodeObject; - toIvec3: (node: Node) => ShaderNodeObject; - toUvec3: (node: Node) => ShaderNodeObject; - toBvec3: (node: Node) => ShaderNodeObject; - toVec4: (node: Node) => ShaderNodeObject; - toIvec4: (node: Node) => ShaderNodeObject; - toUvec4: (node: Node) => ShaderNodeObject; - toBvec4: (node: Node) => ShaderNodeObject; - toMat2: (node: Node) => ShaderNodeObject; - toMat3: (node: Node) => ShaderNodeObject; - toMat4: (node: Node) => ShaderNodeObject; - - element: typeof element; - convert: typeof convert; - - append: typeof append; -} - export function addMethodChaining(name: string, nodeElement: unknown): void; +declare module "../Nodes.js" { + interface Node { + assign: (sourceNode: Node | number) => this; + get: (value: string) => Node; + } +} + type XYZWCharacter = "x" | "y" | "z" | "w"; type RGBACharacter = "r" | "g" | "b" | "a"; type STPQCharacter = "s" | "t" | "p" | "q"; @@ -67,42 +44,65 @@ type STPQSwizzle = export type SwizzleOption = XYZWSwizzle | RGBASwizzle | STPQSwizzle; -export type Swizzable = - & T +export type ArrayElementIndex = + | 0 + | 1 + | 2 + | 3 + | 4 + | 5 + | 6 + | 7 + | 8 + | 9 + | 10 + | 11 + | 12 + | 13 + | 14 + | 15 + | 16 + | 17 + | 18 + | 19 + | 20 + | 21 + | 22 + | 23 + | 24 + | 25 + | 26 + | 27 + | 28 + | 29 + | 30 + | 31; + +export type Swizzable = & { - [Key in SwizzleOption | number]: ShaderNodeObject; + [Key in SwizzleOption | ArrayElementIndex]: Node; } & { - [Key in SwizzleOption as `set${Uppercase}`]: (value: Node) => ShaderNodeObject; + [Key in SwizzleOption as `set${Uppercase}`]: (value: Node) => Node; } & { - [Key in SwizzleOption as `flip${Uppercase}`]: () => ShaderNodeObject; + [Key in SwizzleOption as `flip${Uppercase}`]: () => Node; }; -export type ShaderNodeObject = - & T - & { - [Key in keyof NodeElements]: T extends { [K in Key]: infer M } ? M - : NodeElements[Key] extends (node: T, ...args: infer Args) => infer R ? (...args: Args) => R - : never; +declare module "../Nodes.js" { + interface Node extends Swizzable { } - & { - [Key in keyof NodeElements as `${Key}Assign`]: T extends { [K in Key]: infer M } ? M - : NodeElements[Key] extends (node: T, ...args: infer Args) => unknown - ? (...args: Args) => ShaderNodeObject - : never; - } - & Swizzable; +} /** anything that can be passed to {@link nodeObject} */ export type NodeObjectOption = Node | number | string; -// same logic as in ShaderNodeObject: number,boolean,node->ShaderNodeObject, otherwise do nothing -export type NodeObject = T extends Node ? ShaderNodeObject - : T extends number | boolean ? ShaderNodeObject> +// same logic as in ShaderNodeObject: number,boolean,node->node, otherwise do nothing +export type NodeObject = T extends Node ? T + : T extends number | boolean ? ConstNode : T; -// opposite of NodeObject: node -> node|ShaderNodeObject|boolean|number, otherwise do nothing +// opposite of NodeObject: node -> node|boolean|number, otherwise do nothing type Proxied = T extends Node | number ? Node | number : T; // https://github.com/microsoft/TypeScript/issues/42435#issuecomment-765557874 export type ProxiedTuple = [...{ [index in keyof T]: Proxied }]; @@ -204,9 +204,9 @@ export const getConstNodeType: (value: NodeOrType) => string | null; export class ShaderNode { constructor(jsFunc: (inputs: NodeObjects, builder: NodeBuilder) => Node); call: ( - inputs: { [key in keyof T]: T[key] extends Node ? ShaderNodeObject | Node : T[key] }, + inputs: { [key in keyof T]: T[key] extends Node ? Node : T[key] }, builder?: NodeBuilder, - ) => ShaderNodeObject; + ) => R; } export function nodeObject(obj: T): NodeObject; @@ -217,38 +217,38 @@ export function nodeArray(obj: readonly [...T]): N export function nodeProxy( nodeClass: T, -): (...params: ProxiedTuple>) => ShaderNodeObject>; +): (...params: ProxiedTuple>) => ConstructedNode; export function nodeProxy>( nodeClass: T, scope: S, -): (...params: ProxiedTuple>>) => ShaderNodeObject>; +): (...params: ProxiedTuple>>) => ConstructedNode; export function nodeProxy>( nodeClass: T, scope: S, factor: NodeObjectOption, -): (...params: ProxiedTuple>>) => ShaderNodeObject>; +): (...params: ProxiedTuple>>) => ConstructedNode; export function nodeImmutable( nodeClass: T, ...params: ProxiedTuple> -): ShaderNodeObject>; +): ConstructedNode; export function nodeProxyIntent( nodeClass: T, -): (...params: ProxiedTuple>) => ShaderNodeObject>; +): (...params: ProxiedTuple>) => ConstructedNode; export function nodeProxyIntent>( nodeClass: T, scope: S, -): (...params: ProxiedTuple>>) => ShaderNodeObject>; +): (...params: ProxiedTuple>>) => ConstructedNode; export function nodeProxyIntent>( nodeClass: T, scope: S, factor: NodeObjectOption, -): (...params: ProxiedTuple>>) => ShaderNodeObject>; +): (...params: ProxiedTuple>>) => ConstructedNode; interface Layout { name: string; @@ -260,10 +260,10 @@ interface Layout { }[]; } -interface ShaderNodeFn { - (...args: Args): ShaderNodeObject; +export interface ShaderNodeFn { + (...args: Args): ShaderCallNodeInternal; - shaderNode: ShaderNodeObject; + shaderNode: ShaderNodeInternal; id: number; getNodeType: (builder: NodeBuilder) => string | null; @@ -274,12 +274,14 @@ interface ShaderNodeFn { once: (subBuilds?: string[] | null) => this; } -export function Fn(jsFunc: (builder: NodeBuilder) => void): ShaderNodeFn<[]>; +export function Fn(jsFunc: (builder: NodeBuilder) => void, layout?: string | Record): ShaderNodeFn<[]>; export function Fn( jsFunc: (args: T, builder: NodeBuilder) => void, + layout?: string | Record, ): ShaderNodeFn>; export function Fn( jsFunc: (args: T, builder: NodeBuilder) => void, + layout?: string | Record, ): ShaderNodeFn<[ProxiedObject]>; export const setCurrentStack: (stack: StackNode | null) => void; @@ -291,17 +293,24 @@ export const Switch: (expression: Node) => StackNode; export function Stack(node: Node): Node; +declare module "../Nodes.js" { + interface Node { + toStack: () => Node; + toStackAssign: () => this; + } +} + interface ColorFunction { // The first branch in `ConvertType` will forward the parameters to the `Color` constructor if there are no // parameters or all the parameters are non-objects - (color?: string | number): ShaderNodeObject>; - (r: number, g: number, b: number): ShaderNodeObject>; + (color?: string | number): ConstNode; + (r: number, g: number, b: number): ConstNode; // The second branch does not apply because `cacheMap` is `null` // The third branch will be triggered if there is a single parameter. - (color: Color): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + (color: Color): ConstNode; + (node: Node): Node; // The fall-through branch will be triggered if there is more than one parameter, or one of the parameters is an // object. Not sure which cases are worth considering here. @@ -310,8 +319,8 @@ interface ColorFunction { export const color: ColorFunction; interface NumberFunction { - (value?: number): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + (value?: number): ConstNode; + (node: Node): Node; } export const float: NumberFunction; @@ -319,8 +328,8 @@ export const int: NumberFunction; export const uint: NumberFunction; interface BooleanFunction { - (value?: boolean): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + (value?: boolean): ConstNode; + (node: Node): Node; } export const bool: BooleanFunction; @@ -328,126 +337,224 @@ export const bool: BooleanFunction; interface Vector2Function { // The first branch in `ConvertType` will forward the parameters to the `Vector2` constructor if there are no // parameters or all the parameters are non-objects - (x?: number, y?: number): ShaderNodeObject>; + (x?: number, y?: number): ConstNode; // The second branch does not apply because `cacheMap` is `null` // The third branch will be triggered if there is a single parameter. - (value: Vector2): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + (value: Vector2): ConstNode; + (node: Node): Node; // The fall-through branch will be triggered if there is more than one parameter, or one of the parameters is an // object. - (x: Node | number, y: Node | number): ShaderNodeObject; + (x: Node | number, y: Node | number): JoinNode; } export const vec2: Vector2Function; export const ivec2: Vector2Function; export const uvec2: Vector2Function; -export const bvec2: (node: Node) => ShaderNodeObject; +export const bvec2: (node: Node) => Node; interface Vector3Function { // The first branch in `ConvertType` will forward the parameters to the `Vector3` constructor if there are no // parameters or all the parameters are non-objects - (x?: number, y?: number, z?: number): ShaderNodeObject>; + (x?: number, y?: number, z?: number): ConstNode; // The second branch does not apply because `cacheMap` is `null` // The third branch will be triggered if there is a single parameter. - (value: Vector3): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + (value: Vector3): ConstNode; + (node: Node): Node; // The fall-through branch will be triggered if there is more than one parameter, or one of the parameters is an // object. - (x: Node | number, y: Node | number, z?: Node | number): ShaderNodeObject; + (x: Node | number, y: Node | number, z?: Node | number): JoinNode; } export const vec3: Vector3Function; export const ivec3: Vector3Function; export const uvec3: Vector3Function; -export const bvec3: (node: Node) => ShaderNodeObject; +export const bvec3: (node: Node) => Node; interface Vector4Function { // The first branch in `ConvertType` will forward the parameters to the `Vector4` constructor if there are no // parameters or all the parameters are non-objects - (x?: number, y?: number, z?: number, w?: number): ShaderNodeObject>; + (x?: number, y?: number, z?: number, w?: number): ConstNode; // The second branch does not apply because `cacheMap` is `null` // The third branch will be triggered if there is a single parameter. - (value: Vector4): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + (value: Vector4): ConstNode; + (node: Node): Node; // The fall-through branch will be triggered if there is more than one parameter, or one of the parameters is an // object. - (x: Node | number, y: Node | number, z?: Node | number, w?: Node | number): ShaderNodeObject; + (x: Node | number, y: Node | number, z?: Node | number, w?: Node | number): JoinNode; } export const vec4: Vector4Function; export const ivec4: Vector4Function; export const uvec4: Vector4Function; -export const bvec4: (node: Node) => ShaderNodeObject; +export const bvec4: (node: Node) => Node; interface Matrix2Function { - (value: Matrix2): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + (value: Matrix2): ConstNode; + (node: Node): Node; } export const mat2: Matrix2Function; interface Matrix3Function { - (value: Matrix3): ShaderNodeObject>; + (value: Matrix3): ConstNode; + ( + n11: number | Node, + n12: number | Node, + n13: number | Node, + n21: number | Node, + n22: number | Node, + n23: number | Node, + n31: number | Node, + n32: number | Node, + n33: number | Node, + ): Node; + (): ConstNode; ( - n11: number, - n12: number, - n13: number, - n21: number, - n22: number, - n23: number, - n31: number, - n32: number, - n33: number, - ): ShaderNodeObject>; - (): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + p1: Node, + p2: Node, + p3: Node, + ): Node; + (node: Node): Node; } export const mat3: Matrix3Function; interface Matrix4Function { - (value: Matrix4): ShaderNodeObject>; + (value: Matrix4): ConstNode; + ( + n11: number | Node, + n12: number | Node, + n13: number | Node, + n14: number | Node, + n21: number | Node, + n22: number | Node, + n23: number | Node, + n24: number | Node, + n31: number | Node, + n32: number | Node, + n33: number | Node, + n34: number | Node, + n41: number | Node, + n42: number | Node, + n43: number | Node, + n44: number | Node, + ): Node; + (): ConstNode; ( - n11: number, - n12: number, - n13: number, - n14: number, - n21: number, - n22: number, - n23: number, - n24: number, - n31: number, - n32: number, - n33: number, - n34: number, - n41: number, - n42: number, - n43: number, - n44: number, - ): ShaderNodeObject>; - (): ShaderNodeObject>; - (node: Node): ShaderNodeObject; + p1: Node, + p2: Node, + p3: Node, + p4: Node, + ): Node; + (node: Node): Node; } export const mat4: Matrix4Function; -export const string: (value?: string) => ShaderNodeObject>; -export const arrayBuffer: (value: ArrayBuffer) => ShaderNodeObject>; +export const string: (value?: string) => ConstNode; +export const arrayBuffer: (value: ArrayBuffer) => ConstNode; + +declare module "../Nodes.js" { + interface Node { + toColor: () => Node; + toColorAssign: () => this; + + toFloat: () => Node; + toFloatAssign: () => this; + + toInt: () => Node; + toIntAssign: () => this; + + toUint: () => Node; + toUintAssign: () => this; + + toBool: () => Node; + toBoolAssign: () => this; + + toVec2: () => Node; + toVec2Assign: () => this; + + toIvec2: () => Node; + toIvec2Assign: () => this; + + toUvec2: () => Node; + toUvec2Assign: () => this; -export const element: (node: Node, indexNode: Node) => ShaderNodeObject; -export const convert: (node: Node, types: string) => ShaderNodeObject; -export const split: (node: Node, channels?: string) => ShaderNodeObject; + toBvec2: () => Node; + toBvec2Assign: () => this; + + toVec3: () => Node; + toVec3Assign: () => this; + + toIvec3: () => Node; + toIvec3Assign: () => this; + + toUvec3: () => Node; + toUvec3Assign: () => this; + + toBvec3: () => Node; + ttoBvec3Assign: () => this; + + toVec4: () => Node; + toVec4Assign: () => this; + + toIvec4: () => Node; + toIvec4Assign: () => this; + + toUvec4: () => Node; + toUvec4Assign: () => this; + + toBvec4: () => Node; + toBvec4Assign: () => this; + + toMat2: () => Node; + toMat2Assign: () => this; + + toMat3: () => Node; + toMat3Assign: () => this; + + toMat4: () => Node; + toMat4Assign: () => this; + } +} + +export const element: (node: Node, indexNode: Node) => Node; +export const convert: (node: Node, types: string) => Node; +export const split: (node: Node, channels?: string) => Node; + +declare module "../Nodes.js" { + interface Node { + element: (indexNode: Node) => Node; + elementAssign: (indexNode: Node) => this; + + convert: (types: string) => Node; + convertAssign: (types: string) => this; + } +} /** * @deprecated append() has been renamed to Stack(). */ export const append: (node: Node) => Node; + +declare module "../Nodes.js" { + interface Node { + /** + * @deprecated append() has been renamed to Stack(). + */ + append: () => Node; + /** + * @deprecated append() has been renamed to Stack(). + */ + appendAssign: () => this; + } +} diff --git a/types/three/src/nodes/utils/CubeMapNode.d.ts b/types/three/src/nodes/utils/CubeMapNode.d.ts index dd07c3b2c3f48b..76329dba0c8aa8 100644 --- a/types/three/src/nodes/utils/CubeMapNode.d.ts +++ b/types/three/src/nodes/utils/CubeMapNode.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class CubeMapNode extends TempNode { envNode: Node; @@ -10,4 +9,4 @@ declare class CubeMapNode extends TempNode { export default CubeMapNode; -export const cubeMapNode: (envNode: Node) => ShaderNodeObject; +export const cubeMapNode: (envNode: Node) => CubeMapNode; diff --git a/types/three/src/nodes/utils/DebugNode.d.ts b/types/three/src/nodes/utils/DebugNode.d.ts index 1fb7ccc336fbee..a86c21500f030b 100644 --- a/types/three/src/nodes/utils/DebugNode.d.ts +++ b/types/three/src/nodes/utils/DebugNode.d.ts @@ -1,7 +1,6 @@ import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class DebugNode extends TempNode { constructor(node: Node, callback?: ((code: string) => void) | null); @@ -12,10 +11,15 @@ export default DebugNode; export const debug: ( node: Node, callback?: ((node: NodeBuilder, code: string) => void) | null, -) => ShaderNodeObject; +) => DebugNode; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - debug: typeof debug; +declare module "../Nodes.js" { + interface Node { + debug: ( + callback?: ((node: NodeBuilder, code: string) => void) | null, + ) => DebugNode; + debugAssign: ( + callback?: ((node: NodeBuilder, code: string) => void) | null, + ) => this; } } diff --git a/types/three/src/nodes/utils/Discard.d.ts b/types/three/src/nodes/utils/Discard.d.ts index d0252a34aa840f..3d148cc4a6d897 100644 --- a/types/three/src/nodes/utils/Discard.d.ts +++ b/types/three/src/nodes/utils/Discard.d.ts @@ -1,11 +1,11 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const Discard: (conditional?: Node) => ShaderNodeObject; -export const Return: () => ShaderNodeObject; +export const Discard: (conditional?: Node) => Node; +export const Return: () => Node; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - discard: typeof Discard; +declare module "../Nodes.js" { + interface Node { + discard: () => Node; + discardAssign: () => this; } } diff --git a/types/three/src/nodes/utils/EquirectUV.d.ts b/types/three/src/nodes/utils/EquirectUV.d.ts index 18663a97b1e17e..1107bf8d0233da 100644 --- a/types/three/src/nodes/utils/EquirectUV.d.ts +++ b/types/three/src/nodes/utils/EquirectUV.d.ts @@ -1,4 +1,3 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const equirectUV: (dirNode?: Node) => ShaderNodeObject; +export const equirectUV: (dirNode?: Node) => Node; diff --git a/types/three/src/nodes/utils/EventNode.d.ts b/types/three/src/nodes/utils/EventNode.d.ts index a372290aa0339c..271380ebcb589d 100644 --- a/types/three/src/nodes/utils/EventNode.d.ts +++ b/types/three/src/nodes/utils/EventNode.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; import NodeFrame from "../core/NodeFrame.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export type EventNodeType = typeof EventNode.OBJECT | typeof EventNode.MATERIAL; @@ -12,10 +11,16 @@ declare class EventNode extends Node { static OBJECT: "object"; static MATERIAL: "material"; + static BEFORE_OBJECT: "beforeObject"; + static BEFORE_MATERIAL: "beforeMaterial"; } export default EventNode; -export const OnObjectUpdate: (callback: (frame: NodeFrame) => void) => ShaderNodeObject; +export const OnObjectUpdate: (callback: (frame: NodeFrame) => void) => Node; -export const OnMaterialUpdate: (callback: (frame: NodeFrame) => void) => ShaderNodeObject; +export const OnMaterialUpdate: (callback: (frame: NodeFrame) => void) => Node; + +export const OnBeforeObjectUpdate: (callback: (frame: NodeFrame) => void) => Node; + +export const OnBeforeMaterialUpdate: (callback: (frame: NodeFrame) => void) => Node; diff --git a/types/three/src/nodes/utils/FunctionOverloadingNode.d.ts b/types/three/src/nodes/utils/FunctionOverloadingNode.d.ts index d7c3febb434b7e..e7c62fb1a6a908 100644 --- a/types/three/src/nodes/utils/FunctionOverloadingNode.d.ts +++ b/types/three/src/nodes/utils/FunctionOverloadingNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class FunctionOverloadingNode extends Node { functionNodes: Node[]; @@ -10,4 +9,4 @@ declare class FunctionOverloadingNode extends Node { export default FunctionOverloadingNode; -export const overloadingFn: (functionNodes: Node[]) => (...params: Node[]) => ShaderNodeObject; +export const overloadingFn: (functionNodes: Node[]) => (...params: Node[]) => FunctionOverloadingNode; diff --git a/types/three/src/nodes/utils/LoopNode.d.ts b/types/three/src/nodes/utils/LoopNode.d.ts index 422e63c3411552..9fa5c088bc8f85 100644 --- a/types/three/src/nodes/utils/LoopNode.d.ts +++ b/types/three/src/nodes/utils/LoopNode.d.ts @@ -1,6 +1,6 @@ import Node from "../core/Node.js"; import NodeBuilder from "../core/NodeBuilder.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; +import { VarNode } from "../Nodes.js"; interface LoopNodeObjectParameter { // TODO Expand to other types and update loop function types appropriately @@ -10,6 +10,7 @@ interface LoopNodeObjectParameter { start: number | Node; end: number | Node; condition?: string; + update?: VarNode | number | string; } type LoopNodeParameter = Node | number | LoopNodeObjectParameter; @@ -25,14 +26,14 @@ declare class LoopNode extends Node { export default LoopNode; interface Loop { - (i: LoopNodeParameter, func: (inputs: { readonly i: number }) => void): ShaderNodeObject; + (i: LoopNodeParameter, func: (inputs: { readonly i: Node }) => void): Node; ( i: LoopNodeParameter, j: LoopNodeParameter, - func: (inputs: { readonly i: number; readonly j: number }) => void, - ): ShaderNodeObject; + func: (inputs: { readonly i: Node; readonly j: Node }) => void, + ): Node; } export const Loop: Loop; -export const Continue: () => ShaderNodeObject; -export const Break: () => ShaderNodeObject; +export const Continue: () => Node; +export const Break: () => Node; diff --git a/types/three/src/nodes/utils/MatcapUV.d.ts b/types/three/src/nodes/utils/MatcapUV.d.ts index 15744b448f7f1c..cffbfb246b3d2e 100644 --- a/types/three/src/nodes/utils/MatcapUV.d.ts +++ b/types/three/src/nodes/utils/MatcapUV.d.ts @@ -1,4 +1,3 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const matcapUV: ShaderNodeObject; +export const matcapUV: Node; diff --git a/types/three/src/nodes/utils/MaxMipLevelNode.d.ts b/types/three/src/nodes/utils/MaxMipLevelNode.d.ts index 455cb77a550279..a25670111e184b 100644 --- a/types/three/src/nodes/utils/MaxMipLevelNode.d.ts +++ b/types/three/src/nodes/utils/MaxMipLevelNode.d.ts @@ -1,7 +1,6 @@ import { Texture } from "../../textures/Texture.js"; import TextureNode from "../accessors/TextureNode.js"; import UniformNode from "../core/UniformNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class MaxMipLevelNode extends UniformNode<0> { constructor(textureNode: TextureNode); @@ -11,4 +10,4 @@ export default class MaxMipLevelNode extends UniformNode<0> { get texture(): Texture; } -export const maxMipLevel: (texture: Texture) => ShaderNodeObject; +export const maxMipLevel: (texture: Texture) => MaxMipLevelNode; diff --git a/types/three/src/nodes/utils/Oscillators.d.ts b/types/three/src/nodes/utils/Oscillators.d.ts index df4c35f5a4a953..256da27284eb8b 100644 --- a/types/three/src/nodes/utils/Oscillators.d.ts +++ b/types/three/src/nodes/utils/Oscillators.d.ts @@ -1,7 +1,6 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const oscSine: (timeNode?: Node) => ShaderNodeObject; -export const oscSquare: (timeNode?: Node) => ShaderNodeObject; -export const oscTriangle: (timeNode?: Node) => ShaderNodeObject; -export const oscSawtooth: (timeNode?: Node) => ShaderNodeObject; +export const oscSine: (timeNode?: Node) => Node; +export const oscSquare: (timeNode?: Node) => Node; +export const oscTriangle: (timeNode?: Node) => Node; +export const oscSawtooth: (timeNode?: Node) => Node; diff --git a/types/three/src/nodes/utils/Packing.d.ts b/types/three/src/nodes/utils/Packing.d.ts index d3e570ad59ab87..ba2c71f6876763 100644 --- a/types/three/src/nodes/utils/Packing.d.ts +++ b/types/three/src/nodes/utils/Packing.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const directionToColor: (node: Node) => ShaderNodeObject; -export const colorToDirection: (node: Node) => ShaderNodeObject; +export const directionToColor: (node: Node) => Node; +export const colorToDirection: (node: Node) => Node; diff --git a/types/three/src/nodes/utils/PostProcessingUtils.d.ts b/types/three/src/nodes/utils/PostProcessingUtils.d.ts index 1d8afca64aaad8..a7a2122a8a9283 100644 --- a/types/three/src/nodes/utils/PostProcessingUtils.d.ts +++ b/types/three/src/nodes/utils/PostProcessingUtils.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; /** * Computes a position in view space based on a fragment's screen position expressed as uv coordinates, the fragments @@ -14,7 +13,7 @@ export const getViewPosition: ( screenPosition: Node, depth: Node, projectionMatrixInverse: Node, -) => ShaderNodeObject; +) => Node; /** * Computes a screen position expressed as uv coordinates based on a fragment's position in view space and the camera's @@ -27,7 +26,7 @@ export const getViewPosition: ( export const getScreenPosition: ( viewPosition: Node, projectionMatrix: Node, -) => ShaderNodeObject; +) => Node; /** * Computes a normal vector based on depth data. Can be used as a fallback when no normal render target is available or @@ -42,4 +41,6 @@ export const getNormalFromDepth: ( uv: Node, depthTexture: Node, projectionMatrixInverse: Node, -) => ShaderNodeObject; +) => Node; + +export const interleavedGradientNoise: (position: Node) => Node; diff --git a/types/three/src/nodes/utils/RTTNode.d.ts b/types/three/src/nodes/utils/RTTNode.d.ts index 1157610a481c09..11b91bcca94f01 100644 --- a/types/three/src/nodes/utils/RTTNode.d.ts +++ b/types/three/src/nodes/utils/RTTNode.d.ts @@ -2,7 +2,6 @@ import { TextureDataType } from "../../constants.js"; import { RenderTarget } from "../../core/RenderTarget.js"; import TextureNode from "../accessors/TextureNode.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export interface RTTNodeOptions { type: TextureDataType; @@ -38,10 +37,10 @@ export const rtt: ( width?: number | null, height?: number | null, options?: RTTNodeOptions, -) => ShaderNodeObject; +) => RTTNode; export const convertToTexture: ( node: Node, width?: number | null, height?: number | null, options?: RTTNodeOptions, -) => ShaderNodeObject; +) => RTTNode; diff --git a/types/three/src/nodes/utils/ReflectorNode.d.ts b/types/three/src/nodes/utils/ReflectorNode.d.ts index 54775034120a59..1e1f0d493ecac4 100644 --- a/types/three/src/nodes/utils/ReflectorNode.d.ts +++ b/types/three/src/nodes/utils/ReflectorNode.d.ts @@ -3,7 +3,6 @@ import { Object3D } from "../../core/Object3D.js"; import { RenderTarget } from "../../core/RenderTarget.js"; import TextureNode from "../accessors/TextureNode.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export interface ReflectorNodeParameters { target?: Object3D | undefined; @@ -25,7 +24,7 @@ declare class ReflectorNode extends TextureNode { get target(): Object3D; - getDepthNode(): ShaderNodeObject; + getDepthNode(): ReflectorNode; } declare class ReflectorBaseNode extends Node { @@ -57,6 +56,6 @@ declare class ReflectorBaseNode extends Node { set resolution(value: number); } -export const reflector: (parameters?: ReflectorNodeParameters) => ShaderNodeObject; +export const reflector: (parameters?: ReflectorNodeParameters) => ReflectorNode; export default ReflectorNode; diff --git a/types/three/src/nodes/utils/RemapNode.d.ts b/types/three/src/nodes/utils/RemapNode.d.ts index 00cbd91a2bb516..1dc4a70c08ac29 100644 --- a/types/three/src/nodes/utils/RemapNode.d.ts +++ b/types/three/src/nodes/utils/RemapNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class RemapNode extends Node { node: Node; @@ -19,18 +18,41 @@ export const remap: ( inHighNode: Node | number, outLowNode?: Node | number, outHighNode?: Node | number, -) => ShaderNodeObject; +) => RemapNode; export const remapClamp: ( node: Node, inLowNode: Node | number, inHighNode: Node | number, outLowNode?: Node | number, outHighNode?: Node | number, -) => ShaderNodeObject; +) => RemapNode; -declare module "../tsl/TSLCore.js" { - interface NodeElements { - remap: typeof remap; - remapClamp: typeof remapClamp; +declare module "../Nodes.js" { + interface Node { + remap: ( + inLowNode: Node | number, + inHighNode: Node | number, + outLowNode?: Node | number, + outHighNode?: Node | number, + ) => RemapNode; + remapAssign: ( + inLowNode: Node | number, + inHighNode: Node | number, + outLowNode?: Node | number, + outHighNode?: Node | number, + ) => this; + + remapClamp: ( + inLowNode: Node | number, + inHighNode: Node | number, + outLowNode?: Node | number, + outHighNode?: Node | number, + ) => RemapNode; + remapClampAssign: ( + inLowNode: Node | number, + inHighNode: Node | number, + outLowNode?: Node | number, + outHighNode?: Node | number, + ) => this; } } diff --git a/types/three/src/nodes/utils/RotateNode.d.ts b/types/three/src/nodes/utils/RotateNode.d.ts index d06e729474c96b..915bc21d3be9c4 100644 --- a/types/three/src/nodes/utils/RotateNode.d.ts +++ b/types/three/src/nodes/utils/RotateNode.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; import TempNode from "../core/TempNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class RotateNode extends TempNode { positionNode: Node; @@ -12,4 +11,4 @@ export default class RotateNode extends TempNode { export const rotate: ( positionNode: Node, rotationNode: Node | number, -) => ShaderNodeObject; +) => RotateNode; diff --git a/types/three/src/nodes/utils/SampleNode.d.ts b/types/three/src/nodes/utils/SampleNode.d.ts index bdbed256449495..77e4eb2430582d 100644 --- a/types/three/src/nodes/utils/SampleNode.d.ts +++ b/types/three/src/nodes/utils/SampleNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; declare class SampleNode extends Node { callback: (uv: Node) => Node; @@ -14,4 +13,4 @@ declare class SampleNode extends Node { export default SampleNode; -export const sample: (callback: (uv: Node) => Node, uv?: Node | null) => ShaderNodeObject; +export const sample: (callback: (uv: Node) => Node, uv?: Node | null) => SampleNode; diff --git a/types/three/src/nodes/utils/SpriteSheetUVNode.d.ts b/types/three/src/nodes/utils/SpriteSheetUVNode.d.ts index 88bffd6169d460..6eb266ac318855 100644 --- a/types/three/src/nodes/utils/SpriteSheetUVNode.d.ts +++ b/types/three/src/nodes/utils/SpriteSheetUVNode.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export default class SpriteSheetUVNode extends Node { countNode: Node; @@ -13,4 +12,4 @@ export const spritesheetUV: ( countNode: Node, uvNode: Node | null, frameNode: Node | null, -) => ShaderNodeObject; +) => SpriteSheetUVNode; diff --git a/types/three/src/nodes/utils/SpriteUtils.d.ts b/types/three/src/nodes/utils/SpriteUtils.d.ts index 32f71da99f43d0..a29cf54db97a15 100644 --- a/types/three/src/nodes/utils/SpriteUtils.d.ts +++ b/types/three/src/nodes/utils/SpriteUtils.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export const billboarding: ( args?: { position?: Node | null; horizontal?: boolean; vertical?: boolean }, -) => ShaderNodeObject; +) => Node; diff --git a/types/three/src/nodes/utils/StorageArrayElementNode.d.ts b/types/three/src/nodes/utils/StorageArrayElementNode.d.ts index 6056ff5429befa..a8110c50862b9b 100644 --- a/types/three/src/nodes/utils/StorageArrayElementNode.d.ts +++ b/types/three/src/nodes/utils/StorageArrayElementNode.d.ts @@ -1,6 +1,5 @@ import StorageBufferNode from "../accessors/StorageBufferNode.js"; import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; import ArrayElementNode from "./ArrayElementNode.js"; export default class StorageArrayElementNode extends ArrayElementNode { @@ -17,4 +16,4 @@ export default class StorageArrayElementNode extends ArrayElementNode { export const storageElement: ( storageBufferNode: Node, indexNode: Node, -) => ShaderNodeObject; +) => StorageArrayElementNode; diff --git a/types/three/src/nodes/utils/Timer.d.ts b/types/three/src/nodes/utils/Timer.d.ts index 8241395e5a7614..bc0a8bf9b8c7f8 100644 --- a/types/three/src/nodes/utils/Timer.d.ts +++ b/types/three/src/nodes/utils/Timer.d.ts @@ -1,6 +1,5 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const time: ShaderNodeObject; -export const deltaTime: ShaderNodeObject; -export const frameId: ShaderNodeObject; +export const time: Node; +export const deltaTime: Node; +export const frameId: Node; diff --git a/types/three/src/nodes/utils/TriplanarTextures.d.ts b/types/three/src/nodes/utils/TriplanarTextures.d.ts index 03785d49bd5e0a..e76f4f7c99080f 100644 --- a/types/three/src/nodes/utils/TriplanarTextures.d.ts +++ b/types/three/src/nodes/utils/TriplanarTextures.d.ts @@ -1,5 +1,4 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export const triplanarTextures: ( textureXNode: Node, @@ -8,7 +7,7 @@ export const triplanarTextures: ( scaleNode?: Node, positionNode?: Node, normalNode?: Node, -) => ShaderNodeObject; +) => Node; export const triplanarTexture: ( textureXNode: Node, @@ -17,4 +16,4 @@ export const triplanarTexture: ( scaleNode?: Node, positionNode?: Node, normalNode?: Node, -) => ShaderNodeObject; +) => Node; diff --git a/types/three/src/nodes/utils/UVUtils.d.ts b/types/three/src/nodes/utils/UVUtils.d.ts index b5351d8249599d..a0c2e58beb806e 100644 --- a/types/three/src/nodes/utils/UVUtils.d.ts +++ b/types/three/src/nodes/utils/UVUtils.d.ts @@ -1,15 +1,14 @@ import Node from "../core/Node.js"; import OperatorNode from "../math/OperatorNode.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; export const rotateUV: ( uv: Node, rotation: Node, center?: Node, -) => ShaderNodeObject; +) => OperatorNode; export const spherizeUV: ( uv: Node, strength: Node | number, center?: Node, -) => ShaderNodeObject; +) => OperatorNode; diff --git a/types/three/src/nodes/utils/ViewportUtils.d.ts b/types/three/src/nodes/utils/ViewportUtils.d.ts index 47cdb03c46e898..f7f5a631a6d545 100644 --- a/types/three/src/nodes/utils/ViewportUtils.d.ts +++ b/types/three/src/nodes/utils/ViewportUtils.d.ts @@ -1,4 +1,3 @@ import Node from "../core/Node.js"; -import { ShaderNodeObject } from "../tsl/TSLCore.js"; -export const viewportSafeUV: (uv?: Node | null) => ShaderNodeObject; +export const viewportSafeUV: (uv?: Node | null) => Node; diff --git a/types/three/src/renderers/common/Animation.d.ts b/types/three/src/renderers/common/Animation.d.ts index 6507a8a4569dfe..33406ad8817dc7 100644 --- a/types/three/src/renderers/common/Animation.d.ts +++ b/types/three/src/renderers/common/Animation.d.ts @@ -1,5 +1,6 @@ import Info from "./Info.js"; import Nodes from "./nodes/Nodes.js"; +import Renderer from "./Renderer.js"; export interface AnimationContext { requestAnimationFrame(callback: FrameRequestCallback, xrFrame?: XRFrame): number; cancelAnimationFrame(handle: number): void; @@ -10,6 +11,7 @@ export interface AnimationContext { * @private */ declare class Animation { + renderer: Renderer; nodes: Nodes; info: Info; _context: AnimationContext | null; @@ -18,10 +20,11 @@ declare class Animation { /** * Constructs a new animation loop management component. * + * @param {Renderer} renderer - A reference to the main renderer. * @param {Nodes} nodes - Renderer component for managing nodes related logic. * @param {Info} info - Renderer component for managing metrics and monitoring data. */ - constructor(nodes: Nodes, info: Info); + constructor(renderer: Renderer, nodes: Nodes, info: Info); /** * Starts the internal animation loop. */ diff --git a/types/three/src/renderers/common/Bindings.d.ts b/types/three/src/renderers/common/Bindings.d.ts index b62b673aa68b06..b46d587a703694 100644 --- a/types/three/src/renderers/common/Bindings.d.ts +++ b/types/three/src/renderers/common/Bindings.d.ts @@ -73,6 +73,18 @@ declare class Bindings extends DataMap<{ * @param {RenderObject} renderObject - The render object. */ updateForRender(renderObject: RenderObject): void; + /** + * Deletes the bindings for the given compute node. + * + * @param {Node} computeNode - The compute node. + */ + deleteForCompute(computeNode: ComputeNode): void; + /** + * Deletes the bindings for the given renderObject node. + * + * @param {RenderObject} renderObject - The renderObject. + */ + deleteForRender(renderObject: RenderObject): void; /** * Updates the given array of bindings. * diff --git a/types/three/src/renderers/common/CanvasTarget.d.ts b/types/three/src/renderers/common/CanvasTarget.d.ts new file mode 100644 index 00000000000000..fb337706733bbb --- /dev/null +++ b/types/three/src/renderers/common/CanvasTarget.d.ts @@ -0,0 +1,142 @@ +import { EventDispatcher } from "../../core/EventDispatcher.js"; +import { Vector2 } from "../../math/Vector2.js"; +import { Vector4 } from "../../math/Vector4.js"; +import { DepthTexture } from "../../textures/DepthTexture.js"; +import { FramebufferTexture } from "../../textures/FramebufferTexture.js"; +export interface CanvasTargetEventMap { + resize: {}; + dispose: {}; +} +/** + * CanvasTarget is a class that represents the final output destination of the renderer. + * + * @augments EventDispatcher + */ +declare class CanvasTarget extends EventDispatcher { + domElement: HTMLCanvasElement; + _pixelRatio: number; + _width: number; + _height: number; + _viewport: Vector4; + _scissor: Vector4; + _scissorTest: boolean; + colorTexture: FramebufferTexture; + depthTexture: DepthTexture; + /** + * Constructs a new CanvasTarget. + * + * @param {HTMLCanvasElement|OffscreenCanvas} domElement - The canvas element to render to. + */ + constructor(domElement: HTMLCanvasElement); + /** + * Returns the pixel ratio. + * + * @return {number} The pixel ratio. + */ + getPixelRatio(): number; + /** + * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize(target: Vector2): Vector2; + /** + * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The renderer's size in logical pixels. + */ + getSize(target: Vector2): Vector2; + /** + * Sets the given pixel ratio and resizes the canvas if necessary. + * + * @param {number} [value=1] - The pixel ratio. + */ + setPixelRatio(value?: number): void; + /** + * This method allows to define the drawing buffer size by specifying + * width, height and pixel ratio all at once. The size of the drawing + * buffer is computed with this formula: + * ```js + * size.x = width * pixelRatio; + * size.y = height * pixelRatio; + * ``` + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {number} pixelRatio - The pixel ratio. + */ + setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; + /** + * Sets the size of the renderer. + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. + */ + setSize(width: number, height: number, updateStyle?: boolean): void; + /** + * Returns the scissor rectangle. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The scissor rectangle. + */ + getScissor(target: Vector4): Vector4; + /** + * Defines the scissor rectangle. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. + * Instead of passing four arguments, the method also works with a single four-dimensional vector. + * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. + * @param {number} width - The width of the scissor box in logical pixel unit. + * @param {number} height - The height of the scissor box in logical pixel unit. + */ + setScissor(x: Vector4): void; + setScissor(x: number, y: number, width: number, height: number): void; + /** + * Returns the scissor test value. + * + * @return {boolean} Whether the scissor test should be enabled or not. + */ + getScissorTest(): boolean; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Returns the viewport definition. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The viewport definition. + */ + getViewport(target: Vector4): Vector4; + /** + * Defines the viewport. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. + * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. + */ + setViewport(x: Vector4): void; + setViewport(x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; + /** + * Dispatches the resize event. + * + * @private + */ + _dispatchResize(): void; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * @fires RenderTarget#dispose + */ + dispose(): void; +} +export default CanvasTarget; diff --git a/types/three/src/renderers/common/Geometries.d.ts b/types/three/src/renderers/common/Geometries.d.ts index 9776a26f21a8d6..a9991333c3ca3f 100644 --- a/types/three/src/renderers/common/Geometries.d.ts +++ b/types/three/src/renderers/common/Geometries.d.ts @@ -80,5 +80,6 @@ declare class Geometries extends DataMap<{ * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. */ getIndex(renderObject: RenderObject): BufferAttribute | null; + dispose(): void; } export default Geometries; diff --git a/types/three/src/renderers/common/InspectorBase.d.ts b/types/three/src/renderers/common/InspectorBase.d.ts new file mode 100644 index 00000000000000..9e9b13ff43e51e --- /dev/null +++ b/types/three/src/renderers/common/InspectorBase.d.ts @@ -0,0 +1,105 @@ +import { Camera } from "../../cameras/Camera.js"; +import { RenderTarget } from "../../core/RenderTarget.js"; +import ComputeNode from "../../nodes/gpgpu/ComputeNode.js"; +import { Scene } from "../../scenes/Scene.js"; +import { Texture } from "../../textures/Texture.js"; +import Renderer from "./Renderer.js"; +/** + * InspectorBase is the base class for all inspectors. + * + * @class InspectorBase + */ +declare class InspectorBase { + _renderer: Renderer | null; + /** + * Creates a new InspectorBase. + */ + constructor(); + /** + * Returns the node frame for the current renderer. + * + * @return {Object} The node frame. + */ + get nodeFrame(): import("../../Three.WebGPU.Nodes.js").NodeFrame; + /** + * Sets the renderer for this inspector. + * + * @param {WebGLRenderer} renderer - The renderer to associate with this inspector. + * @return {InspectorBase} This inspector instance. + */ + setRenderer(renderer: Renderer | null): this; + /** + * Returns the renderer associated with this inspector. + * + * @return {WebGLRenderer} The associated renderer. + */ + getRenderer(): Renderer | null; + /** + * Initializes the inspector. + */ + init(): void; + /** + * Called when a frame begins. + */ + begin(): void; + /** + * Called when a frame ends. + */ + finish(): void; + /** + * Inspects a node. + * + * @param {Node} node - The node to inspect. + */ + inspect(): void; + /** + * When a compute operation is performed. + * + * @param {ComputeNode} computeNode - The compute node being executed. + * @param {number|Array} dispatchSizeOrCount - The dispatch size or count. + */ + computeAsync(computeNode: ComputeNode, dispatchSizeOrCount: number | number[]): void; + /** + * Called when a compute operation begins. + * + * @param {string} uid - A unique identifier for the render context. + * @param {ComputeNode} computeNode - The compute node being executed. + */ + beginCompute(uid: string, computeNode: ComputeNode): void; + /** + * Called when a compute operation ends. + * + * @param {string} uid - A unique identifier for the render context. + * @param {ComputeNode} computeNode - The compute node being executed. + */ + finishCompute(uid: string): void; + /** + * Called when a render operation begins. + * + * @param {string} uid - A unique identifier for the render context. + * @param {Scene} scene - The scene being rendered. + * @param {Camera} camera - The camera being used for rendering. + * @param {?WebGLRenderTarget} renderTarget - The render target, if any. + */ + beginRender(uid: string, scene: Scene, camera: Camera, renderTarget: RenderTarget): void; + /** + * Called when an animation loop ends. + * + * @param {string} uid - A unique identifier for the render context. + */ + finishRender(uid: string): void; + /** + * Called when a texture copy operation is performed. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture): void; + /** + * Called when a framebuffer copy operation is performed. + * + * @param {Texture} framebufferTexture - The texture associated with the framebuffer. + */ + copyFramebufferToTexture(framebufferTexture: Texture): void; +} +export default InspectorBase; diff --git a/types/three/src/renderers/common/PostProcessing.d.ts b/types/three/src/renderers/common/PostProcessing.d.ts index 65d5cc93bcf4e1..3b0566150eea89 100644 --- a/types/three/src/renderers/common/PostProcessing.d.ts +++ b/types/three/src/renderers/common/PostProcessing.d.ts @@ -15,6 +15,9 @@ declare class PostProcessing { dispose(): void; + /** + * @deprecated "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer. + */ renderAsync(): Promise; } diff --git a/types/three/src/renderers/common/QuadMesh.d.ts b/types/three/src/renderers/common/QuadMesh.d.ts index ee2bb93bae6bbe..79c2212c4fade6 100644 --- a/types/three/src/renderers/common/QuadMesh.d.ts +++ b/types/three/src/renderers/common/QuadMesh.d.ts @@ -10,6 +10,9 @@ export default class QuadMesh extends Mesh { constructor(material?: Material | null); + /** + * @deprecated "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer. + */ renderAsync(renderer: Renderer): Promise; render(renderer: Renderer): void; diff --git a/types/three/src/renderers/common/RenderContexts.d.ts b/types/three/src/renderers/common/RenderContexts.d.ts index 1be5d0d59b88e2..784773f988ddce 100644 --- a/types/three/src/renderers/common/RenderContexts.d.ts +++ b/types/three/src/renderers/common/RenderContexts.d.ts @@ -39,7 +39,9 @@ declare class RenderContexts { * @param {string} attachmentState - The attachment state. * @return {ChainMap} The chain map. */ - _getChainMap(attachmentState: string): ChainMap; + _getChainMap( + attachmentState: string, + ): ChainMap, Camera], RenderContext>; /** * Frees internal resources. */ diff --git a/types/three/src/renderers/common/Renderer.d.ts b/types/three/src/renderers/common/Renderer.d.ts index 5e8c139c2a92ed..5c7fcac010efd3 100644 --- a/types/three/src/renderers/common/Renderer.d.ts +++ b/types/three/src/renderers/common/Renderer.d.ts @@ -23,10 +23,13 @@ import Attributes from "./Attributes.js"; import Backend from "./Backend.js"; import Background from "./Background.js"; import Bindings from "./Bindings.js"; +import CanvasTarget from "./CanvasTarget.js"; import ClippingContext from "./ClippingContext.js"; import Color4 from "./Color4.js"; import Geometries from "./Geometries.js"; +import IndirectStorageBufferAttribute from "./IndirectStorageBufferAttribute.js"; import Info from "./Info.js"; +import InspectorBase from "./InspectorBase.js"; import Lighting from "./Lighting.js"; import NodeLibrary from "./nodes/NodeLibrary.js"; import Nodes from "./nodes/Nodes.js"; @@ -69,9 +72,7 @@ export interface RendererParameters { */ declare class Renderer { readonly isRenderer: true; - domElement: HTMLCanvasElement; backend: Backend; - samples: number; autoClear: boolean; autoClearColor: boolean; autoClearDepth: boolean; @@ -87,13 +88,10 @@ declare class Renderer { info: Info; library: NodeLibrary; lighting: Lighting; + _samples: number; + _canvasTarget: CanvasTarget; + _inspector: InspectorBase; _getFallback: ((error: unknown) => Backend) | null; - _pixelRatio: number; - _width: number; - _height: number; - _viewport: Vector4; - _scissor: Vector4; - _scissorTest: boolean; _attributes: Attributes | null; _geometries: Geometries | null; _nodes: Nodes | null; @@ -215,6 +213,14 @@ declare class Renderer { * @return {Promise} A Promise that resolves when the renderer has been initialized. */ init(): Promise; + /** + * A reference to the canvas element the renderer is drawing to. + * This value of this property will automatically be created by + * the renderer. + * + * @type {HTMLCanvasElement|OffscreenCanvas} + */ + get domElement(): HTMLCanvasElement; /** * The coordinate system of the renderer. The value of this property * depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or @@ -244,6 +250,7 @@ declare class Renderer { * Renders the scene in an async fashion. * * @async + * @deprecated * @param {Object3D} scene - The scene or 3D object to render. * @param {Camera} camera - The camera. * @return {Promise} A Promise that resolves when the render has been finished. @@ -254,9 +261,17 @@ declare class Renderer { * the CPU waits for the GPU to complete its operation (e.g. a compute task). * * @async + * @deprecated * @return {Promise} A Promise that resolves when synchronization has been finished. */ waitForGPU(): Promise; + /** + * Sets the inspector instance. The inspector can be any class that extends from `InspectorBase`. + * + * @param {InspectorBase} value - The new inspector. + */ + set inspector(value: InspectorBase); + get inspector(): InspectorBase; /** * Enables or disables high precision for model-view and normal-view matrices. * When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance. @@ -311,17 +326,27 @@ declare class Renderer { _renderBundle(bundle: Bundle, sceneRef: Scene, lightsNode: LightsNode): void; /** * Renders the scene or 3D object with the given camera. This method can only be called - * if the renderer has been initialized. + * if the renderer has been initialized. When using `render()` inside an animation loop, + * it's guaranteed the renderer will be initialized. The animation loop must be defined + * with {@link Renderer#setAnimationLoop} though. + * + * For all other use cases (like when using on-demand rendering), you must call + * {@link Renderer#init} before rendering. * * The target of the method is the default framebuffer (meaning the canvas) * or alternatively a render target when specified via `setRenderTarget()`. * * @param {Object3D} scene - The scene or 3D object to render. * @param {Camera} camera - The camera to render the scene with. - * @return {?Promise} A Promise that resolve when the scene has been rendered. - * Only returned when the renderer has not been initialized. */ - render(scene: Object3D, camera: Camera): Promise | undefined; + render(scene: Object3D, camera: Camera): void; + /** + * Returns whether the renderer has been initialized or not. + * + * @readonly + * @return {boolean} Whether the renderer has been initialized or not. + */ + get initialized(): boolean; /** * Returns an internal render target which is used when computing the output tone mapping * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render @@ -330,7 +355,7 @@ declare class Renderer { * @private * @return {?RenderTarget} The render target. The method returns `null` if no output conversion should be applied. */ - _getFrameBufferTarget(): RenderTarget | null; + _getFrameBufferTarget(): RenderTarget> | null; /** * Renders the scene or 3D object with the given camera. * @@ -373,10 +398,16 @@ declare class Renderer { * for best compatibility. * * @async - * @param {?Function} callback - The application's animation loop. + * @param {?onAnimationCallback} callback - The application's animation loop. * @return {Promise} A Promise that resolves when the set has been executed. */ setAnimationLoop(callback: ((time: DOMHighResTimeStamp, frame?: XRFrame) => void) | null): Promise; + /** + * Returns the current animation loop callback. + * + * @return {?Function} The current animation loop callback. + */ + getAnimationLoop(): ((time: DOMHighResTimeStamp, xrFrame?: XRFrame) => void) | null; /** * Can be used to transfer buffer data from a storage buffer attribute * from the GPU to the CPU in context of compute shaders. @@ -568,35 +599,25 @@ declare class Renderer { * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - * @return {Promise} A Promise that resolves when the clear operation has been executed. - * Only returned when the renderer has not been initialized. */ - clear(color?: boolean, depth?: boolean, stencil?: boolean): Promise | undefined; + clear(color?: boolean, depth?: boolean, stencil?: boolean): void; /** * Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties. - * - * @return {Promise} A Promise that resolves when the clear operation has been executed. - * Only returned when the renderer has not been initialized. */ - clearColor(): Promise | undefined; + clearColor(): void; /** * Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties. - * - * @return {Promise} A Promise that resolves when the clear operation has been executed. - * Only returned when the renderer has not been initialized. */ - clearDepth(): Promise | undefined; + clearDepth(): void; /** * Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties. - * - * @return {Promise} A Promise that resolves when the clear operation has been executed. - * Only returned when the renderer has not been initialized. */ - clearStencil(): Promise | undefined; + clearStencil(): void; /** * Async version of {@link Renderer#clear}. * * @async + * @deprecated * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. @@ -607,6 +628,7 @@ declare class Renderer { * Async version of {@link Renderer#clearColor}. * * @async + * @deprecated * @return {Promise} A Promise that resolves when the clear operation has been executed. */ clearColorAsync(): Promise; @@ -614,6 +636,7 @@ declare class Renderer { * Async version of {@link Renderer#clearDepth}. * * @async + * @deprecated * @return {Promise} A Promise that resolves when the clear operation has been executed. */ clearDepthAsync(): Promise; @@ -621,9 +644,32 @@ declare class Renderer { * Async version of {@link Renderer#clearStencil}. * * @async + * @deprecated * @return {Promise} A Promise that resolves when the clear operation has been executed. */ clearStencilAsync(): Promise; + /** + * Returns `true` if a framebuffer target is needed to perform tone mapping or color space conversion. + * If this is the case, the renderer allocates an internal render target for that purpose. + */ + get needsFrameBufferTarget(): boolean; + /** + * The number of samples used for multi-sample anti-aliasing (MSAA). + * + * @type {number} + * @default 0 + */ + get samples(): number; + /** + * The current number of samples used for multi-sample anti-aliasing (MSAA). + * + * When rendering to a custom render target, the number of samples of that render target is used. + * If the renderer needs an internal framebuffer target for tone mapping or color space conversion, + * the number of samples is set to 0. + * + * @type {number} + */ + get currentSamples(): number; /** * The current tone mapping of the renderer. When not producing screen output, * the tone mapping is always `NoToneMapping`. @@ -664,7 +710,7 @@ declare class Renderer { * * @return {?RenderTarget} The render target. Returns `null` if no render target is set. */ - getRenderTarget(): RenderTarget | null; + getRenderTarget(): RenderTarget> | null; /** * Sets the output render target for the renderer. * @@ -676,7 +722,20 @@ declare class Renderer { * * @return {?RenderTarget} The current output render target. Returns `null` if no output target is set. */ - getOutputRenderTarget(): RenderTarget | null; + getOutputRenderTarget(): RenderTarget> | null; + /** + * Sets the canvas target. The canvas target manages the HTML canvas + * or the offscreen canvas the renderer draws into. + * + * @param {CanvasTarget} canvasTarget - The canvas target. + */ + setCanvasTarget(canvasTarget: CanvasTarget): void; + /** + * Returns the current canvas target. + * + * @return {CanvasTarget} The current canvas target. + */ + getCanvasTarget(): CanvasTarget; /** * Resets the renderer to the initial state before WebXR started. */ @@ -742,29 +801,36 @@ declare class Renderer { * if the renderer has been initialized. * * @param {Node|Array} computeNodes - The compute node(s). - * @param {?(Array|number)} [dispatchSizeOrCount=null] - Array with [ x, y, z ] values for dispatch or a single number for the count. + * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] + * - A single number representing count, or + * - An array [x, y, z] representing dispatch size, or + * - A IndirectStorageBufferAttribute for indirect dispatch size. * @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized. */ compute( computeNodes: ComputeNode | ComputeNode[], - dispatchSizeOrCount?: number[] | number | null, + dispatchSize?: number[] | number | IndirectStorageBufferAttribute | null, ): Promise | undefined; /** * Execute a single or an array of compute nodes. * * @async * @param {Node|Array} computeNodes - The compute node(s). - * @param {?(Array|number)} [dispatchSizeOrCount=null] - Array with [ x, y, z ] values for dispatch or a single number for the count. + * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] + * - A single number representing count, or + * - An array [x, y, z] representing dispatch size, or + * - A IndirectStorageBufferAttribute for indirect dispatch size. * @return {Promise} A Promise that resolve when the compute has finished. */ computeAsync( computeNodes: ComputeNode | ComputeNode[], - dispatchSizeOrCount?: number[] | number | null, + dispatchSize?: number[] | number | IndirectStorageBufferAttribute | null, ): Promise; /** * Checks if the given feature is supported by the selected backend. * * @async + * @deprecated * @param {string} name - The feature's name. * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. */ @@ -777,7 +843,7 @@ declare class Renderer { * @param {string} name - The feature's name. * @return {boolean} Whether the feature is supported or not. */ - hasFeature(name: string): false | void; + hasFeature(name: string): void; /** * Returns `true` when the renderer has been initialized. * @@ -789,6 +855,7 @@ declare class Renderer { * (which can cause noticeable lags due to decode and GPU upload overhead). * * @async + * @deprecated * @param {Texture} texture - The texture. * @return {Promise} A Promise that resolves when the texture has been initialized. */ @@ -909,6 +976,14 @@ declare class Renderer { lightsNode: LightsNode, passId?: string | null, ): void; + /** + * Retrieves shadow nodes for the given material. This is used to setup shadow passes. + * The result is cached per material and updated when the material's version changes. + * + * @param {Material} material + * @returns {Object} - The shadow nodes for the material. + */ + _getShadowNodes(material: Material): any; /** * This method represents the default render object function that manages the render lifecycle * of the object. @@ -982,6 +1057,12 @@ declare class Renderer { clippingContext: ClippingContext | null, passId?: string, ): void; + /** + * Callback when the canvas has been resized. + * + * @private + */ + _onCanvasTargetResize(): void; /** * Alias for `compileAsync()`. * @@ -993,4 +1074,11 @@ declare class Renderer { */ get compile(): (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Promise; } +/** + * Animation loop parameter of `renderer.setAnimationLoop()`. + * + * @callback onAnimationCallback + * @param {DOMHighResTimeStamp} time - A timestamp indicating the end time of the previous frame's rendering. + * @param {XRFrame} [frame] - A reference to the current XR frame. Only relevant when using XR rendering. + */ export default Renderer; diff --git a/types/three/src/renderers/common/SampledTexture.d.ts b/types/three/src/renderers/common/SampledTexture.d.ts index 1ad60f753cd40c..919a93c44a912d 100644 --- a/types/three/src/renderers/common/SampledTexture.d.ts +++ b/types/three/src/renderers/common/SampledTexture.d.ts @@ -6,6 +6,8 @@ declare class SampledTexture extends Sampler { store: boolean; + mipLevel: number; + readonly isSampledTexture: true; constructor(name: string, texture: Texture | null); diff --git a/types/three/src/renderers/common/Sampler.d.ts b/types/three/src/renderers/common/Sampler.d.ts index 89e9f0ccbdae1d..8fbf5ece809c8c 100644 --- a/types/three/src/renderers/common/Sampler.d.ts +++ b/types/three/src/renderers/common/Sampler.d.ts @@ -6,6 +6,8 @@ declare class Sampler extends Binding { generation: number | null; + samplerKey: string; + readonly isSampler: true; constructor(name: string, texture: Texture | null); diff --git a/types/three/src/renderers/common/Textures.d.ts b/types/three/src/renderers/common/Textures.d.ts index ac4ac7f931c0a4..d81082f94ef270 100644 --- a/types/three/src/renderers/common/Textures.d.ts +++ b/types/three/src/renderers/common/Textures.d.ts @@ -87,6 +87,19 @@ declare class Textures extends DataMap<{ * @param {Object} [options={}] - The options. */ updateTexture(texture: Texture, options?: TextureOptions): void; + /** + * Updates the sampler for the given texture. This method has no effect + * for the WebGL backend since it has no concept of samplers. Texture + * parameters are configured with the `texParameter()` command for each + * texture. + * + * In WebGPU, samplers are objects like textures and it's possible to share + * them when the texture parameters match. + * + * @param {Texture} texture - The texture to update the sampler for. + * @return {string} The current sampler key. + */ + updateSampler(texture: Texture): void; /** * Computes the size of the given texture and writes the result * into the target vector. This vector is also returned by the @@ -116,6 +129,13 @@ declare class Textures extends DataMap<{ * @return {boolean} Whether mipmaps are required or not. */ needsMipmaps(texture: Texture): boolean; + /** + * Frees internal resources when the given render target isn't + * required anymore. + * + * @param {RenderTarget} renderTarget - The render target to destroy. + */ + _destroyRenderTarget(renderTarget: RenderTarget): void; /** * Frees internal resource when the given texture isn't * required anymore. diff --git a/types/three/src/renderers/common/TimestampQueryPool.d.ts b/types/three/src/renderers/common/TimestampQueryPool.d.ts index 8fe992eef8b892..99136ddcbec60b 100644 --- a/types/three/src/renderers/common/TimestampQueryPool.d.ts +++ b/types/three/src/renderers/common/TimestampQueryPool.d.ts @@ -10,21 +10,44 @@ declare abstract class TimestampQueryPool { queryOffsets: Map; isDisposed: boolean; lastValue: number; + frames: number[]; pendingResolve: boolean; + timestamps: Map; /** * Creates a new timestamp query pool. * * @param {number} [maxQueries=256] - Maximum number of queries this pool can hold. */ constructor(maxQueries?: number); + /** + * Returns all timestamp frames. + * + * @return {Array} The timestamp frames. + */ + getTimestampFrames(): number[]; + /** + * Returns the timestamp for a given render context. + * + * @param {string} uid - A unique identifier for the render context. + * @return {?number} The timestamp, or undefined if not available. + */ + getTimestamp(uid: string): number; + /** + * Returns whether a timestamp is available for a given render context. + * + * @param {string} uid - A unique identifier for the render context. + * @return {boolean} True if a timestamp is available, false otherwise. + */ + hasTimestamp(uid: string): boolean; /** * Allocate queries for a specific uid. * * @abstract * @param {string} uid - A unique identifier for the render context. + * @param {number} frameId - The current frame identifier. * @returns {?number} */ - abstract allocateQueriesForContext(uid: string): number | null; + abstract allocateQueriesForContext(uid: string, frameId: number): number | null; /** * Resolve all timestamps and return data (or process them). * diff --git a/types/three/src/renderers/common/extras/PMREMGenerator.d.ts b/types/three/src/renderers/common/extras/PMREMGenerator.d.ts index 28719bd2b61638..cb85b63210596d 100644 --- a/types/three/src/renderers/common/extras/PMREMGenerator.d.ts +++ b/types/three/src/renderers/common/extras/PMREMGenerator.d.ts @@ -1,6 +1,7 @@ import { RenderTarget } from "../../../core/RenderTarget.js"; import { Vector3 } from "../../../math/Vector3.js"; import { Scene } from "../../../scenes/Scene.js"; +import { Texture } from "../../../textures/Texture.js"; import Renderer from "../Renderer.js"; export interface PMREMGeneratorOptions { @@ -19,7 +20,9 @@ declare class PMREMGenerator { far?: number, options?: PMREMGeneratorOptions, ): RenderTarget; - + /** + * @deprecated ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead. + */ fromSceneAsync( scene: Scene, sigma?: number, @@ -28,6 +31,21 @@ declare class PMREMGenerator { options?: PMREMGeneratorOptions, ): Promise; + fromEquirectangular(equirectangular: Texture, renderTarget?: RenderTarget | null): RenderTarget; + /** + * @deprecated ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead. + */ + fromEquirectangularAsync(equirectangular: Texture, renderTarget?: RenderTarget | null): Promise; + + fromCubemap(cubemap: Texture, renderTarget?: RenderTarget | null): RenderTarget; + /** + * @deprecated ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead. + */ + fromCubemapAsync(cubemap: Texture, renderTarget?: RenderTarget | null): Promise; + + compileCubemapShader(): Promise; + compileEquirectangularShader(): Promise; + dispose(): void; } diff --git a/types/three/src/renderers/common/nodes/NodeLibrary.d.ts b/types/three/src/renderers/common/nodes/NodeLibrary.d.ts index 5fd9eabbec30d5..e3a078a147b39c 100644 --- a/types/three/src/renderers/common/nodes/NodeLibrary.d.ts +++ b/types/three/src/renderers/common/nodes/NodeLibrary.d.ts @@ -4,7 +4,6 @@ import { Material } from "../../../materials/Material.js"; import NodeMaterial from "../../../materials/nodes/NodeMaterial.js"; import Node from "../../../nodes/core/Node.js"; import AnalyticLightNode from "../../../nodes/lighting/AnalyticLightNode.js"; -import { ShaderNodeObject } from "../../../nodes/tsl/TSLCore.js"; /** * The purpose of a node library is to assign node implementations * to existing library features. In `WebGPURenderer` lights, materials @@ -22,7 +21,7 @@ declare class NodeLibrary { materialNodes: Map; - toneMappingNodes: Map ShaderNodeObject>; + toneMappingNodes: Map Node>; /** * Constructs a new node library. */ @@ -44,17 +43,14 @@ declare class NodeLibrary { * @param {Function} toneMappingNode - The tone mapping node function. * @param {number} toneMapping - The tone mapping. */ - addToneMapping( - toneMappingNode: (color: Node, exposure: Node) => ShaderNodeObject, - toneMapping: ToneMapping, - ): void; + addToneMapping(toneMappingNode: (color: Node, exposure: Node) => Node, toneMapping: ToneMapping): void; /** * Returns a tone mapping node function for a tone mapping technique (constant). * * @param {number} toneMapping - The tone mapping. * @return {?Function} The tone mapping node function. Returns `null` if no node function is found. */ - getToneMappingFunction(toneMapping: ToneMapping): ((color: Node, exposure: Node) => ShaderNodeObject) | null; + getToneMappingFunction(toneMapping: ToneMapping): ((color: Node, exposure: Node) => Node) | null; /** * Returns a node material class definition for a material type. * diff --git a/types/three/src/renderers/common/nodes/Nodes.d.ts b/types/three/src/renderers/common/nodes/Nodes.d.ts index 1016f7c67cc7dd..d2a1b20d6e17e1 100644 --- a/types/three/src/renderers/common/nodes/Nodes.d.ts +++ b/types/three/src/renderers/common/nodes/Nodes.d.ts @@ -8,7 +8,6 @@ import UniformGroupNode from "../../../nodes/core/UniformGroupNode.js"; import ComputeNode from "../../../nodes/gpgpu/ComputeNode.js"; import LightsNode from "../../../nodes/lighting/LightsNode.js"; import { NodeFrame } from "../../../nodes/Nodes.js"; -import { ShaderNodeObject } from "../../../nodes/TSL.js"; import { Fog } from "../../../scenes/Fog.js"; import { FogExp2 } from "../../../scenes/FogExp2.js"; import { Scene } from "../../../scenes/Scene.js"; @@ -33,11 +32,11 @@ interface ComputeNodeData { } interface SceneData { background?: Color | Texture | CubeTexture | undefined; - backgroundNode?: ShaderNodeObject | undefined; + backgroundNode?: Node | undefined; fog?: Fog | FogExp2 | undefined; - fogNode?: ShaderNodeObject | undefined; + fogNode?: Node | undefined; environment?: Texture | undefined; - environmentNode?: ShaderNodeObject | undefined; + environmentNode?: Node | undefined; } interface CacheKeyData { callId: number; @@ -45,9 +44,9 @@ interface CacheKeyData { } declare module "../../../scenes/Scene.js" { interface Scene { - environmentNode?: ShaderNodeObject | null | undefined; - backgroundNode?: ShaderNodeObject | null | undefined; - fogNode?: ShaderNodeObject | null | undefined; + environmentNode?: Node | null | undefined; + backgroundNode?: Node | null | undefined; + fogNode?: Node | null | undefined; } } /** @@ -90,7 +89,7 @@ declare class Nodes extends DataMap<{ version?: number; }>; cacheLib: { - [type: string]: WeakMap | undefined>; + [type: string]: WeakMap; }; constructor(renderer: Renderer, backend: Backend); /** @@ -145,7 +144,7 @@ declare class Nodes extends DataMap<{ * @param {Scene} scene - The scene. * @return {Node} A node representing the current scene environment. */ - getEnvironmentNode(scene: Scene): ShaderNodeObject | null; + getEnvironmentNode(scene: Scene): Node | null; /** * Returns a background node for the current configured * scene background. @@ -153,14 +152,14 @@ declare class Nodes extends DataMap<{ * @param {Scene} scene - The scene. * @return {Node} A node representing the current scene background. */ - getBackgroundNode(scene: Scene): ShaderNodeObject | null; + getBackgroundNode(scene: Scene): Node | null; /** * Returns a fog node for the current configured scene fog. * * @param {Scene} scene - The scene. * @return {Node} A node representing the current scene fog. */ - getFogNode(scene: Scene): ShaderNodeObject | null; + getFogNode(scene: Scene): Node | null; /** * Returns a cache key for the given scene and lights node. * This key is used by `RenderObject` as a part of the dynamic @@ -199,9 +198,9 @@ declare class Nodes extends DataMap<{ getCacheNode( type: string, object: object, - callback: () => ShaderNodeObject | undefined, + callback: () => Node | undefined, forceUpdate?: boolean, - ): ShaderNodeObject | undefined; + ): Node | undefined; /** * If a scene fog is configured, this method makes sure to * represent the fog with a corresponding node-based implementation. @@ -245,7 +244,7 @@ declare class Nodes extends DataMap<{ * @param {Texture} outputTarget - The output target. * @return {Node} The output node. */ - getOutputNode(outputTarget: Texture): ShaderNodeObject; + getOutputNode(outputTarget: Texture): Node; /** * Triggers the call of `updateBefore()` methods * for all nodes of the given render object. diff --git a/types/three/src/renderers/webgpu/utils/WebGPUConstants.d.ts b/types/three/src/renderers/webgpu/utils/WebGPUConstants.d.ts index 65adaf938fbf00..ead5ba69ed793e 100644 --- a/types/three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +++ b/types/three/src/renderers/webgpu/utils/WebGPUConstants.d.ts @@ -335,3 +335,8 @@ export enum GPUFeatureName { TextureFormatsTier1 = "texture-formats-tier1", TextureFormatsTier2 = "texture-formats-tier2", } + +export enum GPUFeatureMap { + "texture-compression-s3tc" = "texture-compression-bc", + "texture-compression-etc1" = "texture-compression-etc2", +} diff --git a/types/three/src/scenes/Scene.d.ts b/types/three/src/scenes/Scene.d.ts index c2f43afd7b0b5b..c03c9ec9e4061f 100644 --- a/types/three/src/scenes/Scene.d.ts +++ b/types/three/src/scenes/Scene.d.ts @@ -1,4 +1,4 @@ -import { JSONMeta, Object3D, Object3DJSON, Object3DJSONObject } from "../core/Object3D.js"; +import { JSONMeta, Object3D, Object3DEventMap, Object3DJSON, Object3DJSONObject } from "../core/Object3D.js"; import { Material } from "../materials/Material.js"; import { Color } from "../math/Color.js"; import { Euler, EulerTuple } from "../math/Euler.js"; @@ -31,7 +31,7 @@ export interface SceneJSON extends Object3DJSON { * @see {@link https://threejs.org/docs/index.html#api/en/scenes/Scene | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/scenes/Scene.js | Source} */ -export class Scene extends Object3D { +export class Scene extends Object3D { /** * Create a new {@link Scene} object. */ diff --git a/types/three/src/textures/CanvasTexture.d.ts b/types/three/src/textures/CanvasTexture.d.ts index 4db5b83165bbe7..38331465497dc3 100644 --- a/types/three/src/textures/CanvasTexture.d.ts +++ b/types/three/src/textures/CanvasTexture.d.ts @@ -6,7 +6,7 @@ import { TextureDataType, Wrapping, } from "../constants.js"; -import { OffscreenCanvas, Texture } from "./Texture.js"; +import { Texture } from "./Texture.js"; /** * Creates a texture from a {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas | canvas element}. @@ -17,7 +17,7 @@ import { OffscreenCanvas, Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/CanvasTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CanvasTexture.js | Source} */ -export class CanvasTexture extends Texture { +export class CanvasTexture extends Texture { /** * This creates a new {@link THREE.CanvasTexture | CanvasTexture} object. * @param canvas The HTML canvas element from which to load the texture. @@ -31,7 +31,7 @@ export class CanvasTexture extends Texture { * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY} */ constructor( - canvas?: TexImageSource | OffscreenCanvas, + canvas?: TCanvas, mapping?: Mapping, wrapS?: Wrapping, wrapT?: Wrapping, diff --git a/types/three/src/textures/CompressedArrayTexture.d.ts b/types/three/src/textures/CompressedArrayTexture.d.ts index e46c3d47898fa8..fb3f46dbe4bea1 100644 --- a/types/three/src/textures/CompressedArrayTexture.d.ts +++ b/types/three/src/textures/CompressedArrayTexture.d.ts @@ -1,5 +1,5 @@ import { CompressedPixelFormat, TextureDataType, Wrapping } from "../constants.js"; -import { CompressedTexture, CompressedTextureMipmap } from "./CompressedTexture.js"; +import { CompressedTexture, CompressedTextureImageData, CompressedTextureMipmap } from "./CompressedTexture.js"; /** * Creates an texture 2D array based on data in compressed form, for example from a @@ -8,7 +8,7 @@ import { CompressedTexture, CompressedTextureMipmap } from "./CompressedTexture. * @see {@link https://threejs.org/docs/index.html#api/en/textures/CompressedArrayTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CompressedArrayTexture.js | Source} */ -export class CompressedArrayTexture extends CompressedTexture { +export class CompressedArrayTexture extends CompressedTexture { /** * Read-only flag to check if a given object is of type {@link CompressedArrayTexture}. * @remarks This is a _constant_ value @@ -16,13 +16,6 @@ export class CompressedArrayTexture extends CompressedTexture { */ readonly isCompressedArrayTexture: true; - /** - * Overridden with a object containing width and height. - * @override - */ - get image(): { width: number; height: number; depth: number }; - set image(value: { width: number; height: number; depth: number }); - /** * This defines how the texture is wrapped in the depth direction. * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants} @@ -66,3 +59,7 @@ export class CompressedArrayTexture extends CompressedTexture { */ clearLayoutUpdates(): void; } + +export interface CompressedArrayTextureImageData extends CompressedTextureImageData { + depth: number; +} diff --git a/types/three/src/textures/CompressedCubeTexture.d.ts b/types/three/src/textures/CompressedCubeTexture.d.ts index 9c72145a05e51a..65418a39add34a 100644 --- a/types/three/src/textures/CompressedCubeTexture.d.ts +++ b/types/three/src/textures/CompressedCubeTexture.d.ts @@ -1,12 +1,12 @@ import { CompressedPixelFormat, TextureDataType } from "../constants.js"; -import { CompressedTexture } from "./CompressedTexture.js"; +import { CompressedTexture, CompressedTextureImageData } from "./CompressedTexture.js"; -export class CompressedCubeTexture extends CompressedTexture { +export class CompressedCubeTexture extends CompressedTexture { readonly isCompressedCubeTexture: true; readonly isCubeTexture: true; constructor( - images: Array<{ width: number; height: number }>, + images: CompressedTextureImageData[], format?: CompressedPixelFormat, type?: TextureDataType, ); diff --git a/types/three/src/textures/CompressedTexture.d.ts b/types/three/src/textures/CompressedTexture.d.ts index 8112f90ee0ebda..dc19f087fc822f 100644 --- a/types/three/src/textures/CompressedTexture.d.ts +++ b/types/three/src/textures/CompressedTexture.d.ts @@ -21,7 +21,7 @@ export interface CompressedTextureMipmap { * @see {@link https://threejs.org/docs/index.html#api/en/textures/CompressedTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CompressedTexture.js | Source} */ -export class CompressedTexture extends Texture { +export class CompressedTexture extends Texture { /** * This creates a new {@link THREE.CompressedTexture | CompressedTexture} object. * @param mipmaps The mipmaps array should contain objects with data, width and height. The mipmaps should be of the @@ -60,13 +60,6 @@ export class CompressedTexture extends Texture { */ readonly isCompressedTexture: true; - /** - * Overridden with a object containing width and height. - * @override - */ - get image(): { width: number; height: number }; - set image(value: { width: number; height: number }); - /** * The mipmaps array should contain objects with data, width and height. The mipmaps should be of the correct * format and type. @@ -92,3 +85,8 @@ export class CompressedTexture extends Texture { */ generateMipmaps: boolean; } + +export interface CompressedTextureImageData { + width: number; + height: number; +} diff --git a/types/three/src/textures/CubeTexture.d.ts b/types/three/src/textures/CubeTexture.d.ts index f5808aaf93b7c5..0f95676ef9f929 100644 --- a/types/three/src/textures/CubeTexture.d.ts +++ b/types/three/src/textures/CubeTexture.d.ts @@ -27,7 +27,7 @@ import { Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/CubeTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CubeTexture.js | Source} */ -export class CubeTexture extends Texture { +export class CubeTexture extends Texture { /** * This creates a new {@link THREE.CubeTexture | CubeTexture} object. * @param images @@ -42,7 +42,7 @@ export class CubeTexture extends Texture { * @param colorSpace See {@link Texture.colorSpace | .colorSpace}. Default {@link NoColorSpace} */ constructor( - images?: any[], // HTMLImageElement or HTMLCanvasElement + images?: HTMLImageElement[], mapping?: CubeTextureMapping, wrapS?: Wrapping, wrapT?: Wrapping, @@ -65,15 +65,8 @@ export class CubeTexture extends Texture { * An image object, typically created using the {@link THREE.CubeTextureLoader.load | CubeTextureLoader.load()} method. * @see {@link Texture.image} */ - get image(): any; - set image(data: any); - - /** - * An image object, typically created using the {@link THREE.CubeTextureLoader.load | CubeTextureLoader.load()} method. - * @see {@link Texture.image} - */ - get images(): any; - set images(data: any); + get images(): HTMLImageElement[]; + set images(value: HTMLImageElement[]); /** * @inheritDoc diff --git a/types/three/src/textures/Data3DTexture.d.ts b/types/three/src/textures/Data3DTexture.d.ts index 99ef5ce0dd7126..73430ddeee1b7b 100644 --- a/types/three/src/textures/Data3DTexture.d.ts +++ b/types/three/src/textures/Data3DTexture.d.ts @@ -1,6 +1,5 @@ import { MagnificationTextureFilter, MinificationTextureFilter, Wrapping } from "../constants.js"; import { TypedArray } from "../core/BufferAttribute.js"; -import { TextureImageData } from "./DataTexture.js"; import { Texture } from "./Texture.js"; /** @@ -33,7 +32,7 @@ import { Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/Data3DTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/Data3DTexture.js | Source} */ -export class Data3DTexture extends Texture { +export class Data3DTexture extends Texture { /** * Create a new instance of {@link Data3DTexture} * @param data {@link https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView | ArrayBufferView} of the texture. Default `null`. @@ -50,13 +49,6 @@ export class Data3DTexture extends Texture { */ readonly isData3DTexture: true; - /** - * Overridden with a record type holding data, width and height and depth. - * @override - */ - get image(): Texture3DImageData; - set image(data: Texture3DImageData); - /** * @override * @defaultValue {@link THREE.NearestFilter} @@ -94,6 +86,9 @@ export class Data3DTexture extends Texture { unpackAlignment: number; } -export interface Texture3DImageData extends TextureImageData { +export interface Data3DTextureImageData { + data: TypedArray | null; + width: number; + height: number; depth: number; } diff --git a/types/three/src/textures/DataArrayTexture.d.ts b/types/three/src/textures/DataArrayTexture.d.ts index eacca2abb19012..ac6354ae8ba9ad 100644 --- a/types/three/src/textures/DataArrayTexture.d.ts +++ b/types/three/src/textures/DataArrayTexture.d.ts @@ -1,5 +1,5 @@ import { MagnificationTextureFilter, MinificationTextureFilter } from "../constants.js"; -import { Texture3DImageData } from "./Data3DTexture.js"; +import { TypedArray } from "../core/BufferAttribute.js"; import { Texture } from "./Texture.js"; /** @@ -35,7 +35,7 @@ import { Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/DataArrayTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/DataArrayTexture.js | Source} */ -export class DataArrayTexture extends Texture { +export class DataArrayTexture extends Texture { /** * Read-only flag to check if a given object is of type {@link DataArrayTexture}. * @remarks This is a _constant_ value @@ -43,13 +43,6 @@ export class DataArrayTexture extends Texture { */ readonly isDataArrayTexture: true; - /** - * Overridden with a record type holding data, width and height and depth. - * @override - */ - get image(): Texture3DImageData; - set image(data: Texture3DImageData); - /** * @override * @defaultValue {@link THREE.NearestFilter} @@ -107,7 +100,7 @@ export class DataArrayTexture extends Texture { * @param height Height of the texture. Default `1`. * @param depth Depth of the texture. Default `1`. */ - constructor(data?: BufferSource | null, width?: number, height?: number, depth?: number); + constructor(data?: TypedArray | null, width?: number, height?: number, depth?: number); /** * Describes that a specific layer of the texture needs to be updated. Normally when {@link Texture.needsUpdate} is @@ -121,3 +114,10 @@ export class DataArrayTexture extends Texture { */ clearLayoutUpdates(): void; } + +export interface DataArrayTextureImageData { + data: TypedArray | null; + width: number; + height: number; + depth: number; +} diff --git a/types/three/src/textures/DataTexture.d.ts b/types/three/src/textures/DataTexture.d.ts index 51d2b1b982b9c2..6789450f8a3e79 100644 --- a/types/three/src/textures/DataTexture.d.ts +++ b/types/three/src/textures/DataTexture.d.ts @@ -36,7 +36,7 @@ import { Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/DataTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/DataTexture.js | Source} */ -export class DataTexture extends Texture { +export class DataTexture extends Texture { /** * @param data {@link https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView | ArrayBufferView} of the texture. Default `null`. * @param width Width of the texture. Default `1`. @@ -73,13 +73,6 @@ export class DataTexture extends Texture { */ readonly isDataTexture: true; - /** - * Overridden with a record type holding data, width and height and depth. - * @override - */ - get image(): TextureImageData; - set image(value: TextureImageData); - /** * @override * @defaultValue {@link THREE.NearestFilter} @@ -111,8 +104,8 @@ export class DataTexture extends Texture { unpackAlignment: number; } -export interface TextureImageData { - data: TypedArray; - height: number; +export interface DataTextureImageData { + data: TypedArray | null; width: number; + height: number; } diff --git a/types/three/src/textures/DepthTexture.d.ts b/types/three/src/textures/DepthTexture.d.ts index 9dca127ac7beb0..63dbe3650352ef 100644 --- a/types/three/src/textures/DepthTexture.d.ts +++ b/types/three/src/textures/DepthTexture.d.ts @@ -15,7 +15,7 @@ import { Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/DepthTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/DepthTexture.js | Source} */ -export class DepthTexture extends Texture { +export class DepthTexture extends Texture { /** * Create a new instance of {@link DepthTexture} * @param width Width of the texture. @@ -51,13 +51,6 @@ export class DepthTexture extends Texture { */ readonly isDepthTexture: true; - /** - * Overridden with a record type holding width and height. - * @override - */ - get image(): { width: number; height: number; depth: number }; - set image(value: { width: number; height: number; depth: number }); - /** * @override * @defaultValue `false` @@ -104,3 +97,9 @@ export class DepthTexture extends Texture { */ compareFunction: TextureComparisonFunction | null; } + +export interface DepthTextureImageData { + width: number; + height: number; + depth: number; +} diff --git a/types/three/src/textures/ExternalTexture.d.ts b/types/three/src/textures/ExternalTexture.d.ts index 8f62cacbb1cab5..fb5f442d16a02a 100644 --- a/types/three/src/textures/ExternalTexture.d.ts +++ b/types/three/src/textures/ExternalTexture.d.ts @@ -1,6 +1,8 @@ +/// + import { Texture } from "./Texture.js"; -declare class ExternalTexture extends Texture { +declare class ExternalTexture extends Texture { sourceTexture: WebGLTexture | GPUTexture | null; readonly isExternalTexture: true; diff --git a/types/three/src/textures/FramebufferTexture.d.ts b/types/three/src/textures/FramebufferTexture.d.ts index ad54c51757d5cc..38ffe8de79cd94 100644 --- a/types/three/src/textures/FramebufferTexture.d.ts +++ b/types/three/src/textures/FramebufferTexture.d.ts @@ -27,7 +27,7 @@ import { Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/FramebufferTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/FramebufferTexture.js | Source} */ -export class FramebufferTexture extends Texture { +export class FramebufferTexture extends Texture { /** * Create a new instance of {@link FramebufferTexture} * @param width The width of the texture. @@ -60,3 +60,8 @@ export class FramebufferTexture extends Texture { */ generateMipmaps: boolean; } + +export interface FramebufferTextureImageData { + width: number; + height: number; +} diff --git a/types/three/src/textures/Source.d.ts b/types/three/src/textures/Source.d.ts index 6894f09bf52543..80c50bdeff73f4 100644 --- a/types/three/src/textures/Source.d.ts +++ b/types/three/src/textures/Source.d.ts @@ -19,7 +19,7 @@ export class SourceJSON { * @see {@link https://threejs.org/docs/index.html#api/en/textures/Source | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/Source.js | Source} */ -export class Source { +export class Source { /** * Flag to check if a given object is of type {@link Source}. * @remarks This is a _constant_ value @@ -39,7 +39,7 @@ export class Source { * The actual data of a texture. * @remarks The type of this property depends on the texture that uses this instance. */ - data: any; + data: TData; /** * This property is only relevant when {@link .needsUpdate} is set to `true` and provides more control on how @@ -61,7 +61,7 @@ export class Source { * Create a new instance of {@link Source} * @param data The data definition of a texture. Default `null` */ - constructor(data: any); + constructor(data: TData); getSize(target: Vector3): Vector3; diff --git a/types/three/src/textures/Texture.d.ts b/types/three/src/textures/Texture.d.ts index a9e9ba2dea06db..6ee82aaff45c87 100644 --- a/types/three/src/textures/Texture.d.ts +++ b/types/three/src/textures/Texture.d.ts @@ -102,7 +102,7 @@ export interface OffscreenCanvas extends EventTarget {} * @see {@link https://threejs.org/docs/index.html#api/en/textures/Texture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/Textures/Texture.js | Source} */ -export class Texture extends EventDispatcher<{ dispose: {} }> { +export class Texture extends EventDispatcher<{ dispose: {} }> { /** * This creates a new {@link THREE.Texture | Texture} object. * @param image See {@link Texture.image | .image}. Default {@link THREE.Texture.DEFAULT_IMAGE} @@ -117,7 +117,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> { * @param colorSpace See {@link Texture.colorSpace | .colorSpace}. Default {@link THREE.NoColorSpace} */ constructor( - image?: TexImageSource | OffscreenCanvas, + image?: TImage, mapping?: Mapping, wrapS?: Wrapping, wrapT?: Wrapping, @@ -133,7 +133,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> { * @deprecated */ constructor( - image: TexImageSource | OffscreenCanvas, + image: TImage, mapping: Mapping, wrapS: Wrapping, wrapT: Wrapping, @@ -176,7 +176,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> { * This is often useful in context of spritesheets where multiple textures render the same data * but with different {@link Texture} transformations. */ - source: Source; + source: Source; /** * The width of the texture in pixels. @@ -200,8 +200,8 @@ export class Texture extends EventDispatcher<{ dispose: {} }> { * for your {@link Texture} image and continuously update this {@link Texture} * as long as video is playing - the {@link THREE.VideoTexture | VideoTexture} class handles this automatically. */ - get image(): any; - set image(data: any); + get image(): TImage; + set image(data: TImage); /** * Array of user-specified mipmaps @@ -474,7 +474,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> { * The Global default value for {@link Texture.image | .image}. * @defaultValue `null`. */ - static DEFAULT_IMAGE: any; + static DEFAULT_IMAGE: null; /** * The Global default value for {@link mapping | .mapping}. @@ -528,7 +528,7 @@ export class Texture extends EventDispatcher<{ dispose: {} }> { */ clone(): this; - copy(source: Texture): this; + copy(source: Texture): this; /** * Sets this texture's properties based on `values`. diff --git a/types/three/src/textures/VideoFrameTexture.d.ts b/types/three/src/textures/VideoFrameTexture.d.ts index 8f89271d7b3cd2..3217ba8f6e3fda 100644 --- a/types/three/src/textures/VideoFrameTexture.d.ts +++ b/types/three/src/textures/VideoFrameTexture.d.ts @@ -8,7 +8,7 @@ import { } from "../constants.js"; import { VideoTexture } from "./VideoTexture.js"; -declare class VideoFrameTexture extends VideoTexture { +declare class VideoFrameTexture extends VideoTexture { constructor( mapping?: Mapping, wrapS?: Wrapping, diff --git a/types/three/src/textures/VideoTexture.d.ts b/types/three/src/textures/VideoTexture.d.ts index 31dc5d4566924a..22fb0e6ec1d44a 100644 --- a/types/three/src/textures/VideoTexture.d.ts +++ b/types/three/src/textures/VideoTexture.d.ts @@ -27,7 +27,7 @@ import { Texture } from "./Texture.js"; * @see {@link https://threejs.org/docs/index.html#api/en/textures/VideoTexture | Official Documentation} * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/VideoTexture.js | Source} */ -export class VideoTexture extends Texture { +export class VideoTexture extends Texture { /** * Create a new instance of {@link VideoTexture} * @param video The video element to use as the texture. @@ -41,7 +41,7 @@ export class VideoTexture extends Texture { * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY} */ constructor( - video: HTMLVideoElement, + video: TVideo, mapping?: Mapping, wrapS?: Wrapping, wrapT?: Wrapping, diff --git a/types/three/src/utils.d.ts b/types/three/src/utils.d.ts index 3fda1cfda6a357..7e4c41c4371fcc 100644 --- a/types/three/src/utils.d.ts +++ b/types/three/src/utils.d.ts @@ -1,3 +1,19 @@ -export function createCanvasElement(): HTMLCanvasElement; +declare function createCanvasElement(): HTMLCanvasElement; -export function probeAsync(gl: WebGLRenderingContext, sync: WebGLSync, interval: number): Promise; +declare function setConsoleFunction( + fn: (type: "log" | "warn" | "error", message: string, ...params: unknown[]) => void, +): void; + +declare function getConsoleFunction(): (type: "log" | "warn" | "error", message: string, ...params: unknown[]) => void; + +declare function log(...params: unknown[]): void; + +declare function warn(...params: unknown[]): void; + +declare function error(...params: unknown[]): void; + +declare function warnOnce(...params: unknown[]): void; + +declare function probeAsync(gl: WebGLRenderingContext, sync: WebGLSync, interval: number): Promise; + +export { createCanvasElement, error, getConsoleFunction, log, probeAsync, setConsoleFunction, warn, warnOnce }; diff --git a/types/three/test/integration/nodes-webgl.ts b/types/three/test/integration/nodes-webgl.ts deleted file mode 100644 index e84a36db154b8c..00000000000000 --- a/types/three/test/integration/nodes-webgl.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Tests some webgl imports, and everything else that is not imported elsewhere. - */ - -import { ConstNode, NodeUtils } from "three/webgpu"; - -NodeUtils.getNodeChildren(new ConstNode(1)); -NodeUtils.getValueType(1); -NodeUtils.getValueFromType("color"); diff --git a/types/three/test/unit/examples/jsm/postprocessing/SavePass.ts b/types/three/test/unit/examples/jsm/postprocessing/SavePass.ts index 113df6d9d3303d..cc874111037172 100644 --- a/types/three/test/unit/examples/jsm/postprocessing/SavePass.ts +++ b/types/three/test/unit/examples/jsm/postprocessing/SavePass.ts @@ -2,7 +2,7 @@ import * as THREE from "three"; import { SavePass } from "three/addons/postprocessing/SavePass.js"; let pass = new SavePass(); // $ExpectType SavePass -let rt = pass.renderTarget; // $ExpectType WebGLRenderTarget +let rt = pass.renderTarget; // $ExpectType WebGLRenderTarget> pass = new SavePass(new THREE.WebGLRenderTarget(128, 128)); // $ExpectType SavePass -rt = pass.renderTarget; // $ExpectType WebGLRenderTarget +rt = pass.renderTarget; // $ExpectType WebGLRenderTarget> diff --git a/types/three/test/unit/src/nodes/code/FunctionNode.ts b/types/three/test/unit/src/nodes/code/FunctionNode.ts index 50c43cd386160c..83e79cf4ca5db1 100644 --- a/types/three/test/unit/src/nodes/code/FunctionNode.ts +++ b/types/three/test/unit/src/nodes/code/FunctionNode.ts @@ -2,8 +2,8 @@ * Various tests of func, fn and call */ -import { call, code, glslFn, ProxiedObject, Swizzable, uv, wgslFn } from "three/tsl"; -import { FunctionCallNode, FunctionNode, Node } from "three/webgpu"; +import { call, code, glslFn, ProxiedObject, uv, wgslFn } from "three/tsl"; +import { FunctionNode, Node } from "three/webgpu"; export const mx_noise = code("whatever"); const includes = [mx_noise]; @@ -11,17 +11,14 @@ const includes = [mx_noise]; const someFunc1 = new FunctionNode<[a: Node]>(); const someFunc2 = new FunctionNode<{ a: Node }>(); -// eslint-disable-next-line @definitelytyped/no-unnecessary-generics -function assertSwizzable(_s: Swizzable) {} +type A = ProxiedObject; -type a = ProxiedObject; - -assertSwizzable>(call(someFunc1, [1])); -assertSwizzable>(call(someFunc1, [uv()])); -assertSwizzable>(call(someFunc1, [uv().xy])); -assertSwizzable>(call(someFunc2, { a: 1 })); -assertSwizzable>(call(someFunc2, { a: uv() })); -assertSwizzable>(call(someFunc2, { a: uv().xy })); +call(someFunc1, [1]); +call(someFunc1, [uv()]); +call(someFunc1, [uv().xy]); +call(someFunc2, { a: 1 }); +call(someFunc2, { a: uv() }); +call(someFunc2, { a: uv().xy }); export const mx_cell_noise_float_call = wgslFn<[Node]>("float mx_cell_noise_float( vec3 p )", includes); export const mx_worley_noise_float_call = wgslFn<[Node, Node, Node]>( @@ -30,9 +27,9 @@ export const mx_worley_noise_float_call = wgslFn<[Node, Node, Node]>( ); export const ab_call = wgslFn<{ a: Node; b: Node }>("float mx_cell_noise_float( vec3 p )", includes); -assertSwizzable(mx_cell_noise_float_call.call(uv())); -assertSwizzable(mx_worley_noise_float_call.call(uv(), 1, 1)); -assertSwizzable(ab_call.call({ a: 1, b: uv() })); +mx_cell_noise_float_call.call(uv()); +mx_worley_noise_float_call.call(uv(), 1, 1); +ab_call.call({ a: 1, b: uv() }); export const mx_cell_noise_float = glslFn<[Node]>("float mx_cell_noise_float( vec3 p )", includes); export const mx_worley_noise_float = glslFn<[Node, Node, Node]>( @@ -41,6 +38,6 @@ export const mx_worley_noise_float = glslFn<[Node, Node, Node]>( ); export const ab = glslFn<{ a: Node; b: Node }>("float mx_cell_noise_float( vec3 p )", includes); -assertSwizzable(mx_cell_noise_float(uv())); -assertSwizzable(mx_worley_noise_float(uv(), 1, 1)); -assertSwizzable(ab({ a: 1, b: uv() })); +mx_cell_noise_float(uv()); +mx_worley_noise_float(uv(), 1, 1); +ab({ a: 1, b: uv() }); diff --git a/types/three/test/unit/src/nodes/tsl/TSLCore.ts b/types/three/test/unit/src/nodes/tsl/TSLCore.ts index 6511176353bd86..33e66378a5a736 100644 --- a/types/three/test/unit/src/nodes/tsl/TSLCore.ts +++ b/types/three/test/unit/src/nodes/tsl/TSLCore.ts @@ -2,13 +2,9 @@ * Various tests of ShaderNode and related type inference */ -import { color, Fn, nodeArray, nodeImmutable, ShaderNode, ShaderNodeObject, Swizzable, vec3 } from "three/tsl"; +import { color, Fn, nodeArray, nodeImmutable, ShaderNode, vec3 } from "three/tsl"; import { ConstNode, MaterialNode, Node, PropertyNode } from "three/webgpu"; -// just to type check -// eslint-disable-next-line @definitelytyped/no-unnecessary-generics -function assertSwizzable(_s: Swizzable) {} - const s = color(1); s.xyz; @@ -17,19 +13,19 @@ aa[0].xy = s; aa[1].w = s; aa[2] = "hello"; -assertSwizzable(nodeImmutable(MaterialNode, MaterialNode.ROTATION)); -assertSwizzable(nodeImmutable(PropertyNode, "vec4", "DiffuseColor")); +nodeImmutable(MaterialNode, MaterialNode.ROTATION); +nodeImmutable(PropertyNode, "vec4", "DiffuseColor"); const shader = new ShaderNode<{ a: Node; b: Node }>(params => { return params.a; }); -assertSwizzable(shader.call({ a: s, b: new ConstNode(1) })); +shader.call({ a: s, b: new ConstNode(1) }); const fnWithoutArgs = Fn(() => vec3(1, 2, 3)); -assertSwizzable(fnWithoutArgs()); +fnWithoutArgs(); -const fnWithArrayArgs = Fn(([a, b]: [a: ShaderNodeObject, b: ShaderNodeObject]) => a.add(b)); -assertSwizzable(fnWithArrayArgs(0.5, color(0.0, 0.25, 0.5))); +const fnWithArrayArgs = Fn(([a, b]: [a: Node, b: Node]) => a.add(b)); +fnWithArrayArgs(0.5, color(0.0, 0.25, 0.5)); -const fnWithArgs = Fn(({ a, b }: { a: ShaderNodeObject; b: ShaderNodeObject }) => a.add(b)); -assertSwizzable(fnWithArgs({ a: 0.5, b: color(0.0, 0.25, 0.5) })); +const fnWithArgs = Fn(({ a, b }: { a: Node; b: Node }) => a.add(b)); +fnWithArgs({ a: 0.5, b: color(0.0, 0.25, 0.5) }); diff --git a/types/three/tsconfig.json b/types/three/tsconfig.json index 7ebde9fe59df2e..2eb642969c75fd 100644 --- a/types/three/tsconfig.json +++ b/types/three/tsconfig.json @@ -21,7 +21,6 @@ "test/integration/lights-pointlights2.ts", "test/integration/loaders-gltfloader-plugin.ts", "test/integration/materials-meshgouraud.ts", - "test/integration/nodes-webgl.ts", "test/integration/objects-reflector.ts", "test/integration/three-examples/webgl2_rendertarget_texture2darray.ts", "test/integration/three-examples/webgl_loader_ldraw.ts", diff --git a/types/wordpress__block-editor/components/panel-color-settings.d.ts b/types/wordpress__block-editor/components/panel-color-settings.d.ts index da320bf01c25a0..f45c5103dcc229 100644 --- a/types/wordpress__block-editor/components/panel-color-settings.d.ts +++ b/types/wordpress__block-editor/components/panel-color-settings.d.ts @@ -1,14 +1,44 @@ -import { ColorPalette, PanelBody } from "@wordpress/components"; -import { ComponentProps, ComponentType } from "react"; +import { ColorPalette, GradientPicker } from "@wordpress/components"; +import type { ComponentProps, ComponentType, ReactNode } from "react"; declare namespace PanelColorSettings { - type ColorSetting = - & Partial> - & Pick, "onChange" | "value"> - & { label: string }; - interface Props extends Omit, "children"> { - colorSettings: ColorSetting[]; - disableCustomColors?: boolean | undefined; + interface ColorSetting { + /** The current color of the setting. */ + value: string; + /** Callback on change of the setting. */ + onChange: (value: string | undefined) => void; + /** Label of the setting. */ + label: string; + /** Colors palette for this specific setting. */ + colors?: ComponentProps["colors"]; + /** Whether to disable custom colors for this specific setting. */ + disableCustomColors?: boolean; + /** Whether to disable custom gradients for this specific setting. */ + disableCustomGradients?: boolean; + } + interface Props { + /** A user-provided set of color settings. */ + colorSettings?: ColorSetting[]; + /** Added to the underlying ToolsPanel instance. */ + className?: string; + /** Array of colors to be used. */ + colors?: ComponentProps["colors"]; + /** Not recommended to be used since `PanelColorSettings` resets it. */ + gradients?: ComponentProps["gradients"]; + /** Whether the addition of custom colors is enabled. */ + disableCustomColors?: boolean; + /** Not recommended to be used since `PanelColorSettings` sets it. */ + disableCustomGradients?: boolean; + /** Displayed below the underlying `PanelColorGradientSettings` instance. */ + children?: ReactNode; + /** Title of the underlying `ToolsPanel`. */ + title?: string; + /** Whether to show the title of the `ToolsPanel`. */ + showTitle?: boolean; + /** Whether this is rendered in the sidebar. */ + __experimentalIsRenderedInSidebar?: boolean; + /** Whether to enable setting opacity when specifying a color. */ + enableAlpha?: boolean; } } declare const PanelColorSettings: ComponentType; diff --git a/types/wordpress__block-editor/wordpress__block-editor-tests.tsx b/types/wordpress__block-editor/wordpress__block-editor-tests.tsx index ddc76ca13893c2..1f440d33a701f0 100644 --- a/types/wordpress__block-editor/wordpress__block-editor-tests.tsx +++ b/types/wordpress__block-editor/wordpress__block-editor-tests.tsx @@ -299,7 +299,6 @@ be.withFontSizes("fontSize")(() =>

Hello World

); //

Hello World

); color && console.log(color); }, label: "Background Color", - disableCustomColors: true, colors: [ { color: "#ff0000", @@ -318,8 +316,12 @@ be.withFontSizes("fontSize")(() =>

Hello World

); name: "Yellow", }, ], + disableCustomColors: false, }, ]} + disableCustomColors={true} + showTitle={true} + enableAlpha={true} />;