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
2 changes: 2 additions & 0 deletions types/three/examples/jsm/Addons.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export * from "./exporters/USDZExporter.js";
export * from "./geometries/BoxLineGeometry.js";
export * from "./geometries/ConvexGeometry.js";
export * from "./geometries/DecalGeometry.js";
export * from "./geometries/LoftGeometry.js";
export * from "./geometries/ParametricFunctions.js";
export * from "./geometries/ParametricGeometry.js";
export * from "./geometries/RoundedBoxGeometry.js";
Expand Down Expand Up @@ -284,6 +285,7 @@ export * from "./webxr/OculusHandModel.js";
export * from "./webxr/OculusHandPointerModel.js";
export * from "./webxr/Text2D.js";
export * from "./webxr/VRButton.js";
export * from "./webxr/WebGLXRFallback.js";
export * from "./webxr/XRButton.js";
export * from "./webxr/XRControllerModelFactory.js";
export * from "./webxr/XREstimatedLight.js";
Expand Down
9 changes: 9 additions & 0 deletions types/three/examples/jsm/controls/FirstPersonControls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ declare class FirstPersonControls extends Controls<{}> {
*/
lookSpeed: number;

/**
* How quickly the movement and look velocity catches up to the input. Lower
* values feel heavier (more inertia), `1` disables damping.
*
* @type {number}
* @default 0.1
*/
dampingFactor: number;

/**
* Whether or not it's possible to vertically look around. Default is `true`.
*/
Expand Down
4 changes: 2 additions & 2 deletions types/three/examples/jsm/controls/OrbitControls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface OrbitControlsEventMap {
/**
* Orbit controls allow the camera to orbit around a target.
*/
declare class OrbitControls extends Controls<OrbitControlsEventMap> {
declare class OrbitControls<TCamera extends Camera = Camera> extends Controls<OrbitControlsEventMap, TCamera> {
/**
* The focus point of the controls, the {@link .object} orbits around this. It can be updated manually at any point
* to change the focus of the controls.
Expand Down Expand Up @@ -206,7 +206,7 @@ declare class OrbitControls extends Controls<OrbitControlsEventMap> {
* is the scene itself.
* @param domElement The HTML element used for event listeners. (optional)
*/
constructor(object: Camera, domElement?: HTMLElement | SVGElement | null);
constructor(object: TCamera, domElement?: HTMLElement | SVGElement | null);

set cursorStyle(type: "auto" | "grab");
get cursorStyle(): "auto" | "grab";
Expand Down
33 changes: 32 additions & 1 deletion types/three/examples/jsm/controls/TransformControls.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Camera, ColorRepresentation, Controls, Mesh, Object3D, Quaternion, Raycaster, Vector3 } from "three";
import { Camera, ColorRepresentation, Controls, Mesh, Object3D, Quaternion, Raycaster, Vector3, Vector4 } from "three";

export type TransformControlsMode = "translate" | "rotate" | "scale";

Expand Down Expand Up @@ -41,6 +41,8 @@ export interface TransformControlsEventMap {
"showXY-changed": { value: unknown };
"showYZ-changed": { value: unknown };
"showXZ-changed": { value: unknown };
"showXYZE-changed": { value: unknown };
"showE-changed": { value: unknown };
"minX-changed": { value: unknown };
"maxX-changed": { value: unknown };
"minY-changed": { value: unknown };
Expand Down Expand Up @@ -111,6 +113,17 @@ declare class TransformControls extends Controls<TransformControlsEventMap> {
*/
size: number;

/**
* The viewport rectangle, in logical (CSS) pixels with the origin at the lower-left
* of the canvas. Set this when the renderer uses a sub-canvas viewport so pointer
* coordinates map to the correct region. If `null`, the full canvas is used.
*
* @name TransformControls#viewport
* @type {?Vector4}
* @default null
*/
viewport: Vector4 | null;

/**
* Whether or not dragging is currently performed. Read-only property.
*/
Expand Down Expand Up @@ -152,6 +165,24 @@ declare class TransformControls extends Controls<TransformControlsEventMap> {
*/
showXZ: boolean;

/**
* Whether the xyze rotation helper should be visible or not.
*
* @name TransformControls#showXYZE
* @type {boolean}
* @default true
*/
showXYZE: boolean;

/**
* Whether the e rotation helper should be visible or not.
*
* @name TransformControls#showE
* @type {boolean}
* @default true
*/
showE: boolean;

/**
* The minimum allowed X position during translation. Default is `-Infinity`.
*/
Expand Down
86 changes: 73 additions & 13 deletions types/three/examples/jsm/csm/CSMFrustum.d.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,85 @@
import { Matrix4, Vector3 } from "three";

export interface CSMFrustumVerticies {
export interface CSMFrustumVertices {
near: Vector3[];
far: Vector3[];
}

export interface CSMFrustumParameters {
webGL?: boolean;
projectionMatrix?: Matrix4;
maxFar?: number;
/**
* - Whether this CSM frustum is used with WebGL or WebGPU.
*/
webGL?: boolean | undefined;
/**
* - Whether reversed depth buffer is enabled.
*/
reversedDepth?: boolean | undefined;
/**
* - A projection matrix usually of the scene's camera.
*/
projectionMatrix?: Matrix4 | undefined;
/**
* - The maximum far value.
*/
maxFar?: number | undefined;
}

declare class CSMFrustum {
zNear: number;
vertices: CSMFrustumVerticies;

/**
* Represents the frustum of a CSM instance.
*
* @three_import import { CSMFrustum } from 'three/addons/csm/CSMFrustum.js';
*/
export class CSMFrustum {
/**
* Constructs a new CSM frustum.
*
* @param {CSMFrustum~Data} [data] - The CSM data.
*/
constructor(data?: CSMFrustumParameters);

setFromProjectionMatrix(projectionMatrix: Matrix4, maxFar: number): CSMFrustumVerticies;
split(breaks: number[], target: CSMFrustum[]): void;
/**
* The zNear value. This value depends on whether the CSM
* is used with WebGL or WebGPU. Both API use different
* conventions for their projection matrices.
*
* @type {number}
*/
zNear: number;
/**
* The zFar value.
*
* @type {number}
*/
zFar: number;
/**
* An object representing the vertices of the near and
* far plane in view space.
*
* @type {Object}
*/
vertices: CSMFrustumVertices;
/**
* Setups this CSM frustum from the given projection matrix and max far value.
*
* @param {Matrix4} projectionMatrix - The projection matrix, usually of the scene's camera.
* @param {number} maxFar - The maximum far value.
* @returns {Object} An object representing the vertices of the near and far plane in view space.
*/
setFromProjectionMatrix(projectionMatrix: Matrix4, maxFar: number): CSMFrustumVertices;
/**
* Splits the CSM frustum by the given array. The new CSM frustum are pushed into the given
* target array.
*
* @param {Array<number>} breaks - An array of numbers in the range `[0,1]` the defines how the
* CSM frustum should be split up.
* @param {Array<CSMFrustum>} target - The target array that holds the new CSM frustums.
*/
split(breaks: Array<number>, target: Array<CSMFrustum>): void;
/**
* Transforms the given target CSM frustum into the different coordinate system defined by the
* given camera matrix.
*
* @param {Matrix4} cameraMatrix - The matrix that defines the new coordinate system.
* @param {CSMFrustum} target - The CSM to convert.
*/
toSpace(cameraMatrix: Matrix4, target: CSMFrustum): void;
}

export { CSMFrustum };
2 changes: 1 addition & 1 deletion types/three/examples/jsm/exporters/DRACOExporter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export interface DRACOExporterOptions {
export class DRACOExporter {
constructor();

parse(object: Mesh | Points, options?: DRACOExporterOptions): Int8Array<ArrayBuffer>;
parseAsync(object: Mesh | Points, options?: DRACOExporterOptions): Promise<Int8Array<ArrayBuffer>>;
}
4 changes: 2 additions & 2 deletions types/three/examples/jsm/exporters/GLTFExporter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface GLTFExporterOptions {
/**
* List of animations to be included in the export.
*/
animations?: AnimationClip[];
animations?: AnimationClip[] | AnimationClip[][];

/**
* Generate indices for non-index geometry and export with them. Default is false.
Expand Down Expand Up @@ -88,7 +88,7 @@ declare class GLTFExporter {
parse(
input: Object3D | Object3D[],
onDone: (gltf: ArrayBuffer | { [key: string]: unknown }) => void,
onError: (error: ErrorEvent) => void,
onError: ((error: ErrorEvent) => void) | null,
options?: GLTFExporterOptions,
): void;

Expand Down
9 changes: 5 additions & 4 deletions types/three/examples/jsm/exporters/PLYExporter.d.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { Object3D } from "three";

export interface PLYExporterOptionsBase {
excludeAttributes?: string[];
littleEndian?: boolean;
excludeAttributes?: string[] | undefined;
littleEndian?: boolean | undefined;
customPropertyMapping?: Record<string, string[]>;
}

export interface PLYExporterOptionsBinary extends PLYExporterOptionsBase {
binary: true;
}

export interface PLYExporterOptionsString extends PLYExporterOptionsBase {
binary?: false;
binary?: false | undefined;
}

export interface PLYExporterOptions extends PLYExporterOptionsBase {
binary?: boolean;
binary?: boolean | undefined;
}

export class PLYExporter {
Expand Down
6 changes: 5 additions & 1 deletion types/three/examples/jsm/exporters/USDZExporter.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Object3D } from "three";
import { AnimationClip, Object3D } from "three";
import * as WebGLTextureUtils from "../utils/WebGLTextureUtils.js";
import * as WebGPUTextureUtils from "../utils/WebGPUTextureUtils.js";

Expand All @@ -8,13 +8,17 @@ export interface USDZExporterOptions {
onlyVisible?: boolean | undefined;
quickLookCompatible?: boolean | undefined;
maxTextureSize?: number | undefined;
animations?: AnimationClip[] | undefined;
animationFrameRate?: number | undefined;
}

export class USDZExporter {
textureUtils: typeof WebGLTextureUtils | typeof WebGPUTextureUtils | null;

constructor();

setTextureUtils(textureUtils: typeof WebGLTextureUtils | typeof WebGPUTextureUtils | null): void;

parse(
scene: Object3D,
onDone: (result: Uint8Array<ArrayBuffer>) => void,
Expand Down
75 changes: 75 additions & 0 deletions types/three/examples/jsm/generators/CityGenerator.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { Group, Material, MeshStandardNodeMaterial } from "three/webgpu";
import { SidewalkGenerator } from "./city/SidewalkGenerator.js";
import { SkyscraperGenerator } from "./city/SkyscraperGenerator.js";

export interface CityGeneratorParameters {
seed: number;
street: number;
lot: number;
lotsX: number;
lotsZ: number;
blocksX: number;
blocksZ: number;
curbHeight: number;
curbRadius: number;
}

export interface CityGeneratorLayout {
street: number;
lot: number;
lotsX: number;
lotsZ: number;
blocksX: number;
blocksZ: number;
blockW: number;
blockD: number;
cityW: number;
cityD: number;
}

export interface CityGeneratorMaterials {
building?: Material | undefined;
}

/**
* Lays out a grid of city blocks and fills each lot with a {@link SkyscraperGenerator}
* tower of its own seed, height and footprint, optionally on raised sidewalk
* slabs (curbs). Returns a `THREE.Group` ready to add to a scene.
*
* Pass a building material to dress the towers; the sidewalks dress themselves
* via {@link SidewalkGenerator}. The layout is exposed as
* {@link CityGenerator#layout} so the surrounding scene (road markings, etc.)
* can align to the same grid.
*
* ```js
* const city = new CityGenerator( { seed: 1 } );
* scene.add( city.build( materials ) );
* ```
*/
export class CityGenerator {
constructor(parameters?: Partial<CityGeneratorParameters>);

parameters: CityGeneratorParameters;
layout: CityGeneratorLayout;

generators: SkyscraperGenerator[];
sidewalk: SidewalkGenerator;
group: Group | null;

build(materials?: CityGeneratorMaterials): Group;
dispose(): void;

static defaults: CityGeneratorParameters;
}

/**
* The shared material every tower in a {@link CityGenerator} is dressed with: one flat
* masonry colour per lot, picked from a palette by hashing the lot's grid cell.
*/
export function createBuildingMaterial(layout: CityGeneratorLayout, seed?: number): MeshStandardNodeMaterial;

/**
* The road surface: wet asphalt with lane lines and crosswalks aligned to a
* {@link CityGenerator} layout. Apply it to a ground plane sized to the city.
*/
export function createRoadMaterial(layout: CityGeneratorLayout): MeshStandardNodeMaterial;
Loading