Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions types/three/examples/jsm/exporters/GLTFExporter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ export class GLTFExporter {
options?: GLTFExporterOptions,
): void;

/**
* Generates a .gltf (JSON) or .glb (binary) output from the input (Scenes or Objects).
*
* This is just like the {@link parse}() method, but instead of accepting callbacks it returns a promise that
* resolves with the result, and otherwise accepts the same options.
*/
parseAsync(
input: Object3D | Object3D[],
options?: GLTFExporterOptions,
Expand Down
24 changes: 24 additions & 0 deletions types/three/examples/jsm/geometries/TeapotGeometry.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
import { BufferGeometry } from "three";

/**
* {@link TeapotGeometry} tesselates the famous Utah teapot database by Martin Newell.
*
* {@link TeapotGeometry} is an add-on, and must be imported explicitly. See
* [Installation / Addons]{@link https://threejs.org/docs/#manual/en/introduction/Installation}.
*
* @example
* import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
*
* const geometry = new TeapotGeometry( 50, 18 );
* const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
* const teapot = new THREE.Mesh( geometry, material );
* scene.add( teapot );
*/
export class TeapotGeometry extends BufferGeometry {
/**
* @param size Relative scale of the teapot. Optional; Defaults to `50`.
* @param segments Number of line segments to subdivide each patch edge. Optional; Defaults to `10`.
* @param bottom Whether the bottom of the teapot is generated or not. Optional; Defaults to `true`.
* @param lid Whether the lid is generated or not. Optional; Defaults to `true`.
* @param body Whether the body is generated or not. Optional; Defaults to `true`.
* @param fitLid Whether the lid is slightly stretched to prevent gaps between the body and lid or not. Optional;
* Defaults to `true`.
* @param blinn Whether the teapot is scaled vertically for better aesthetics or not. Optional; Defaults to `true`.
*/
constructor(
size?: number,
segments?: number,
Expand Down
14 changes: 8 additions & 6 deletions types/three/examples/jsm/helpers/ViewHelper.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { Camera, Object3D, Vector3, WebGLRenderer } from "three";

export class ViewHelper extends Object3D {
readonly isViewHelper: true;

animating: boolean;
center: Vector3;

readonly isViewHelper: true;
render: (renderer: WebGLRenderer) => void;
handleClick: (event: MouseEvent) => boolean;
setLabels: (labelX?: string, labelY?: string, labelZ?: string) => void;
setLabelStyle: (font?: string, color?: string, radius?: number) => void;
update: (delta: number) => void;
dispose: () => void;

constructor(camera: Camera, domElement: HTMLElement);

render(renderer: WebGLRenderer): void;
handleClick(event: MouseEvent): boolean;
update(delta: number): void;
dispose(): void;
}
6 changes: 2 additions & 4 deletions types/three/examples/jsm/lines/LineMaterial.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { Color, ColorRepresentation, MaterialParameters, ShaderMaterial, Vector2 } from "three";
import { Color, ColorRepresentation, ShaderMaterial, ShaderMaterialParameters, Vector2 } from "three";

export interface LineMaterialParameters extends MaterialParameters {
export interface LineMaterialParameters extends ShaderMaterialParameters {
alphaToCoverage?: boolean | undefined;
color?: ColorRepresentation | undefined;
dashed?: boolean | undefined;
dashScale?: number | undefined;
dashSize?: number | undefined;
dashOffset?: number | undefined;
gapSize?: number | undefined;
linewidth?: number | undefined;
resolution?: Vector2 | undefined;
wireframe?: boolean | undefined;
worldUnits?: boolean | undefined;
}

Expand Down
10 changes: 8 additions & 2 deletions types/three/examples/jsm/loaders/DDSLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { CompressedPixelFormat, CompressedTextureLoader, LoadingManager, PixelFormat } from "three";
import {
CompressedPixelFormat,
CompressedTextureLoader,
CompressedTextureMipmap,
LoadingManager,
PixelFormat,
} from "three";

export interface DDS {
mipmaps: object[];
mipmaps: CompressedTextureMipmap[];
width: number;
height: number;
format: PixelFormat | CompressedPixelFormat;
Expand Down
4 changes: 3 additions & 1 deletion types/three/examples/jsm/loaders/GLTFLoader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
BufferAttribute,
BufferGeometry,
Camera,
ColorSpace,
FileLoader,
Group,
ImageBitmapLoader,
Expand Down Expand Up @@ -112,7 +113,8 @@ export class GLTFParser {
texCoord?: number | undefined;
extensions?: any;
},
) => Promise<void>;
colorSpace?: ColorSpace | undefined,
) => Promise<Texture | null>;
assignFinalMaterial: (object: Mesh) => void;
getMaterialType: () => typeof MeshStandardMaterial;
loadMaterial: (materialIndex: number) => Promise<Material>;
Expand Down
10 changes: 8 additions & 2 deletions types/three/examples/jsm/loaders/KTXLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { CompressedPixelFormat, CompressedTextureLoader, LoadingManager, PixelFormat } from "three";
import {
CompressedPixelFormat,
CompressedTextureLoader,
CompressedTextureMipmap,
LoadingManager,
PixelFormat,
} from "three";

export interface KTX {
mipmaps: object[];
mipmaps: CompressedTextureMipmap[];
width: number;
height: number;
format: PixelFormat | CompressedPixelFormat;
Expand Down
4 changes: 2 additions & 2 deletions types/three/examples/jsm/loaders/PVRLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CompressedPixelFormat, CompressedTextureLoader, LoadingManager } from "three";
import { CompressedPixelFormat, CompressedTextureLoader, CompressedTextureMipmap, LoadingManager } from "three";

export interface PVR {
mipmaps: object[];
mipmaps: CompressedTextureMipmap[];
width: number;
height: number;
format: CompressedPixelFormat;
Expand Down
13 changes: 10 additions & 3 deletions types/three/examples/jsm/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export {
step,
tan,
transformDirection,
transpose,
trunc,
} from "./math/MathNode.js";

Expand Down Expand Up @@ -164,7 +165,7 @@ export { triNoise3D } from "./math/TriNoise3D.js";
// utils
export { default as ArrayElementNode } from "./utils/ArrayElementNode.js";
export { default as ConvertNode } from "./utils/ConvertNode.js";
export { default as DiscardNode, discard } from "./utils/DiscardNode.js";
export { default as DiscardNode, discard, Return } from "./utils/DiscardNode.js";
export { default as EquirectUVNode, equirectUV } from "./utils/EquirectUVNode.js";
export { default as JoinNode } from "./utils/JoinNode.js";
export { default as MatcapUVNode, matcapUV } from "./utils/MatcapUVNode.js";
Expand Down Expand Up @@ -266,6 +267,7 @@ export * from "./accessors/ReflectVectorNode.js";
export { default as RendererReferenceNode, rendererReference } from "./accessors/RendererReferenceNode.js";
export { default as SkinningNode, skinning } from "./accessors/SkinningNode.js";
export { default as StorageBufferNode, storage, storageObject } from "./accessors/StorageBufferNode.js";
export { default as StorageTextureNode, storageTexture, textureStore } from "./accessors/StorageTextureNode.js";
export * from "./accessors/TangentNode.js";
export { default as Texture3DNode, texture3D } from "./accessors/Texture3DNode.js";
export { default as TextureBicubicNode, textureBicubic } from "./accessors/TextureBicubicNode.js";
Expand Down Expand Up @@ -297,19 +299,23 @@ export {
linearTosRGB,
sRGBToLinear,
} from "./display/ColorSpaceNode.js";
export { default as DepthOfFieldNode, dof } from "./display/DepthOfFieldNode.js";
export { default as DotScreenNode, dotScreen } from "./display/DotScreenNode.js";
export { default as FrontFacingNode, faceDirection, frontFacing } from "./display/FrontFacingNode.js";
export { default as GaussianBlurNode, gaussianBlur } from "./display/GaussianBlurNode.js";
export { default as NormalMapNode, normalMap } from "./display/NormalMapNode.js";
export { default as PosterizeNode, posterize } from "./display/PosterizeNode.js";
export { default as RGBShiftNode, rgbShift } from "./display/RGBShiftNode.js";
export { default as SobelOperatorNode, sobel } from "./display/SobelOperatorNode.js";
export { default as ToneMappingNode, toneMapping } from "./display/ToneMappingNode.js";
export {
default as ViewportDepthNode,
depth,
depthPixel,
depthTexture,
linearDepth,
orthographicDepthToViewZ,
perspectiveDepthToViewZ,
ViewportDepthNodeScope,
viewportLinearDepth,
viewZToOrthographicDepth,
viewZToPerspectiveDepth,
} from "./display/ViewportDepthNode.js";
Expand Down Expand Up @@ -355,6 +361,7 @@ export { default as LightingContextNode, lightingContext } from "./lighting/Ligh
export { default as LightingNode } from "./lighting/LightingNode.js";
export { default as LightsNode, lights } from "./lighting/LightsNode.js";
export { default as PointLightNode } from "./lighting/PointLightNode.js";
export { default as RectAreaLightNode } from "./lighting/RectAreaLightNode.js";
export { default as SpotLightNode } from "./lighting/SpotLightNode.js";

// pmrem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ declare class BufferAttributeNode extends InputNode<TypedArray | InterleavedBuff
bufferStride?: number,
bufferOffset?: number,
);
getHash(builder: NodeBuilder): string;
getNodeType(builder: NodeBuilder): string | null;
setup(builder: NodeBuilder): void;
generate(builder: NodeBuilder): string | null | undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import StorageBufferAttribute from "../../renderers/common/StorageBufferAttribute.js";
import StorageInstancedBufferAttribute from "../../renderers/common/StorageInstancedBufferAttribute.js";
import { GPUBufferBindingType } from "../../renderers/webgpu/utils/WebGPUConstants.js";
import { NodeOrType, NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
import StorageArrayElementNode from "../utils/StoargeArrayElementNode.js";
import BufferNode from "./BufferNode.js";
Expand All @@ -8,6 +9,8 @@ export default class StorageBufferNode extends BufferNode {
readonly isStorageBufferNode: true;
bufferObject: boolean;

access: GPUBufferBindingType;

constructor(
value: StorageBufferAttribute | StorageInstancedBufferAttribute,
bufferType: string,
Expand All @@ -17,6 +20,10 @@ export default class StorageBufferNode extends BufferNode {
element(indexNode: NodeRepresentation): ShaderNodeObject<StorageArrayElementNode>;

setBufferObject(value: boolean): this;

setAccess(value: GPUBufferBindingType): this;

toReadOnly(): this;
}

export const storage: (
Expand Down
40 changes: 40 additions & 0 deletions types/three/examples/jsm/nodes/accessors/StorageTextureNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Texture } from "three";
import { GPUStorageTextureAccess } from "../../renderers/webgpu/utils/WebGPUConstants.js";
import Node from "../core/Node.js";
import NodeBuilder from "../core/NodeBuilder.js";
import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
import TextureNode from "./TextureNode.js";

export default class StorageTextureNode extends TextureNode {
storeNode: Node | null;

readonly isStorageTextureNode: true;

access: GPUStorageTextureAccess;

constructor(
value: Texture,
uvNode?: ShaderNodeObject<Node> | null,
storeNode?: Node | null,
);

setAccess(value: GPUStorageTextureAccess): this;

toReadOnly(): this;

toWriteOnly(): this;

generateStore(builder: NodeBuilder): void;
}

export const storageTexture: (
value: Texture,
uvNode?: NodeRepresentation,
storeNode?: NodeRepresentation,
) => ShaderNodeObject<StorageTextureNode>;

export const textureStore: (
value: Texture,
uvNode?: NodeRepresentation,
storeNode?: NodeRepresentation,
) => ShaderNodeObject<StorageTextureNode>;
9 changes: 4 additions & 5 deletions types/three/examples/jsm/nodes/core/CacheNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ import Node from "./Node.js";
import NodeCache from "./NodeCache.js";

export default class CacheNode extends Node {
isCacheNode: true;
node: Node;
cache: NodeCache;
parent: boolean;

constructor(node: Node, cache?: NodeCache);
readonly isCacheNode: true;

constructor(node: Node, parent?: boolean);
}

export const cache: (node: Node, cache?: NodeCache) => ShaderNodeObject<CacheNode>;
export const globalCache: (node: Node) => ShaderNodeObject<CacheNode>;

declare module "../shadernode/ShaderNode.js" {
interface NodeElements {
cache: typeof cache;
globalCache: typeof globalCache;
}
}
11 changes: 11 additions & 0 deletions types/three/examples/jsm/nodes/core/LightingModel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ export interface LightingModelDirectInput {
shadowMask: Node;
}

export interface LightingModelDirectRectAreaInput {
lightColor: Node;
lightPosition: Node;
halfWidth: Node;
halfHeight: Node;
reflectedLight: LightingModelReflectedLight;
ltc_1: Node;
ltc_2: Node;
}

export interface LightingModelIndirectInput {
radiance: Node;
irradiance: Node;
Expand All @@ -31,6 +41,7 @@ export default class LightingModel {
start(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
finish(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
direct(input: LightingModelDirectInput, stack: StackNode, builder: NodeBuilder): void;
directRectArea(input: LightingModelDirectRectAreaInput, stack: StackNode, builder: NodeBuilder): void;
indirectDiffuse(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
indirectSpecular(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
ambientOcclusion(input: LightingModelIndirectInput, stack: StackNode, builder: NodeBuilder): void;
Expand Down
3 changes: 3 additions & 0 deletions types/three/examples/jsm/nodes/core/Node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ declare class Node extends EventDispatcher<{
nodeType: string | null;
updateType: NodeUpdateType;
updateBeforeType: NodeUpdateType;
updateAfterType: NodeUpdateType;
uuid: string;
version: number;
_cacheKey: string | null;
Expand All @@ -95,6 +96,7 @@ declare class Node extends EventDispatcher<{
getHash(builder: NodeBuilder): string;
getUpdateType(): NodeUpdateType;
getUpdateBeforeType(): NodeUpdateType;
getUpdateAfterType(): NodeUpdateType;
getElementType(builder: NodeBuilder): "bool" | "int" | "float" | "vec2" | "vec3" | "vec4" | "uint" | null;
getNodeType(builder: NodeBuilder): string | null;
getShared(builder: NodeBuilder): Node;
Expand All @@ -104,6 +106,7 @@ declare class Node extends EventDispatcher<{
analyze(builder: NodeBuilder): void;
generate(builder: NodeBuilder, output?: string | null): string | null | undefined;
updateBefore(frame: NodeFrame): void;
updateAfter(frame: NodeFrame): void;
update(frame: NodeFrame): void;
build(builder: NodeBuilder, output?: string | null): string | null;
getSerializeChildren(): Generator<import("./NodeUtils.js").NodeChild, void, unknown>;
Expand Down
10 changes: 7 additions & 3 deletions types/three/examples/jsm/nodes/core/NodeBuilder.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BufferGeometry, Material, Object3D, Renderer } from "three";
import { BufferGeometry, Material, Object3D, Renderer, Texture } from "three";
import FogNode from "../fog/FogNode.js";
import LightsNode from "../lighting/LightsNode.js";
import { NodeShaderStage } from "./constants.js";
Expand Down Expand Up @@ -58,13 +58,17 @@ export default abstract class NodeBuilder {
setHashNode(node: Node, hash: string): void;
addNode(node: Node): void;
get currentNode(): Node;
isFilteredTexture(texture: Texture): boolean;
getMethod(method: string): string;
getNodeFromHash(hash: string): Node;

addFlow(shaderStage: NodeShaderStage, node: Node): Node;

setContext(context: NodeBuilderContext): void;
getContext(): NodeBuilderContext;
setCache(cache: NodeCache): void;
getCache(): NodeCache;
getCacheFromNode(node: Node, parent?: boolean): NodeCache;
isAvailable(name: string): boolean;

abstract getInstanceIndex(): string;
Expand All @@ -83,7 +87,7 @@ export default abstract class NodeBuilder {

getAttribute(name: string, type: string): NodeAttribute;

getPropertyName(node: Node, shaderStage: NodeShaderStage): string;
getPropertyName<TValue>(node: NodeVar | NodeUniform<TValue>, shaderStage: NodeShaderStage): string;
isVector(type: string): boolean;

isMatrix(type: string): boolean;
Expand Down Expand Up @@ -117,7 +121,7 @@ export default abstract class NodeBuilder {
): FlowData;
hasGeometryAttribute(name: string): boolean;
abstract getAttributes(shaderStage: NodeShaderStage): string;
abstract getVarys(shaderStage: NodeShaderStage): string;
abstract getVaryings(shaderStage: NodeShaderStage): string;
getVars(shaderStage: NodeShaderStage): string;
abstract getUniforms(stage: NodeShaderStage): string;
getCodes(shaderStage: NodeShaderStage): string;
Expand Down
Loading